[asterisk-commits] jpeeler: trunk r235265 - in /trunk: CHANGES main/manager.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Dec 15 18:31:57 CST 2009


Author: jpeeler
Date: Tue Dec 15 18:31:53 2009
New Revision: 235265

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=235265
Log:
Enhance AMI redirect to allow channels to be redirected to different places.

New parameters ExtraContext, ExtraExtension, and ExtraPriority have been added
to redirect the second channel to a different location. Previously, it was only
possible to redirect both channels to the same place.

(closes issue #15853)
Reported by: haakon
Patches:
      trunk-manager.c.patch uploaded by haakon (license 880)
Tested by: jpeeler

Modified:
    trunk/CHANGES
    trunk/main/manager.c

Modified: trunk/CHANGES
URL: http://svnview.digium.com/svn/asterisk/trunk/CHANGES?view=diff&rev=235265&r1=235264&r2=235265
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Tue Dec 15 18:31:53 2009
@@ -306,6 +306,9 @@
  * The configuration file manager.conf now supports a channelvars option, which
    specifies a list of channel variables to include in each channel-oriented
    event.
+ * The redirect command now has new parameters ExtraContext, ExtraExtension, 
+   and ExtraPriority to allow redirecting the second channel to a different
+   location than the first.
 
 Channel Event Logging
 ---------------------

Modified: trunk/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/manager.c?view=diff&rev=235265&r1=235264&r2=235265
==============================================================================
--- trunk/main/manager.c (original)
+++ trunk/main/manager.c Tue Dec 15 18:31:53 2009
@@ -353,11 +353,20 @@
 			<parameter name="Exten" required="true">
 				<para>Extension to transfer to.</para>
 			</parameter>
+			<parameter name="ExtraExten">
+				<para>Extension to transfer extrachannel to (optional).</para>
+			</parameter>
 			<parameter name="Context" required="true">
 				<para>Context to transfer to.</para>
 			</parameter>
+			<parameter name="ExtraContext">
+				<para>Context to transfer extrachannel to (optional).</para>
+			</parameter>
 			<parameter name="Priority" required="true">
 				<para>Priority to transfer to.</para>
+			</parameter>
+			<parameter name="ExtraPriority">
+				<para>Priority to transfer extrachannel to (optional).</para>
 			</parameter>
 		</syntax>
 		<description>
@@ -3054,10 +3063,13 @@
 	const char *name = astman_get_header(m, "Channel");
 	const char *name2 = astman_get_header(m, "ExtraChannel");
 	const char *exten = astman_get_header(m, "Exten");
+	const char *exten2 = astman_get_header(m, "ExtraExten");
 	const char *context = astman_get_header(m, "Context");
+	const char *context2 = astman_get_header(m, "ExtraContext");
 	const char *priority = astman_get_header(m, "Priority");
+	const char *priority2 = astman_get_header(m, "ExtraPriority");
 	struct ast_channel *chan, *chan2 = NULL;
-	int pi = 0;
+	int pi, pi2 = 0;
 	int res;
 
 	if (ast_strlen_zero(name)) {
@@ -3068,6 +3080,13 @@
 	if (!ast_strlen_zero(priority) && (sscanf(priority, "%30d", &pi) != 1)) {
 		if ((pi = ast_findlabel_extension(NULL, context, exten, priority, NULL)) < 1) {
 			astman_send_error(s, m, "Invalid priority");
+			return 0;
+		}
+	}
+
+	if (!ast_strlen_zero(priority2) && (sscanf(priority2, "%30d", &pi2) != 1)) {
+		if ((pi2 = ast_findlabel_extension(NULL, context2, exten2, priority2, NULL)) < 1) {
+			astman_send_error(s, m, "Invalid ExtraPriority");
 			return 0;
 		}
 	}
@@ -3111,7 +3130,11 @@
 					ast_set_flag(chan2, AST_FLAG_BRIDGE_HANGUP_DONT); /* don't let the after-bridge code run the h-exten */
 					ast_channel_unlock(chan2);
 				}
-				res = ast_async_goto(chan2, context, exten, pi);
+				if (context2) {
+					res = ast_async_goto(chan2, context2, exten2, pi2);
+				} else {
+					res = ast_async_goto(chan2, context, exten, pi);
+				}
 			} else {
 				res = -1;
 			}




More information about the asterisk-commits mailing list