I'm trying to make my app receive SIP calls from an IP camera, the devices that will run the app doesn't support voip and sip api, So, I've to use a SIP-Stack which lead me to use imsDroid by doubango.
I tried it's demo test-call which gives a two way SIP-Calls, the problem is when running the app (after modifying the code with my attributes) it can receive the call but it only displaying the default Ringtone without any action taken by the Broadcast receiver, and it doesn't even goes into the Broadcast Receiver and I don't know what is the receiver which displays the ringtone, and although I don't receive any broadcast through my app, I'm getting the following log in the phone with every sip call to it:
09-14 17:52:18.251: D/native(32712): 17:52:18.227 absua_core.c !.RX 802 bytes Request msg INVITE/cseq=20 (rdata0x77848634) from UDP 192.168.30.105:5060:
09-14 17:52:18.251: D/native(32712): INVITE sip:8001@192.168.30.73:5060 SIP/2.0
09-14 17:52:18.251: D/native(32712): Via: SIP/2.0/UDP 192.168.30.105:5060;rport;branch=z9hG4bK1623506163
09-14 17:52:18.251: D/native(32712): Via: SIP/2.0/UDP 192.168.30.105:5061;rport=5061;branch=z9hG4bK988072274
09-14 17:52:18.251: D/native(32712): Record-Route: <sip:8000@192.168.30.105:5060;lr>
09-14 17:52:18.251: D/native(32712): From: <sip:8001@192.168.30.105>;tag=1036856804
09-14 17:52:18.251: D/native(32712): To: <sip:8001@192.168.30.105:5060>
09-14 17:52:18.251: D/native(32712): Call-ID: 201509141548131962663840@192.168.30.105
09-14 17:52:18.251: D/native(32712): CSeq: 20 INVITE
09-14 17:52:18.251: D/native(32712): Contact: <sip:8001@192.168.30.105:5061>
09-14 17:52:18.251: D/native(32712): User-agent: Dahua UAC/3.0 VTO6210B V2.1.0.0
09-14 17:52:18.251: D/native(32712): Expires: 120
09-14 17:52:18.251: D/native(32712): Max-Forwards: 69
09-14 17:52:18.251: D/native(32712): Content-Type: application/sdp
09-14 17:52:18.251: D/native(32712): Content-Length: 242
09-14 17:52:18.251: D/native(32712):
09-14 17:52:18.251: D/native(32712): v=0
09-14 17:52:18.251: D/native(32712): o=0 0 0 IN IP4 192.168.30.105
09-14 17:52:18.251: D/native(32712): s=Dahua VT 1.5
09-14 17:52:18.251: D/native(32712): c=IN IP4 192.168.30.105
09-14 17:52:18.251: D/native(32712): t=0 0
09-14 17:52:18.251: D/native(32712): m=video 15002 RTP/AVP 96
09-14 17:52:18.251: D/native(32712): a=framerate:25.000000
09-14 17:52:18.251: D/native(32712): a=rtpmap:96 H264/90000
09-14 17:52:18.251: D/native(32712): m=audio 15000 RTP/AVP 97 0
09-14 17:52:18.251: D/native(32712): a=rtpmap:97 PCM/16000
09-14 17:52:18.251: D/native(32712): a=rtpmap:0 PCMU/8000
09-14 17:52:18.251: D/native(32712): a=sendrecv
09-14 17:52:18.251: D/native(32712): --end msg--
09-14 17:52:18.251: D/native(32712): 17:52:18.259 absua_call.c .Incoming Request msg INVITE/cseq=20 (rdata0x77848634)
09-14 17:52:18.261: D/native(32712): 17:52:18.269 absua_media.c ..Call 0: initializing media..
09-14 17:52:18.271: D/native(32712): 17:52:18.273 absua_media.c ...RTP socket reachable at 192.168.30.73:40000
09-14 17:52:18.271: D/native(32712): 17:52:18.274 absua_media.c ...RTCP socket reachable at 192.168.30.73:40001
09-14 17:52:18.271: D/native(32712): 17:52:18.276 absua_media.c ...RTP socket reachable at 192.168.30.73:40002
09-14 17:52:18.271: D/native(32712): 17:52:18.278 absua_media.c ...RTCP socket reachable at 192.168.30.73:40003
09-14 17:52:18.271: D/native(32712): 17:52:18.279 absua_media.c ...Media index 1 selected for audio call 0
09-14 17:52:18.281: D/native(32712): 17:52:18.286 absua_core.c .....TX 408 bytes Response msg 100/INVITE/cseq=20 (tdta0x778c0418) to UDP 192.168.30.105:5060:
09-14 17:52:18.281: D/native(32712): SIP/2.0 100 Trying
09-14 17:52:18.281: D/native(32712): Via: SIP/2.0/UDP 192.168.30.105:5060;rport=5060;received=192.168.30.105;branch=z9hG4bK1623506163
09-14 17:52:18.281: D/native(32712): Via: SIP/2.0/UDP 192.168.30.105:5061;rport=5061;branch=z9hG4bK988072274
09-14 17:52:18.281: D/native(32712): Record-Route: <sip:8000@192.168.30.105:5060;lr>
09-14 17:52:18.281: D/native(32712): Call-ID: 201509141548131962663840@192.168.30.105
09-14 17:52:18.281: D/native(32712): From: <sip:8001@192.168.30.105>;tag=1036856804
09-14 17:52:18.281: D/native(32712): To: <sip:8001@192.168.30.105>
09-14 17:52:18.281: D/native(32712): CSeq: 20 INVITE
09-14 17:52:18.281: D/native(32712): Content-Length: 0
09-14 17:52:18.281: D/native(32712):
09-14 17:52:18.281: D/native(32712): --end msg--
09-14 17:52:18.281: D/native(32712): 17:52:18.287 sip_inv ...absip_dlg_send_response returns (null)
09-14 17:52:18.281: V/AlarmManager(818): waitForAlarm result :4
09-14 17:52:18.291: V/AlarmManager(818): trigger ELAPSED_REALTIME_WAKEUP or RTC_WAKEUP
09-14 17:52:18.311: D/SIP UA Receiver(32712): < LOCK CPU
09-14 17:52:18.311: D/AbtoPhone(32712): call Id = 0
09-14 17:52:18.311: D/SIP SRV(32712): send event
09-14 17:52:18.311: D/SIP UA Receiver(32712): Get call info for update
09-14 17:52:18.321: D/SIP UA Receiver(32712): Launch update
09-14 17:52:18.321: D/SipCalls(32712): Update call 0
09-14 17:52:18.331: D/native(32712): 17:52:18.332 zrtp_android.c ..jzrtp_getInfoFromContext : user data 0
09-14 17:52:18.331: D/SIP UA Receiver(32712): Incoming call << for account 0
09-14 17:52:18.331: D/SIP SRV(32712): Search if should I auto answer for <sip:8001@192.168.30.105>
09-14 17:52:18.331: D/SIP SRV(32712): Oupps... that come from an unknown account...
09-14 17:52:18.331: D/SIP UA Receiver(32712): Should I anto answer ? 0
09-14 17:52:18.331: D/native(32712): 17:52:18.340 absua_call.c ..Answering call 0: code=180
09-14 17:52:18.341: D/native(32712): 17:52:18.342 absua_core.c ......TX 573 bytes Response msg 180/INVITE/cseq=20 (tdta0x778c0418) to UDP 192.168.30.105:5060:
09-14 17:52:18.341: D/native(32712): SIP/2.0 180 Ringing
09-14 17:52:18.341: D/native(32712): Via: SIP/2.0/UDP 192.168.30.105:5060;rport=5060;received=192.168.30.105;branch=z9hG4bK1623506163
09-14 17:52:18.341: D/native(32712): Via: SIP/2.0/UDP 192.168.30.105:5061;rport=5061;branch=z9hG4bK988072274
09-14 17:52:18.341: D/native(32712): Record-Route: <sip:8000@192.168.30.105:5060;lr>
09-14 17:52:18.341: D/native(32712): Call-ID: 201509141548131962663840@192.168.30.105
09-14 17:52:18.341: D/native(32712): From: <sip:8001@192.168.30.105>;tag=1036856804
09-14 17:52:18.341: D/native(32712): To: <sip:8001@192.168.30.105>;tag=mq10g9jp0JdExCHy95p-JEzF4gglxudk
09-14 17:52:18.341: D/native(32712): CSeq: 20 INVITE
09-14 17:52:18.341: D/native(32712): Contact: <sip:192.168.30.73:5060>
09-14 17:52:18.341: D/native(32712): Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
09-14 17:52:18.341: D/native(32712): Content-Length: 0
09-14 17:52:18.341: D/native(32712):
09-14 17:52:18.341: D/native(32712): --end msg--
09-14 17:52:18.341: I/native(32712): 17:52:18.344 absua_jni_addo .........Call 0 state changed to EARLY (180 Ringing)
09-14 17:52:18.341: D/SIP UA Receiver(32712): < LOCK CPU
09-14 17:52:18.341: D/SIP UA Receiver(32712): Call state <<
09-14 17:52:18.341: D/SIP UA Receiver(32712): Get call info for update
09-14 17:52:18.341: D/SIP UA Receiver(32712): Launch update
09-14 17:52:18.341: D/SipCalls(32712): Update call 0
09-14 17:52:18.341: D/SipCalls(32712): Last status code is 180
09-14 17:52:18.351: D/native(32712): 17:52:18.352 zrtp_android.c .........jzrtp_getInfoFromContext : user data 0
09-14 17:52:18.351: D/SIP SRV(32712): send event
09-14 17:52:18.351: D/SIP UA Receiver(32712): < LOCK CPU
09-14 17:52:18.351: D/SIP UA Receiver(32712): Call state >>
09-14 17:52:18.351: D/SIP UA Receiver(32712): > UNLOCK CPU 1
09-14 17:52:18.351: D/SIP UA Receiver(32712): > UNLOCK CPU 1
09-14 17:52:18.351: D/native(32712): 17:52:18.360 sip_inv ....absip_dlg_send_response returns (null)
09-14 17:52:18.361: W/Settings(32712): Setting wifi_sleep_policy has moved from android.provider.Settings.System to android.provider.Settings.Global, returning read-only value.
09-14 17:52:18.361: I/AudioService(818): getStreamVolume 0 index 50
09-14 17:52:18.361: D/MediaManager(32712): Target mode... : 3
09-14 17:52:18.371: D/AudioFocus 8(32712): Focus again false
09-14 17:52:18.371: I/MediaFocusControl(818): Remote Control registerMediaButtonIntent() for PendingIntent{45889c80: PendingIntentRecord{4581e950 org.abtollc.videosoftphone broadcastIntent}}
09-14 17:52:18.371: I/MediaFocusControl(818): AudioFocus requestAudioFocus() from android.media.AudioManager$42bb2fa8org.abtollc.utils.audio.AudioFocus8$1$42bcd908
09-14 17:52:18.381: D/Ringer(32712): ==> ring() called...
09-14 17:52:18.381: D/CallerInfo(32712): Number looks usable, try People lookup
09-14 17:52:18.381: V/KeyguardUpdateMonitor(1074): handleSetGenerationId(g=692, clear=true)
09-14 17:52:18.381: V/KeyguardUpdateMonitor(1074): handleSetGenerationId(g=693, clear=true)
09-14 17:52:18.401: V/MediaPlayer-JNI(32712): native_setup
09-14 17:52:18.401: V/MediaPlayer(32712): constructor
09-14 17:52:18.401: V/MediaPlayer(32712): setListener
09-14 17:52:18.401: I/MediaPlayer(32712): it is a Ringtone type is : 1
09-14 17:52:18.401: D/RingtoneManager(32712): getActualDefaultRingtoneUri type :1
09-14 17:52:18.411: D/RingtoneManager(32712): checkDefaultRingtoneProperUri : InternalMediaAudio uriString not null type:1
09-14 17:52:18.411: I/MediaPlayer(32712): It is a Not a DRM RingTone: return NULl
09-14 17:52:18.411: I/MediaPlayer(32712): path is null
09-14 17:52:18.411: D/RingtoneManager(818): getActualDefaultRingtoneUri type :1
09-14 17:52:18.411: D/RingtoneManager(818): checkDefaultRingtoneProperUri : InternalMediaAudio uriString not null type:1
and about how I registered my broadcast:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Incoming call broadcast receiver
final IntentFilter intentRFilter = new IntentFilter();
callStateReceiver = new CallStateReceiver();
intentRFilter.addAction(NgnInviteEventArgs.ACTION_INVITE_EVENT);
registerReceiver(callStateReceiver, intentRFilter);
}
public class CallStateReceiver extends BroadcastReceiver {
// it doesn't enter it at all
@Override
public void onReceive(Context context, Intent intent) {
final String action = intent.getAction();
if(NgnInviteEventArgs.ACTION_INVITE_EVENT.equals(action)){
NgnInviteEventArgs args =
intent.getParcelableExtra(NgnEventArgs.EXTRA_EMBEDDED);
if(args == null){
Log.d("DEBUG", "Invalid event args");
return;
}
NgnAVSession avSession
= NgnAVSession.getSession(args.getSessionId());
if (avSession == null) {
return;
}
final InviteState callState = avSession.getState();
NgnEngine mEngine = NgnEngine.getInstance();
switch(callState){
case NONE:
default:
break;
case INCOMING:
Log.i("DEBUG", "Incoming call");
// Ring
mEngine.getSoundService().startRingTone(); // it doesn't goes here
// Start a ReceiveActivity
Intent i = new Intent(context.getApplicationContext(),
ReceiveCallActivity.class);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
i.putExtra("SIP_SESSION_ID", avSession.getId());
i.putExtra("PHONE_NUMBER_EXTRA",
avSession.getRemotePartyDisplayName());
context.startActivity(i);
break;
case INCALL:
Log.i("DEBUG", "Call connected");
mEngine.getSoundService().stopRingTone();
break;
case TERMINATED:
Log.i("DEBUG", "Call terminated");
mEngine.getSoundService().stopRingTone();
mEngine.getSoundService().stopRingBackTone();
break;
}
}
}
}