主頁 > 服務(wù)與支持 > 開發(fā)平臺(tái) > 客戶端SDK參考 > Windows Native SDK > 音視頻呼叫 結(jié)束通話(或呼叫)
更新時(shí)間:2019-11-20
用戶在通話接通前可進(jìn)行取消呼叫或拒絕呼叫等操作,通話過程中可以結(jié)束通話。
主叫或被叫在通話過程中掛斷呼叫
通話雙方均可掛斷呼叫,本章節(jié)以主叫發(fā)起掛斷為例。
//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; } |
被叫在收到來電時(shí)拒絕呼叫
//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; |
在實(shí)際現(xiàn)網(wǎng)部署過程中,業(yè)務(wù)服務(wù)器可能開啟了呼叫等待功能,在被叫拒絕呼叫時(shí),業(yè)務(wù)服務(wù)器會(huì)與主叫建立通話并播放提示音“對(duì)方忙”或“對(duì)方通話中”,主叫SDK在此過程中會(huì)上報(bào)TSDK_E_CALL_EVT_CALL_CONNECTED事件,需要用戶通過主叫UI主動(dòng)掛斷呼叫。
//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; } |
被叫在收到來電時(shí)未接聽
在實(shí)際現(xiàn)網(wǎng)部署過程中,業(yè)務(wù)服務(wù)器可能開啟了呼叫等待功能,在被叫拒絕呼叫時(shí),業(yè)務(wù)服務(wù)器會(huì)與主叫建立通話并播放提示音“對(duì)方未接聽”,主叫SDK在此過程中會(huì)上報(bào)TSDK_E_CALL_EVT_CALL_RTP_CREATED或TSDK_E_CALL_EVT_CALL_CONNECTED事件,需要用戶通過主叫UI主動(dòng)掛斷呼叫。
//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; } |
無。