Commit 3d6e551e by 刘鹏

feat: 声网日志埋点完成

parent 3507c44d
...@@ -50,6 +50,8 @@ import com.ydl.ydlcommon.utils.LogUtil ...@@ -50,6 +50,8 @@ import com.ydl.ydlcommon.utils.LogUtil
import com.ydl.ydlcommon.utils.StatusBarUtils import com.ydl.ydlcommon.utils.StatusBarUtils
import com.ydl.ydlcommon.utils.Utils import com.ydl.ydlcommon.utils.Utils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.utils.log.AliYunLogConfig
import com.ydl.ydlcommon.utils.log.AliYunLogHelper
import com.ydl.ydlcommon.utils.log.LogHelper import com.ydl.ydlcommon.utils.log.LogHelper
import com.ydl.ydlcommon.utils.remind.ToastHelper import com.ydl.ydlcommon.utils.remind.ToastHelper
import com.yidianling.common.tools.ToastUtil import com.yidianling.common.tools.ToastUtil
...@@ -212,6 +214,8 @@ class AudioHomeActivity : ...@@ -212,6 +214,8 @@ class AudioHomeActivity :
uploadException("mRtcEventHandler-onWarning:warnCode--%${warn}", callback = null) uploadException("mRtcEventHandler-onWarning:warnCode--%${warn}", callback = null)
LogUtil.e("[agora]发生警告回调$warn") LogUtil.e("[agora]发生警告回调$warn")
writeAgoraLog("声网警告回调($warn)") writeAgoraLog("声网警告回调($warn)")
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.AGORA, "声网警告回调($warn)")
//103:没有可用的频道资源。可能是因为服务端没法分配频道资源 //103:没有可用的频道资源。可能是因为服务端没法分配频道资源
//104:查找频道超时。在加入频道时 SDK 先要查找指定的频道,出现该警告一般是因为网络太差,连接不到服务器 //104:查找频道超时。在加入频道时 SDK 先要查找指定的频道,出现该警告一般是因为网络太差,连接不到服务器
//105:查找频道请求被服务器拒绝。服务器可能没有办法处理这个请求或请求是非法的 //105:查找频道请求被服务器拒绝。服务器可能没有办法处理这个请求或请求是非法的
...@@ -240,6 +244,8 @@ class AudioHomeActivity : ...@@ -240,6 +244,8 @@ class AudioHomeActivity :
super.onError(err) super.onError(err)
uploadException("mRtcEventHandler-onError:errorCode--%${err}", callback = null) uploadException("mRtcEventHandler-onError:errorCode--%${err}", callback = null)
writeAgoraLog("声网错误回调errorCode--%${err}") writeAgoraLog("声网错误回调errorCode--%${err}")
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.AGORA, "声网错误回调errorCode--%${err}")
//3:SDK 初始化失败。Agora 建议尝试以下处理方法 //3:SDK 初始化失败。Agora 建议尝试以下处理方法
//7:SDK 尚未初始化,就调用其 API。请确认在调用 API 之前已创建 RtcEngine 对象并完成初始化 //7:SDK 尚未初始化,就调用其 API。请确认在调用 API 之前已创建 RtcEngine 对象并完成初始化
//10:API 调用超时。有些 API 调用需要 SDK 返回结果,如果 SDK 处理时间过长,超过 10 秒没有返回,会出现此错误 //10:API 调用超时。有些 API 调用需要 SDK 返回结果,如果 SDK 处理时间过长,超过 10 秒没有返回,会出现此错误
...@@ -283,11 +289,15 @@ class AudioHomeActivity : ...@@ -283,11 +289,15 @@ class AudioHomeActivity :
override fun onApiCallExecuted(error: Int, api: String?, result: String?) { override fun onApiCallExecuted(error: Int, api: String?, result: String?) {
super.onApiCallExecuted(error, api, result) super.onApiCallExecuted(error, api, result)
// LogUtil.e("[agora]$api 已执行回调 $result") // LogUtil.e("[agora]$api 已执行回调 $result")
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.AGORA, "$api 已执行回调 $result")
} }
override fun onJoinChannelSuccess(channel: String?, uid: Int, elapsed: Int) { override fun onJoinChannelSuccess(channel: String?, uid: Int, elapsed: Int) {
super.onJoinChannelSuccess(channel, uid, elapsed) super.onJoinChannelSuccess(channel, uid, elapsed)
LogUtil.e("[agora]$uid 用户声网加入频道成功:channel=$channel") LogUtil.e("[agora]$uid 用户声网加入频道成功:channel=$channel")
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.AGORA, "$uid 用户声网加入频道成功:channel=$channel")
//更新ui //更新ui
// onJoinChannelSuccess() // onJoinChannelSuccess()
...@@ -303,6 +313,8 @@ class AudioHomeActivity : ...@@ -303,6 +313,8 @@ class AudioHomeActivity :
override fun onRejoinChannelSuccess(channel: String?, uid: Int, elapsed: Int) { override fun onRejoinChannelSuccess(channel: String?, uid: Int, elapsed: Int) {
super.onRejoinChannelSuccess(channel, uid, elapsed) super.onRejoinChannelSuccess(channel, uid, elapsed)
LogUtil.e("[agora]$uid 用户声网重新加入频道成功:channel=$channel") LogUtil.e("[agora]$uid 用户声网重新加入频道成功:channel=$channel")
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.AGORA, "$uid 用户声网重新加入频道成功:channel=$channel")
runOnUiThread { runOnUiThread {
//自己加入频道成功 //自己加入频道成功
if (!isConnectSuccess) { if (!isConnectSuccess) {
...@@ -316,6 +328,8 @@ class AudioHomeActivity : ...@@ -316,6 +328,8 @@ class AudioHomeActivity :
override fun onRtcStats(stats: IRtcEngineEventHandler.RtcStats?) { override fun onRtcStats(stats: IRtcEngineEventHandler.RtcStats?) {
super.onRtcStats(stats) super.onRtcStats(stats)
writeAgoraLog("声网onRtcStats:users:${stats?.users}") writeAgoraLog("声网onRtcStats:users:${stats?.users}")
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.AGORA, "声网onRtcStats:users:${stats?.users}")
// 不需要移动端做离开房间逻辑,服务端会判断进行踢人逻辑 // 不需要移动端做离开房间逻辑,服务端会判断进行踢人逻辑
//因为用户端直接加入了频道,防止该回调执行时,专家还未加入频道,因此在连接成功之后,才进行频道人数判断 //因为用户端直接加入了频道,防止该回调执行时,专家还未加入频道,因此在连接成功之后,才进行频道人数判断
// if (isConnectSuccess && null != stats?.users && stats.users == 1) { // if (isConnectSuccess && null != stats?.users && stats.users == 1) {
...@@ -332,6 +346,8 @@ class AudioHomeActivity : ...@@ -332,6 +346,8 @@ class AudioHomeActivity :
// 3 网络连接被服务器中止 该情况现在是因为后端踢人逻辑 // 3 网络连接被服务器中止 该情况现在是因为后端踢人逻辑
if (reason == 3) { if (reason == 3) {
writeAgoraLog("通话结束:网络连接被服务器中止 该情况现在是因为后端踢人逻辑,原因(${reason})") writeAgoraLog("通话结束:网络连接被服务器中止 该情况现在是因为后端踢人逻辑,原因(${reason})")
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.AGORA, "通话结束:网络连接被服务器中止 该情况现在是因为后端踢人逻辑,原因(${reason})")
// com.yidianling.common.tools.ToastUtil.toastShort("专家已挂断") // com.yidianling.common.tools.ToastUtil.toastShort("专家已挂断")
//通话结束或挂断时,上传日志文件 //通话结束或挂断时,上传日志文件
uploadLog() uploadLog()
...@@ -343,6 +359,8 @@ class AudioHomeActivity : ...@@ -343,6 +359,8 @@ class AudioHomeActivity :
override fun onLeaveChannel(stats: IRtcEngineEventHandler.RtcStats?) { override fun onLeaveChannel(stats: IRtcEngineEventHandler.RtcStats?) {
super.onLeaveChannel(stats) super.onLeaveChannel(stats)
LogUtil.e("[agora]离开频道回调") LogUtil.e("[agora]离开频道回调")
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.AGORA, "离开频道回调")
//通话结束或挂断时,上传日志文件 //通话结束或挂断时,上传日志文件
uploadLog() uploadLog()
} }
...@@ -351,12 +369,16 @@ class AudioHomeActivity : ...@@ -351,12 +369,16 @@ class AudioHomeActivity :
override fun onUserJoined(uid: Int, elapsed: Int) { override fun onUserJoined(uid: Int, elapsed: Int) {
super.onUserJoined(uid, elapsed) super.onUserJoined(uid, elapsed)
LogUtil.e("[agora]远端用户/主播加入频道回调") LogUtil.e("[agora]远端用户/主播加入频道回调")
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.AGORA, "远端用户/主播加入频道回调")
} }
override fun onUserOffline(uid: Int, elapsed: Int) { override fun onUserOffline(uid: Int, elapsed: Int) {
super.onUserOffline(uid, elapsed) super.onUserOffline(uid, elapsed)
LogUtil.e("[agora]远端用户$uid 离开频道回调") LogUtil.e("[agora]远端用户$uid 离开频道回调")
writeAgoraLog("接通后通话结束:对方已挂断") writeAgoraLog("接通后通话结束:对方已挂断")
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.AGORA, "接通后通话结束:对方已挂断")
//通话结束或挂断时,上传日志文件 //通话结束或挂断时,上传日志文件
uploadLog() uploadLog()
showToast("专家已挂断") showToast("专家已挂断")
...@@ -430,6 +452,8 @@ class AudioHomeActivity : ...@@ -430,6 +452,8 @@ class AudioHomeActivity :
//页面传递数据初始化 //页面传递数据初始化
initIntentData() initIntentData()
writeAgoraLog("通话页面打开的时候,RTM登录状态码:${YDLavManager.sdkStatus}") writeAgoraLog("通话页面打开的时候,RTM登录状态码:${YDLavManager.sdkStatus}")
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.AGORA, "通话页面打开的时候,RTM登录状态码:${YDLavManager.sdkStatus}")
if (YDLavManager.sdkStatus != Constants.CONNECTION_STATE_CONNECTED) { if (YDLavManager.sdkStatus != Constants.CONNECTION_STATE_CONNECTED) {
//再次登录声网,确保声网登录状态 //再次登录声网,确保声网登录状态
reLoginRTM() reLoginRTM()
...@@ -486,6 +510,8 @@ class AudioHomeActivity : ...@@ -486,6 +510,8 @@ class AudioHomeActivity :
commentUrl = intent.getStringExtra(IntentConstants.INTENT_COMMENT_URL) commentUrl = intent.getStringExtra(IntentConstants.INTENT_COMMENT_URL)
dialStatus = intent.getStringExtra(IntentConstants.INTENT_DIALSTATUS) dialStatus = intent.getStringExtra(IntentConstants.INTENT_DIALSTATUS)
writeAgoraLog("专家的通话状态dialStatus:$dialStatus", false) writeAgoraLog("专家的通话状态dialStatus:$dialStatus", false)
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.AGORA, "专家的通话状态dialStatus:$dialStatus")
isShowAXB = intent.getBooleanExtra(IntentConstants.INTENT_ISSHOWAXB, true) isShowAXB = intent.getBooleanExtra(IntentConstants.INTENT_ISSHOWAXB, true)
val logBean = AgoraLogInfoBean( val logBean = AgoraLogInfoBean(
...@@ -500,7 +526,8 @@ class AudioHomeActivity : ...@@ -500,7 +526,8 @@ class AudioHomeActivity :
) )
val content = Gson().toJson(logBean) val content = Gson().toJson(logBean)
writeAgoraLog("主叫方发送的邀请通话消息内容:$content", true) writeAgoraLog("主叫方发送的邀请通话消息内容:$content", true)
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.AGORA, "主叫方发送的邀请通话消息内容:$content")
localRemainTime = remainTime?.toInt() localRemainTime = remainTime?.toInt()
handler = Handler() handler = Handler()
vibrator = getSystemService(Service.VIBRATOR_SERVICE) as Vibrator? vibrator = getSystemService(Service.VIBRATOR_SERVICE) as Vibrator?
...@@ -508,6 +535,8 @@ class AudioHomeActivity : ...@@ -508,6 +535,8 @@ class AudioHomeActivity :
private fun reLoginRTM() { private fun reLoginRTM() {
writeAgoraLog("RMT状态:${YDLavManager.sdkStatus},重新登录RMT") writeAgoraLog("RMT状态:${YDLavManager.sdkStatus},重新登录RMT")
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.AGORA, "RMT状态:${YDLavManager.sdkStatus},重新登录RMTt")
val uid = YdlCommonRouterManager.getYdlCommonRoute().getUid().toString() val uid = YdlCommonRouterManager.getYdlCommonRoute().getUid().toString()
YDLavManager.instances.login(uid) { _isSuccess, _msg -> YDLavManager.instances.login(uid) { _isSuccess, _msg ->
// writeAgoraLog("拨打电话界面打开RTM重新登录,uid=${uid}") // writeAgoraLog("拨打电话界面打开RTM重新登录,uid=${uid}")
...@@ -518,6 +547,8 @@ class AudioHomeActivity : ...@@ -518,6 +547,8 @@ class AudioHomeActivity :
private fun initView() { private fun initView() {
writeAgoraLog("用户拨打电话界面开启") writeAgoraLog("用户拨打电话界面开启")
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.AGORA, "用户拨打电话界面开启")
tv_change_route.isEnabled = false tv_change_route.isEnabled = false
//水波纹view初始化 //水波纹view初始化
wave_view.setDuration(6000) wave_view.setDuration(6000)
...@@ -563,6 +594,8 @@ class AudioHomeActivity : ...@@ -563,6 +594,8 @@ class AudioHomeActivity :
} }
if (isConnectSuccess) { if (isConnectSuccess) {
writeAgoraLog("已接通:主叫主动挂断") writeAgoraLog("已接通:主叫主动挂断")
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.AGORA, "已接通:主叫主动挂断")
updateExpertStatus(false, 1) updateExpertStatus(false, 1)
leaveChannel() leaveChannel()
uploadLog() uploadLog()
...@@ -611,6 +644,8 @@ class AudioHomeActivity : ...@@ -611,6 +644,8 @@ class AudioHomeActivity :
when { when {
permission.granted -> { permission.granted -> {
writeAgoraLog("请求音频权限通过") writeAgoraLog("请求音频权限通过")
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.AGORA, "请求音频权限通过")
init() init()
} }
permission.shouldShowRequestPermissionRationale -> { permission.shouldShowRequestPermissionRationale -> {
...@@ -620,6 +655,8 @@ class AudioHomeActivity : ...@@ -620,6 +655,8 @@ class AudioHomeActivity :
// 拒绝权限操作发送给服务端 // 拒绝权限操作发送给服务端
uploadException("AudioNotAuth","zhu",YDLavManager.AUDIO_NO_AUTH_ERROR_CODE,null) uploadException("AudioNotAuth","zhu",YDLavManager.AUDIO_NO_AUTH_ERROR_CODE,null)
writeAgoraLog("拒绝请求音频权限") writeAgoraLog("拒绝请求音频权限")
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.AGORA, "拒绝请求音频权限")
uploadLog() uploadLog()
ToastHelper.show(getString(R.string.audioim_need_storage_permission_hint)) ToastHelper.show(getString(R.string.audioim_need_storage_permission_hint))
...@@ -682,6 +719,8 @@ class AudioHomeActivity : ...@@ -682,6 +719,8 @@ class AudioHomeActivity :
//关闭音乐 //关闭音乐
stopPlaying() stopPlaying()
writeAgoraLog("未接通挂断:50s等待倒计时结束挂断") writeAgoraLog("未接通挂断:50s等待倒计时结束挂断")
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.AGORA, "未接通挂断:50s等待倒计时结束挂断")
//提示切换传统线路 //提示切换传统线路
//发送消息通知专家用户已挂断 //发送消息通知专家用户已挂断
YDLavManager.instances.cancelCall( YDLavManager.instances.cancelCall(
...@@ -690,6 +729,8 @@ class AudioHomeActivity : ...@@ -690,6 +729,8 @@ class AudioHomeActivity :
sendDoctocrMsg!! sendDoctocrMsg!!
) { msg, code -> ) { msg, code ->
writeAgoraLog("未接听时:主叫(用户)主动挂断失败,msg=$msg($code),再次挂断") writeAgoraLog("未接听时:主叫(用户)主动挂断失败,msg=$msg($code),再次挂断")
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.AGORA, "未接听时:主叫(用户)主动挂断失败,msg=$msg($code),再次挂断")
} }
//通话结束或挂断时,上传日志文件 //通话结束或挂断时,上传日志文件
uploadLog() uploadLog()
...@@ -725,6 +766,8 @@ class AudioHomeActivity : ...@@ -725,6 +766,8 @@ class AudioHomeActivity :
*/ */
fun joinChannel() { fun joinChannel() {
writeAgoraLog("对方(专家)接受了通话邀请,主叫(用户)开始加入频道:$channelId") writeAgoraLog("对方(专家)接受了通话邀请,主叫(用户)开始加入频道:$channelId")
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.AGORA, "对方(专家)接受了通话邀请,主叫(用户)开始加入频道:$channelId")
voiceManage!!.getVoiceApi().joinChannel( voiceManage!!.getVoiceApi().joinChannel(
token!!, token!!,
channelId!!, channelId!!,
...@@ -740,6 +783,8 @@ class AudioHomeActivity : ...@@ -740,6 +783,8 @@ class AudioHomeActivity :
*/ */
private fun userCloseCalling() { private fun userCloseCalling() {
writeAgoraLog("未接听时:主叫(用户)主动挂断,取消呼叫") writeAgoraLog("未接听时:主叫(用户)主动挂断,取消呼叫")
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.AGORA, "未接听时:主叫(用户)主动挂断,取消呼叫")
LogUtil.e("未接听挂断") LogUtil.e("未接听挂断")
//发送消息通知专家用户已挂断 //发送消息通知专家用户已挂断
YDLavManager.instances.cancelCall( YDLavManager.instances.cancelCall(
...@@ -748,6 +793,8 @@ class AudioHomeActivity : ...@@ -748,6 +793,8 @@ class AudioHomeActivity :
sendDoctocrMsg!! sendDoctocrMsg!!
) { msg, code -> ) { msg, code ->
writeAgoraLog("未接听时:主叫(用户)主动挂断失败,msg=$msg($code),再次挂断") writeAgoraLog("未接听时:主叫(用户)主动挂断失败,msg=$msg($code),再次挂断")
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.AGORA, "未接听时:主叫(用户)主动挂断失败,msg=$msg($code),再次挂断")
} }
//通话结束或挂断时,上传日志文件 //通话结束或挂断时,上传日志文件
uploadLog() uploadLog()
...@@ -793,6 +840,8 @@ class AudioHomeActivity : ...@@ -793,6 +840,8 @@ class AudioHomeActivity :
val dialog = AxbConfirmDialog(mContext, type, object : AxbConfirmDialog.OnClickEnsureListener { val dialog = AxbConfirmDialog(mContext, type, object : AxbConfirmDialog.OnClickEnsureListener {
override fun onClickEnsure() { override fun onClickEnsure() {
writeAgoraLog("主叫点击切换AXB按钮") writeAgoraLog("主叫点击切换AXB按钮")
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.AGORA, "主叫点击切换AXB按钮")
switchAXB() switchAXB()
} }
...@@ -815,6 +864,8 @@ class AudioHomeActivity : ...@@ -815,6 +864,8 @@ class AudioHomeActivity :
uploadException("", "zhu", "108", object : YDLavManager.UploadExceptionCallback { uploadException("", "zhu", "108", object : YDLavManager.UploadExceptionCallback {
override fun onSuccess() { override fun onSuccess() {
writeAgoraLog("离开房间成功,主叫切换AXB之后") writeAgoraLog("离开房间成功,主叫切换AXB之后")
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.AGORA, "离开房间成功,主叫切换AXB之后")
mPresenter.getAXBPhone(ConnectCommand(listenId!!, "1")) mPresenter.getAXBPhone(ConnectCommand(listenId!!, "1"))
} }
...@@ -848,6 +899,8 @@ class AudioHomeActivity : ...@@ -848,6 +899,8 @@ class AudioHomeActivity :
sendDoctocrMsg!! sendDoctocrMsg!!
) { msg, code -> ) { msg, code ->
writeAgoraLog("未接听时:主叫主动挂断失败,msg=$msg($code),再次挂断") writeAgoraLog("未接听时:主叫主动挂断失败,msg=$msg($code),再次挂断")
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.AGORA, "未接听时:主叫主动挂断失败,msg=$msg($code),再次挂断")
} }
leaveChannel() leaveChannel()
} }
......
...@@ -22,13 +22,12 @@ import com.ydl.ydl_av.messge_service.callback.LoginCallback ...@@ -22,13 +22,12 @@ import com.ydl.ydl_av.messge_service.callback.LoginCallback
import com.ydl.ydl_av.messge_service.request.LoginParam import com.ydl.ydl_av.messge_service.request.LoginParam
import com.ydl.ydl_av.messge_service.response.CallLocalResponse import com.ydl.ydl_av.messge_service.response.CallLocalResponse
import com.ydl.ydl_av.messge_service.response.CallRemoteResponse import com.ydl.ydl_av.messge_service.response.CallRemoteResponse
import com.ydl.ydlcommon.base.BaseApp
import com.ydl.ydlcommon.modular.ModularServiceManager import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.utils.ActivityManager import com.ydl.ydlcommon.utils.ActivityManager
import com.ydl.ydlcommon.utils.LogUtil import com.ydl.ydlcommon.utils.LogUtil
import com.ydl.ydlcommon.utils.SharedPreferencesEditor import com.ydl.ydlcommon.utils.log.AliYunLogConfig
import com.ydl.ydlcommon.utils.log.AliYunLogHelper
import com.ydl.ydlcommon.utils.log.LogHelper import com.ydl.ydlcommon.utils.log.LogHelper
import com.yidianling.common.tools.RxSPTool
import com.yidianling.common.tools.ToastUtil import com.yidianling.common.tools.ToastUtil
import com.yidianling.im.api.bean.IMRegisterObserverCustomNotificationCallBack import com.yidianling.im.api.bean.IMRegisterObserverCustomNotificationCallBack
import com.yidianling.im.api.bean.IMSendCustomNotificationResultCallBack import com.yidianling.im.api.bean.IMSendCustomNotificationResultCallBack
...@@ -93,6 +92,10 @@ class YDLavManager { ...@@ -93,6 +92,10 @@ class YDLavManager {
override fun onCallRecivedByPeer(response: CallLocalResponse?) { override fun onCallRecivedByPeer(response: CallLocalResponse?) {
//返回给主叫:被叫已收到呼叫邀请 //返回给主叫:被叫已收到呼叫邀请
LogUtil.e("[agora]${response?.calleeId}已收到呼叫邀请,频道号${response?.ChannelId}") LogUtil.e("[agora]${response?.calleeId}已收到呼叫邀请,频道号${response?.ChannelId}")
AliYunLogHelper.getInstance().sendLog(
AliYunLogConfig.AGORA,
"${response?.calleeId}已收到呼叫邀请,频道号${response?.ChannelId}"
)
val act = ActivityManager.getInstance().getTopTaskActivity() val act = ActivityManager.getInstance().getTopTaskActivity()
if (act is AudioHomeActivity) { if (act is AudioHomeActivity) {
...@@ -106,7 +109,10 @@ class YDLavManager { ...@@ -106,7 +109,10 @@ class YDLavManager {
override fun onCallAccepted(response: CallLocalResponse?, msg: String?) { override fun onCallAccepted(response: CallLocalResponse?, msg: String?) {
//返回给主叫 //返回给主叫
LogUtil.e("[agora]${response?.calleeId}已接收呼叫邀请") LogUtil.e("[agora]${response?.calleeId}已接收呼叫邀请")
AliYunLogHelper.getInstance().sendLog(
AliYunLogConfig.AGORA,
"${response?.calleeId}已接收呼叫邀请"
)
//加入声网频道时机修改:主叫收到被叫接受邀请的回调后再加入声网频道 //加入声网频道时机修改:主叫收到被叫接受邀请的回调后再加入声网频道
val act = ActivityManager.getInstance().getTopTaskActivity() val act = ActivityManager.getInstance().getTopTaskActivity()
if (act is AudioHomeActivity) { if (act is AudioHomeActivity) {
...@@ -119,7 +125,10 @@ class YDLavManager { ...@@ -119,7 +125,10 @@ class YDLavManager {
override fun onCallRefused(response: CallLocalResponse?, msg: String?) { override fun onCallRefused(response: CallLocalResponse?, msg: String?) {
//返回给主叫 //返回给主叫
LogUtil.e("[agora]${response?.calleeId}已拒绝呼叫邀请") LogUtil.e("[agora]${response?.calleeId}已拒绝呼叫邀请")
AliYunLogHelper.getInstance().sendLog(
AliYunLogConfig.AGORA,
"${response?.calleeId}已拒绝呼叫邀请"
)
val act = ActivityManager.getInstance().getTopTaskActivity() val act = ActivityManager.getInstance().getTopTaskActivity()
if (act is AudioHomeActivity) { if (act is AudioHomeActivity) {
act.runOnUiThread { act.runOnUiThread {
...@@ -137,6 +146,10 @@ class YDLavManager { ...@@ -137,6 +146,10 @@ class YDLavManager {
override fun onCallCanceled(response: CallLocalResponse?) { override fun onCallCanceled(response: CallLocalResponse?) {
//返回给主叫 //返回给主叫
LogUtil.e("[agora]主叫已取消呼叫邀请") LogUtil.e("[agora]主叫已取消呼叫邀请")
AliYunLogHelper.getInstance().sendLog(
AliYunLogConfig.AGORA,
"主叫已取消呼叫邀请"
)
val act = ActivityManager.getInstance().getTopTaskActivity() val act = ActivityManager.getInstance().getTopTaskActivity()
if (act is AudioHomeActivity) { if (act is AudioHomeActivity) {
act.runOnUiThread { act.runOnUiThread {
...@@ -149,6 +162,10 @@ class YDLavManager { ...@@ -149,6 +162,10 @@ class YDLavManager {
override fun onCallFailure(response: CallLocalResponse?, errorCode: Int) { override fun onCallFailure(response: CallLocalResponse?, errorCode: Int) {
//返回给主叫 //返回给主叫
LogUtil.e("[agora]呼叫${response?.calleeId}用户失败:${response?.response}") LogUtil.e("[agora]呼叫${response?.calleeId}用户失败:${response?.response}")
AliYunLogHelper.getInstance().sendLog(
AliYunLogConfig.AGORA,
"呼叫${response?.calleeId}用户失败:${response?.response}"
)
val act = ActivityManager.getInstance().getTopTaskActivity() val act = ActivityManager.getInstance().getTopTaskActivity()
//专家离线或者30 秒后仍未收到专家响应,重新再邀请一次 //专家离线或者30 秒后仍未收到专家响应,重新再邀请一次
when (errorCode) { when (errorCode) {
...@@ -160,26 +177,13 @@ class YDLavManager { ...@@ -160,26 +177,13 @@ class YDLavManager {
} }
} }
} }
RtmStatusCode.LocalInvitationError.LOCAL_INVITATION_ERR_INVITATION_EXPIRE -> { //呼叫邀请过期。被叫 ACK 响应呼叫邀请后 60 秒呼叫邀请未被取消、接受、拒绝,则呼叫邀请过期。 RtmStatusCode.LocalInvitationError.LOCAL_INVITATION_ERR_INVITATION_EXPIRE -> {
//呼叫邀请过期。被叫 ACK 响应呼叫邀请后 60 秒呼叫邀请未被取消、接受、拒绝,则呼叫邀请过期。
/*
* 和IOS保持一致,当呼叫邀请为3的时候不处理
* */
/* if (act is AudioHomeActivity) {
act.runOnUiThread {
sendCustomNotification(response?.calleeId!!, response?.ChannelId!!, "5")
callEndStatusUpdate(response.ChannelId!!, 2, "被叫超时未接听")
act.uploadExceptionStatus("对方未接听", 3)
// //通话结束或挂断时,上传日志文件
// act.uploadLog()
// act.leaveChannel()
}
}*/
} }
} }
//呼叫失败日志输出 //呼叫失败日志输出
if (act is AudioHomeActivity){ if (act is AudioHomeActivity) {
act.runOnUiThread{ act.runOnUiThread {
act.writeAgoraLog("发送通话邀请失败:${errorCode}") act.writeAgoraLog("发送通话邀请失败:${errorCode}")
LogHelper.getInstance().uploadLog(false) LogHelper.getInstance().uploadLog(false)
} }
...@@ -189,17 +193,29 @@ class YDLavManager { ...@@ -189,17 +193,29 @@ class YDLavManager {
override fun onRemoteInvitationReceived(response: CallRemoteResponse?) { override fun onRemoteInvitationReceived(response: CallRemoteResponse?) {
//返回给被叫 //返回给被叫
LogUtil.e("[agora]收到来自${response?.callerId}的呼叫邀请") LogUtil.e("[agora]收到来自${response?.callerId}的呼叫邀请")
AliYunLogHelper.getInstance().sendLog(
AliYunLogConfig.AGORA,
"收到来自${response?.callerId}的呼叫邀请"
)
receivedCall(response?.content, "来自RTM") receivedCall(response?.content, "来自RTM")
} }
override fun onRemoteInvitationAccepted(response: CallRemoteResponse?) { override fun onRemoteInvitationAccepted(response: CallRemoteResponse?) {
//返回给被叫 //返回给被叫
LogUtil.e("[agora]接受来自${response?.callerId}的呼叫成功") LogUtil.e("[agora]接受来自${response?.callerId}的呼叫成功")
AliYunLogHelper.getInstance().sendLog(
AliYunLogConfig.AGORA,
"接受来自${response?.callerId}的呼叫成功"
)
} }
override fun onRemoteInvitationRefused(response: CallRemoteResponse?) { override fun onRemoteInvitationRefused(response: CallRemoteResponse?) {
//返回给被叫 //返回给被叫
LogUtil.e("[agora]已拒绝来自${response?.callerId}的呼叫") LogUtil.e("[agora]已拒绝来自${response?.callerId}的呼叫")
AliYunLogHelper.getInstance().sendLog(
AliYunLogConfig.AGORA,
"已拒绝来自${response?.callerId}的呼叫"
)
val act = ActivityManager.getInstance().getTopTaskActivity() val act = ActivityManager.getInstance().getTopTaskActivity()
if (act is ConsultantAudioHomeActivity) { if (act is ConsultantAudioHomeActivity) {
act.uploadExceptionStatus("已拒绝", 2) act.uploadExceptionStatus("已拒绝", 2)
...@@ -210,7 +226,14 @@ class YDLavManager { ...@@ -210,7 +226,14 @@ class YDLavManager {
callEndStatusUpdate(response?.ChannelId!!, 1, "主叫取消呼叫") callEndStatusUpdate(response?.ChannelId!!, 1, "主叫取消呼叫")
//返回给被叫 //返回给被叫
LogUtil.e("[agora]主叫${response?.callerId}已取消呼叫邀请") LogUtil.e("[agora]主叫${response?.callerId}已取消呼叫邀请")
writeAgoraLog("呼叫邀请被取消:主叫(专家)主动取消-------Time:${AudioLogUtils.format.format(Calendar.getInstance().time)}", FILE_NAME) AliYunLogHelper.getInstance().sendLog(
AliYunLogConfig.AGORA,
"主叫${response?.callerId}已取消呼叫邀请"
)
writeAgoraLog(
"呼叫邀请被取消:主叫(专家)主动取消-------Time:${AudioLogUtils.format.format(Calendar.getInstance().time)}",
FILE_NAME
)
val act = ActivityManager.getInstance().getTopTaskActivity() val act = ActivityManager.getInstance().getTopTaskActivity()
if (act is ConsultantAudioHomeActivity) { if (act is ConsultantAudioHomeActivity) {
...@@ -224,13 +247,26 @@ class YDLavManager { ...@@ -224,13 +247,26 @@ class YDLavManager {
//返回给被叫 //返回给被叫
LogUtil.e("[agora]来自主叫${response?.callerId}的呼叫邀请进程失败:${response?.response}") LogUtil.e("[agora]来自主叫${response?.callerId}的呼叫邀请进程失败:${response?.response}")
if (errorCode == RtmStatusCode.RemoteInvitationError.REMOTE_INVITATION_ERR_INVITATION_EXPIRE) { //呼叫邀请过期 if (errorCode == RtmStatusCode.RemoteInvitationError.REMOTE_INVITATION_ERR_INVITATION_EXPIRE) { //呼叫邀请过期
writeAgoraLog("呼叫邀请被取消:用户未接听-------Time:${AudioLogUtils.format.format(Calendar.getInstance().time)}", FILE_NAME) AliYunLogHelper.getInstance().sendLog(
AliYunLogConfig.AGORA,
"呼叫邀请被取消:用户未接听"
)
writeAgoraLog(
"呼叫邀请被取消:用户未接听-------Time:${AudioLogUtils.format.format(Calendar.getInstance().time)}",
FILE_NAME
)
val act = ActivityManager.getInstance().getTopTaskActivity() val act = ActivityManager.getInstance().getTopTaskActivity()
if (act is ConsultantAudioHomeActivity) { if (act is ConsultantAudioHomeActivity) {
act.uploadExceptionStatus("未接听", 3) act.uploadExceptionStatus("未接听", 3)
} }
} else { } else {
writeAgoraLog("呼叫邀请被取消:错误原因(${errorCode})-------Time:${AudioLogUtils.format.format(Calendar.getInstance().time)}", FILE_NAME) writeAgoraLog(
"呼叫邀请被取消:错误原因(${errorCode})", FILE_NAME
)
AliYunLogHelper.getInstance().sendLog(
AliYunLogConfig.AGORA,
"呼叫邀请被取消:错误原因(${errorCode})"
)
} }
callEndStatusUpdate(response?.ChannelId!!, 2, "超时未接听导致的取消呼叫") callEndStatusUpdate(response?.ChannelId!!, 2, "超时未接听导致的取消呼叫")
//关闭页面 //关闭页面
...@@ -239,11 +275,29 @@ class YDLavManager { ...@@ -239,11 +275,29 @@ class YDLavManager {
override fun onOtherMsg(error: String?) { override fun onOtherMsg(error: String?) {
LogUtil.e("[agora]其它消息:${error}") LogUtil.e("[agora]其它消息:${error}")
if (error.equals("呼叫发送成功")){ if (error.equals("呼叫发送成功")) {
writeAgoraLog("声网发送通话邀请成功-------Time:${AudioLogUtils.format.format(Calendar.getInstance().time)}", "confide.log",true) writeAgoraLog(
}else{ "声网发送通话邀请成功-------Time:${AudioLogUtils.format.format(Calendar.getInstance().time)}",
writeAgoraLog("声网发送通话邀请失败${error}-------Time:${AudioLogUtils.format.format(Calendar.getInstance().time)}", "confide.log",true) "confide.log",
true
)
AliYunLogHelper.getInstance().sendLog(
AliYunLogConfig.AGORA,
"声网发送通话邀请成功"
)
} else {
writeAgoraLog(
"声网发送通话邀请失败${error}-------Time:${
AudioLogUtils.format.format(
Calendar.getInstance().time
)
}", "confide.log", true
)
LogHelper.getInstance().uploadLog(false) LogHelper.getInstance().uploadLog(false)
AliYunLogHelper.getInstance().sendLog(
AliYunLogConfig.AGORA,
"声网发送通话邀请失败${error}"
)
} }
} }
}) })
...@@ -354,15 +408,31 @@ class YDLavManager { ...@@ -354,15 +408,31 @@ class YDLavManager {
override fun onException(throwable: Throwable) { override fun onException(throwable: Throwable) {
// writeAgoraLog("云信发送通话邀请异常${throwable.message}-------Time:${AudioLogUtils.format.format(Calendar.getInstance().time)}", "confide.log", true) // writeAgoraLog("云信发送通话邀请异常${throwable.message}-------Time:${AudioLogUtils.format.format(Calendar.getInstance().time)}", "confide.log", true)
// LogHelper.getInstance().uploadLog(false) // LogHelper.getInstance().uploadLog(false)
AliYunLogHelper.getInstance().sendLog(
AliYunLogConfig.AGORA,
"云信发送通话邀请异常${throwable.message}"
)
} }
override fun onFailed(code: Int) { override fun onFailed(code: Int) {
// writeAgoraLog("云信发送通话邀请失败${code}-------Time:${AudioLogUtils.format.format(Calendar.getInstance().time)}", "confide.log", true) // writeAgoraLog("云信发送通话邀请失败${code}-------Time:${AudioLogUtils.format.format(Calendar.getInstance().time)}", "confide.log", true)
// LogHelper.getInstance().uploadLog(false) // LogHelper.getInstance().uploadLog(false)
AliYunLogHelper.getInstance().sendLog(
AliYunLogConfig.AGORA,
"云信发送通话邀请失败${code}"
)
} }
override fun onSuccess() { override fun onSuccess() {
writeAgoraLog("云信发送通话邀请成功-------Time:${AudioLogUtils.format.format(Calendar.getInstance().time)}", "confide.log", true) writeAgoraLog(
"云信发送通话邀请成功-------Time:${AudioLogUtils.format.format(Calendar.getInstance().time)}",
"confide.log",
true
)
AliYunLogHelper.getInstance().sendLog(
AliYunLogConfig.AGORA,
"云信发送通话邀请成功"
)
} }
}) })
}, 300) }, 300)
...@@ -394,22 +464,50 @@ class YDLavManager { ...@@ -394,22 +464,50 @@ class YDLavManager {
override fun onSuccess() { override fun onSuccess() {
//登陆成功,发起呼叫 //登陆成功,发起呼叫
LogUtil.e("[agora]实时消息登录成功") LogUtil.e("[agora]实时消息登录成功")
writeAgoraLog("声网rtm登录成功,uid:$userId-------Time:${AudioLogUtils.format.format(Calendar.getInstance().time)}", "confide.log", true) AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.AGORA, "声网rtm登录成功,uid:$userId")
writeAgoraLog(
"声网rtm登录成功,uid:$userId-------Time:${
AudioLogUtils.format.format(
Calendar.getInstance().time
)
}", "confide.log", true
)
event(true, "") event(true, "")
} }
override fun onFailure(msg: String?) { override fun onFailure(msg: String?) {
LogUtil.e("[agora]实时消息登录失败:$msg") LogUtil.e("[agora]实时消息登录失败:$msg")
writeAgoraLog("声网rtm登录失败:$msg-------Time:${AudioLogUtils.format.format(Calendar.getInstance().time)}", "confide.log", true) writeAgoraLog(
"声网rtm登录失败:$msg-------Time:${
AudioLogUtils.format.format(
Calendar.getInstance().time
)
}", "confide.log", true
)
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.AGORA, "声网rtm登录失败:$msg")
event(false, msg) event(false, msg)
} }
}) })
} else { } else {
LogUtil.e("声网token获取失败uid:" + userId + " error:" + it.msg) LogUtil.e("声网token获取失败uid:" + userId + " error:" + it.msg)
LogHelper.getInstance().writeLogSync("声网token获取失败uid:" + userId + " error:" + it.msg) LogHelper.getInstance()
.writeLogSync("声网token获取失败uid:" + userId + " error:" + it.msg)
AliYunLogHelper.getInstance().sendLog(
AliYunLogConfig.AGORA,
"声网token获取失败uid" + userId + " error:" + it.msg
)
} }
}, { }, {
LogUtil.e("声网token获取异常uid:" + userId + " error:" + it.message) LogUtil.e("声网token获取异常uid:" + userId + " error:" + it.message)
AliYunLogHelper.getInstance().sendLog(
AliYunLogConfig.AGORA,
"声网token获取异常uid:" + userId + " error:" + it.message
)
}) })
} }
...@@ -428,7 +526,16 @@ class YDLavManager { ...@@ -428,7 +526,16 @@ class YDLavManager {
Observable.timer(1000, TimeUnit.MILLISECONDS).subscribeOn(Schedulers.io()) Observable.timer(1000, TimeUnit.MILLISECONDS).subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()).subscribe { .observeOn(AndroidSchedulers.mainThread()).subscribe {
LogUtil.e("[agora]启动通话界面") LogUtil.e("[agora]启动通话界面")
writeAgoraLog("收到主叫方通话邀请($from)-------Time:${AudioLogUtils.format.format(Calendar.getInstance().time)}", FILE_NAME, false) writeAgoraLog(
"收到主叫方通话邀请($from)-------Time:${
AudioLogUtils.format.format(
Calendar.getInstance().time
)
}", FILE_NAME, false
)
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.AGORA, "收到主叫方通话邀请($from)")
LogHelper.getInstance().uploadLog(false) LogHelper.getInstance().uploadLog(false)
//邀请加入频道消息,跳转通话界面 //邀请加入频道消息,跳转通话界面
ARouter.getInstance().build("/av/ConsultantAudioHomeActivity") ARouter.getInstance().build("/av/ConsultantAudioHomeActivity")
...@@ -436,12 +543,29 @@ class YDLavManager { ...@@ -436,12 +543,29 @@ class YDLavManager {
} }
} else { } else {
LogUtil.d("[agora]收到声网邀请,但界面实例已存在") LogUtil.d("[agora]收到声网邀请,但界面实例已存在")
writeAgoraLog("收到主叫方通话邀请,但界面实例已存在($from)-------Time:${AudioLogUtils.format.format(Calendar.getInstance().time)}", FILE_NAME, false) writeAgoraLog(
"收到主叫方通话邀请,但界面实例已存在($from)-------Time:${
AudioLogUtils.format.format(
Calendar.getInstance().time
)
}", FILE_NAME, false
)
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.AGORA, "收到主叫方通话邀请,但界面实例已存在($from)")
LogHelper.getInstance().uploadLog(false) LogHelper.getInstance().uploadLog(false)
} }
} else { } else {
LogUtil.d("[agora]收到声网邀请,但response==null") LogUtil.d("[agora]收到声网邀请,但response==null")
writeAgoraLog("收到主叫方通话邀请,但response==null($from)-------Time:${AudioLogUtils.format.format(Calendar.getInstance().time)}", FILE_NAME, false) writeAgoraLog(
"收到主叫方通话邀请,但response==null($from)-------Time:${
AudioLogUtils.format.format(
Calendar.getInstance().time
)
}", FILE_NAME, false
)
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.AGORA, "收到主叫方通话邀请,但response==null($from)")
LogHelper.getInstance().uploadLog(false) LogHelper.getInstance().uploadLog(false)
} }
} }
...@@ -472,19 +596,25 @@ class YDLavManager { ...@@ -472,19 +596,25 @@ class YDLavManager {
* 退出登录 * 退出登录
* @param * @param
*/ */
private fun logout(isReLogin:Boolean) { private fun logout(isReLogin: Boolean) {
EventBus.getDefault().unregister(this) EventBus.getDefault().unregister(this)
YDLRTMClient.instances.logout(object : LoginCallback { YDLRTMClient.instances.logout(object : LoginCallback {
override fun onSuccess() { override fun onSuccess() {
//退出登陆成功 //退出登陆成功
LogUtil.d("[agora]实时消息退出成功") LogUtil.d("[agora]实时消息退出成功")
if (isReLogin){ AliYunLogHelper.getInstance()
login(ModularServiceManager.provide(IUserService::class.java).getUserInfo()?.uid) .sendLog(AliYunLogConfig.AGORA, "实时消息退出成功")
if (isReLogin) {
login(
ModularServiceManager.provide(IUserService::class.java).getUserInfo()?.uid
)
} }
} }
override fun onFailure(msg: String?) { override fun onFailure(msg: String?) {
LogUtil.d("[agora]实时消息退出失败:$msg") LogUtil.d("[agora]实时消息退出失败:$msg")
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.AGORA, "实时消息退出失败:$msg")
} }
}) })
} }
...@@ -492,7 +622,7 @@ class YDLavManager { ...@@ -492,7 +622,7 @@ class YDLavManager {
/** /**
* 退出登录默认不重新登录 * 退出登录默认不重新登录
*/ */
fun logout(){ fun logout() {
logout(false) logout(false)
} }
...@@ -510,6 +640,8 @@ class YDLavManager { ...@@ -510,6 +640,8 @@ class YDLavManager {
callback?.onSuccess() callback?.onSuccess()
}, { }, {
LogUtil.e("agora", "声网上传异常与错误日志接口调用失败:" + it.message) LogUtil.e("agora", "声网上传异常与错误日志接口调用失败:" + it.message)
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.AGORA, "声网上传异常与错误日志接口调用失败: + ${it.message}")
}) })
} }
...@@ -529,6 +661,9 @@ class YDLavManager { ...@@ -529,6 +661,9 @@ class YDLavManager {
.subscribe({ .subscribe({
}, { }, {
LogUtil.d("callEndStatusUpdate error: ${it.message}") LogUtil.d("callEndStatusUpdate error: ${it.message}")
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.AGORA, "callEndStatusUpdate error: ${it.message}")
}) })
} }
...@@ -538,6 +673,8 @@ class YDLavManager { ...@@ -538,6 +673,8 @@ class YDLavManager {
private val listener = object : InitListener { private val listener = object : InitListener {
override fun onTokenExpired() { override fun onTokenExpired() {
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.AGORA, "onTokenExpired")
LogUtil.e("[agora]onTokenExpired") LogUtil.e("[agora]onTokenExpired")
instances.login( instances.login(
ModularServiceManager.provide(IUserService::class.java).getUserInfo()?.uid ModularServiceManager.provide(IUserService::class.java).getUserInfo()?.uid
...@@ -546,22 +683,32 @@ class YDLavManager { ...@@ -546,22 +683,32 @@ class YDLavManager {
override fun onMessageReceived(message: RTMMesssage, userId: Int) { override fun onMessageReceived(message: RTMMesssage, userId: Int) {
LogUtil.i("[agora]onMessageReceived:${message.text} -->uid:$userId") LogUtil.i("[agora]onMessageReceived:${message.text} -->uid:$userId")
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.AGORA, "onMessageReceived:${message.text} -->uid:$userId")
} }
override fun onConnectionStateChanged(state: Int, reason: Int) { override fun onConnectionStateChanged(state: Int, reason: Int) {
sdkStatus = state sdkStatus = state
writeAgoraLog("声网rtm登录状态:${state}-------Time:${AudioLogUtils.format.format(Calendar.getInstance().time)}", "confide.log", true) writeAgoraLog(
"声网rtm登录状态:${state}-------Time:${AudioLogUtils.format.format(Calendar.getInstance().time)}",
"confide.log",
true
)
LogUtil.i("[agora]onConnectionStateChanged:state:${state} -->reason:$reason") LogUtil.i("[agora]onConnectionStateChanged:state:${state} -->reason:$reason")
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.AGORA, "声网rtm登录状态:${state}")
/* /*
* 当reason=CONNECTION_CHANGE_REASON_REMOTE_LOGIN的时候,是远端用户以相同UID登录RTM * 当reason=CONNECTION_CHANGE_REASON_REMOTE_LOGIN的时候,是远端用户以相同UID登录RTM
* 如果正在通话中,则不进行退出操作 * 如果正在通话中,则不进行退出操作
* */ * */
if (reason==CONNECTION_CHANGE_REASON_REMOTE_LOGIN){ if (reason == CONNECTION_CHANGE_REASON_REMOTE_LOGIN) {
if (!activityIsExists(ConsultantAudioHomeActivity::class.java)&&!activityIsExists(AudioHomeActivity::class.java)){ if (!activityIsExists(ConsultantAudioHomeActivity::class.java) && !activityIsExists(
AudioHomeActivity::class.java
)
) {
isOnlineRtm = false isOnlineRtm = false
logout() logout()
}else{ } else {
logout(true) logout(true)
} }
} }
......
...@@ -47,6 +47,8 @@ import com.ydl.ydlcommon.utils.LogUtil ...@@ -47,6 +47,8 @@ import com.ydl.ydlcommon.utils.LogUtil
import com.ydl.ydlcommon.utils.StatusBarUtils import com.ydl.ydlcommon.utils.StatusBarUtils
import com.ydl.ydlcommon.utils.Utils import com.ydl.ydlcommon.utils.Utils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.utils.log.AliYunLogConfig
import com.ydl.ydlcommon.utils.log.AliYunLogHelper
import com.ydl.ydlcommon.utils.log.LogHelper import com.ydl.ydlcommon.utils.log.LogHelper
import com.ydl.ydlcommon.utils.remind.ToastHelper import com.ydl.ydlcommon.utils.remind.ToastHelper
import com.yidianling.user.api.service.IUserService import com.yidianling.user.api.service.IUserService
...@@ -137,7 +139,7 @@ class ConsultantAudioHomeActivity : ...@@ -137,7 +139,7 @@ class ConsultantAudioHomeActivity :
super.onJoinChannelSuccess(channel, uid, elapsed) super.onJoinChannelSuccess(channel, uid, elapsed)
LogUtil.e("[agora]$uid 加入频道回调") LogUtil.e("[agora]$uid 加入频道回调")
writeAgoraLog("被叫(用户)加入声网($channel)频道成功") writeAgoraLog("被叫(用户)加入声网($channel)频道成功")
AliYunLogHelper.getInstance().sendLog(AliYunLogConfig.AGORA, "被叫(用户)加入声网($channel)频道成功")
runOnUiThread { runOnUiThread {
// 加入频道后再通知用户已接受 // 加入频道后再通知用户已接受
// YDLRTMClient.instances.acceptCall(mAudioMessageBean?.channelId) // YDLRTMClient.instances.acceptCall(mAudioMessageBean?.channelId)
...@@ -165,6 +167,9 @@ class ConsultantAudioHomeActivity : ...@@ -165,6 +167,9 @@ class ConsultantAudioHomeActivity :
super.onRejoinChannelSuccess(channel, uid, elapsed) super.onRejoinChannelSuccess(channel, uid, elapsed)
LogUtil.e("[agora]$uid 重新加入频道回调") LogUtil.e("[agora]$uid 重新加入频道回调")
writeAgoraLog("被叫(用户)重新加入声网频道($channel)成功") writeAgoraLog("被叫(用户)重新加入声网频道($channel)成功")
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.AGORA, "被叫(用户)重新加入声网频道($channel)成功")
runOnUiThread { runOnUiThread {
if (!isConnectSuccess) { if (!isConnectSuccess) {
tv_toast.visibility = View.VISIBLE tv_toast.visibility = View.VISIBLE
...@@ -182,6 +187,8 @@ class ConsultantAudioHomeActivity : ...@@ -182,6 +187,8 @@ class ConsultantAudioHomeActivity :
super.onUserJoined(uid, elapsed) super.onUserJoined(uid, elapsed)
LogUtil.e("[agora]远端用户加入频道回调") LogUtil.e("[agora]远端用户加入频道回调")
writeAgoraLog("主叫(专家)加入声网频道成功") writeAgoraLog("主叫(专家)加入声网频道成功")
AliYunLogHelper.getInstance().sendLog(AliYunLogConfig.AGORA, "主叫(专家)加入声网频道成功")
//另一方加入频道成功 //另一方加入频道成功
runOnUiThread { runOnUiThread {
isConnectSuccess = true isConnectSuccess = true
...@@ -223,6 +230,8 @@ class ConsultantAudioHomeActivity : ...@@ -223,6 +230,8 @@ class ConsultantAudioHomeActivity :
override fun onLeaveChannel(stats: IRtcEngineEventHandler.RtcStats?) { override fun onLeaveChannel(stats: IRtcEngineEventHandler.RtcStats?) {
super.onLeaveChannel(stats) super.onLeaveChannel(stats)
LogUtil.e("[agora]自己离开频道回调") LogUtil.e("[agora]自己离开频道回调")
AliYunLogHelper.getInstance().sendLog(AliYunLogConfig.AGORA, "自己离开频道回调")
//通知php 通话已结束 //通知php 通话已结束
close(RESULT_ANSWERED_CODE, "") close(RESULT_ANSWERED_CODE, "")
} }
...@@ -241,6 +250,8 @@ class ConsultantAudioHomeActivity : ...@@ -241,6 +250,8 @@ class ConsultantAudioHomeActivity :
override fun onUserOffline(uid: Int, elapsed: Int) { override fun onUserOffline(uid: Int, elapsed: Int) {
super.onUserOffline(uid, elapsed) super.onUserOffline(uid, elapsed)
LogUtil.e("[agora]$uid 主播离开频道回调") LogUtil.e("[agora]$uid 主播离开频道回调")
AliYunLogHelper.getInstance().sendLog(AliYunLogConfig.AGORA, "$uid 主播离开频道回调")
runOnUiThread { runOnUiThread {
YDLavManager.instances.callEndStatusUpdate( YDLavManager.instances.callEndStatusUpdate(
mAudioMessageBean?.channelId!!, mAudioMessageBean?.channelId!!,
...@@ -249,6 +260,8 @@ class ConsultantAudioHomeActivity : ...@@ -249,6 +260,8 @@ class ConsultantAudioHomeActivity :
) )
showToast("对方已挂断") showToast("对方已挂断")
writeAgoraLog("通话接通后挂断:主叫(专家)离开频道") writeAgoraLog("通话接通后挂断:主叫(专家)离开频道")
AliYunLogHelper.getInstance().sendLog(AliYunLogConfig.AGORA, "通话接通后挂断:主叫(专家)离开频道")
if (null != totalDisposable) { if (null != totalDisposable) {
totalDisposable!!.dispose() totalDisposable!!.dispose()
} }
...@@ -265,6 +278,8 @@ class ConsultantAudioHomeActivity : ...@@ -265,6 +278,8 @@ class ConsultantAudioHomeActivity :
} }
LogUtil.e("[agora]发生警告回调=$warn") LogUtil.e("[agora]发生警告回调=$warn")
writeAgoraLog("声网警告回调码:($warn)") writeAgoraLog("声网警告回调码:($warn)")
AliYunLogHelper.getInstance().sendLog(AliYunLogConfig.AGORA, "声网警告回调码:($warn)")
//103:没有可用的频道资源。可能是因为服务端没法分配频道资源 //103:没有可用的频道资源。可能是因为服务端没法分配频道资源
//104:查找频道超时。在加入频道时 SDK 先要查找指定的频道,出现该警告一般是因为网络太差,连接不到服务器 //104:查找频道超时。在加入频道时 SDK 先要查找指定的频道,出现该警告一般是因为网络太差,连接不到服务器
//105:查找频道请求被服务器拒绝。服务器可能没有办法处理这个请求或请求是非法的 //105:查找频道请求被服务器拒绝。服务器可能没有办法处理这个请求或请求是非法的
...@@ -290,6 +305,7 @@ class ConsultantAudioHomeActivity : ...@@ -290,6 +305,7 @@ class ConsultantAudioHomeActivity :
uploadException("mRtcEventHandler-onError:errorCode--%${err}") uploadException("mRtcEventHandler-onError:errorCode--%${err}")
LogUtil.e("[agora] 发生错误回调 =$err") LogUtil.e("[agora] 发生错误回调 =$err")
writeAgoraLog("声网错误回调errorCode--%${err}") writeAgoraLog("声网错误回调errorCode--%${err}")
AliYunLogHelper.getInstance().sendLog(AliYunLogConfig.AGORA, "声网错误回调errorCode--%${err}")
//3:SDK 初始化失败。Agora 建议尝试以下处理方法 //3:SDK 初始化失败。Agora 建议尝试以下处理方法
//7:SDK 尚未初始化,就调用其 API。请确认在调用 API 之前已创建 RtcEngine 对象并完成初始化 //7:SDK 尚未初始化,就调用其 API。请确认在调用 API 之前已创建 RtcEngine 对象并完成初始化
...@@ -510,6 +526,8 @@ class ConsultantAudioHomeActivity : ...@@ -510,6 +526,8 @@ class ConsultantAudioHomeActivity :
override fun channelTokenResponse(token: String?, needJoinChannel: Boolean) { override fun channelTokenResponse(token: String?, needJoinChannel: Boolean) {
if (TextUtils.isEmpty(token)) { if (TextUtils.isEmpty(token)) {
LogUtil.e("[agora]token not null") LogUtil.e("[agora]token not null")
AliYunLogHelper.getInstance().sendLog(AliYunLogConfig.AGORA, "token isEmpty ")
showToast("通话频道不存在") showToast("通话频道不存在")
finish() finish()
return return
...@@ -583,6 +601,8 @@ class ConsultantAudioHomeActivity : ...@@ -583,6 +601,8 @@ class ConsultantAudioHomeActivity :
val account = YdlCommonRouterManager.getYdlCommonRoute().getUid() val account = YdlCommonRouterManager.getYdlCommonRoute().getUid()
if (!TextUtils.isEmpty(mAudioMessageBean?.channelId)) { if (!TextUtils.isEmpty(mAudioMessageBean?.channelId)) {
LogUtil.e("[agora] joinChannel:$account") LogUtil.e("[agora] joinChannel:$account")
AliYunLogHelper.getInstance().sendLog(AliYunLogConfig.AGORA, "joinChannel:$account")
voiceManage?.getVoiceApi()?.joinChannel( voiceManage?.getVoiceApi()?.joinChannel(
channelToken channelToken
?: "", mAudioMessageBean!!.channelId!!, "Extra Optional Data", account ?: "", mAudioMessageBean!!.channelId!!, "Extra Optional Data", account
...@@ -807,6 +827,9 @@ class ConsultantAudioHomeActivity : ...@@ -807,6 +827,9 @@ class ConsultantAudioHomeActivity :
fun close(code: Int, msg: String) { fun close(code: Int, msg: String) {
runOnUiThread { runOnUiThread {
LogUtil.e("[agora]close(code:$code,msg:$msg)") LogUtil.e("[agora]close(code:$code,msg:$msg)")
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.AGORA, "close(code:$code,msg:$msg)")
//上传日志文件 //上传日志文件
uploadLog() uploadLog()
stopMusic() stopMusic()
...@@ -837,6 +860,7 @@ class ConsultantAudioHomeActivity : ...@@ -837,6 +860,7 @@ class ConsultantAudioHomeActivity :
} }
ActivityManager.getInstance().removeStack(activity = this) ActivityManager.getInstance().removeStack(activity = this)
LogUtil.e("[agora]页面移除") LogUtil.e("[agora]页面移除")
AliYunLogHelper.getInstance().sendLog(AliYunLogConfig.AGORA, "页面移除")
finish() finish()
} }
} }
...@@ -945,9 +969,11 @@ class ConsultantAudioHomeActivity : ...@@ -945,9 +969,11 @@ class ConsultantAudioHomeActivity :
Observable.create<Any> { Observable.create<Any> {
try { try {
AudioLogUtils.writeAgoraLog( AudioLogUtils.writeAgoraLog(
"$content-------Time:${AudioLogUtils.format.format( "$content-------Time:${
Calendar.getInstance().time AudioLogUtils.format.format(
)}", "consult.log" Calendar.getInstance().time
)
}", "consult.log"
) )
} catch (e: Exception) { } catch (e: Exception) {
} }
......
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