Cody
Cody

Reputation: 4471

How to get SIP caller information under android sip library

I have an Android application using Android SIP library.

In receiving call part, I would like to know the caller's information like the caller account so that user can decide to answer or decline the call.

However, I can't find how to display this information.

My question is how to get caller account/ID of the incoming call ?

Below is my broadcast receiver to receiver incoming sip call:

public class IncomingCallReceiver extends BroadcastReceiver {
    public void onReceive(final Context context, Intent intent) {
        ...
        SipManager sipManager = SipManager.newInstance(this);
        ...
        SipAudioCall call = sipManager.takeAudioCall(sipIntent, listener);
        if(answerCall){
            call.answerCall(30);
        }else{
            call.endCall();
        }

    }
}

I have tried to parse the incoming intent. There are two extras in intent contain the followings:

android:sipCallID:

v=0
o=- 1458035023435 1458035023447 IN IP4 210.202.37.33
s=-
c=IN IP4 210.202.37.33
t=0 0
m=audio 13662 RTP/AVP 96 97 3 0 8 127
a=rtpmap:96 GSM-EFR/8000
a=rtpmap:97 AMR/8000
a=rtpmap:3 GSM/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:127 telephone-event/8000
a=fmtp:127 0-15
a=direction:active
a=nortpproxy:yes

android:sipOfferSD:

[email protected]

but, it's seems not helpful.

Upvotes: 0

Views: 687

Answers (1)

Nacho
Nacho

Reputation: 1124

What you posted as content of the intent seems to be the SDP (Session Description Protocol) offer, which contains the description of media parameters. It doesn't have the session information you seek.

Since yo have a SipManager instance, I am guessing you somehow createSipSession(). Once you have the session you can retrieve the SipProfile of the peer using getPeerProfile() which should in turn contain the information you require.

You can also get the peer profile using call.getPeerProfile() if the previous doesn't work, since you also have a SipAudioCall object.

Upvotes: 1

Related Questions