提交 ab292dc3 authored 作者: Anthony Minessale's avatar Anthony Minessale

add some more signal tracking to verto

上级 236233d2
......@@ -156,6 +156,7 @@
<button data-inline="true" id="clearbtn">Clear</button>
<button data-inline="true" id="callbtn">Call</button>
<br><br>
<div style="color:blue" id="main_info">&nbsp;</div><br><br>
<img src="img/verto_black_web.gif" width="300"><br><br>
<button data-inline="true"id="logoutbtn">Log Out</button>
</div>
......
This diff was suppressed by a .gitattributes entry.
......@@ -145,7 +145,9 @@ var callbacks = {
goto_page("incall");
break;
case $.verto.enum.state.hangup:
$("#main_info").html("Call ended with cause: " + d.cause);
case $.verto.enum.state.destroy:
$("#hangup_cause").html("");
clearConfMan();
goto_page("main");
cur_call = null;
......@@ -251,6 +253,8 @@ $("#callbtn").click(function() {
return;
}
$("#main_info").html("Trying");
cur_call = verto.newCall({
destination_number: $("#ext").val(),
caller_id_name: $("#name").val(),
......
......@@ -421,13 +421,13 @@
switch (data.method) {
case 'verto.bye':
dialog.hangup();
dialog.hangup(data.params);
break;
case 'verto.answer':
dialog.handleAnswer(data.params.sdp);
dialog.handleAnswer(data.params);
break;
case 'verto.media':
dialog.handleMedia(data.params.sdp);
dialog.handleMedia(data.params);
break;
case 'verto.display':
dialog.handleDisplay(data.params);
......@@ -1537,6 +1537,14 @@
dialog.lastState = dialog.state;
dialog.state = state;
if (!dialog.causeCode) {
dialog.causeCode = 16;
}
if (!dialog.cause) {
dialog.cause = "NORMAL CLEARING";
}
if (dialog.callbacks.onDialogState) {
dialog.callbacks.onDialogState(this);
......@@ -1613,9 +1621,19 @@
};
$.verto.dialog.prototype.hangup = function(sdp) {
$.verto.dialog.prototype.hangup = function(params) {
var dialog = this;
if (params) {
if (params.causeCode) {
dialog.causeCode = params.causeCode;
}
if (params.cause) {
dialog.cause = params.cause;
}
}
if (dialog.state.val > $.verto.enum.state.new.val && dialog.state.val < $.verto.enum.state.hangup.val) {
dialog.setState($.verto.enum.state.hangup);
} else if (dialog.state.val < $.verto.enum.state.destroy) {
......@@ -1761,7 +1779,7 @@
}
};
$.verto.dialog.prototype.handleAnswer = function(sdp) {
$.verto.dialog.prototype.handleAnswer = function(params) {
var dialog = this;
if (dialog.state.val >= $.verto.enum.state.active.val) {
......@@ -1771,14 +1789,14 @@
if (dialog.state.val >= $.verto.enum.state.early.val) {
dialog.setState($.verto.enum.state.active);
} else {
dialog.rtc.answer(sdp, function() {
dialog.rtc.answer(params.sdp, function() {
dialog.setState($.verto.enum.state.active);
},
function(e) {
console.error(e);
dialog.hangup();
});
console.log("ANSWER SDP", sdp);
console.log("ANSWER SDP", params.sdp);
}
};
......@@ -1815,21 +1833,21 @@
dialog.sendMessage($.verto.enum.message.display, {});
};
$.verto.dialog.prototype.handleMedia = function(sdp) {
$.verto.dialog.prototype.handleMedia = function(params) {
var dialog = this;
if (dialog.state.val >= $.verto.enum.state.early.val) {
return;
}
dialog.rtc.answer(sdp, function() {
dialog.rtc.answer(params.sdp, function() {
dialog.setState($.verto.enum.state.early);
},
function(e) {
console.error(e);
dialog.hangup();
});
console.log("EARLY SDP", sdp);
console.log("EARLY SDP", params.sdp);
};
$.verto.ENUM = function(s) {
......
......@@ -1416,7 +1416,12 @@ static switch_status_t verto_on_hangup(switch_core_session_t *session)
// get the jsock and send hangup notice
if (!tech_pvt->remote_hangup_cause && (jsock = get_jsock(tech_pvt->jsock_uuid))) {
cJSON *msg = jrpc_new_req("verto.bye", tech_pvt->call_id, NULL);
cJSON *params = NULL;
cJSON *msg = jrpc_new_req("verto.bye", tech_pvt->call_id, &params);
switch_call_cause_t cause = switch_channel_get_cause(tech_pvt->channel);
cJSON_AddItemToObject(params, "causeCode", cJSON_CreateNumber(cause));
cJSON_AddItemToObject(params, "cause", cJSON_CreateString(switch_channel_cause2str(cause)));
ws_write_json(jsock, &msg, SWITCH_TRUE);
switch_thread_rwlock_unlock(jsock->rwlock);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论