[asterisk-commits] tilghman: trunk r310500 - in /trunk: ./ pbx/pbx_ael.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Mar 12 14:42:38 CST 2011


Author: tilghman
Date: Sat Mar 12 14:42:33 2011
New Revision: 310500

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=310500
Log:
Merged revisions 310462 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.8

................
  r310462 | tilghman | 2011-03-12 14:27:54 -0600 (Sat, 12 Mar 2011) | 45 lines
  
  Merged revisions 310448 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.6.2
  
  ................
    r310448 | tilghman | 2011-03-12 14:24:54 -0600 (Sat, 12 Mar 2011) | 38 lines
    
    Recorded merge of revisions 310435 via svnmerge from 
    https://origsvn.digium.com/svn/asterisk/branches/1.4
    
    ........
      r310435 | tilghman | 2011-03-12 14:22:07 -0600 (Sat, 12 Mar 2011) | 31 lines
      
      Add AELSub, which provides a stable entry point into AEL subroutines.
      
      This commit needs some explanation, given that we're adding a new application
      into an existing release branch.  This is generally a violation of our release
      policy, except in very limited circumstances, and I believe this is one of
      those circumstances.
      
      The problem that this solves is one of the sanity of using multiple dialplan
      languages to define a dialplan.  In the case of the reporter, he or she is
      using AEL is define subroutines, while using Realtime extensions to invoke
      those subroutines.  While you can do this, it's based upon the reality of AEL
      using actual dialplan extensions; however, there is no guarantee that the
      details of _how_ AEL is compiled into extensions will remain stable.  In fact,
      at the time of this commit, it has already changed twice, once in a
      fundamental way.
      
      Now normally, a new application would only be added to trunk.  However, this
      application is explicitly to create a stable user-level API between versions,
      and adding it to trunk only will not solve the user's problem of switching
      between 1.6.2 and 1.8, nor will it help anybody switching from 1.8 to 1.10.
      Therefore, it needs to go into existing release branches.  For the sake of
      consistency, and also because one of the changes was between 1.4 and 1.6.x,
      I am also electing to commit this to 1.4.
      
      (closes issue #18910)
       Reported by: alexandrekeller
       Patches: 
             20110304__issue18919__1.6.2.diff.txt uploaded by tilghman (license 14)
             20110304__issue18919__1.4.diff.txt uploaded by tilghman (license 14)
       Tested by: alexandrekeller
    ........
  ................
................

Modified:
    trunk/   (props changed)
    trunk/pbx/pbx_ael.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.

Modified: trunk/pbx/pbx_ael.c
URL: http://svnview.digium.com/svn/asterisk/trunk/pbx/pbx_ael.c?view=diff&rev=310500&r1=310499&r2=310500
==============================================================================
--- trunk/pbx/pbx_ael.c (original)
+++ trunk/pbx/pbx_ael.c Sat Mar 12 14:42:33 2011
@@ -54,6 +54,26 @@
 #ifdef AAL_ARGCHECK
 #include "asterisk/argdesc.h"
 #endif
+
+/*** DOCUMENTATION
+	<application name="AELSub" language="en_US">
+		<synopsis>
+			Launch subroutine built with AEL
+		</synopsis>
+		<syntax>
+			<parameter name="routine" required="true">
+				<para>Named subroutine to execute.</para>
+			</parameter>
+			<parameter name="args" required="false" />
+		</syntax>
+		<description>
+			<para>Execute the named subroutine, defined in AEL, from another dialplan
+			language, such as extensions.conf, Realtime extensions, or Lua.</para>
+			<para>The purpose of this application is to provide a sane entry point into
+			AEL subroutines, the implementation of which may change from time to time.</para>
+		</description>
+	</application>
+ ***/
 
 /* these functions are in ../ast_expr2.fl */
 
@@ -107,6 +127,27 @@
 static int aeldebug = 0;
 
 /* interface stuff */
+
+#ifndef STANDALONE
+static char *aelsub = "AELSub";
+
+static int aelsub_exec(struct ast_channel *chan, const char *vdata)
+{
+	char buf[256], *data = ast_strdupa(vdata);
+	struct ast_app *gosub = pbx_findapp("Gosub");
+	AST_DECLARE_APP_ARGS(args,
+		AST_APP_ARG(name);
+		AST_APP_ARG(args);
+	);
+
+	if (gosub) {
+		AST_STANDARD_RAW_ARGS(args, data);
+		snprintf(buf, sizeof(buf), "%s,~~s~~,1(%s)", args.name, args.args);
+		return pbx_exec(chan, gosub, buf);
+	}
+	return -1;
+}
+#endif
 
 /* if all the below are static, who cares if they are present? */
 
@@ -224,12 +265,18 @@
 {
 	ast_context_destroy(NULL, registrar);
 	ast_cli_unregister_multiple(cli_ael, ARRAY_LEN(cli_ael));
+#ifndef STANDALONE
+	ast_unregister_application(aelsub);
+#endif
 	return 0;
 }
 
 static int load_module(void)
 {
 	ast_cli_register_multiple(cli_ael, ARRAY_LEN(cli_ael));
+#ifndef STANDALONE
+	ast_register_application_xml(aelsub, aelsub_exec);
+#endif
 	return (pbx_load_module());
 }
 




More information about the asterisk-commits mailing list