提交 89e3a7bb authored 作者: Anthony Minessale's avatar Anthony Minessale

FS-9979: [verto.js] When verto client rejects a call returns hangup cause…

FS-9979: [verto.js] When verto client rejects a call returns hangup cause NORMAL_CLEARING #comment passing neither cause or causeCode will result in normal clearing, passing either one of cause or causeCode will result in that value being passed and parsed on the server side, if the cause is valid it will be accepted otherwise it will try to validate causeCode instead, if neither are true it defaults to normal clearing #resolve
上级 197bbd8c
This diff was suppressed by a .gitattributes entry.
......@@ -228,7 +228,7 @@ var callbacks = {
});
$("#declinebtn").click(function() {
cur_call.hangup();
cur_call.hangup({"cause": "CALL_REJECTED"});
$('#dialog-incoming-call').dialog('close');
});
......
......@@ -2194,14 +2194,6 @@
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);
}
......@@ -2321,6 +2313,10 @@
}
}
if (!dialog.cause && !dialog.causeCode) {
dialog.cause = "NORMAL_CLEARING";
}
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) {
......
This diff was suppressed by a .gitattributes entry.
......@@ -874,7 +874,7 @@ var callbacks = {
});
$("#declinebtn").click(function() {
cur_call.hangup();
cur_call.hangup({"cause": "CALL_REJECTED"});
$('#dialog-incoming-call').dialog('close');
});
......
This diff was suppressed by a .gitattributes entry.
......@@ -565,7 +565,7 @@ var callbacks = {
});
$("#declinebtn").click(function() {
cur_call.hangup();
cur_call.hangup({"cause": "CALL_REJECTED"});
$('#dialog-incoming-call').dialog('close');
});
......
......@@ -2766,11 +2766,11 @@ static switch_bool_t verto__answer_func(const char *method, cJSON *params, jsock
static switch_bool_t verto__bye_func(const char *method, cJSON *params, jsock_t *jsock, cJSON **response)
{
cJSON *obj = cJSON_CreateObject();
cJSON *obj = cJSON_CreateObject(), *causeObj = NULL;
switch_core_session_t *session;
cJSON *dialog = NULL;
const char *call_id = NULL, *cause_str = NULL;
int err = 0;
int err = 0, got_cause = 0;
switch_call_cause_t cause = SWITCH_CAUSE_NORMAL_CLEARING;
*response = obj;
......@@ -2795,6 +2795,24 @@ static switch_bool_t verto__bye_func(const char *method, cJSON *params, jsock_t
if (check != SWITCH_CAUSE_NONE) {
cause = check;
got_cause = 1;
}
}
if (!got_cause && (causeObj = cJSON_GetObjectItem(params, "causeCode"))) {
int check = 0;
const char *cause_str = NULL;
if (!zstr(causeObj->valuestring)) {
check = atoi(causeObj->valuestring);
} else if (causeObj->valueint) {
check = causeObj->valueint;
}
cause_str = switch_channel_cause2str((switch_call_cause_t)check);
if (!zstr(cause_str) && strcasecmp(cause_str, "unknown")) {
cause = (switch_call_cause_t) check;
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论