主頁(yè) > 服務(wù)與支持 > 開發(fā)平臺(tái) > 客戶端SDK參考 > iOS Native SDK > 音視頻呼叫 結(jié)束通話(或呼叫)
更新時(shí)間:2019-11-20
用戶在通話接通前可進(jìn)行取消呼叫或拒絕呼叫等操作,通話過程中可以結(jié)束通話。
主叫或被叫在通話過程中掛斷呼叫
通話雙方均可掛斷呼叫,本章節(jié)以主叫發(fā)起掛斷為例。
-(BOOL)endCall:(unsigned int)callId { TSDK_UINT32 callid = (TSDK_UINT32)callId; TSDK_RESULT ret = tsdk_end_call(callid); return ret == TSDK_SUCCESS ? YES : NO; }
case TSDK_E_CALL_EVT_CALL_ENDED: { DDLogInfo(@"Call_Log: recv call notify :CALL_E_EVT_CALL_ENDED"); TSDK_S_CALL_INFO *callInfo = (TSDK_S_CALL_INFO *)notify.data; CallInfo *tsdkCallInfo = [CallInfo transfromFromCallInfoStract:callInfo]; NSDictionary *resultInfo = @{ TSDK_CALL_INFO_KEY : tsdkCallInfo }; [self respondsCallDelegateWithType:CALL_CLOSE result:resultInfo]; }
主叫在通話接通前取消呼叫
-(BOOL)endCall:(unsigned int)callId { TSDK_UINT32 callid = (TSDK_UINT32)callId; TSDK_RESULT ret = tsdk_end_call(callid); return ret == TSDK_SUCCESS ? YES : NO; }
case TSDK_E_CALL_EVT_CALL_ENDED: { DDLogInfo(@"Call_Log: recv call notify :CALL_E_EVT_CALL_ENDED"); TSDK_S_CALL_INFO *callInfo = (TSDK_S_CALL_INFO *)notify.data; CallInfo *tsdkCallInfo = [CallInfo transfromFromCallInfoStract:callInfo]; NSDictionary *resultInfo = @{ TSDK_CALL_INFO_KEY : tsdkCallInfo }; [self respondsCallDelegateWithType:CALL_CLOSE result:resultInfo]; }
被叫在收到來電時(shí)拒絕呼叫
-(BOOL)endCall:(unsigned int)callId { TSDK_UINT32 callid = (TSDK_UINT32)callId; TSDK_RESULT ret = tsdk_end_call(callid); return ret == TSDK_SUCCESS ? YES : NO; }
在實(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)掛斷呼叫。
case TSDK_E_CALL_EVT_CALL_ENDED: { DDLogInfo(@"Call_Log: recv call notify :CALL_E_EVT_CALL_ENDED"); TSDK_S_CALL_INFO *callInfo = (TSDK_S_CALL_INFO *)notify.data; CallInfo *tsdkCallInfo = [CallInfo transfromFromCallInfoStract:callInfo]; NSDictionary *resultInfo = @{ TSDK_CALL_INFO_KEY : tsdkCallInfo }; [self respondsCallDelegateWithType:CALL_CLOSE result:resultInfo]; }
被叫在收到來電時(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)掛斷呼叫。
case TSDK_E_CALL_EVT_CALL_ENDED: { DDLogInfo(@"Call_Log: recv call notify :CALL_E_EVT_CALL_ENDED"); TSDK_S_CALL_INFO *callInfo = (TSDK_S_CALL_INFO *)notify.data; CallInfo *tsdkCallInfo = [CallInfo transfromFromCallInfoStract:callInfo]; NSDictionary *resultInfo = @{ TSDK_CALL_INFO_KEY : tsdkCallInfo }; [self respondsCallDelegateWithType:CALL_CLOSE result:resultInfo]; }
無。