1

我正在使用 PJSUA/PJSIP 在 Ubuntu 16.04 上编写应用程序。
我需要检测通话何时挂断。有排序call_state()功能吗?

谢谢 !

4

1 回答 1

4

在这里这里找到了解决方案:
您必须像这样修改static void on_call_state(pjsua_call_id call_id, pjsip_event *e)函数:

/* Callback called by the library when call's state has changed */
static void on_call_state(pjsua_call_id call_id, pjsip_event *e)
{
    pjsua_call_info ci;

    PJ_UNUSED_ARG(e);

    pjsua_call_get_info(call_id, &ci);
    PJ_LOG(3,(THIS_FILE, "Call %d state=%.*s", call_id,
             (int)ci.state_text.slen,
             ci.state_text.ptr));


    if (ci.state == PJSIP_INV_STATE_DISCONNECTED) { 

        /*YOUR CODE HERE*/

    }
}
于 2017-05-12T15:55:33.653 回答