Commit ebe6578a by 严久程

接口参数

parent 6e4790e1
...@@ -5,7 +5,7 @@ ext { ...@@ -5,7 +5,7 @@ ext {
ydlPublishVersion = [ ydlPublishVersion = [
// -------------- 业务模块 -------------- // -------------- 业务模块 --------------
//第三步 若干 //第三步 若干
"m-confide" : "0.0.48.43", "m-confide" : "0.0.48.47",
"m-consultant" : "0.0.59.10", "m-consultant" : "0.0.59.10",
"m-fm" : "0.0.29.9", "m-fm" : "0.0.29.9",
"m-user" : "0.0.60.8", "m-user" : "0.0.60.8",
...@@ -39,7 +39,7 @@ ext { ...@@ -39,7 +39,7 @@ ext {
"ydl-webview" : "0.0.38.31", "ydl-webview" : "0.0.38.31",
"ydl-media" : "0.0.21.6", "ydl-media" : "0.0.21.6",
"ydl-pay" : "0.0.18.9", "ydl-pay" : "0.0.18.9",
"m-audioim" : "0.0.49.16", "m-audioim" : "0.0.49.21",
"ydl-flutter-base": "0.0.14.14", "ydl-flutter-base": "0.0.14.14",
//以下 几乎不会动 //以下 几乎不会动
...@@ -122,7 +122,7 @@ ext { ...@@ -122,7 +122,7 @@ ext {
"ydl-webview" : "0.0.38.31", "ydl-webview" : "0.0.38.31",
"ydl-media" : "0.0.21.6", "ydl-media" : "0.0.21.6",
"ydl-pay" : "0.0.18.9", "ydl-pay" : "0.0.18.9",
"m-audioim" : "0.0.49.16", "m-audioim" : "0.0.49.21",
"ydl-flutter-base": "0.0.14.14", "ydl-flutter-base": "0.0.14.14",
//以下 几乎不会动 //以下 几乎不会动
......
...@@ -71,7 +71,9 @@ import java.util.concurrent.TimeUnit ...@@ -71,7 +71,9 @@ import java.util.concurrent.TimeUnit
* @date 2018/10/30 * @date 2018/10/30
*/ */
@Route(path = "/av/AudioHomeActivity") @Route(path = "/av/AudioHomeActivity")
class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudioHomeActivityContract.Presenter>(), IAudioHomeActivityContract.View, SensorEventListener { class AudioHomeActivity :
BaseMvpActivity<IAudioHomeActivityContract.View, IAudioHomeActivityContract.Presenter>(),
IAudioHomeActivityContract.View, SensorEventListener {
/** /**
* 专家头像地址 * 专家头像地址
...@@ -189,7 +191,11 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi ...@@ -189,7 +191,11 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
runOnUiThread { runOnUiThread {
when (warn) { when (warn) {
103, 105, 107 -> { 103, 105, 107 -> {
YDLavManager.instances.callEndStatusUpdate(channelId!!, 4, "收到频道回调警告信息$warn") YDLavManager.instances.callEndStatusUpdate(
channelId!!,
4,
"收到频道回调警告信息$warn"
)
writeAgoraLog("通话挂断:网络异常(${warn})") writeAgoraLog("通话挂断:网络异常(${warn})")
showToast("当前网络较差,请更换网络!") showToast("当前网络较差,请更换网络!")
...@@ -340,6 +346,7 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi ...@@ -340,6 +346,7 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
override fun onNetworkQuality(uid: Int, txQuality: Int, rxQuality: Int) { override fun onNetworkQuality(uid: Int, txQuality: Int, rxQuality: Int) {
super.onNetworkQuality(uid, txQuality, rxQuality) super.onNetworkQuality(uid, txQuality, rxQuality)
LogUtil.e("onNetworkQuality:-------uid=$uid,txQuality=$txQuality,rxQuality=$rxQuality")
var status = -1 var status = -1
var netStatus = when (uid) { var netStatus = when (uid) {
listenerUid!!.toInt() -> { listenerUid!!.toInt() -> {
...@@ -416,7 +423,10 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi ...@@ -416,7 +423,10 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
sensorManager = getSystemService(Context.SENSOR_SERVICE) as SensorManager? sensorManager = getSystemService(Context.SENSOR_SERVICE) as SensorManager?
localPowerManager = getSystemService(POWER_SERVICE) as PowerManager? localPowerManager = getSystemService(POWER_SERVICE) as PowerManager?
localWakeLock = localPowerManager!!.newWakeLock(PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK, "yidianling") localWakeLock = localPowerManager!!.newWakeLock(
PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK,
"yidianling"
)
} }
private fun initIntentData() { private fun initIntentData() {
...@@ -432,9 +442,18 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi ...@@ -432,9 +442,18 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
listenerUid = intent.getStringExtra(IntentConstants.INTENT_LISTENER_UID) listenerUid = intent.getStringExtra(IntentConstants.INTENT_LISTENER_UID)
listenId = intent.getStringExtra(IntentConstants.INTENT_LISTEN_ID) listenId = intent.getStringExtra(IntentConstants.INTENT_LISTEN_ID)
commentUrl = intent.getStringExtra(IntentConstants.INTENT_COMMENT_URL) commentUrl = intent.getStringExtra(IntentConstants.INTENT_COMMENT_URL)
isShowAXB = intent.getBooleanExtra(IntentConstants.INTENT_ISSHOWAXB,true) isShowAXB = intent.getBooleanExtra(IntentConstants.INTENT_ISSHOWAXB, true)
val logBean = AgoraLogInfoBean(expertHeadUrl, expertName, channelId, remainTime, listenerUid, totalDuration, callId, listenId) val logBean = AgoraLogInfoBean(
expertHeadUrl,
expertName,
channelId,
remainTime,
listenerUid,
totalDuration,
callId,
listenId
)
val content = Gson().toJson(logBean) val content = Gson().toJson(logBean)
writeAgoraLog("主叫方发送的邀请通话消息内容:$content", isAppend = false) writeAgoraLog("主叫方发送的邀请通话消息内容:$content", isAppend = false)
...@@ -480,16 +499,17 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi ...@@ -480,16 +499,17 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
YDLImageCacheManager.showImage(this, expertHeadUrl, iv_head, option) YDLImageCacheManager.showImage(this, expertHeadUrl, iv_head, option)
} }
if(!isShowAXB){ if (!isShowAXB) {
tv_change_route.visibility=View.GONE tv_change_route.visibility = View.GONE
tv_change_time_counter.visibility=View.GONE tv_change_time_counter.visibility = View.GONE
} }
} }
private fun setClickEvent() { private fun setClickEvent() {
//切换线路 //切换线路
tv_change_route.setOnClickListener { tv_change_route.setOnClickListener {
showChooseDialog(1) } showChooseDialog(1)
}
//挂断 //挂断
iv_hang_up.setOnClickListener { iv_hang_up.setOnClickListener {
if (Utils.isFastClick()) { if (Utils.isFastClick()) {
...@@ -506,7 +526,11 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi ...@@ -506,7 +526,11 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
userCloseCalling() userCloseCalling()
} }
ActionCountUtils.count("shengwang_popup_layer_page|shengwang_popup_layer_refuse_click", YdlCommonRouterManager.getYdlCommonRoute().getUid().toString(), uid = YdlCommonRouterManager.getYdlCommonRoute().getUid().toString()) ActionCountUtils.count(
"shengwang_popup_layer_page|shengwang_popup_layer_refuse_click",
YdlCommonRouterManager.getYdlCommonRoute().getUid().toString(),
uid = YdlCommonRouterManager.getYdlCommonRoute().getUid().toString()
)
} }
//免提 //免提
...@@ -562,14 +586,27 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi ...@@ -562,14 +586,27 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
//初始化声网 //初始化声网
initializeAgoraEngine() initializeAgoraEngine()
//发起呼叫 //发起呼叫
var msgBean = AudioMessageBean(1, channelId!!, YdlCommonRouterManager.getYdlCommonRoute().getUid().toString(), YdlCommonRouterManager.getYdlCommonRoute().getUserInfo()!!.headUrl, YdlCommonRouterManager.getYdlCommonRoute().getUserInfo()!!.userName, remainTime!!.toInt(), relationId, callId, null, channelId) var msgBean = AudioMessageBean(
1,
channelId!!,
YdlCommonRouterManager.getYdlCommonRoute().getUid().toString(),
YdlCommonRouterManager.getYdlCommonRoute().getUserInfo()!!.headUrl,
YdlCommonRouterManager.getYdlCommonRoute().getUserInfo()!!.userName,
remainTime!!.toInt(),
relationId,
callId,
null,
channelId
)
sendDoctocrMsg = Gson().toJson(msgBean) sendDoctocrMsg = Gson().toJson(msgBean)
writeAgoraLog("主叫发送通话邀请") writeAgoraLog("主叫发送通话邀请")
rtcCall() rtcCall()
//开始60s等待倒计时 //开始60s等待倒计时
waitDisposable = Observable.interval(0, 100, TimeUnit.MILLISECONDS).subscribeOn(Schedulers.computation()).take(600).observeOn(AndroidSchedulers.mainThread()).subscribe({ waitDisposable =
Observable.interval(0, 100, TimeUnit.MILLISECONDS).subscribeOn(Schedulers.computation())
.take(600).observeOn(AndroidSchedulers.mainThread()).subscribe({
tv_change_time_counter.text = "${60 - it / 10}s" tv_change_time_counter.text = "${60 - it / 10}s"
var result = it.toFloat() / 2.5f var result = it.toFloat() / 2.5f
progress_view.setProgress(result) progress_view.setProgress(result)
...@@ -588,7 +625,11 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi ...@@ -588,7 +625,11 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
writeAgoraLog("未接通挂断:60s等待倒计时结束挂断") writeAgoraLog("未接通挂断:60s等待倒计时结束挂断")
//提示切换传统线路 //提示切换传统线路
//发送消息通知专家用户已挂断 //发送消息通知专家用户已挂断
YDLavManager.instances.cancelCall(listenerUid!!, channelId!!, sendDoctocrMsg!!) { msg, code -> YDLavManager.instances.cancelCall(
listenerUid!!,
channelId!!,
sendDoctocrMsg!!
) { msg, code ->
writeAgoraLog("未接听时:主叫主动挂断失败,msg=$msg($code),再次挂断") writeAgoraLog("未接听时:主叫主动挂断失败,msg=$msg($code),再次挂断")
} }
//通话结束或挂断时,上传日志文件 //通话结束或挂断时,上传日志文件
...@@ -624,7 +665,12 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi ...@@ -624,7 +665,12 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
*/ */
fun joinChannel() { fun joinChannel() {
writeAgoraLog("对方接受了通话邀请,主叫开始加入频道:$channelId") writeAgoraLog("对方接受了通话邀请,主叫开始加入频道:$channelId")
voiceManage!!.getVoiceApi().joinChannel(token!!, channelId!!, "Extra Optional Data", YdlCommonRouterManager.getYdlCommonRoute().getUid()) voiceManage!!.getVoiceApi().joinChannel(
token!!,
channelId!!,
"Extra Optional Data",
YdlCommonRouterManager.getYdlCommonRoute().getUid()
)
} }
/** /**
...@@ -636,7 +682,11 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi ...@@ -636,7 +682,11 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
writeAgoraLog("未接听时:主叫主动挂断,取消呼叫") writeAgoraLog("未接听时:主叫主动挂断,取消呼叫")
LogUtil.e("未接听挂断") LogUtil.e("未接听挂断")
//发送消息通知专家用户已挂断 //发送消息通知专家用户已挂断
YDLavManager.instances.cancelCall(listenerUid!!, channelId!!, sendDoctocrMsg!!) { msg, code -> YDLavManager.instances.cancelCall(
listenerUid!!,
channelId!!,
sendDoctocrMsg!!
) { msg, code ->
writeAgoraLog("未接听时:主叫主动挂断失败,msg=$msg($code),再次挂断") writeAgoraLog("未接听时:主叫主动挂断失败,msg=$msg($code),再次挂断")
} }
//通话结束或挂断时,上传日志文件 //通话结束或挂断时,上传日志文件
...@@ -681,7 +731,8 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi ...@@ -681,7 +731,8 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
*/ */
private fun showChooseDialog(type: Int) { private fun showChooseDialog(type: Int) {
val dialog = AxbConfirmDialog(mContext, type, object : AxbConfirmDialog.OnClickEnsureListener { val dialog =
AxbConfirmDialog(mContext, type, object : AxbConfirmDialog.OnClickEnsureListener {
override fun onClickEnsure() { override fun onClickEnsure() {
switchAXB() switchAXB()
} }
...@@ -731,7 +782,11 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi ...@@ -731,7 +782,11 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
//未连接成功,切换axb时:需发送消息通知专家端用户已挂断 //未连接成功,切换axb时:需发送消息通知专家端用户已挂断
//发送消息通知专家用户已挂断 //发送消息通知专家用户已挂断
//发送消息通知专家用户已挂断 //发送消息通知专家用户已挂断
YDLavManager.instances.cancelCall(listenerUid!!, channelId!!, sendDoctocrMsg!!) { msg, code -> YDLavManager.instances.cancelCall(
listenerUid!!,
channelId!!,
sendDoctocrMsg!!
) { msg, code ->
writeAgoraLog("未接听时:主叫主动挂断失败,msg=$msg($code),再次挂断") writeAgoraLog("未接听时:主叫主动挂断失败,msg=$msg($code),再次挂断")
} }
leaveChannel() leaveChannel()
...@@ -763,9 +818,9 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi ...@@ -763,9 +818,9 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
tv_change_doctor.text = "对方暂无应答,正在为您切换线路重播" tv_change_doctor.text = "对方暂无应答,正在为您切换线路重播"
tv_change_doctor.visibility = View.VISIBLE tv_change_doctor.visibility = View.VISIBLE
} }
if(!isShowAXB){ if (!isShowAXB) {
tv_change_route.visibility=View.GONE tv_change_route.visibility = View.GONE
}else{ } else {
//切换线路按钮可见 //切换线路按钮可见
tv_change_route.isEnabled = true tv_change_route.isEnabled = true
tv_change_route.text = "切换至传统电话" tv_change_route.text = "切换至传统电话"
...@@ -857,7 +912,10 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi ...@@ -857,7 +912,10 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
tv_tips.visibility = View.GONE tv_tips.visibility = View.GONE
//剩余倾诉时长倒计时 //剩余倾诉时长倒计时
totalDisposable = Observable.interval(0, 1, TimeUnit.SECONDS).subscribeOn(Schedulers.computation()).take(remainTime!!.toLong() + 1).observeOn(AndroidSchedulers.mainThread()).subscribe({ totalDisposable =
Observable.interval(0, 1, TimeUnit.SECONDS).subscribeOn(Schedulers.computation())
.take(remainTime!!.toLong() + 1).observeOn(AndroidSchedulers.mainThread())
.subscribe({
localRemainTime = remainTime!!.toInt() - it.toInt() localRemainTime = remainTime!!.toInt() - it.toInt()
if (localRemainTime == 180) { if (localRemainTime == 180) {
playNoticeMusic(3) playNoticeMusic(3)
...@@ -868,8 +926,21 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi ...@@ -868,8 +926,21 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
if (localRemainTime!! <= 60) { if (localRemainTime!! <= 60) {
if (tv_change_route.isEnabled) { if (tv_change_route.isEnabled) {
tv_change_route.isEnabled = false tv_change_route.isEnabled = false
tv_change_route.setTextColor(ContextCompat.getColor(this, R.color.audioim_color_50ffffff)) tv_change_route.setTextColor(
tv_change_route.setCompoundDrawablesWithIntrinsicBounds(null, null, ContextCompat.getDrawable(this, R.drawable.audioim_img_choose_arrow_unuse), null) ContextCompat.getColor(
this,
R.color.audioim_color_50ffffff
)
)
tv_change_route.setCompoundDrawablesWithIntrinsicBounds(
null,
null,
ContextCompat.getDrawable(
this,
R.drawable.audioim_img_choose_arrow_unuse
),
null
)
} }
} }
tv_remain_time.text = DateUtils.formatTime(localRemainTime.toString()) tv_remain_time.text = DateUtils.formatTime(localRemainTime.toString())
...@@ -912,7 +983,18 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi ...@@ -912,7 +983,18 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
* @param isCall true 拨打 false 取消拨打 * @param isCall true 拨打 false 取消拨打
*/ */
private fun noticeServerPush(isCall: Boolean) { private fun noticeServerPush(isCall: Boolean) {
var msgBean = AudioMessageBean(1, channelId!!, YdlCommonRouterManager.getYdlCommonRoute().getUid().toString(), YdlCommonRouterManager.getYdlCommonRoute().getUserInfo()!!.headUrl, YdlCommonRouterManager.getYdlCommonRoute().getUserInfo()!!.userName, remainTime!!.toInt(), relationId, callId, null, channelId) var msgBean = AudioMessageBean(
1,
channelId!!,
YdlCommonRouterManager.getYdlCommonRoute().getUid().toString(),
YdlCommonRouterManager.getYdlCommonRoute().getUserInfo()!!.headUrl,
YdlCommonRouterManager.getYdlCommonRoute().getUserInfo()!!.userName,
remainTime!!.toInt(),
relationId,
callId,
null,
channelId
)
var cmd = NoticePushCommand() var cmd = NoticePushCommand()
cmd.data = msgBean cmd.data = msgBean
cmd.pushId = listenerUid cmd.pushId = listenerUid
...@@ -941,10 +1023,18 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi ...@@ -941,10 +1023,18 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
sensorManager!!.registerListener(this, sensorManager!!.getDefaultSensor(Sensor.TYPE_PROXIMITY), SensorManager.SENSOR_DELAY_NORMAL) sensorManager!!.registerListener(
this,
sensorManager!!.getDefaultSensor(Sensor.TYPE_PROXIMITY),
SensorManager.SENSOR_DELAY_NORMAL
)
ActionCountUtils.count("shengwang_popup_layer_page|shengwang_popup_layer_page_visit", "", uid = YdlCommonRouterManager.getYdlCommonRoute().getUid().toString()) ActionCountUtils.count(
"shengwang_popup_layer_page|shengwang_popup_layer_page_visit",
"",
uid = YdlCommonRouterManager.getYdlCommonRoute().getUid().toString()
)
} }
override fun onAccuracyChanged(sensor: Sensor?, accuracy: Int) { override fun onAccuracyChanged(sensor: Sensor?, accuracy: Int) {
...@@ -989,10 +1079,20 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi ...@@ -989,10 +1079,20 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
} else { } else {
tv_nte_status.text = msg tv_nte_status.text = msg
if (status == 0) { if (status == 0) {
tv_nte_status.setCompoundDrawablesWithIntrinsicBounds(ContextCompat.getDrawable(this, R.drawable.av_audio_wifi_normal), null, null, null) tv_nte_status.setCompoundDrawablesWithIntrinsicBounds(
ContextCompat.getDrawable(
this,
R.drawable.av_audio_wifi_normal
), null, null, null
)
} }
if (status == 1) { if (status == 1) {
tv_nte_status.setCompoundDrawablesWithIntrinsicBounds(ContextCompat.getDrawable(this, R.drawable.av_audio_wifi_better), null, null, null) tv_nte_status.setCompoundDrawablesWithIntrinsicBounds(
ContextCompat.getDrawable(
this,
R.drawable.av_audio_wifi_better
), null, null, null
)
} }
if (status == -1) { if (status == -1) {
tv_nte_status.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null) tv_nte_status.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null)
...@@ -1034,11 +1134,18 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi ...@@ -1034,11 +1134,18 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
* 上传错误日志 * 上传错误日志
* zhu 洪平要的,判别是移动端主动调的还是声网返的 * zhu 洪平要的,判别是移动端主动调的还是声网返的
*/ */
private fun uploadException(message: String, zhu: String = "", eventType: String = "99", callback: YDLavManager.UploadExceptionCallback?) { private fun uploadException(
message: String,
zhu: String = "",
eventType: String = "99",
callback: YDLavManager.UploadExceptionCallback?
) {
var time: String = (System.currentTimeMillis() / 1000).toString() var time: String = (System.currentTimeMillis() / 1000).toString()
var uid: String = ModularServiceManager.provide(IUserService::class.java).getUserInfo()?.uid!! var uid: String =
ModularServiceManager.provide(IUserService::class.java).getUserInfo()?.uid!!
var payLoad = PayLoad(channelId ?: "0", time, uid, "1", "999", message) var payLoad = PayLoad(channelId ?: "0", time, uid, "1", "999", message)
var connectException = ConnectExceptionCommand(time + zhu, "2", eventType, payLoad, callStatus) var connectException =
ConnectExceptionCommand(time + zhu, "2", eventType, payLoad, callStatus)
YDLavManager.instances.uploadException(connectException, callback) YDLavManager.instances.uploadException(connectException, callback)
} }
......
...@@ -154,7 +154,11 @@ class YDLavManager { ...@@ -154,7 +154,11 @@ class YDLavManager {
RtmStatusCode.LocalInvitationError.LOCAL_INVITATION_ERR_INVITATION_EXPIRE -> { //呼叫邀请过期。被叫 ACK 响应呼叫邀请后 60 秒呼叫邀请未被取消、接受、拒绝,则呼叫邀请过期。 RtmStatusCode.LocalInvitationError.LOCAL_INVITATION_ERR_INVITATION_EXPIRE -> { //呼叫邀请过期。被叫 ACK 响应呼叫邀请后 60 秒呼叫邀请未被取消、接受、拒绝,则呼叫邀请过期。
if (act is AudioHomeActivity) { if (act is AudioHomeActivity) {
act.runOnUiThread { act.runOnUiThread {
sendCustomNotification(response?.calleeId!!, response?.ChannelId!!, "5") sendCustomNotification(
response?.calleeId!!,
response?.ChannelId!!,
"5"
)
callEndStatusUpdate(response.ChannelId!!, 2, "被叫超时未接听") callEndStatusUpdate(response.ChannelId!!, 2, "被叫超时未接听")
act.writeAgoraLog("呼叫失败:${errorCode}") act.writeAgoraLog("呼叫失败:${errorCode}")
act.uploadExceptionStatus("对方未接听", 3) act.uploadExceptionStatus("对方未接听", 3)
...@@ -225,7 +229,11 @@ class YDLavManager { ...@@ -225,7 +229,11 @@ class YDLavManager {
AudioImIn.registerObserveCustomNotification(object : AudioImIn.registerObserveCustomNotification(object :
IMRegisterObserverCustomNotificationCallBack { IMRegisterObserverCustomNotificationCallBack {
override fun onObserverCustomNotification(fromUid: String, toUid: String, content: String) { override fun onObserverCustomNotification(
fromUid: String,
toUid: String,
content: String
) {
LogUtil.e("[agora]收到云信的通知消息:$content") LogUtil.e("[agora]收到云信的通知消息:$content")
val agoraInvitationBean = Gson().fromJson(content, AgoraInvitationBean::class.java) val agoraInvitationBean = Gson().fromJson(content, AgoraInvitationBean::class.java)
...@@ -284,8 +292,16 @@ class YDLavManager { ...@@ -284,8 +292,16 @@ class YDLavManager {
sendCustomNotification(toUid, data, "4") sendCustomNotification(toUid, data, "4")
} }
fun cancelCall(listenerUid: String, channelId: String, data: String, event: (msg: String?, code: Int) -> Unit) { fun cancelCall(
YDLRTMClient.instances.cancelCall(listenerUid, channelId, object : CancelCallStatusListener { listenerUid: String,
channelId: String,
data: String,
event: (msg: String?, code: Int) -> Unit
) {
YDLRTMClient.instances.cancelCall(
listenerUid,
channelId,
object : CancelCallStatusListener {
override fun onFailure(errorMsg: String?, errorCode: Int) { override fun onFailure(errorMsg: String?, errorCode: Int) {
event(errorMsg, errorCode) event(errorMsg, errorCode)
YDLRTMClient.instances.cancelCall(listenerUid, channelId, null) YDLRTMClient.instances.cancelCall(listenerUid, channelId, null)
...@@ -334,7 +350,9 @@ class YDLavManager { ...@@ -334,7 +350,9 @@ class YDLavManager {
.observeOn(AndroidSchedulers.mainThread()).subscribe({ .observeOn(AndroidSchedulers.mainThread()).subscribe({
if ("200".equals(it.code)) { if ("200".equals(it.code)) {
LogUtil.e("[agora]登录av的login-uid:$userId") LogUtil.e("[agora]登录av的login-uid:$userId")
YDLRTMClient.instances.login(LoginParam(userId, it.data.token), object : LoginCallback { YDLRTMClient.instances.login(
LoginParam(userId, it.data.token),
object : LoginCallback {
override fun onSuccess() { override fun onSuccess() {
//登陆成功,发起呼叫 //登陆成功,发起呼叫
LogUtil.e("[agora]实时消息登录成功") LogUtil.e("[agora]实时消息登录成功")
...@@ -348,7 +366,8 @@ class YDLavManager { ...@@ -348,7 +366,8 @@ class YDLavManager {
}) })
} 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)
} }
}, { }, {
LogUtil.e("声网token获取异常uid:" + userId + " error:" + it.message) LogUtil.e("声网token获取异常uid:" + userId + " error:" + it.message)
...@@ -363,7 +382,9 @@ class YDLavManager { ...@@ -363,7 +382,9 @@ class YDLavManager {
if (!TextUtils.isEmpty(content)) { if (!TextUtils.isEmpty(content)) {
//如果已经接听了用户电话 再有电话进来 是不能接听的 //如果已经接听了用户电话 再有电话进来 是不能接听的
if (!activityIsExists(ConsultantAudioHomeActivity::class.java) && !activityIsExists( if (!activityIsExists(ConsultantAudioHomeActivity::class.java) && !activityIsExists(
AudioHomeActivity::class.java)) { AudioHomeActivity::class.java
)
) {
//延时启动通话界面,防止刚打开就被main遮挡 //延时启动通话界面,防止刚打开就被main遮挡
Observable.timer(1000, TimeUnit.MILLISECONDS).subscribeOn(Schedulers.io()) Observable.timer(1000, TimeUnit.MILLISECONDS).subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()).subscribe { .observeOn(AndroidSchedulers.mainThread()).subscribe {
...@@ -426,8 +447,10 @@ class YDLavManager { ...@@ -426,8 +447,10 @@ class YDLavManager {
* 声网出现异常,上传错误日志 connectException * 声网出现异常,上传错误日志 connectException
*/ */
@SuppressLint("CheckResult") @SuppressLint("CheckResult")
fun uploadException(connectException: ConnectExceptionCommand, fun uploadException(
callback: UploadExceptionCallback?) { connectException: ConnectExceptionCommand,
callback: UploadExceptionCallback?
) {
AudioApiRequestUtil.connectException(connectException).subscribeOn(Schedulers.io()) AudioApiRequestUtil.connectException(connectException).subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()).subscribe({ .observeOn(AndroidSchedulers.mainThread()).subscribe({
callback?.onSuccess() callback?.onSuccess()
...@@ -448,8 +471,11 @@ class YDLavManager { ...@@ -448,8 +471,11 @@ class YDLavManager {
fun callEndStatusUpdate(channelId: String, endStatus: Int, msg: String) { fun callEndStatusUpdate(channelId: String, endStatus: Int, msg: String) {
AudioApiRequestUtil.callEndStatusUpdate(channelId, endStatus, msg) AudioApiRequestUtil.callEndStatusUpdate(channelId, endStatus, msg)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()).subscribe({ .observeOn(AndroidSchedulers.mainThread())
.subscribe({
LogUtil.d("callEndStatusUpdate success")
}, { }, {
LogUtil.d("callEndStatusUpdate error: ${it.message}")
}) })
} }
......
...@@ -69,7 +69,8 @@ interface AudioNetAPi { ...@@ -69,7 +69,8 @@ interface AudioNetAPi {
fun listenToken(@FieldMap map: Map<String, String>): Observable<BaseResponse<ListenTokenBean>> fun listenToken(@FieldMap map: Map<String, String>): Observable<BaseResponse<ListenTokenBean>>
@Headers( YDL_DOMAIN + YDL_DOMAIN_JAVA)
@GET("message/call-end/agora") @GET("message/call-end/agora")
fun callEndStatusUpdate(channelId:String,endStatus:Int,msg:String): Observable<BaseResponse<Any>> fun callEndStatusUpdate(@Query("channelId") channelId:String,@Query("endStatus") endStatus:Int,@Query("msg") msg:String): Observable<BaseResponse<Any>>
} }
\ No newline at end of file
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