[asterisk-commits] jrose: trunk r312678 - in /trunk: CHANGES pbx/pbx_config.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Apr 4 12:32:10 CDT 2011
Author: jrose
Date: Mon Apr 4 12:32:05 2011
New Revision: 312678
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=312678
Log:
Makes 'dialplan add extension' create the specified context if it does not already exist.
If the user invokes 'dialplan add extension' into a non-existing context, the context will be created
and a message informing the user of the context being created will be issued in cli.
(closes issue #17431)
Reported by: leearcher
Patches:
context_auto_create.diff uploaded by kobaz (license 834)
Tested by: leearcher, kobaz, jrose
Modified:
trunk/CHANGES
trunk/pbx/pbx_config.c
Modified: trunk/CHANGES
URL: http://svnview.digium.com/svn/asterisk/trunk/CHANGES?view=diff&rev=312678&r1=312677&r2=312678
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Mon Apr 4 12:32:05 2011
@@ -39,6 +39,8 @@
gtalk.conf.
* The 'logger reload' command now supports an optional argument, specifying an
alternate configuration file to use.
+ * 'dialplan add extension' command will now automatically create a context if
+ the specified context does not exist with a message indicated it did so.
CDR
--------------------------
Modified: trunk/pbx/pbx_config.c
URL: http://svnview.digium.com/svn/asterisk/trunk/pbx/pbx_config.c?view=diff&rev=312678&r1=312677&r2=312678
==============================================================================
--- trunk/pbx/pbx_config.c (original)
+++ trunk/pbx/pbx_config.c Mon Apr 4 12:32:05 2011
@@ -969,6 +969,16 @@
if (!exten || !prior || !app || (!app_data && iprior != PRIORITY_HINT))
return CLI_SHOWUSAGE;
+ if (!ast_context_find(a->argv[5])) {
+ ast_cli(a->fd, "Context '%s' did not exist prior to add extension - the context will be created.\n", a->argv[5]);
+ }
+
+ if (!ast_context_find_or_create(NULL, NULL, a->argv[5], registrar)) {
+ ast_cli(a->fd, "ast_context_find_or_create() failed\n");
+ ast_cli(a->fd, "Failed to add '%s,%s,%s,%s' extension into '%s' context\n", exten, prior, app, app_data, a->argv[5]);
+ return CLI_FAILURE;
+ }
+
if (!app_data)
app_data="";
if (ast_add_extension(a->argv[5], a->argc == 7 ? 1 : 0, exten, iprior, NULL, cidmatch, app,
More information about the asterisk-commits
mailing list