更新時間:2019-11-20
用戶可以將正在進(jìn)行的視頻通話保持,待需要的時候再恢復(fù)通話,能減少撥號次數(shù),使用更方便。
視頻通話已建立,主被叫正在通話中。
保持通話
通話中,主被叫雙方均可以發(fā)起保持通話操作。
視頻通話保持,需先移除視頻,再保持音頻通話;恢復(fù)通話,需先恢復(fù)音頻通話,再打開視頻。
當(dāng)前服務(wù)器暫不支持視頻通話保持,需要先移除視頻窗口,轉(zhuǎn)換為語音通話后再保持通話。
//c code TSDK_RESULT ret; ret = tsdk_hold_call(callid); if (TSDK_SUCCESS != ret) { LOG_D_CALL_ERROR("hold failed. result=%#x", ret); return -1; } return TSDK_SUCCESS; |
//c code case TSDK_E_CALL_EVT_HOLD_SUCCESS: { 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)); CDemoCallCtrlDlg* pCallDlg; pCallDlg = CallDlgManager::GetInstance().GetCallDlgByCallID(notifyInfo->call_id); CHECK_POINTER(pCallDlg); ::PostMessage(pCallDlg->GetSafeHwnd(), WM_CALL_HOLD_SUCESS, NULL, NULL); break; } |
恢復(fù)通話
保持通話發(fā)起方才可進(jìn)行恢復(fù)通話操作。
//c code TSDK_RESULT ret; ret = tsdk_unhold_call(callid); if (TSDK_SUCCESS != ret) { LOG_D_CALL_ERROR("unhold failed. result=%#x", ret); return -1; } return TSDK_SUCCESS; |
恢復(fù)通話可能由于網(wǎng)絡(luò)側(cè)極低概率的沖突或異常,導(dǎo)致用戶恢復(fù)通話失敗,此時SDK向UI上報恢復(fù)通話失敗事件TSDK_E_CALL_EVT_UNHOLD_FAILED,并自動掛斷通話。
//c code case TSDK_E_CALL_EVT_UNHOLD_SUCCESS: { 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)); CDemoCallCtrlDlg* pCallDlg; pCallDlg = CallDlgManager::GetInstance().GetCallDlgByCallID(notifyInfo->call_id); CHECK_POINTER(pCallDlg); ::PostMessage(pCallDlg->GetSafeHwnd(), WM_CALL_UNHOLD_SUCESS, NULL, NULL); break; } |
//c code TSDK_RESULT ret; ret = tsdk_add_video(callid); if (TSDK_SUCCESS != ret) { LOG_D_CALL_ERROR("add video failed. result=%#x", ret); return -1; } return TSDK_SUCCESS; |
//c code TSDK_RESULT ret; TSDK_S_VIDEO_WND_INFO video_window_info[SERVICE_CALL_D_VIDEO_WINDOW_NUM] = { TSDK_E_VIDEO_WND_REMOTE }; video_window_info[TSDK_E_VIDEO_WND_LOCAL].render = (TSDK_UINT32)local_video_wnd; video_window_info[TSDK_E_VIDEO_WND_LOCAL].video_wnd_type = TSDK_E_VIDEO_WND_LOCAL; video_window_info[TSDK_E_VIDEO_WND_LOCAL].index = 1; video_window_info[TSDK_E_VIDEO_WND_LOCAL].display_mode = TSDK_E_VIDEO_WND_DISPLAY_FULL; video_window_info[TSDK_E_VIDEO_WND_REMOTE].render = (TSDK_UINT32)remote_video_wnd; video_window_info[TSDK_E_VIDEO_WND_REMOTE].video_wnd_type = TSDK_E_VIDEO_WND_REMOTE; video_window_info[TSDK_E_VIDEO_WND_REMOTE].index = 0; video_window_info[TSDK_E_VIDEO_WND_REMOTE].display_mode = TSDK_E_VIDEO_WND_DISPLAY_FULL; ret = tsdk_set_video_window(callid, SERVICE_CALL_D_VIDEO_WINDOW_NUM,video_window_info); if( TSDK_SUCCESS != ret ) { LOG_D_CALL_ERROR("set video window info failed. result=%#x", ret); return -1; } return TSDK_SUCCESS; |
//c code unsigned int callID = (unsigned int)wParam; CDemoCallCtrlDlg* pCallDlg = CallDlgManager::GetInstance().GetCallDlgByCallID(callID); CHECK_POINTER_RETURN(pCallDlg, -1L); CDemoPromptDlg dlg; dlg.SetTextOfContent(L"The peer party request add video,do you agree?"); INT_PTR nResponse = dlg.DoModal(); pCallDlg->PostMessage(WM_CALL_ADD_VIDEO, (WPARAM)nResponse, NULL); return 0L; |
//c code TSDK_RESULT ret; ret = tsdk_reply_add_video(callid,isAccept); if (TSDK_SUCCESS != ret) { LOG_D_CALL_ERROR("reply add video failed. result=%#x", ret); return -1; } return TSDK_SUCCESS; |
//c code TSDK_RESULT ret; TSDK_S_VIDEO_WND_INFO video_window_info[SERVICE_CALL_D_VIDEO_WINDOW_NUM] = { TSDK_E_VIDEO_WND_REMOTE }; video_window_info[TSDK_E_VIDEO_WND_LOCAL].render = (TSDK_UINT32)local_video_wnd; video_window_info[TSDK_E_VIDEO_WND_LOCAL].video_wnd_type = TSDK_E_VIDEO_WND_LOCAL; video_window_info[TSDK_E_VIDEO_WND_LOCAL].index = 1; video_window_info[TSDK_E_VIDEO_WND_LOCAL].display_mode = TSDK_E_VIDEO_WND_DISPLAY_FULL; video_window_info[TSDK_E_VIDEO_WND_REMOTE].render = (TSDK_UINT32)remote_video_wnd; video_window_info[TSDK_E_VIDEO_WND_REMOTE].video_wnd_type = TSDK_E_VIDEO_WND_REMOTE; video_window_info[TSDK_E_VIDEO_WND_REMOTE].index = 0; video_window_info[TSDK_E_VIDEO_WND_REMOTE].display_mode = TSDK_E_VIDEO_WND_DISPLAY_FULL; ret = tsdk_set_video_window(callid, SERVICE_CALL_D_VIDEO_WINDOW_NUM,video_window_info); if(TSDK_SUCCESS != ret) { LOG_D_CALL_ERROR("set video window info failed. result=%#x", ret); return -1; } return TSDK_SUCCESS; |
//c code unsigned int callID = (unsigned int)wParam; CDemoCallCtrlDlg* pCallDlg; pCallDlg = CallDlgManager::GetInstance().GetCallDlgByCallID(callID); CHECK_POINTER_RETURN(pCallDlg, -1L); DLG_TYPE type; type = SIP_SIGNLE_VIDEO; pCallDlg->SendMessage(WM_CALL_MODIFY_VIDEO, WPARAM(type), NULL); return 0L; |
因通話雙方均可以在本端處于通話態(tài)發(fā)起保持操作,即通話可能會處于雙向保持態(tài),在任一保持方發(fā)起恢復(fù)通話時,僅能恢復(fù)本端通話狀態(tài),不會恢復(fù)對端的通話狀態(tài);視頻通話雙向保持中任一方先恢復(fù)通話,不會自動打開視頻。