更新時間:2019-11-20
用戶在通話接通前可進行取消呼叫或拒絕呼叫等操作,通話過程中可以結(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; } |
被叫在收到來電時拒絕呼叫
//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; |
在實際現(xiàn)網(wǎng)部署過程中,業(yè)務(wù)服務(wù)器可能開啟了呼叫等待功能,在被叫拒絕呼叫時,業(yè)務(wù)服務(wù)器會與主叫建立通話并播放提示音“對方忙”或“對方通話中”,主叫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; } |
被叫在收到來電時未接聽
在實際現(xiàn)網(wǎng)部署過程中,業(yè)務(wù)服務(wù)器可能開啟了呼叫等待功能,在被叫拒絕呼叫時,業(yè)務(wù)服務(wù)器會與主叫建立通話并播放提示音“對方未接聽”,主叫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; } |
無。