我使用pjsip進行VOIP呼叫。爲了延長電池壽命,策略是每當通話結束時取消註冊和刪除SIP賬戶。 GCM會通知來電,這將觸發註冊sip賬戶。pjsip android unregister/register crash
這個工程,但不穩定。有時應用程序在pjsip本地層崩潰(我懷疑是因爲gc踢錯了線程?)。
我在所有的東西上仔細調用.delete()。但是這沒有幫助。有時候我可以在碰撞之前做10-15個電話。但在其他設備上更少。
崩潰我得到的只是給我一個無用的致命信號11:
10-27 22:53:23.045 1068-2014/com.funbers.app /System.out﹕ 22:53:23.204 pjsua_core.c .RX 619 bytes Response msg 200/REGISTER/cseq=24488 (rdata0x613e2540) from TLS 162.209.100.164:5061:
10-27 22:53:23.200 1068-2014/com.funbers.app I/System.out﹕ SIP/2.0 200 OK
10-27 22:53:23.200 1068-2014/com.funbers.app I/System.out﹕ Via: SIP/2.0/TLS 85.225.249.21:46425;branch=z9hG4bKPjQ71QoAFam.OlO6FEvuVz2gM5PPu4DWmH;alias;received=85.225.249.21;rport=46425
10-27 22:53:23.200 1068-2014/com.funbers.app I/System.out﹕ From: "12025999147" <sip:[email protected]>;tag=XvzX1mdof0g94DVFNNaryzYNTCpwFwD0
10-27 22:53:23.200 1068-2014/com.funbers.app I/System.out﹕ To: "12025999147" <sip:[email protected]>;tag=as7431db35
10-27 22:53:23.200 1068-2014/com.funbers.app I/System.out﹕ Call-ID: naIKdyL6kahHCqtpDB9mKwGs3IVssYbq
10-27 22:53:23.200 1068-2014/com.funbers.app I/System.out﹕ CSeq: 24488 REGISTER
10-27 22:53:23.200 1068-2014/com.funbers.app I/System.out﹕ Server: Asterisk
10-27 22:53:23.200 1068-2014/com.funbers.app I/System.out﹕ Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
10-27 22:53:23.200 1068-2014/com.funbers.app I/System.out﹕ Supported: replaces, timer
10-27 22:53:23.200 1068-2014/com.funbers.app I/System.out﹕ Expires: 0
10-27 22:53:23.200 1068-2014/com.funbers.app I/System.out﹕ Date: Mon, 27 Oct 2014 21:53:26 GMT
10-27 22:53:23.200 1068-2014/com.funbers.app I/System.out﹕ Content-Length: 0
10-27 22:53:23.200 1068-2014/com.funbers.app I/System.out﹕ [ 10-27 22:53:23.200 1068: 2014 I/System.out ]
10-27 22:53:23.200 1068-2014/com.funbers.app I/System.out﹕ --end msg--
10-27 22:53:23.210 1068-2014/com.funbers.app I/System.out﹕ 22:53:23.214 pjsua_acc.c ...."12025999147" <sip:[email protected];transport=tls>: unregistration success
10-27 22:53:23.210 1068-2014/com.funbers.app D/Funbers﹕ notifyRegState: code: 200, reason: OK, expiration: 0
10-27 22:53:23.215 1068-2014/com.funbers.app D/Funbers﹕ Delete account (notifyRegState)
10-27 22:53:23.220 1068-2014/com.funbers.app I/System.out﹕ 22:53:23.229 pjsua_acc.c ....Deleting account 0..
10-27 22:53:23.225 1068-2014/com.funbers.app I/System.out﹕ 22:53:23.229 pjsua_acc.c .....Account id 0 deleted
10-27 22:53:23.225 1068-2014/com.funbers.app A/libc﹕ Fatal signal 11 (SIGSEGV) at 0x24656369 (code=1), thread 2014 (com.funbers.app)
現在我不知道,是它甚至是一個好主意註銷/呼叫後刪除帳戶。或者應該保持活着的sip帳戶(並且每隔幾分鐘註冊一次)?在後臺有活動的sipservice會耗盡多少電量?
或者我可以在我的註冊/註銷電話中遺漏某些東西。順便說一句我不註銷方式:
account.setRegistration(false);
然後等待登記變更通知前做:
account.delete();
account = null;
只是一個隨機問題。您是通過GCM立即獲取事件還是會有相當的延遲?即使手機處於睡眠狀態,也要立即獲得推送通知,手機必須保持TCP套接字處於活動狀態,您也可以在應用程序中執行此操作。 – nnb 2014-10-29 06:58:53
大部分時間都很快。快速建立電話的工作。但偶爾一次gcm推送可能會延遲更長的時間。 我已經轉向新的'VOIP'推動蘋果允許(對於iOS 8+) - 哪個更好。 – 2015-08-13 09:56:35
@RasmusHöglund你能找到解決方案嗎?我得到完全相同的問題(出站和入站),它似乎是隨機崩潰 – 2015-12-18 18:05:08