summaryrefslogtreecommitdiff
path: root/apps/app_dial.c
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2015-12-04 17:22:29 -0600
committerRichard Mudgett <rmudgett@digium.com>2016-01-04 13:33:37 -0600
commit80a8b2a4cd34f8bd02f3edd07af9316f562463c9 (patch)
treec653681360081e58ca67f63ea3ced958d6662d3d /apps/app_dial.c
parentf42036bf6b4a188dd9a083669c9a00e37203e51c (diff)
app_dial: Immediately exit dial if the caller is already hung up.
If a caller hangs up before dial is executed within an AGI then the AGI has likely eaten all queued frames before executing the dial in DeadAGI mode. With the caller hung up and no pending frames from the caller's read queue, dial would not know that the call has hung up until a called channel answers. It is rather annoying to whoever just answered the non-existent call. Dial should not continue execution in DeadAGI mode, hangup handlers, or the h exten. * Added a check early in dial to abort dialing if the caller has hungup. ASTERISK-25307 #close Reported by: David Cunningham Change-Id: Icd1bc0764726ef8c809f76743ca008d0f102f418
Diffstat (limited to 'apps/app_dial.c')
-rw-r--r--apps/app_dial.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/apps/app_dial.c b/apps/app_dial.c
index d65dcae0a..bc4f8a574 100644
--- a/apps/app_dial.c
+++ b/apps/app_dial.c
@@ -2151,6 +2151,24 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
return -1;
}
+ if (ast_check_hangup_locked(chan)) {
+ /*
+ * Caller hung up before we could dial. If dial is executed
+ * within an AGI then the AGI has likely eaten all queued
+ * frames before executing the dial in DeadAGI mode. With
+ * the caller hung up and no pending frames from the caller's
+ * read queue, dial would not know that the call has hung up
+ * until a called channel answers. It is rather annoying to
+ * whoever just answered the non-existent call.
+ *
+ * Dial should not continue execution in DeadAGI mode, hangup
+ * handlers, or the h exten.
+ */
+ ast_verb(3, "Caller hung up before dial.\n");
+ pbx_builtin_setvar_helper(chan, "DIALSTATUS", "CANCEL");
+ return -1;
+ }
+
parse = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, parse);