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",
//以下 几乎不会动 //以下 几乎不会动
......
...@@ -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)
...@@ -224,8 +228,12 @@ class YDLavManager { ...@@ -224,8 +228,12 @@ 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,16 +292,24 @@ class YDLavManager { ...@@ -284,16 +292,24 @@ 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,
override fun onFailure(errorMsg: String?, errorCode: Int) { channelId: String,
event(errorMsg, errorCode) data: String,
YDLRTMClient.instances.cancelCall(listenerUid, channelId, null) event: (msg: String?, code: Int) -> Unit
} ) {
YDLRTMClient.instances.cancelCall(
listenerUid,
channelId,
object : CancelCallStatusListener {
override fun onFailure(errorMsg: String?, errorCode: Int) {
event(errorMsg, errorCode)
YDLRTMClient.instances.cancelCall(listenerUid, channelId, null)
}
override fun onSuccess() { override fun onSuccess() {
} }
}) })
callEndStatusUpdate(channelId, 1, "主叫取消呼叫") callEndStatusUpdate(channelId, 1, "主叫取消呼叫")
sendCustomNotification(listenerUid, data, "3") sendCustomNotification(listenerUid, data, "3")
...@@ -304,16 +320,16 @@ class YDLavManager { ...@@ -304,16 +320,16 @@ class YDLavManager {
infoBean.data = data infoBean.data = data
infoBean.callType = callType infoBean.callType = callType
AudioImIn.sendCustomNotification(toUid, Gson().toJson(infoBean), AudioImIn.sendCustomNotification(toUid, Gson().toJson(infoBean),
object : IMSendCustomNotificationResultCallBack { object : IMSendCustomNotificationResultCallBack {
override fun onException(throwable: Throwable) { override fun onException(throwable: Throwable) {
} }
override fun onFailed(code: Int) { override fun onFailed(code: Int) {
} }
override fun onSuccess() { override fun onSuccess() {
} }
}) })
} }
fun login(userId: String?) { fun login(userId: String?) {
...@@ -331,10 +347,12 @@ class YDLavManager { ...@@ -331,10 +347,12 @@ class YDLavManager {
//登录实时消息 //登录实时消息
//获取token //获取token
AudioApiRequestUtil.getAgoraToken().subscribeOn(Schedulers.io()) AudioApiRequestUtil.getAgoraToken().subscribeOn(Schedulers.io())
.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]实时消息登录成功")
...@@ -346,13 +364,14 @@ class YDLavManager { ...@@ -346,13 +364,14 @@ class YDLavManager {
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)
}, { }
LogUtil.e("声网token获取异常uid:" + userId + " error:" + it.message) }, {
}) LogUtil.e("声网token获取异常uid:" + userId + " error:" + it.message)
})
} }
/** /**
...@@ -363,17 +382,19 @@ class YDLavManager { ...@@ -363,17 +382,19 @@ 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 {
LogUtil.e("[agora]启动通话界面") LogUtil.e("[agora]启动通话界面")
//邀请加入频道消息,跳转通话界面 //邀请加入频道消息,跳转通话界面
ARouter.getInstance().build("/av/ConsultantAudioHomeActivity") ARouter.getInstance().build("/av/ConsultantAudioHomeActivity")
.withString("param", content).navigation() .withString("param", content).navigation()
AudioLogUtils.writeAgoraLog("收到主叫方通话邀请($from)", FILE_NAME, false) AudioLogUtils.writeAgoraLog("收到主叫方通话邀请($from)", FILE_NAME, false)
} }
} else { } else {
LogUtil.d("[agora]收到声网邀请,但界面实例已存在") LogUtil.d("[agora]收到声网邀请,但界面实例已存在")
} }
...@@ -426,14 +447,16 @@ class YDLavManager { ...@@ -426,14 +447,16 @@ 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()
}, { }, {
LogUtil.e("agora", "声网上传异常与错误日志接口调用失败:" + it.message) LogUtil.e("agora", "声网上传异常与错误日志接口调用失败:" + it.message)
}) })
} }
/** /**
...@@ -447,10 +470,13 @@ class YDLavManager { ...@@ -447,10 +470,13 @@ class YDLavManager {
@SuppressLint("CheckResult") @SuppressLint("CheckResult")
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