[asterisk-dev] Bug or by design: Inheritance of templates and categories in config files.

Kevin P. Fleming kpfleming at digium.com
Tue Jan 4 13:03:03 CST 2011


On 01/04/2011 09:33 AM, Michel Verbraak wrote:
> During testing of an application I'm developing I found that asterisk
> does not load template categories in config files as specified in the
> main/config.c file.
>
> In this file it is specified as following:
>
> /* Actually parse the entry */
> if (cur[0] == '[') { /* A category header */
> /* format is one of the following:
> * [foo] define a new category named 'foo'
> * [foo](!) define a new template category named 'foo'
> * [foo](+) append to category 'foo', error if foo does not exist.
> * [foo](a) define a new category and inherit from template a.
> * You can put a comma-separated list of templates and '!' and '+'
> * between parentheses, with obvious meaning.
> */
>
>
> But if I configure this:
> [testA]
> exten => testA,1,NoOp(testA)
>
> [testB](testA)
> exten => testB,1,NoOp(testB)
>
> The end result is that category "testA" is inherited by category "testB"
> without being defined as a template category "(!)".

A 'template category' is just a convenience feature, it's not required 
for inheritance. The (!) marker just makes the category *only* usable 
for inheritance, it is made invisible to the consumer of the 
configuration file being parsed. Any category can be inherited.

-- 
Kevin P. Fleming
Digium, Inc. | Director of Software Technologies
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
skype: kpfleming | jabber: kfleming at digium.com
Check us out at www.digium.com & www.asterisk.org



More information about the asterisk-dev mailing list