[asterisk-users] Adding a context from the console

Tilghman Lesher tlesher at digium.com
Thu May 27 13:14:46 CDT 2010


On Thursday 27 May 2010 03:55:05 Lee Archer wrote:
> On Wednesday 19 May 2010 16:44 Tilghman Lesher wrote:
> > On Wednesday 19 May 2010 02:28:02 Lee Archer wrote:
> > > Hi, is it possible to add a context from the console using the
> > > dialplan command?
> >
> > Yes, just add an extension to it.  The context will be created as
> > needed.
>
> Hi, this didn't seem to work.  Is there something I am missing?
>
> dialplan add extension 1234,1,NoOp,hello into default
> Extension '1234,1,NoOp,hello' added into 'default' context
>     -- Added extension '1234' priority 1 to default (0x8e8f520)
>
> dialplan add extension 1234,1,NoOp,hello into test
> Failed to add '1234,1,NoOp,hello' extension into 'test' context

File a bug on this.  The patch is as simple as (attached).

-- 
Tilghman Lesher
Digium, Inc. | Senior Software Developer
twitter: Corydon76 | IRC: Corydon76-dig (Freenode)
Check us out at: www.digium.com & www.asterisk.org
-------------- next part --------------
Index: pbx/pbx_config.c
===================================================================
--- pbx/pbx_config.c	(revision 266141)
+++ pbx/pbx_config.c	(working copy)
@@ -1543,6 +1543,7 @@
 
 	if (!app_data)
 		app_data="";
+	ast_context_find_or_create(NULL, argv[5], registrar);
 	if (ast_add_extension(argv[5], argc == 7 ? 1 : 0, exten, iprior, NULL, cidmatch, app,
 		(void *)strdup(app_data), ast_free_ptr, registrar)) {
 		switch (errno) {


More information about the asterisk-users mailing list