更新时间:2019-11-20
用户可以将正在进行的视频通话保持,待需要的时候再恢复通话,能减少拨号次数,使用更方便。
视频通话已建立,主被叫正在通话中。
保持通话
通话中,主被叫双方均可以发起保持通话操作。
视频通话保持,需先移除视频,再保持音频通话;恢复通话,需先恢复音频通话,再打开视频。
当前服务器暂不支持视频通话保持,需要先移除视频窗口,转换为语音通话后再保持通话。
//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; } |
恢复通话
保持通话发起方才可进行恢复通话操作。
//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; |
恢复通话可能由于网络侧极低概率的冲突或异常,导致用户恢复通话失败,此时SDK向UI上报恢复通话失败事件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; |
因通话双方均可以在本端处于通话态发起保持操作,即通话可能会处于双向保持态,在任一保持方发起恢复通话时,仅能恢复本端通话状态,不会恢复对端的通话状态;视频通话双向保持中任一方先恢复通话,不会自动打开视频。