Commit dcbc972e by 严久程

Merge branch '声网通话流程优化' of…

Merge branch '声网通话流程优化' of ssh://gitlab.yidianling.com:2224/app_android_lib/YDL-Component into 声网通话流程优化

 Conflicts:
	m-audioim/src/main/java/com/ydl/audioim/AudioHomeActivity.kt
	m-audioim/src/main/java/com/ydl/audioim/YDLavManager.kt
parents 8c3b433e a71b15e3
......@@ -60,20 +60,7 @@ import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import io.reactivex.schedulers.Schedulers
import kotlinx.android.synthetic.main.audioim_activity_audio_home.iv_hands_free
import kotlinx.android.synthetic.main.audioim_activity_audio_home.iv_hang_up
import kotlinx.android.synthetic.main.audioim_activity_audio_home.iv_head
import kotlinx.android.synthetic.main.audioim_activity_audio_home.progress_view
import kotlinx.android.synthetic.main.audioim_activity_audio_home.rl_remain_time
import kotlinx.android.synthetic.main.audioim_activity_audio_home.tv_change_doctor
import kotlinx.android.synthetic.main.audioim_activity_audio_home.tv_change_route
import kotlinx.android.synthetic.main.audioim_activity_audio_home.tv_change_time_counter
import kotlinx.android.synthetic.main.audioim_activity_audio_home.tv_name
import kotlinx.android.synthetic.main.audioim_activity_audio_home.tv_nte_status
import kotlinx.android.synthetic.main.audioim_activity_audio_home.tv_remain_time
import kotlinx.android.synthetic.main.audioim_activity_audio_home.tv_tips
import kotlinx.android.synthetic.main.audioim_activity_audio_home.tv_waiting
import kotlinx.android.synthetic.main.audioim_activity_audio_home.wave_view
import kotlinx.android.synthetic.main.audioim_activity_audio_home.*
import java.util.concurrent.TimeUnit
/**
......@@ -174,11 +161,13 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
private var voiceManage: YDLVoiceManager? = null
//频道管理器
// private var channelManager: ChannelManager? = null
// private var channelManager: ChannelManager? = null
private var isLeavelChannel: Boolean = false
private var hasUpLoadLog = false
private var callStatus: Int = -1
/**
* 声网事件回调 (SDK 通过指定的事件通知应用程序 SDK 的运行事件,如: 加入或离开频道,新用户加入频道等)
*/
......@@ -260,14 +249,14 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
override fun onApiCallExecuted(error: Int, api: String?, result: String?) {
super.onApiCallExecuted(error, api, result)
// LogUtil.e("[agora]$api 已执行回调 $result")
// LogUtil.e("[agora]$api 已执行回调 $result")
}
override fun onJoinChannelSuccess(channel: String?, uid: Int, elapsed: Int) {
super.onJoinChannelSuccess(channel, uid, elapsed)
LogUtil.e("[agora]$uid 用户声网加入频道成功:channel=$channel")
//更新ui
// onJoinChannelSuccess()
// onJoinChannelSuccess()
//更新:现在专家先加入频道,所以不会有等待的过程,
runOnUiThread {
......@@ -275,6 +264,7 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
//自己加入频道成功
connectSuccess()
}
}
override fun onRejoinChannelSuccess(channel: String?, uid: Int, elapsed: Int) {
......@@ -289,6 +279,7 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
}
}
override fun onRtcStats(stats: IRtcEngineEventHandler.RtcStats?) {
super.onRtcStats(stats)
//因为用户端直接加入了频道,防止该回调执行时,专家还未加入频道,因此在连接成功之后,才进行频道人数判断
......@@ -321,6 +312,7 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
uploadLog()
}
override fun onUserJoined(uid: Int, elapsed: Int) {
super.onUserJoined(uid, elapsed)
LogUtil.e("[agora]远端用户/主播加入频道回调")
......@@ -384,6 +376,7 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
showNetStatus(netStatus, status)
}
}
//
override fun createPresenter(): IAudioHomeActivityContract.Presenter {
return AudioHomePresenterImpl()
......@@ -412,6 +405,7 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
requestPermission()
}
private fun setWindowStatusBarColor() {
StatusBarUtils.setWindowStatusBarColor(this, R.color.audioim_color_40353535)
}
......@@ -660,19 +654,19 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
callStartTime = System.currentTimeMillis()
}
// if(finishStatus==1){
// var param = ConnectFinishCommand(listenerUid!!, relationId!!, "0",
// remainTime!!.toInt() - localRemainTime!!, callId!!,
// "0","0","$callStartTime",
// "${System.currentTimeMillis()}",3)
// mPresenter.connectFinish(param)
// }else{
// 接通开始回调
// callStartTime = System.currentTimeMillis()
// var param = ConnectStartCommand(listenerUid!!, relationId!!, callId!!,
// "${System.currentTimeMillis()}","3","0","0","0","0")
// mPresenter.connectStart(param)
// }
// if(finishStatus==1){
// var param = ConnectFinishCommand(listenerUid!!, relationId!!, "0",
// remainTime!!.toInt() - localRemainTime!!, callId!!,
// "0","0","$callStartTime",
// "${System.currentTimeMillis()}",3)
// mPresenter.connectFinish(param)
// }else{
// 接通开始回调
// callStartTime = System.currentTimeMillis()
// var param = ConnectStartCommand(listenerUid!!, relationId!!, callId!!,
// "${System.currentTimeMillis()}","3","0","0","0","0")
// mPresenter.connectStart(param)
// }
}
/**
......@@ -705,6 +699,7 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
override fun onSuccess() {
mPresenter.getAXBPhone(ConnectCommand(listenId!!, "1"))
}
})
YDLavManager.instances.callEndStatusUpdate(channelId!!, 3, "接通中:主叫主动切换AXB")
......@@ -736,6 +731,7 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
}
}
/**
* 跳转拨号界面
*/
......@@ -745,6 +741,7 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
finish()
}
/**
* 60s等待完成,专家未接听
*/
......@@ -827,9 +824,9 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
voiceManage!!.getVoiceApi().setEnableSpeakerphone(false)
iv_hands_free.isSelected = false
iv_hands_free.setImageResource(R.drawable.audioim_img_hands_free_unuse)
// if (waitDisposable != null) {
// waitDisposable!!.dispose()
// }
// if (waitDisposable != null) {
// waitDisposable!!.dispose()
// }
if (disposable != null) {
disposable!!.dispose()
}
......@@ -1016,6 +1013,11 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
}
}
fun uploadExceptionStatus(msg: String, status: Int) {
callStatus = status
uploadException(msg, zhu = "zhu", eventType = "108", callback = null)
}
/**
* 上传错误日志
* zhu 洪平要的,判别是移动端主动调的还是声网返的
......@@ -1024,7 +1026,7 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
var time: String = (System.currentTimeMillis() / 1000).toString()
var uid: String = ModularServiceManager.provide(IUserService::class.java).getUserInfo()?.uid!!
var payLoad = PayLoad(channelId ?: "0", time, uid, "1", "999", message)
var connectException = ConnectExceptionCommand(time + zhu, "2", eventType, payLoad)
var connectException = ConnectExceptionCommand(time + zhu, "2", eventType, payLoad, callStatus)
YDLavManager.instances.uploadException(connectException, callback)
}
......
......@@ -120,6 +120,7 @@ class YDLavManager {
//通话结束或挂断时,上传日志文件
act.uploadLog()
act.leaveChannel()
act.uploadExceptionStatus("对方已拒绝", 2)
}
}
}
......@@ -131,6 +132,7 @@ class YDLavManager {
if (act is AudioHomeActivity) {
act.runOnUiThread {
act.writeAgoraLog("主叫呼叫取消:超时或主动取消")
act.uploadExceptionStatus("已取消", 1)
}
}
}
......@@ -155,6 +157,10 @@ class YDLavManager {
sendCustomNotification(response?.calleeId!!, response?.ChannelId!!, "5")
callEndStatusUpdate(response.ChannelId!!, 2, "被叫超时未接听")
act.writeAgoraLog("呼叫失败:${errorCode}")
act.uploadExceptionStatus("对方未接听", 3)
// //通话结束或挂断时,上传日志文件
// act.uploadLog()
// act.leaveChannel()
}
}
}
......@@ -175,6 +181,10 @@ class YDLavManager {
override fun onRemoteInvitationRefused(response: CallRemoteResponse?) {
//返回给被叫
LogUtil.e("[agora]已拒绝来自${response?.callerId}的呼叫")
val act = ActivityManager.getInstance().getTopTaskActivity()
if (act is ConsultantAudioHomeActivity) {
act.uploadExceptionStatus("已拒绝", 2)
}
}
override fun onRemoteInvitationCanceled(response: CallRemoteResponse?) {
......@@ -182,6 +192,12 @@ class YDLavManager {
//返回给被叫
LogUtil.e("[agora]主叫${response?.callerId}已取消呼叫邀请")
AudioLogUtils.writeAgoraLog("呼叫邀请被取消:主叫主动取消", FILE_NAME)
val act = ActivityManager.getInstance().getTopTaskActivity()
if (act is ConsultantAudioHomeActivity) {
act.uploadExceptionStatus("对方已取消", 1)
}
closePage()
}
......@@ -190,6 +206,10 @@ class YDLavManager {
LogUtil.e("[agora]来自主叫${response?.callerId}的呼叫邀请进程失败:${response?.response}")
if (errorCode == RtmStatusCode.RemoteInvitationError.REMOTE_INVITATION_ERR_INVITATION_EXPIRE) { //呼叫邀请过期
AudioLogUtils.writeAgoraLog("呼叫邀请被取消:呼叫邀请过期", FILE_NAME)
val act = ActivityManager.getInstance().getTopTaskActivity()
if (act is ConsultantAudioHomeActivity) {
act.uploadExceptionStatus("未接听", 3)
}
} else {
AudioLogUtils.writeAgoraLog("呼叫邀请被取消:错误原因(${errorCode})", FILE_NAME)
}
......
......@@ -891,6 +891,11 @@ class ConsultantAudioHomeActivity : BaseMvpActivity<IConsultantAudioHomeActivity
}.subscribeOn(Schedulers.io()).subscribe()
}
fun uploadExceptionStatus(msg: String, status: Int) {
callStatus = status
uploadException(msg, zhu = "zhu", eventType = "108")
}
/**
* 上传错误日志
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment