在pjsip的SIP通话期间如何播放提示音?

时间:2019-07-19 07:58:47

标签: ios voip pjsip

最近,我在pjsip中开发了一个SIP呼叫应用程序。而且它具有重新编码的通话功能,现在我想在录音通话中播放提示音。请帮我怎么做。

我尝试了此链接,但未打开文件错误。 ios pjsip - play a sound during sip call

pj_status_t play_sound_during_call(pj_str_t sound_file)
{
    pjsua_player_id player_id;
    pj_status_t status;
    status = pjsua_player_create(&sound_file, 0, &player_id);
    if (status != PJ_SUCCESS)
        return status;

    pjmedia_port *player_media_port;

    status = pjsua_player_get_port(player_id, &player_media_port);
    if (status != PJ_SUCCESS)
    {
        return status;
    }

    pj_pool_t *pool = pjsua_pool_create("my_eof_data", 512, 512);
    struct pjsua_player_eof_data *eof_data = PJ_POOL_ZALLOC_T(pool, struct pjsua_player_eof_data);
    eof_data->pool = pool;
    eof_data->player_id = player_id;

    pjmedia_wav_player_set_eof_cb(player_media_port, eof_data, &on_pjsua_wav_file_end_callback);

    status = pjsua_conf_connect(pjsua_player_get_conf_port(player_id), 0);

    if (status != PJ_SUCCESS)
    {
        return status;
    }        

    return status;
}

请帮助并告诉我如何在通话中播放wav文件。 预先感谢

0 个答案:

没有答案