2016-12-06 25 views
1

有人可以告訴我爲什麼會發生這種情況?ios10 iphone5s voip siphon pjsip2.5.5打開聲音設備時出錯

iOS10,iPhone5s,VOIP Siphon pjsip2.5.5。

這些問題並不是每次都會出現,有時候您想撥打電話或接聽電話(添加時間:20161226)。

錯誤打開音響設備:

14:06:03.137742 pjsua_aud.c ....Set sound device: capture=-1, playback=-2 

14:06:03.137775 pjsua_aud.c .....Opening sound device (speaker + mic) [email protected]/1/20ms 

14:06:03.137837 coreaudio_dev. ......Using VoiceProcessingIO audio unit 

14:06:03.147404 acquire_call enter,call_id:2 
14:06:03.233365 level:4,msg:14:06:03.233 pjsua_aud.c .....Opening sound device (speaker + mic) [email protected]/1/20ms 

14:06:03.233488 level:4,msg:14:06:03.233 coreaudio_dev. ......Using VoiceProcessingIO audio unit 

14:06:03.263379 AVAudioSessionRouteChangeNotification ..changeReason..3 
14:06:03.439201 pjsua_aud.c .....Opening sound device (speaker + mic) [email protected]/1/20ms 

14:06:03.444813 coreaudio_dev. ......Using VoiceProcessingIO audio unit 

14:06:03.518592 pjsua_aud.c .....Opening sound device (speaker + mic) [email protected]/1/20ms 

14:06:03.518731 coreaudio_dev. ......Using VoiceProcessingIO audio unit 

14:06:03.587808 pjsua_aud.c .....Opening sound device (speaker + mic) [email protected]/1/20ms 

14:06:03.587936 coreaudio_dev. ......Using VoiceProcessingIO audio unit 

14:06:03.659660 pjsua_aud.c .....Opening sound device (speaker + mic) [email protected]/1/20ms 

14:06:03.659837 coreaudio_dev. ......Using VoiceProcessingIO audio unit 

14:06:03.734433 pjsua_aud.c .....Unable to open sound device: Unknown OpenSSL error 503317117 [status=506637] 

14:06:03.734512 pjsua_aud.c ....Error opening sound device: Unknown OpenSSL error 503317117 [status=506637] 

14:06:03.734534 pjsua_aud.c ...Conf connect: 0 --> 2 

14:06:03.734555 pjsua_aud.c ....Set sound device: capture=-1, playback=-2 

14:06:03.734586 pjsua_aud.c .....Opening sound device (speaker + mic) [email protected]/1/20ms 

14:06:03.734651 coreaudio_dev. ......Using VoiceProcessingIO audio unit 

14:06:03.799718 pjsua_aud.c .....Opening sound device (speaker + mic) [email protected]/1/20ms 

14:06:03.799847 coreaudio_dev. ......Using VoiceProcessingIO audio unit 

14:06:03.868825 pjsua_aud.c .....Opening sound device (speaker + mic) [email protected]/1/20ms 

14:06:03.869031 coreaudio_dev. ......Using VoiceProcessingIO audio unit 

14:06:03.936294 pjsua_aud.c .....Opening sound device (speaker + mic) [email protected]/1/20ms 

14:06:03.936423 coreaudio_dev. ......Using VoiceProcessingIO audio unit 

14:06:04.006834 pjsua_aud.c .....Opening sound device (speaker + mic) [email protected]/1/20ms 

14:06:04.006962 coreaudio_dev. ......Using VoiceProcessingIO audio unit 

14:06:04.075150 pjsua_aud.c .....Opening sound device (speaker + mic) [email protected]/1/20ms 

14:06:04.075288 coreaudio_dev. ......Using VoiceProcessingIO audio unit 

14:06:04.144082 pjsua_aud.c .....Unable to open sound device: Unknown OpenSSL error 503317117 [status=506637] 

14:06:04.144165 pjsua_aud.c ....Error opening sound device: Unknown OpenSSL error 503317117 [status=506637] 

14:06:04.144186 pjsua_conf_connect:pjsua_conf_connect_value 506637 ret 506637 

今日(2016年12月16日),我得到了同樣的錯誤,但錯誤數量是不同的(iphone5的ios10.1.1 siphone pjsip2.5.5)

316-981188544 2016-12-16 10:52:29.160553 pjsua_aud.c .....Opening sound device (speaker + mic) [email protected]/1/20ms 

316-981188544 2016-12-16 10:52:29.160689 coreaudio_dev. ......Using VoiceProcessingIO audio unit 

316-981188544 2016-12-16 10:52:29.167254 pjsua_aud.c .....Opening sound device (speaker + mic) [email protected]/1/20ms 

316-981188544 2016-12-16 10:52:29.167391 coreaudio_dev. ......Using VoiceProcessingIO audio unit 

316-981188544 2016-12-16 10:52:29.172857 pjsua_aud.c .....Opening sound device (speaker + mic) [email protected]/1/20ms 

