[Asterisk-code-review] app dial: Immediately exit dial if the caller is already hun... (asterisk[master])

Joshua Colp asteriskteam at digium.com
Tue Jan 5 05:55:17 CST 2016


Joshua Colp has submitted this change and it was merged.

Change subject: app_dial: Immediately exit dial if the caller is already hung up.
......................................................................


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
---
M apps/app_dial.c
1 file changed, 18 insertions(+), 0 deletions(-)

Approvals:
  Mark Michelson: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, approved



diff --git a/apps/app_dial.c b/apps/app_dial.c
index 540f662..11591bd 100644
--- a/apps/app_dial.c
+++ b/apps/app_dial.c
@@ -2151,6 +2151,24 @@
 		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);

-- 
To view, visit https://gerrit.asterisk.org/1904
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Icd1bc0764726ef8c809f76743ca008d0f102f418
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>



More information about the asterisk-code-review mailing list