2017-05-11 107 views
0

我正在用PJSUA/PJSIP在Ubuntu 16.04上编写应用程序。
我需要检测何时挂断电话。有没有排序call_state()函数?检测结束通话PJSIP

谢谢!

回答

1

找到了解决办法herehere
您必须修改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*/ 

    } 
}