更新時間:2019-11-20
主被叫建立音頻通話。
主被叫客戶端均已注冊。
呼叫ID作為一路通話的唯一標識,UI應保存并管理,以用于后繼的呼叫相關操作。
//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é)束通話(或呼叫)章節(jié)描述。
//Java code int result = tsdkCall.answerCall(iVideoCall==1? true:false); |
RTP通道已建立,可以進行一些二次撥號等操作。
//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); } |