更新時間:2019-11-20
用戶點對點音頻通話。
主被叫客戶端均已注冊。
呼叫ID作為一路通話的唯一標識,UI應保存并管理,以用于后繼的呼叫相關操作。
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é)束通話(或呼叫)章節(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通道已建立,可以進行一些二次撥號等操作。
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]; }