主頁(yè) > 服務(wù)與支持 > 開(kāi)發(fā)平臺(tái) > 客戶(hù)端SDK參考 > Android Native SDK > 音視頻呼叫 建立音頻通話
更新時(shí)間:2019-11-20
主被叫建立音頻通話。
主被叫客戶(hù)端均已注冊(cè)。
呼叫ID作為一路通話的唯一標(biāo)識(shí),UI應(yīng)保存并管理,以用于后繼的呼叫相關(guān)操作。
//Java code TsdkCall call = TsdkManager.getInstance().getCallManager().startCall(toNumber, isVideoCall); |
//Java code public void onEvtCallIncoming(TsdkCall call, Boolean maybeVideoCall){ Log.i(TAG, "onCallComing"); if (null == call) { Log.e(TAG, "onCallComing call is null"); return; } Session newSession = new Session(call); putCallSessionToMap(newSession); CallInfo callInfo = getCallInfo(call); callInfo.setMaybeVideoCall(maybeVideoCall); mCallNotification.onCallEventNotify(CallConstant.CallEvent.CALL_COMING, callInfo); } |
//Java code //Java code public void onEvtCallRingback(TsdkCall call){ Log.i(TAG, "onCallRingBack"); if (null == call) { Log.e(TAG, "onCallRingBack call is null"); return; } if (null != mCallNotification) { mCallNotification.onCallEventNotify(CallConstant.CallEvent.PLAY_RING_BACK_TONE, null); } } |
被叫若拒絕呼叫參見(jiàn)結(jié)束通話(或呼叫)章節(jié)描述。
//Java code int result = tsdkCall.answerCall(iVideoCall==1? true:false); |
RTP通道已建立,可以進(jìn)行一些二次撥號(hào)等操作。
//Java code public void onEvtCallRtpCreated(TsdkCall call){ Log.i(TAG, "onCallRTPCreated"); if (null == call) { Log.e(TAG, "tupCall obj is null"); return; } CallInfo callInfo = getCallInfo(call); mCallNotification.onCallEventNotify(CallConstant.CallEvent.RTP_CREATED, callInfo); } |
//Java code public void onEvtCallConnected(TsdkCall call){ Log.i(TAG, "onCallConnected"); if (null == call) { Log.e(TAG, "call obj is null"); return; } CallInfo callInfo = getCallInfo(call); Session callSession = getCallSessionByCallID(call.getCallInfo().getCallId()); if (callSession == null) { Log.e(TAG, "call session obj is null"); return; } if (callInfo.isVideoCall()) { callSession.setCallStatus(CallConstant.CallStatus.VIDEO_CALLING); } else { callSession.setCallStatus(CallConstant.CallStatus.AUDIO_CALLING); } mCallNotification.onCallEventNotify(CallConstant.CallEvent.CALL_CONNECTED, callInfo); } |