Not able to make outgoing call when trying to have single intent for both incoming and outgoing call

278 views
Skip to first unread message

sachin sharma

unread,
Oct 15, 2013, 6:14:38 AM10/15/13
to csipsim...@googlegroups.com
As part of creating an android app for basic voip call using csipsimple as library, i am trying to handle both incoming and outgoing call via single intent. What is happening is while the app is able to receive incoming voip call, the outgoing call is not being placed. I have a broadcast reveiver listening for incoming calls. Initially the control was not getting transferred out of this receiver function for taking the outgoing call event. After some code changes the control is getting for the outgoing logic. However the invite is not getting generated for the outgoing event.
I am attaching the android.manifest.xml as well as the logs 
 
My outgoingActivity sends number and starts sipservice. The outgoingcallchoser gets the number. After this, due to some processing which I am unable to comprehend, the Broadcast Receiver receives INCALL action. As a result it is handling an outgoing call as an incoming call and the number passed from the OutgoingCallChooser is null. Also, the call is established but the layout for incoming call is set.
The rough call flow is like this:
App UI ->initiate outggoing call -> Activity(outgoing defned in nextactivity)->outgoing callactivity(get outgoing number) sent to -> Cisipsimple->SIPHOME(OutgoingCallChooser)->returning call intent as incoming call and not outgoing call
Can anyone guide as to where i am doing some mistake because of which the SIPHOME's outgoing call chooser is returning an incoming call intent for an outgoing call
 
regards
Sachin

Régis Montoya

unread,
Oct 15, 2013, 9:46:08 AM10/15/13
to csipsim...@googlegroups.com
Hi Sachin,

The files are not attached ;).

Just quick point about your description.
The current csipsimple approach is to raise the "in call" activity only
based on the fact there is currently a sip call. The outgoing call
activity does *not* need to launch the "in call" activity. Whatever will
launch a sip call (in the service) will result in the service asking for
an activity to handle an *ongoing* call (there is no different flow if
this ongoing comes from an outgoing or from an incoming). I think it's
good doing this way because it's rock robust and the concept of an
*activity* handling a call should be the same whatever if the call was
outgoing or incoming. Then, obviously the content of this activity
should change depending of the state of the call (incoming ringing etc
etc), but it's just about internal UI then.
> --
> You received this message because you are subscribed to the Google
> Groups "CSipSimple Development" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to csipsimple-de...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

sachin sharma

unread,
Oct 16, 2013, 7:16:00 AM10/16/13
to csipsim...@googlegroups.com
Regis,
 
    I have done some more changes in the code to reolve the issue.The following are the findings :
 
  1) From logs i found out that after the sip stack is started , i am getting one error " BR_CLEAR_DEATH_NOTIFICATION_DONE cookie
      This error comes after it checks (isConnectivityValid function)
 
  2) To compare the flow i ran a outgoing call via incoming activity. Here the following were the main differences in execution flow:
 
     2.1) i get the prints for " We are Valid for WiFi"  this is not coming for my app
     2.2) Then there is a bind print and afterwards make call is invoked.
 
These above flows are not getting executed for my app . My app just hangs at this point and when the phone sleeps it goes in to Pause and call is cleared afterwards.
 
  Can u suggest why this is happening.
 
regards
Sachin

sachin sharma

unread,
Oct 17, 2013, 8:44:17 AM10/17/13
to csipsim...@googlegroups.com
Hi Regis

This is the sequence of events in my application:

The OutCallActivity starts the action:

                Intent dialerIntent = new Intent(Intent.ACTION_CALL);
                System.out.println(" --- *** 12 *** ---");
                dialerIntent.setData(SipUri.forgeSipUri(SCHEME_CSIP, number));
                System.out.println(" --- *** 13 *** --- URI : "+ SipUri.forgeSipUri(SCHEME_CSIP, number));
                dialerIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                System.out.println(" --- *** 14 *** ---");
                dialerIntent.putExtra(SipProfile.FIELD_ACC_ID,foundProfile.id);
                System.out.println("Starting the action : ["+dialerIntent.getAction()+"]");
                System.out.println(" --- *** 15 *** ---");
                System.out.println("----Number before passing to Incall is ----"+number);
                dialerIntent.putExtra("number", number);
                startActivity(dialerIntent);
                finish();

This hits the OutgoingCallChooser in the com.csipsimple.ui.outgoing package

After that it hits our activity - InCallActivity which is listening for INCALL action.
(This was to handle incoming calls but this is hit for outgoing calls also)

This time the number to be called is no where to be found. It is null when i try to retrieve it using all of the following ways:

                String nbr1 = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
                Long nbr2 = getIntent().getLongExtra(SipProfile.FIELD_ACC_ID, SipProfile.INVALID_ID);
                String nbr3 = UriUtils.extractNumberFromIntent(intent, this);
                System.out.println(THIS_FILE+"--- Number in---- "+nbr1);
                System.out.println(THIS_FILE+"--- Number in---- "+nbr2);
                System.out.println(THIS_FILE+"--- Number in---- "+nbr3);

Can you please validate if the flow is correct. if not what changes should i make to resolve this issue. i am stuck in this issue for over a week now?
This time i am uploding the logs :)
forReg.txt

Régis Montoya

unread,
Oct 19, 2013, 6:11:23 AM10/19/13
to CSipSimple dev group
Hi,
Again, the INCALL activity does NOT have the outgoing call number in the intent. It's not directly raised by the outgoing activity. It's raised by the sip service.
It's what I tried to explain previously.
Let me try again:

The OUTgoing flow is for OUTGOING. It process the fact somebody (user/app) wants to call a number and will finally ends by requesting the sip stack to place a sip call. This flow ends inside the sip stack that launches a sip call. The intent passed here is not passed elsewhere.

The ONgoing (ON not OUT) flow is about a call that is currently active. It's also named INCALL (inside a call). It's about ONGOING. In this activity, whatever the call was outgoing or incoming, you have one job to do : present something about the ONGOING call. So if you want to get the number of the guy currently in the call at this point, you will NOT find it in the intent.
And it's definitely a good software design because it's rock robust to any way that could reach a sip call.

So, if you real question is "How do I get the current remote part sip number while implementing my own InCall activity?"
The reply is that you need to have a look to the csipsimple InCall sample :
http://code.google.com/p/csipsimple/source/browse/trunk/CSipSimple/src/com/csipsimple/ui/incall/InCallActivity.java

It was already discussed here on how it works, but a quick summary :
 - you basically bind the sip service (if you don't know how to bind an android service, have a look to android sdk docs about service binding)
 - you add your *internal* broadcast receiver to listen about call changes
 - when service is bound and when your broadcast receiver receives something you request the list of ongoing calls to the sip service and decide to update your user interface accordingly.
 - at creation of the activity you also have an extra param passed in the intent (*by the sip service*) which is the CallInfo issuing the InCall activity. (You can see how to retrieve it on line 145 of the file linked above). BUT please, do NOT only use that in your activity.

What you'll get using this methods is the list of ONgoing calls. Here, you can get *anything* you want about the call. The remote part uri, the fact it was incoming or outgoing call, the current sip state of the call, etc etc etc.





2013/10/17 sachin sharma <sachi...@gmail.com>
Reply all
Reply to author
Forward
0 new messages