316-981188544 2016-12-16 10:52:29.172994 coreaudio_dev. ......Using VoiceProcessingIO audio unit 

316-981188544 2016-12-16 10:52:29.178400 pjsua_aud.c .....Opening sound device (speaker + mic) [email protected]/1/20ms 

316-981188544 2016-12-16 10:52:29.178539 coreaudio_dev. ......Using VoiceProcessingIO audio unit 

316-981188544 2016-12-16 10:52:29.184486 pjsua_aud.c .....Opening sound device (speaker + mic) [email protected]/1/20ms 

316-981188544 2016-12-16 10:52:29.184631 coreaudio_dev. ......Using VoiceProcessingIO audio unit 

316-981188544 2016-12-16 10:52:29.195032 pjsua_aud.c .....Unable to open sound device: Unknown error -1701297535 [status=-1701297535] 

316-981188544 2016-12-16 10:52:29.195105 pjsua_aud.c ....Error opening sound device: Unknown error -1701297535 [status=-1701297535] 
+0

具有u發現任何解決這個? – DadoZolic

回答

0

我的問題是,當我在有來電時播放的聲音我設置AudioSession caterogry播放,如:

try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback) 

我把它改爲播放和錄製:

try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayAndRecord) 

它在那之後就工作了。因此,如果您在代碼中的某處將音頻會話設置爲回放,請將其更改爲播放和錄製。

+0

我檢查了pjsip源代碼,發現coreaudio_dev.m中有setCategory:AVAudioSessionCategoryPlayAndRecord,我確定它使用AVAudioSessionCategoryPlayAndRecord.So,這不是原因。 – steve

2

步驟1:在支持文件夾時您xcode項目首開的info.plist文件,然後單擊「+」信息屬性列表

步驟2:選擇並添加隱私 - 麥克風使用說明在列表中。

步驟3:增加值麥克風隱私 - 麥克風使用說明

現在編譯並運行您的項目。

+0

是的,我已經完成了這些步驟。錯誤發生了一段時間,大部分時間,它都很好。 – steve

+0

@steve在執行上述這些步驟之前,音頻正在工作還是完全不工作? – NandhaKumar

+0

我從一開始就在做這些步驟,所以這些都不是原因。音頻在大部分時間都運行良好,有時我聽不到聲音,然後檢查日誌,發現這些問題。 – steve

0

最後,我修復與IOS的CallKit這個bug,看看這個網站:https://trac.pjsip.org/repos/ticket/1941

詳情: CallKit框架允許應用程序使用手機自帶UI接聽來電和呼出。爲了達到這個目的,CallKit要求只有在音頻會話被激活時才能啓動通話音頻,因此建議您在使用PJSIP時只在必要時打開音響設備。它可以通過以下方式完成:

啓動沒有聲音設備的PJSIP(通過在啓動後調用pjsua_set_no_snd_dev())。在未使用時關閉聲音設備,也使用相同的API(pjsua_set_no_snd_dev())。激活音頻會話後,使用API​​ pjsua_set_snd_dev()打開聲音設備。以下是關於如何將CallKit與PJSIP集成的示例,以及Apple提供的揚聲器示例應用程序中的代表功能。

要撥出電話:

func provider(_ provider: CXProvider, perform action: CXStartCallAction) { 
     /* 1. We must not start call audio here, and can only do so 
     * once the audio session has been activated by the system 
     * after having its priority elevated. So, make sure that the sound 
     * device is closed at this point. 
     */ 

     /* 2. Provide your own implementation to configure 
     * the audio session here. 
     */ 
     configureAudioSession() 

     /* 3. Make call with pjsua_call_make_call(). 
     * Then use pjsua's on_call_state() callback to report significant 
     * events in the call's lifecycle, by calling iOS API 
     * CXProvider.reportOutgoingCall(with: startedConnectingAt:) and 
     * CXProvider.reportOutgoingCall(with: ConnectedAt:) 
     */ 

     /* 4. If step (3) above returns PJ_SUCCESS, call action.fulfill(), 
     * otherwise call action.fail(). 
     */ 
    } 

爲了處理來電:

func provider(_ provider: CXProvider, perform action: CXAnswerCallAction) { 
     /* 1. We must not start call audio here, and can only do so 
     * once the audio session has been activated by the system 
     * after having its priority elevated. So, make sure that the sound 
     * device is closed at this point. 
     */ 

     /* 2. Provide your own implementation to configure 
     * the audio session here. 
     */ 
     configureAudioSession() 

     /* 3. Answer the call with pjsua_call_answer(). 
     */ 

     /* 4. If step (3) above returns PJ_SUCCESS, call action.fulfill(), 
     * otherwise call action.fail(). 
     */ 
    } 

要啓動聲音設備:

func provider(_ provider: CXProvider, didActivate audioSession: AVAudioSession) { 
    /* Start call audio media, now that the audio session has been 
    * activated after having its priority boosted. 
    * 
    * Call pjsua API pjsua_set_snd_dev() here. 
    */ 
}