更新时间:2019-11-20
用户在通话接通前可进行取消呼叫或拒绝呼叫等操作,通话过程中可以结束通话。
主叫或被叫在通话过程中挂断呼叫
通话双方均可挂断呼叫,本章节以主叫发起挂断为例。
//c code TSDK_RESULT ret; ret = tsdk_end_call(callid); if(TSDK_SUCCESS != ret) { LOG_D_CALL_ERROR("end call failed. result=%#x", ret); return -1; } return TSDK_SUCCESS; |
//c code case TSDK_E_CALL_EVT_CALL_ENDED: { CHECK_POINTER(data); TSDK_S_CALL_INFO* callInfo = (TSDK_S_CALL_INFO*)data; TSDK_S_CALL_INFO* notifyInfo = new TSDK_S_CALL_INFO; memset(notifyInfo, 0, sizeof(TSDK_S_CALL_INFO)); memcpy_s(notifyInfo, sizeof(TSDK_S_CALL_INFO), callInfo, sizeof(TSDK_S_CALL_INFO)); ::PostMessage(maindlg->GetSafeHwnd(), WM_CALL_END, (WPARAM)notifyInfo, NULL); break; } |
主叫在通话接通前取消呼叫
//c code TSDK_RESULT ret; ret = tsdk_end_call(callid); if(TSDK_SUCCESS != ret) { LOG_D_CALL_ERROR("end call failed. result=%#x", ret); return -1; } return TSDK_SUCCESS; |
//c code case TSDK_E_CALL_EVT_CALL_ENDED: { CHECK_POINTER(data); TSDK_S_CALL_INFO* callInfo = (TSDK_S_CALL_INFO*)data; TSDK_S_CALL_INFO* notifyInfo = new TSDK_S_CALL_INFO; memset(notifyInfo, 0, sizeof(TSDK_S_CALL_INFO)); memcpy_s(notifyInfo, sizeof(TSDK_S_CALL_INFO), callInfo, sizeof(TSDK_S_CALL_INFO)); ::PostMessage(maindlg->GetSafeHwnd(), WM_CALL_END, (WPARAM)notifyInfo, NULL); break; } |
被叫在收到来电时拒绝呼叫
//c code TSDK_RESULT ret; ret = tsdk_end_call(callid); if(TSDK_SUCCESS != ret) { LOG_D_CALL_ERROR("end call failed. result=%#x", ret); return -1; } return TSDK_SUCCESS; |
在实际现网部署过程中,业务服务器可能开启了呼叫等待功能,在被叫拒绝呼叫时,业务服务器会与主叫建立通话并播放提示音“对方忙”或“对方通话中”,主叫SDK在此过程中会上报TSDK_E_CALL_EVT_CALL_CONNECTED事件,需要用户通过主叫UI主动挂断呼叫。
//c code case TSDK_E_CALL_EVT_CALL_ENDED: { CHECK_POINTER(data); TSDK_S_CALL_INFO* callInfo = (TSDK_S_CALL_INFO*)data; TSDK_S_CALL_INFO* notifyInfo = new TSDK_S_CALL_INFO; memset(notifyInfo, 0, sizeof(TSDK_S_CALL_INFO)); memcpy_s(notifyInfo, sizeof(TSDK_S_CALL_INFO), callInfo, sizeof(TSDK_S_CALL_INFO)); ::PostMessage(maindlg->GetSafeHwnd(), WM_CALL_END, (WPARAM)notifyInfo, NULL); break; } |
被叫在收到来电时未接听
在实际现网部署过程中,业务服务器可能开启了呼叫等待功能,在被叫拒绝呼叫时,业务服务器会与主叫建立通话并播放提示音“对方未接听”,主叫SDK在此过程中会上报TSDK_E_CALL_EVT_CALL_RTP_CREATED或TSDK_E_CALL_EVT_CALL_CONNECTED事件,需要用户通过主叫UI主动挂断呼叫。
//c code case TSDK_E_CALL_EVT_CALL_ENDED: { CHECK_POINTER(data); TSDK_S_CALL_INFO* callInfo = (TSDK_S_CALL_INFO*)data; TSDK_S_CALL_INFO* notifyInfo = new TSDK_S_CALL_INFO; memset(notifyInfo, 0, sizeof(TSDK_S_CALL_INFO)); memcpy_s(notifyInfo, sizeof(TSDK_S_CALL_INFO), callInfo, sizeof(TSDK_S_CALL_INFO)); ::PostMessage(maindlg->GetSafeHwnd(), WM_CALL_END, (WPARAM)notifyInfo, NULL); break; } |
无。