[asterisk-commits] branch bweschke/bug_5657 - r7454 /team/bweschke/bug_5657/apps/app_dial.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Dec 12 23:55:59 CST 2005


Author: bweschke
Date: Mon Dec 12 23:55:53 2005
New Revision: 7454

URL: http://svn.digium.com/view/asterisk?rev=7454&view=rev
Log:
 Code update/import for this issue. Original bug #5657. Objective: provide an additional option in Dial to prevent Asterisk upon acting on call forward requests when it receives them.

Modified:
    team/bweschke/bug_5657/apps/app_dial.c

Modified: team/bweschke/bug_5657/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_5657/apps/app_dial.c?rev=7454&r1=7453&r2=7454&view=diff
==============================================================================
--- team/bweschke/bug_5657/apps/app_dial.c (original)
+++ team/bweschke/bug_5657/apps/app_dial.c Mon Dec 12 23:55:53 2005
@@ -160,6 +160,8 @@
 "           party until the called channel has answered.\n"
 "    S(x) - Hang up the call after 'x' seconds *after* the called party has\n"
 "           answered the call.\n"  	
+"    i    - Asterisk will ignore any forwarding requests it may receive on this\n"
+"           dial attempt.\n"
 "    t    - Allow the called party to transfer the calling party by sending the\n"
 "           DTMF sequence defiend in features.conf.\n"
 "    T    - Allow the calling party to transfer the called party by sending the\n"
@@ -210,6 +212,7 @@
 	OPT_CALLEE_MONITOR = (1 << 21),
 	OPT_CALLER_MONITOR = (1 << 22),
 	OPT_GOTO = (1 << 23),
+	OPT_IGNORE_FORWARDING = (1 << 24),
 } dial_exec_option_flags;
 
 #define DIAL_STILLGOING			(1 << 30)
@@ -249,6 +252,7 @@
 	AST_APP_OPTION_ARG('P', OPT_PRIVACY, OPT_ARG_PRIVACY),
 	AST_APP_OPTION('r', OPT_RINGBACK),
 	AST_APP_OPTION_ARG('S', OPT_DURATION_STOP, OPT_ARG_DURATION_STOP),
+	AST_APP_OPTION('i', OPT_IGNORE_FORWARDING),
 	AST_APP_OPTION('t', OPT_CALLEE_TRANSFER),
 	AST_APP_OPTION('T', OPT_CALLER_TRANSFER),
 	AST_APP_OPTION('w', OPT_CALLEE_MONITOR),
@@ -442,7 +446,7 @@
 						       DIAL_NOFORWARDHTML);
 				}
 			} else if (o->chan && (o->chan == winner)) {
-				if (!ast_strlen_zero(o->chan->call_forward)) {
+				if (!ast_strlen_zero(o->chan->call_forward) && !ast_test_flag(&opts, OPT_IGNORE_FORWARDING)) {
 					char tmpchan[256];
 					char *stuff;
 					char *tech;
@@ -538,7 +542,12 @@
 					/* Hangup the original channel now, in case we needed it */
 					ast_hangup(winner);
 					continue;
+				} else if (ast_test_flag(&opts, OPT_IGNORE_FORWARDING)) {
+					if (option_verbose > 2)
+						ast_verbose(VERBOSE_PREFIX_3 "Forwarding %s to '%s/%s' prevented by dial option 'i'\n", in->name, tech, stuff);
+					o->chan = NULL;
 				}
+
 				f = ast_read(winner);
 				if (f) {
 					if (f->frametype == AST_FRAME_CONTROL) {
@@ -1015,7 +1024,7 @@
 			continue;
 		}
 		pbx_builtin_setvar_helper(tmp->chan, "DIALEDPEERNUMBER", numsubst);
-		if (!ast_strlen_zero(tmp->chan->call_forward)) {
+		if (!ast_strlen_zero(tmp->chan->call_forward) && !ast_test_flag(&opts, OPT_IGNORE_FORWARDING)) {
 			char tmpchan[256];
 			char *stuff;
 			char *tech;
@@ -1050,7 +1059,14 @@
 				cur = rest;
 				continue;
 			}
-		}
+		} else if (ast_test_flag(&opts, OPT_IGNORE_FORWARDING)) {
+			if (option_verbose > 2)
+				ast_verbose(VERBOSE_PREFIX_3 "Forwarding %s to '%s/%s' prevented by dial option 'i'\n", chan->name, tech, stuff);
+			ast_hangup(tmp->chan);
+			cur = rest;
+			continue;
+		}
+		
 
 		/* Inherit specially named variables from parent channel */
 		ast_channel_inherit_variables(chan, tmp->chan);



More information about the asterisk-commits mailing list