[Home]

Summary:ASTERISK-06671: New [+context] feature in extensions.conf allowing more stuff to be added to an existing context as the dialplan loads
Reporter:Steve Davies . (stevedavies)Labels:
Date Opened:2006-03-31 00:35:33.000-0600Date Closed:2006-04-04 08:34:12
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Core/Configuration
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) append-to-context.patch.branch-1.2
( 1) append-to-context.patch.trunk
Description:
This has proven very useful in trying to use #include to keep an organised dialplan.
In my case I keep all the dialplan stuff for a particular customer in a separate file.
But without this feature I had to also maintain a separate file which had all the "how to call me" stuff for ALL customers.
This big central file was hard to manage and broke the neat encapsulation that the #include tries to achieve.

With the [+context] feature I can now do the following:

main extensions.conf:
[customer-numbers]



and in the one customer config files:

[+customers-numbers]
exten => 0871234XXX,1,Macro(call-customer,...)

and in another:

[+customer-numbers]
exten => 0871235XXX,1,Macro(call-customer,...)

etc etc.

Now as the dialplan loads, the customer-numbers context gets filled up with each customers' numbers.

Regards,
Steve

****** ADDITIONAL INFORMATION ******


I have attached patches both for trunk and for branch-1.2

trunk revision is 16617
branch-1.2 revision is 16545

my disclaimer is on file.
Comments:By: Olle Johansson (oej) 2006-04-04 03:05:46

This already is possible with the configuration templates!

From doc/configuration.txt:
------------------------
Adding to an existing section
-----------------------------

       [section]
       label = value

       [section](+)
       label2 = value2

In this case, the plus sign indicates that the second section (with the
same name) is an addition to the first section. The second section can
be in another file (by using the #include statement). If the section
name referred to before the plus is missing, the configuration will fail
to load.

By: Olle Johansson (oej) 2006-04-04 03:06:11

So do you add anything beyond the existing feature?

By: Steve Davies . (stevedavies) 2006-04-04 07:55:01

Hi Olle,

My patch I created on 1.2 branch and forward-ported to trunk.  1.2 doesn't have the feature.  When I forward-ported I didn't notice the (+) feature.

So I don't think this patch does anything different; only thing I notice is that my patch creates the context if its not there when the [+context] line is seen.  And I like my syntax better...

I would be happy to have the (+) feature backported into 1.2 though.

Regards,
Steve

By: Olle Johansson (oej) 2006-04-04 08:32:48

As far as I know, the configuration templates are in 1.2 and that's a syntax we have settled for some time now...

Play around with it and have fun. If you want to extend it, please submit a patch :-)

By: Olle Johansson (oej) 2006-04-04 08:33:50

Duplicate of existing functionality in 1.2 and trunk. (See README.configuration in the doc/ directory of 1.2 source code).