我正在尝试让我的应用程序接收来自 IP 摄像头的 SIP 呼叫,运行该应用程序的设备不支持 voip 和 sip api,因此,我必须使用 SIP-Stack 来引导我使用imsDroid豆瓣_
我尝试了它的演示测试呼叫,它提供了两种方式的 SIP 呼叫,问题是在运行应用程序时(使用我的属性修改代码后)它可以接收呼叫,但它只显示默认铃声而没有采取任何操作广播接收器,它甚至没有进入广播接收器,我不知道显示铃声的接收器是什么,虽然我没有通过我的应用程序收到任何广播,但我得到以下登录每次 sip 呼叫的电话:
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
以及我如何注册我的广播:
@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;
}
}
}
}