mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-03 03:20:57 +00:00
apps/app_dial.c: HANGUPCAUSE reason code for CANCEL is set to AST_CAUSE_NORMAL_CLEARING
changed that when we recive a CANCEL that we set HANGUPCAUSE to AST_CAUSE_NORMAL_CLEARING ASTERISK-28053 Reported by: roadkill Change-Id: Ib653aec2282f55b59d87484391cc07c8e6612b89
This commit is contained in:
committed by
Friendly Automation
parent
f872750add
commit
fc321db1f8
@@ -1146,6 +1146,7 @@ struct privacy_args {
|
|||||||
char privcid[256];
|
char privcid[256];
|
||||||
char privintro[1024];
|
char privintro[1024];
|
||||||
char status[256];
|
char status[256];
|
||||||
|
int canceled;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void publish_dial_end_event(struct ast_channel *in, struct dial_head *out_chans, struct ast_channel *exception, const char *status)
|
static void publish_dial_end_event(struct ast_channel *in, struct dial_head *out_chans, struct ast_channel *exception, const char *status)
|
||||||
@@ -1718,6 +1719,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
|
|||||||
/* Got hung up */
|
/* Got hung up */
|
||||||
*to = -1;
|
*to = -1;
|
||||||
strcpy(pa->status, "CANCEL");
|
strcpy(pa->status, "CANCEL");
|
||||||
|
pa->canceled = 1;
|
||||||
publish_dial_end_event(in, out_chans, NULL, pa->status);
|
publish_dial_end_event(in, out_chans, NULL, pa->status);
|
||||||
if (f) {
|
if (f) {
|
||||||
if (f->data.uint32) {
|
if (f->data.uint32) {
|
||||||
@@ -1742,6 +1744,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
|
|||||||
*to = 0;
|
*to = 0;
|
||||||
*result = f->subclass.integer;
|
*result = f->subclass.integer;
|
||||||
strcpy(pa->status, "CANCEL");
|
strcpy(pa->status, "CANCEL");
|
||||||
|
pa->canceled = 1;
|
||||||
publish_dial_end_event(in, out_chans, NULL, pa->status);
|
publish_dial_end_event(in, out_chans, NULL, pa->status);
|
||||||
ast_frfree(f);
|
ast_frfree(f);
|
||||||
ast_channel_unlock(in);
|
ast_channel_unlock(in);
|
||||||
@@ -1759,6 +1762,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
|
|||||||
ast_verb(3, "User requested call disconnect.\n");
|
ast_verb(3, "User requested call disconnect.\n");
|
||||||
*to = 0;
|
*to = 0;
|
||||||
strcpy(pa->status, "CANCEL");
|
strcpy(pa->status, "CANCEL");
|
||||||
|
pa->canceled = 1;
|
||||||
publish_dial_end_event(in, out_chans, NULL, pa->status);
|
publish_dial_end_event(in, out_chans, NULL, pa->status);
|
||||||
ast_frfree(f);
|
ast_frfree(f);
|
||||||
if (is_cc_recall) {
|
if (is_cc_recall) {
|
||||||
@@ -2241,7 +2245,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
|
|||||||
struct ast_channel *peer = NULL;
|
struct ast_channel *peer = NULL;
|
||||||
int to; /* timeout */
|
int to; /* timeout */
|
||||||
struct cause_args num = { chan, 0, 0, 0 };
|
struct cause_args num = { chan, 0, 0, 0 };
|
||||||
int cause;
|
int cause, hanguptreecause = -1;
|
||||||
|
|
||||||
struct ast_bridge_config config = { { 0, } };
|
struct ast_bridge_config config = { { 0, } };
|
||||||
struct timeval calldurationlimit = { 0, };
|
struct timeval calldurationlimit = { 0, };
|
||||||
@@ -2250,6 +2254,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
|
|||||||
.sentringing = 0,
|
.sentringing = 0,
|
||||||
.privdb_val = 0,
|
.privdb_val = 0,
|
||||||
.status = "INVALIDARGS",
|
.status = "INVALIDARGS",
|
||||||
|
.canceled = 0,
|
||||||
};
|
};
|
||||||
int sentringing = 0, moh = 0;
|
int sentringing = 0, moh = 0;
|
||||||
const char *outbound_group = NULL;
|
const char *outbound_group = NULL;
|
||||||
@@ -3350,11 +3355,16 @@ out:
|
|||||||
}
|
}
|
||||||
|
|
||||||
ast_channel_early_bridge(chan, NULL);
|
ast_channel_early_bridge(chan, NULL);
|
||||||
/* forward 'answered elsewhere' if we received it */
|
/* forward 'answered elsewhere' if we received it */
|
||||||
hanguptree(&out_chans, NULL,
|
if (ast_channel_hangupcause(chan) == AST_CAUSE_ANSWERED_ELSEWHERE || ast_test_flag64(&opts, OPT_CANCEL_ELSEWHERE)) {
|
||||||
ast_channel_hangupcause(chan) == AST_CAUSE_ANSWERED_ELSEWHERE
|
hanguptreecause = AST_CAUSE_ANSWERED_ELSEWHERE;
|
||||||
|| ast_test_flag64(&opts, OPT_CANCEL_ELSEWHERE)
|
} else if (pa.canceled) { /* Caller canceled */
|
||||||
? AST_CAUSE_ANSWERED_ELSEWHERE : -1);
|
if (ast_channel_hangupcause(chan))
|
||||||
|
hanguptreecause = ast_channel_hangupcause(chan);
|
||||||
|
else
|
||||||
|
hanguptreecause = AST_CAUSE_NORMAL_CLEARING;
|
||||||
|
}
|
||||||
|
hanguptree(&out_chans, NULL, hanguptreecause);
|
||||||
pbx_builtin_setvar_helper(chan, "DIALSTATUS", pa.status);
|
pbx_builtin_setvar_helper(chan, "DIALSTATUS", pa.status);
|
||||||
ast_debug(1, "Exiting with DIALSTATUS=%s.\n", pa.status);
|
ast_debug(1, "Exiting with DIALSTATUS=%s.\n", pa.status);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user