pjsip-2.7.1使用ios CallKit调用pjsua_set_snd_dev时断言失败

问题描述 投票:1回答:1

在我将pjsip从v2.6更新到v2.7.1之后,我的应用程序将使用函数pjsua_set_snd_dev()来断言失败。根据pjsip的票#1941:

拨打电话:

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.
     */
}

当调用pjsua API pjsua_set_snd_dev()时,会显示:

断言失败:(param && id!= PJMEDIA_AUD_INVALID_DEV),函数pjmedia_aud_dev_default_param,file ../src/pjmedia/audiodev.c,第487行。

我发现v2.7.1,在pjsua_set_no_snd_dev()中,有

pjsua_var.cap_dev = PJSUA_SND_NO_DEV; pjsua_var.play_dev = PJSUA_SND_NO_DEV;

但是在v2.6中,没有这个。

PJSUA_SND_NO_DEV和PJMEDIA_AUD_INVALID_DEV与-3相同。

这是一个错误,还是我混淆了什么?

voip pjsip callkit
1个回答
0
投票

史蒂夫你补充说

App在功能中提供IP语音服务所需的后台模式

或者您可以直接在Info.plist中添加

© www.soinside.com 2019 - 2024. All rights reserved.