[asterisk-commits] dbrooks: branch 1.6.2 r205287 - in /branches/1.6.2: ./ main/features.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jul 8 13:19:03 CDT 2009


Author: dbrooks
Date: Wed Jul  8 13:18:59 2009
New Revision: 205287

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=205287
Log:
Merged revisions 205254 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
  r205254 | dbrooks | 2009-07-08 12:26:26 -0500 (Wed, 08 Jul 2009) | 8 lines
  
  Fixes Park() argument handling
  
  Park() was not respecting the arguments passed to it. Any extension/context/priority
  given to it was being ignored. This patch remedies this.
  
  (closes issue #15380)
  Reported by: DLNoah
........

Modified:
    branches/1.6.2/   (props changed)
    branches/1.6.2/main/features.c

Propchange: branches/1.6.2/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.2/main/features.c
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.6.2/main/features.c?view=diff&rev=205287&r1=205286&r2=205287
==============================================================================
--- branches/1.6.2/main/features.c (original)
+++ branches/1.6.2/main/features.c Wed Jul  8 13:18:59 2009
@@ -202,7 +202,8 @@
 	char exten[AST_MAX_EXTENSION];
 	int priority;
 	int parkingtime;                            /*!< Maximum length in parking lot before return */
-	int notquiteyet;
+	unsigned int notquiteyet:1;
+	unsigned int options_specified:1;
 	char peername[1024];
 	unsigned char moh_trys;
 	struct ast_parkinglot *parkinglot;
@@ -733,13 +734,20 @@
 
 	/* Remember what had been dialed, so that if the parking
 	   expires, we try to come back to the same place */
+
+	pu->options_specified = (!ast_strlen_zero(args->return_con) || !ast_strlen_zero(args->return_ext) || args->return_pri);
+
+	/* If extension has options specified, they override all other possibilities
+	such as the returntoorigin flag and transferred context. Information on
+	extension options is lost here, so we set a flag */
+
 	ast_copy_string(pu->context, 
 		S_OR(args->return_con, S_OR(chan->macrocontext, chan->context)), 
 		sizeof(pu->context));
 	ast_copy_string(pu->exten, 
 		S_OR(args->return_ext, S_OR(chan->macroexten, chan->exten)), 
 		sizeof(pu->exten));
-	pu->priority = pu->priority ? pu->priority : 
+	pu->priority = args->return_pri ? args->return_pri : 
 		(chan->macropriority ? chan->macropriority : chan->priority);
 
 	/* If parking a channel directly, don't quiet yet get parking running on it.
@@ -3038,13 +3046,18 @@
 
 					ast_add_extension2(con, 1, peername_flat, 1, NULL, NULL, "Dial", ast_strdup(returnexten), ast_free_ptr, registrar);
 				}
-				if (comebacktoorigin) {
-					set_c_e_p(chan, pu->parkinglot->parking_con_dial, peername_flat, 1);
+				if (pu->options_specified == 1) {
+					/* Park() was called with overriding return arguments, respect those arguments */
+					set_c_e_p(chan, pu->context, pu->exten, pu->priority);
 				} else {
-					ast_log(LOG_WARNING, "now going to parkedcallstimeout,s,1 | ps is %d\n",pu->parkingnum);
-					snprintf(parkingslot, sizeof(parkingslot), "%d", pu->parkingnum);
-					pbx_builtin_setvar_helper(chan, "PARKINGSLOT", parkingslot);
-					set_c_e_p(chan, "parkedcallstimeout", peername_flat, 1);
+					if (comebacktoorigin) {
+						set_c_e_p(chan, pu->parkinglot->parking_con_dial, peername_flat, 1);
+					} else {
+						ast_log(LOG_WARNING, "now going to parkedcallstimeout,s,1 | ps is %d\n",pu->parkingnum);
+						snprintf(parkingslot, sizeof(parkingslot), "%d", pu->parkingnum);
+						pbx_builtin_setvar_helper(chan, "PARKINGSLOT", parkingslot);
+						set_c_e_p(chan, "parkedcallstimeout", peername_flat, 1);
+					}
 				}
 			} else {
 				/* They've been waiting too long, send them back to where they came.  Theoretically they




More information about the asterisk-commits mailing list