Commit 32e8effe by 万齐军

异常挂断上报

parent ef1690a8
......@@ -61,6 +61,7 @@ import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.utils.log.AliYunLogConfig
import com.ydl.ydlcommon.utils.log.AliYunRichLogsHelper
import com.ydl.ydlcommon.utils.log.LogHelper
import com.ydl.ydlcommon.utils.log.XLog
import com.ydl.ydlcommon.utils.remind.ToastHelper
import com.yidianling.common.tools.ToastUtil
import com.yidianling.im.api.bean.IMRegisterObserverCustomNotificationCallBack
......@@ -260,7 +261,7 @@ class AudioHomeActivity :
runOnUiThread {
if (hasHandleRefused) return@runOnUiThread
hasHandleRefused = true
YDLavManager.instances.callEndStatusUpdate(channelId ?: "", 2, "被叫拒绝")
YDLavManager.instances.callEndStatusUpdate(channelId, 2, "被叫拒绝")
ToastUtil.toastShort("对方已挂断")
writeAgoraLog("被叫(专家)拒绝了通话邀请")
//通话结束或挂断时,上传日志文件
......@@ -320,7 +321,7 @@ class AudioHomeActivity :
return
}
Apm.reportEvent("agora_android", "occur_error", "$err")
channelId?.let { YDLavManager.instances.callEndStatusUpdate(it, 4, "频道的错误回调信息$err") }
channelId?.let { YDLavManager.instances.callEndStatusUpdate(it, 60, "频道错误回调$err") }
}
override fun onApiCallExecuted(error: Int, api: String?, result: String?) {
......@@ -403,7 +404,6 @@ class AudioHomeActivity :
//通话结束或挂断时,上传日志文件
uploadLog()
leaveChannel()
YDLavManager.instances.callEndStatusUpdate(channelId!!, 4, "服务端踢人触发的回调")
}
}
......@@ -441,7 +441,6 @@ class AudioHomeActivity :
showToast("专家已挂断")
//UserOffLine之后,销毁界面,解决,userOffline有回调之后,onConnectionStateChanged(服务端踢人方法没有调),导致记录时长异常。
leaveChannel()
YDLavManager.instances.callEndStatusUpdate(channelId!!, 4, "对方离开频道")
if (totalDisposable != null) {
totalDisposable?.dispose()
......@@ -751,7 +750,7 @@ class AudioHomeActivity :
updateExpertStatus(false, 1)
leaveChannel()
uploadLog()
YDLavManager.instances.callEndStatusUpdate(channelId!!, 3, "主叫主动挂断")
YDLavManager.instances.callEndStatusUpdate(channelId!!, 5, "主叫挂断")
callEventSave("51", "已接通:主叫主动挂断")
} else {
userCloseCalling()
......@@ -1176,7 +1175,7 @@ class AudioHomeActivity :
}
})
YDLavManager.instances.callEndStatusUpdate(channelId!!, 3, "接通中:主叫主动切换AXB")
YDLavManager.instances.callEndStatusUpdate(channelId!!, 51, "接通中:主叫主动切换AXB")
} else {
mPresenter.getAXBPhone(ConnectCommand(listenId!!, "1"))
......@@ -1366,7 +1365,7 @@ class AudioHomeActivity :
leaveChannel()
uploadLog()
callEventSave("50", "倾诉时间已用完")
YDLavManager.instances.callEndStatusUpdate(channelId!!, 3, "倾诉时间已用完")
YDLavManager.instances.callEndStatusUpdate(channelId!!, 50, "倾诉时间已用完")
//注意:自动挂断时,如果对方离开频道的回调已经触发,就不要再重复调用接口
showToast("通话已结束")
//通话结束或挂断时,上传日志文件
......@@ -1659,10 +1658,14 @@ class AudioHomeActivity :
inner class NetQuality : RtcNetInterface {
override fun onLocalAudioStats(bitrate: Int, packetLossRate: Int) {
XLog.i("NetQuality", "bitrate:$bitrate,packetLossRate:$packetLossRate")
}
override fun onNetQuality(uid: Int, tx: Int, rx: Int) {
if (tx in 4..6 || rx in 4..6) {
XLog.i("NetQuality", "$uid,tx:$tx,rx:$rx")
}
}
......
......@@ -275,7 +275,7 @@ class YDLavManager {
"呼叫邀请被取消:错误原因(${errorCode})"
)
}
callEndStatusUpdate(response?.ChannelId!!, 2, "超时未接听导致的取消呼叫")
callEndStatusUpdate(response?.ChannelId!!, 8, "超时未接听导致的取消呼叫")
//关闭页面
closePage()
}
......@@ -612,17 +612,11 @@ class YDLavManager {
@SuppressLint("CheckResult")
fun callEndStatusUpdate(channelId: String, endStatus: Int, msg: String) {
AudioApiRequestUtil.callEndStatusUpdate(channelId, endStatus, msg)
fun callEndStatusUpdate(channelId: String?, endStatus: Int, msg: String) {
if (channelId == null) return
AudioApiRequestUtil.callEventSave(channelId, "7", endStatus.toString(), null, msg)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
}, {
LogUtil.d("callEndStatusUpdate error: ${it.message}")
AliYunRichLogsHelper.getInstance()
.sendRichLog(AliYunLogConfig.AGORA, "callEndStatusUpdate error: ${it.message}")
})
.subscribe()
}
/**
......
......@@ -4,9 +4,10 @@ package com.ydl.audioim.bean
* 星链-倾诉日志请求参数
* */
data class CallEventRequestBody(
var session :String?,
var line :String,
var status :String,
var response :String,
var eventTime :String
var session: String?,
var line: String,
var status: String,
var response: String? = null,
var eventTime: String,
var remark: String? = null
)
......@@ -106,23 +106,15 @@ class AudioApiRequestUtil {
.listenToken(NetworkParamsUtils.getMaps(cmd))
}
fun callEndStatusUpdate(
channelId: String,
endStatus: Int,
msg: String
): Observable<BaseAPIResponse<Any>> {
return YDLHttpUtils.obtainApi(AudioNetAPi::class.java)
.callEndStatusUpdate(channelId, endStatus, msg)
}
fun callEventSave(
session: String?,
line: String,
status: String,
response: String
response: String?,
remark: String? = null
): Observable<BaseAPIResponse<Any>> {
var eventTime = TimeUtil.getNowDatetime()
var param = CallEventRequestBody(session, line, status, response, eventTime);
var param = CallEventRequestBody(session, line, status, response, eventTime, remark);
var str = Gson().toJson(param)
val body = RequestBody.create(
MediaType.parse("application/json; charset=utf-8"),
......
......@@ -72,9 +72,9 @@ interface AudioNetAPi {
fun listenToken(@FieldMap map: Map<String, String>): Observable<BaseResponse<ListenTokenBean>>
@GET("message/call-end/agora")
@Headers( YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun callEndStatusUpdate(@Query("channelId") channelId:String,@Query("endStatus") endStatus:Int,@Query("msg") msg:String): Observable<BaseAPIResponse<Any>>
// @GET("message/call-end/agora")
// @Headers( YDL_DOMAIN + YDL_DOMAIN_JAVA)
// fun callEndStatusUpdate(@Query("channelId") channelId:String,@Query("endStatus") endStatus:Int,@Query("msg") msg:String): Observable<BaseAPIResponse<Any>>
//倾诉事件上报接口
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA, "Content-Type:application/json")
......
......@@ -85,7 +85,6 @@ internal class RtcGlobalNetQuality(private val threshold: Int) : RtcGlobalNet {
if (quality > 3) {
XLog.i("RtcGlobalNetQuality", quality.toString())
}
android.util.Log.i("qeqe", String.format("%.2f,%d", average, count))
if (count >= threshold) {
//上报
val req = hashMapOf(
......
......@@ -255,15 +255,7 @@ class ConsultantAudioHomeActivity :
super.onConnectionStateChanged(state, reason)
// 3 网络连接被服务器中止 该情况现在是因为后端踢人逻辑
if (reason == 3) {
callEventSave("60", "通话挂断:网络连接被服务器(后端)中止")
showToast("对方已挂断")
YDLavManager.instances.callEndStatusUpdate(
mAudioMessageBean?.channelId!!,
4,
"服务端踢人触发的回调"
)
writeAgoraLog("通话挂断:网络连接被服务器(后端)中止")
//通话结束或挂断时,上传日志文件
uploadLog()
......@@ -318,11 +310,6 @@ class ConsultantAudioHomeActivity :
}
}
runOnUiThread {
YDLavManager.instances.callEndStatusUpdate(
mAudioMessageBean?.channelId!!,
4,
"对方离开频道"
)
showToast("对方已挂断")
writeAgoraLog("通话接通后挂断:主叫(专家)离开频道")
AliYunRichLogsHelper.getInstance()
......@@ -426,8 +413,8 @@ class ConsultantAudioHomeActivity :
}
YDLavManager.instances.callEndStatusUpdate(
mAudioMessageBean?.channelId!!,
4,
"频道的错误回调信息${err} "
60,
"频道错误回调${err} "
)
}
}
......@@ -757,7 +744,7 @@ class ConsultantAudioHomeActivity :
} else if (status == STATUS_ANSWERED) {
callEventSave("51", "通话接通后挂断:专家主动挂断")
YDLavManager.instances.callEndStatusUpdate(mAudioMessageBean?.channelId!!, 3, "被叫主动拒绝")
YDLavManager.instances.callEndStatusUpdate(mAudioMessageBean?.channelId!!, 2, "被叫主动拒绝")
writeAgoraLog("通话接通后挂断:专家主动挂断")
//正常接听 挂断电话 需要重置信令管理类状态
close(RESULT_ANSWERED_CODE, "")
......@@ -1027,7 +1014,7 @@ class ConsultantAudioHomeActivity :
if (!isConnectSuccess) {
YDLavManager.instances.callEndStatusUpdate(
mAudioMessageBean?.channelId!!,
1,
36,
"被叫加入频道后主叫未加入超时"
)
AliYunRichLogsHelper.getInstance().sendRichLog(AliYunLogConfig.AGORA, "咨询用户端:15s后如果还是处于连接中,则直接退出当前页面 channelId:${mAudioMessageBean?.channelId}")
......
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