【发布时间】:2016-04-26 05:51:12
【问题描述】:
我正在处理 quickblox 视频通话,我在创建新会话时将“名称”作为来自网络的用户信息中的键传递:
$(document).on('click', '.j-call', function(e) {
var recp_login=$("#recipient_login").val();
var recp_id=$("#recipient_id").val();
var params = { 'login':'ravindra.gupta' , 'password': 'ravi@agicent'};
QB.createSession(params, function(err, result) {
if(!err){
var extension={
"userInfo": {
"coachname":app.caller.full_name,
"coachid":uid,
"coachimage":coachimg,
"message":app.caller.full_name + " is calling you"
}
};
app.currentSession.call(extension, function (error) {
if (error) {
console.warn(error.detail);
}
}
});
}
在 android 端,我从内部的用户信息中获取名称
public void onReceiveNewSession(final QBRTCSession session) {
if (getCurrentSession() == null) {
Log.e(TAG, "Start new session");
session.getUserInfo().get("coachname");
}
}
当用户关闭(挂断)呼叫时,我正在传递更多信息(“状态”),我使用以下代码:
/** Hangup */
$(document).on('click', '.j-hangup', function() {
if(!_.isEmpty(app.currentSession)) {
var extension={
"userInfo": {
"state":'Paused'
}
};
app.currentSession.update(extension);
app.currentSession.stop(extension,function(){});
app.currentSession = {};
$(".msg_board").show();
qbApp.MsgBoard.update('call has pauzed');
}
});
但在 onReceiveHangUpFromUser() 函数内部的 android 端,我无法获取新数据(“状态”),我总是得到 null。
public void onReceiveHangUpFromUser(final QBRTCSession session,
final Integer userID) {
if (session.equals(getCurrentSession())) {
String state = session.getUserInfo().get("state");
}
}
请帮我解决这个问题。
【问题讨论】: