主頁(yè) > 服務(wù)與支持 > 開(kāi)發(fā)平臺(tái) > 客戶(hù)端SDK參考 > iOS Native SDK > 音視頻呼叫 建立音頻通話(huà)
更新時(shí)間:2019-11-20
用戶(hù)點(diǎn)對(duì)點(diǎn)音頻通話(huà)。
主被叫客戶(hù)端均已注冊(cè)。
呼叫ID作為一路通話(huà)的唯一標(biāo)識(shí),UI應(yīng)保存并管理,以用于后繼的呼叫相關(guān)操作。
TSDK_BOOL isVideo = ((TSDK_CALL_E_CALL_TYPE)callType==CALL_VIDEO)?TSDK_TRUE:TSDK_FALSE; TSDK_UINT32 callid = 0; TSDK_RESULT ret = tsdk_start_call(&callid,(TSDK_CHAR*)[number UTF8String], isVideo);
case TSDK_E_CALL_EVT_CALL_INCOMING: { TSDK_S_CALL_INFO *callInfo = (TSDK_S_CALL_INFO *)notify.data; CallInfo *tsdkCallInfo = [CallInfo transfromFromCallInfoStract:callInfo]; [self resetUCVideoOrientAndIndexWithCallId:0]; NSString *callId = [NSString stringWithFormat:@"%d", callInfo->call_id]; [_tsdkCallInfoDic setObject:tsdkCallInfo forKey:callId]; NSDictionary *resultInfo = @{ TSDK_CALL_INFO_KEY : tsdkCallInfo }; [self respondsCallDelegateWithType:CALL_INCOMMING result:resultInfo]; }
case TSDK_E_CALL_EVT_CALL_RINGBACK: { NSDictionary *resultInfo = @{ TSDK_CALL_RINGBACK_KEY : [NSNumber numberWithBool:true] }; [self respondsCallDelegateWithType:CALL_RINGBACK result:resultInfo]; break; }
被叫若拒絕呼叫參見(jiàn)結(jié)束通話(huà)(或呼叫)章節(jié)描述。
- (BOOL) answerComingCallType:(TUP_CALL_TYPE)callType callId:(unsigned int)callId { TSDK_RESULT ret = tsdk_accept_call((TSDK_UINT32)callId, callType == CALL_AUDIO ? TSDK_FALSE : TSDK_TRUE); DDLogInfo(@"Call_Log:answer call type is %d,result is %d, callid: %d",callType,ret,callId); return ret == TSDK_SUCCESS ? YES : NO; }
RTP通道已建立,可以進(jìn)行一些二次撥號(hào)等操作。
case TSDK_E_CALL_EVT_CALL_CONNECTED: { DDLogInfo(@"Call_Log: recv call notify :CALL_E_EVT_CALL_CONNECTED"); TSDK_S_CALL_INFO *callInfo = (TSDK_S_CALL_INFO *)notify.data; CallInfo *tsdkCallInfo = [CallInfo transfromFromCallInfoStract:callInfo]; NSString *callId = [NSString stringWithFormat:@"%d", tsdkCallInfo.stateInfo.callId]; [_tsdkCallInfoDic setObject:tsdkCallInfo forKey:callId]; NSDictionary *resultInfo = @{ TSDK_CALL_INFO_KEY : tsdkCallInfo }; [self respondsCallDelegateWithType:CALL_CONNECT result:resultInfo]; }