[Asterisk-code-review] apps/app_dial.c: HANGUPCAUSE reason code for CANCEL is set to AST_CAU... (asterisk[16])
Friendly Automation
asteriskteam at digium.com
Mon Dec 6 09:22:23 CST 2021
Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/16347 )
Change subject: apps/app_dial.c: HANGUPCAUSE reason code for CANCEL is set to AST_CAUSE_NORMAL_CLEARING
......................................................................
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
---
M apps/app_dial.c
1 file changed, 16 insertions(+), 6 deletions(-)
Approvals:
Joshua Colp: Looks good to me, but someone else must approve
Kevin Harwell: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
Friendly Automation: Approved for Submit
diff --git a/apps/app_dial.c b/apps/app_dial.c
index 38b1b08..c7ea34b 100644
--- a/apps/app_dial.c
+++ b/apps/app_dial.c
@@ -1146,6 +1146,7 @@
char privcid[256];
char privintro[1024];
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)
@@ -1702,6 +1703,7 @@
/* Got hung up */
*to = -1;
strcpy(pa->status, "CANCEL");
+ pa->canceled = 1;
publish_dial_end_event(in, out_chans, NULL, pa->status);
if (f) {
if (f->data.uint32) {
@@ -1726,6 +1728,7 @@
*to = 0;
*result = f->subclass.integer;
strcpy(pa->status, "CANCEL");
+ pa->canceled = 1;
publish_dial_end_event(in, out_chans, NULL, pa->status);
ast_frfree(f);
ast_channel_unlock(in);
@@ -1742,6 +1745,7 @@
ast_verb(3, "User requested call disconnect.\n");
*to = 0;
strcpy(pa->status, "CANCEL");
+ pa->canceled = 1;
publish_dial_end_event(in, out_chans, NULL, pa->status);
ast_frfree(f);
if (is_cc_recall) {
@@ -2222,7 +2226,7 @@
struct ast_channel *peer;
int to; /* timeout */
struct cause_args num = { chan, 0, 0, 0 };
- int cause;
+ int cause, hanguptreecause = -1;
struct ast_bridge_config config = { { 0, } };
struct timeval calldurationlimit = { 0, };
@@ -2231,6 +2235,7 @@
.sentringing = 0,
.privdb_val = 0,
.status = "INVALIDARGS",
+ .canceled = 0,
};
int sentringing = 0, moh = 0;
const char *outbound_group = NULL;
@@ -3329,11 +3334,16 @@
}
ast_channel_early_bridge(chan, NULL);
- /* forward 'answered elsewhere' if we received it */
- hanguptree(&out_chans, NULL,
- ast_channel_hangupcause(chan) == AST_CAUSE_ANSWERED_ELSEWHERE
- || ast_test_flag64(&opts, OPT_CANCEL_ELSEWHERE)
- ? AST_CAUSE_ANSWERED_ELSEWHERE : -1);
+ /* forward 'answered elsewhere' if we received it */
+ if (ast_channel_hangupcause(chan) == AST_CAUSE_ANSWERED_ELSEWHERE || ast_test_flag64(&opts, OPT_CANCEL_ELSEWHERE)) {
+ hanguptreecause = AST_CAUSE_ANSWERED_ELSEWHERE;
+ } else if (pa.canceled) { /* Caller canceled */
+ 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);
ast_debug(1, "Exiting with DIALSTATUS=%s.\n", pa.status);
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/16347
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: Ib653aec2282f55b59d87484391cc07c8e6612b89
Gerrit-Change-Number: 16347
Gerrit-PatchSet: 10
Gerrit-Owner: Mark Petersen <bugs.digium.com at zombie.dk>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Mark Petersen <bugs.digium.com at zombie.dk>
Gerrit-CC: Sean Bright <sean at seanbright.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20211206/89d88831/attachment.html>
More information about the asterisk-code-review
mailing list