Commit b9e2abb3 by YKai

feat:声网onWaring返回警告,离开房间代码注释,增加日志上传

parent 919ca7e5
...@@ -65,7 +65,7 @@ import java.util.concurrent.TimeUnit ...@@ -65,7 +65,7 @@ import java.util.concurrent.TimeUnit
/** /**
* @author jiucheng * @author jiucheng
* @描述: 倾诉声网通话页面 * @描述: 倾诉声网通话页面(拨打电话界面)
* @Copyright Copyright (c) 2018 * @Copyright Copyright (c) 2018
* @Company 壹点灵 * @Company 壹点灵
* @date 2018/10/30 * @date 2018/10/30
...@@ -188,22 +188,23 @@ class AudioHomeActivity : ...@@ -188,22 +188,23 @@ class AudioHomeActivity :
//106:打开频道超时。查找到指定频道后,SDK 接着打开该频道,超时一般是因为网络太差,连接不到服务器 //106:打开频道超时。查找到指定频道后,SDK 接着打开该频道,超时一般是因为网络太差,连接不到服务器
//107:打开频道请求被服务器拒绝。服务器可能没有办法处理该请求或该请求是非法的 //107:打开频道请求被服务器拒绝。服务器可能没有办法处理该请求或该请求是非法的
LogUtil.e("[agora]发生警告回调$warn") LogUtil.e("[agora]发生警告回调$warn")
runOnUiThread { // 声网发出警告错误码,不应该直接离开房间
when (warn) { // runOnUiThread {
103, 105, 107 -> { // when (warn) {
writeAgoraLog("通话挂断:网络异常(${warn})") // 103, 105, 107 -> {
showToast("当前网络较差,请更换网络!") // writeAgoraLog("通话挂断:网络异常(${warn})")
//通话结束或挂断时,上传日志文件 // showToast("当前网络较差,请更换网络!")
uploadLog() // //通话结束或挂断时,上传日志文件
leaveChannel() // uploadLog()
YDLavManager.instances.callEndStatusUpdate( // leaveChannel()
channelId!!, // YDLavManager.instances.callEndStatusUpdate(
4, // channelId!!,
"收到频道回调警告信息$warn" // 4,
) // "收到频道回调警告信息$warn"
} // )
} // }
} // }
// }
} }
override fun onError(err: Int) { override fun onError(err: Int) {
......
...@@ -11,6 +11,7 @@ import com.ydl.audioim.http.AudioApiRequestUtil ...@@ -11,6 +11,7 @@ import com.ydl.audioim.http.AudioApiRequestUtil
import com.ydl.audioim.http.command.ConnectExceptionCommand import com.ydl.audioim.http.command.ConnectExceptionCommand
import com.ydl.audioim.router.AudioImIn import com.ydl.audioim.router.AudioImIn
import com.ydl.audioim.utils.AudioLogUtils import com.ydl.audioim.utils.AudioLogUtils
import com.ydl.audioim.utils.AudioLogUtils.Companion.writeAgoraLog
import com.ydl.consultantim.ConsultantAudioHomeActivity import com.ydl.consultantim.ConsultantAudioHomeActivity
import com.ydl.ydl_av.messge_service.YDLRTMClient import com.ydl.ydl_av.messge_service.YDLRTMClient
import com.ydl.ydl_av.messge_service.bean.RTMMesssage import com.ydl.ydl_av.messge_service.bean.RTMMesssage
...@@ -47,6 +48,7 @@ class YDLavManager { ...@@ -47,6 +48,7 @@ class YDLavManager {
companion object { companion object {
const val FILE_NAME = "consult" const val FILE_NAME = "consult"
//当前sdk的登录状态 //当前sdk的登录状态
var sdkStatus = -1 var sdkStatus = -1
...@@ -240,9 +242,14 @@ class YDLavManager { ...@@ -240,9 +242,14 @@ class YDLavManager {
//1发起呼叫 2接受呼叫 3取消呼叫 4拒绝呼叫邀请 5呼叫超时 //1发起呼叫 2接受呼叫 3取消呼叫 4拒绝呼叫邀请 5呼叫超时
when (agoraInvitationBean.callType) { when (agoraInvitationBean.callType) {
"1" -> { "1" -> {
writeAgoraLog("1收到云信消息通知电话", FILE_NAME)
receivedCall(agoraInvitationBean.data, "来自云信") receivedCall(agoraInvitationBean.data, "来自云信")
} }
"2" -> { "2" -> {
writeAgoraLog(
"对方接受了通话邀请,主叫开始加入频道:callType${agoraInvitationBean.callType}",
FILE_NAME
)
val act = ActivityManager.getInstance().getTopTaskActivity() val act = ActivityManager.getInstance().getTopTaskActivity()
if (act is AudioHomeActivity) { if (act is AudioHomeActivity) {
act.runOnUiThread { act.runOnUiThread {
...@@ -251,15 +258,15 @@ class YDLavManager { ...@@ -251,15 +258,15 @@ class YDLavManager {
} }
} }
"3" -> { "3" -> {
AudioLogUtils.writeAgoraLog("呼叫邀请被取消:主叫主动取消", FILE_NAME) writeAgoraLog("呼叫邀请被取消:主叫主动取消", FILE_NAME)
closePage() closePage()
} }
"4" -> { "4" -> {
writeAgoraLog("被叫拒绝了通话邀请", FILE_NAME)
val act = ActivityManager.getInstance().getTopTaskActivity() val act = ActivityManager.getInstance().getTopTaskActivity()
if (act is AudioHomeActivity) { if (act is AudioHomeActivity) {
act.runOnUiThread { act.runOnUiThread {
ToastUtil.toastShort("对方已挂断") ToastUtil.toastShort("对方已挂断")
act.writeAgoraLog("被叫拒绝了通话邀请")
//通话结束或挂断时,上传日志文件 //通话结束或挂断时,上传日志文件
act.uploadLog() act.uploadLog()
act.leaveChannel() act.leaveChannel()
...@@ -267,10 +274,16 @@ class YDLavManager { ...@@ -267,10 +274,16 @@ class YDLavManager {
} }
} }
"5" -> { "5" -> {
AudioLogUtils.writeAgoraLog("呼叫邀请被取消:呼叫邀请过期", FILE_NAME) writeAgoraLog("呼叫邀请被取消:呼叫邀请过期", FILE_NAME)
//关闭页面 //关闭页面
closePage() closePage()
} }
else -> {
writeAgoraLog(
"其它AgoraInvitationBean,${agoraInvitationBean.callType}",
FILE_NAME
)
}
} }
} }
}) })
...@@ -393,17 +406,18 @@ class YDLavManager { ...@@ -393,17 +406,18 @@ 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)", FILE_NAME, false)
//邀请加入频道消息,跳转通话界面 //邀请加入频道消息,跳转通话界面
ARouter.getInstance().build("/av/ConsultantAudioHomeActivity") ARouter.getInstance().build("/av/ConsultantAudioHomeActivity")
.withString("param", content).navigation() .withString("param", content).navigation()
AudioLogUtils.writeAgoraLog("收到主叫方通话邀请($from)", FILE_NAME, false)
} }
} else { } else {
LogUtil.d("[agora]收到声网邀请,但界面实例已存在") LogUtil.d("[agora]收到声网邀请,但界面实例已存在")
writeAgoraLog("收到主叫方通话邀请,但界面实例已存在($from)", FILE_NAME, false)
} }
} else { } else {
LogUtil.d("[agora]收到声网邀请,但response==null") LogUtil.d("[agora]收到声网邀请,但response==null")
writeAgoraLog("收到主叫方通话邀请,但response==null($from)", FILE_NAME, false)
} }
} }
...@@ -489,7 +503,9 @@ class YDLavManager { ...@@ -489,7 +503,9 @@ class YDLavManager {
override fun onTokenExpired() { override fun onTokenExpired() {
LogUtil.e("[agora]onTokenExpired") LogUtil.e("[agora]onTokenExpired")
instances.login(ModularServiceManager.provide(IUserService::class.java).getUserInfo()?.uid) instances.login(
ModularServiceManager.provide(IUserService::class.java).getUserInfo()?.uid
)
} }
override fun onMessageReceived(message: RTMMesssage, userId: Int) { override fun onMessageReceived(message: RTMMesssage, userId: Int) {
......
...@@ -62,7 +62,7 @@ import java.util.concurrent.TimeUnit ...@@ -62,7 +62,7 @@ import java.util.concurrent.TimeUnit
/** /**
* @author jiucheng * @author jiucheng
* @描述: 咨询声网通话页面 * @描述: 咨询声网通话页面(接受电话界面)
* @Copyright Copyright (c) 2018 * @Copyright Copyright (c) 2018
* @Company 壹点灵 * @Company 壹点灵
* @date 2018/10/30 * @date 2018/10/30
...@@ -255,18 +255,19 @@ class ConsultantAudioHomeActivity : BaseMvpActivity<IConsultantAudioHomeActivity ...@@ -255,18 +255,19 @@ class ConsultantAudioHomeActivity : BaseMvpActivity<IConsultantAudioHomeActivity
//105:查找频道请求被服务器拒绝。服务器可能没有办法处理这个请求或请求是非法的 //105:查找频道请求被服务器拒绝。服务器可能没有办法处理这个请求或请求是非法的
//106:打开频道超时。查找到指定频道后,SDK 接着打开该频道,超时一般是因为网络太差,连接不到服务器 //106:打开频道超时。查找到指定频道后,SDK 接着打开该频道,超时一般是因为网络太差,连接不到服务器
//107:打开频道请求被服务器拒绝。服务器可能没有办法处理该请求或该请求是非法的 //107:打开频道请求被服务器拒绝。服务器可能没有办法处理该请求或该请求是非法的
runOnUiThread { // 声网发出警告错误码,不应该直接离开房间
when (warn) { // runOnUiThread {
103, 105, 107 -> { // when (warn) {
YDLavManager.instances.callEndStatusUpdate(mAudioMessageBean?.channelId!!, 4, "收到频道回调警告信息${warn}") // 103, 105, 107 -> {
writeAgoraLog("通话挂断:网络异常($warn)") // YDLavManager.instances.callEndStatusUpdate(mAudioMessageBean?.channelId!!, 4, "收到频道回调警告信息${warn}")
showToast("当前网络较差,请更换网络!") // writeAgoraLog("通话挂断:网络异常($warn)")
//通话结束或挂断时,上传日志文件 // showToast("当前网络较差,请更换网络!")
uploadLog() // //通话结束或挂断时,上传日志文件
close(RESULT_NOT_ANSWERED_CODE, "[agora]专家网络较差") // uploadLog()
} // close(RESULT_NOT_ANSWERED_CODE, "[agora]专家网络较差")
} // }
} // }
// }
} }
override fun onError(err: Int) { override fun onError(err: Int) {
...@@ -291,7 +292,7 @@ class ConsultantAudioHomeActivity : BaseMvpActivity<IConsultantAudioHomeActivity ...@@ -291,7 +292,7 @@ class ConsultantAudioHomeActivity : BaseMvpActivity<IConsultantAudioHomeActivity
showToast("请退出应用,重新打开") showToast("请退出应用,重新打开")
close(RESULT_NOT_ANSWERED_CODE, "咨询师已挂断") close(RESULT_NOT_ANSWERED_CODE, "咨询师已挂断")
} }
10, 17 -> { 10 -> {
showToast("当前网络较差,请更换网络") showToast("当前网络较差,请更换网络")
close(RESULT_NOT_ANSWERED_CODE, "专家网络较差") close(RESULT_NOT_ANSWERED_CODE, "专家网络较差")
} }
...@@ -758,20 +759,24 @@ class ConsultantAudioHomeActivity : BaseMvpActivity<IConsultantAudioHomeActivity ...@@ -758,20 +759,24 @@ class ConsultantAudioHomeActivity : BaseMvpActivity<IConsultantAudioHomeActivity
stopMusic() stopMusic()
//播放结束音频 //播放结束音频
playFinishMusic() playFinishMusic()
if (code == RESULT_ANSWERED_CODE) { when (code) {
//已接听,正常挂断 RESULT_ANSWERED_CODE -> {
//离开频道 //已接听,正常挂断
leaveChannel() //离开频道
} else if (code == RESULT_NOT_ANSWERED_CODE) { leaveChannel()
callStatus = 2 }
uploadException("被叫拒绝", zhu = "") RESULT_NOT_ANSWERED_CODE -> {
//未接听,直接挂断 发送消息 callStatus = 2
// YDLRTMClient.instances.refuseCall(mAudioMessageBean?.channelId) uploadException("被叫拒绝", zhu = "")
YDLavManager.instances.refuseCall(mAudioMessageBean!!.userId!!, mAudioMessageBean?.channelId, Gson().toJson(mAudioMessageBean)) //未接听,直接挂断 发送消息
} else if (code == RESULT_USER_CANCEL) { // YDLRTMClient.instances.refuseCall(mAudioMessageBean?.channelId)
callStatus = 1 YDLavManager.instances.refuseCall(mAudioMessageBean!!.userId!!, mAudioMessageBean?.channelId, Gson().toJson(mAudioMessageBean))
uploadException("主叫取消", zhu = "") }
showToast("对方已挂断") RESULT_USER_CANCEL -> {
callStatus = 1
uploadException("主叫取消", zhu = "")
showToast("对方已挂断")
}
} }
ActivityManager.getInstance().removeStack(activity = this) ActivityManager.getInstance().removeStack(activity = this)
LogUtil.e("[agora]页面移除") LogUtil.e("[agora]页面移除")
......
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