更新時間:2019-11-20
用戶在通話接通前可進行取消呼叫或拒絕呼叫等操作,通話過程中可以結(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]; }
被叫在收到來電時拒絕呼叫
-(BOOL)endCall:(unsigned int)callId { TSDK_UINT32 callid = (TSDK_UINT32)callId; TSDK_RESULT ret = tsdk_end_call(callid); return ret == TSDK_SUCCESS ? YES : NO; }
在實際現(xiàn)網(wǎng)部署過程中,業(yè)務(wù)服務(wù)器可能開啟了呼叫等待功能,在被叫拒絕呼叫時,業(yè)務(wù)服務(wù)器會與主叫建立通話并播放提示音“對方忙”或“對方通話中”,主叫SDK在此過程中會上報TSDK_E_CALL_EVT_CALL_CONNECTED事件,需要用戶通過主叫UI主動掛斷呼叫。
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]; }
被叫在收到來電時未接聽
在實際現(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主動掛斷呼叫。
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]; }
無。