[asterisk-commits] tilghman: branch 1.4 r310435 - /branches/1.4/pbx/pbx_ael.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Sat Mar 12 14:22:14 CST 2011
Author: tilghman
Date: Sat Mar 12 14:22:07 2011
New Revision: 310435
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=310435
Log:
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:
branches/1.4/pbx/pbx_ael.c
Modified: branches/1.4/pbx/pbx_ael.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.4/pbx/pbx_ael.c?view=diff&rev=310435&r1=310434&r2=310435
==============================================================================
--- branches/1.4/pbx/pbx_ael.c (original)
+++ branches/1.4/pbx/pbx_ael.c Sat Mar 12 14:22:07 2011
@@ -4502,6 +4502,30 @@
static int aeldebug = 0;
+#ifndef STANDALONE_AEL
+static char *aelsub = "AELSub";
+static char *aelsub_synopsis = "Launch subroutine built with AEL";
+static char *aelsub_descrip =
+"AELSub(<macroname>[|<args>])\n"
+"Execute the named subroutine, defined in AEL, from another dialplan language,\n"
+"such as extensions.conf or Realtime extensions.\n\n"
+"The purpose of this application is to provide a sane entry point into AEL\n"
+"subroutines, the implementation of which may change from time to time.\n";
+
+static int aelsub_exec(struct ast_channel *chan, void *vdata)
+{
+ char *data = ast_strdupa(vdata);
+ struct ast_app *macro = pbx_findapp("Macro");
+ if (macro) {
+ if (strncmp(data, "macro-", 6) == 0) {
+ data += 6;
+ }
+ return pbx_exec(chan, macro, data);
+ }
+ return -1;
+}
+#endif
+
/* interface stuff */
/* if all the below are static, who cares if they are present? */
@@ -4620,12 +4644,18 @@
{
ast_context_destroy(NULL, registrar);
ast_cli_unregister_multiple(cli_ael, sizeof(cli_ael) / sizeof(struct ast_cli_entry));
+#ifndef STANDALONE_AEL
+ ast_unregister_application(aelsub);
+#endif
return 0;
}
static int load_module(void)
{
ast_cli_register_multiple(cli_ael, sizeof(cli_ael) / sizeof(struct ast_cli_entry));
+#ifndef STANDALONE_AEL
+ ast_register_application(aelsub, aelsub_exec, aelsub_synopsis, aelsub_descrip);
+#endif
return (pbx_load_module());
}
More information about the asterisk-commits
mailing list