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

Tilghman Lesher tilghman at meg.abyt.es
Tue Jan 4 13:42:32 CST 2011


On Tuesday 04 January 2011 09:33:53 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 "(!)".
> 
> If this is a Bug one line should be changed. For version 1.8.1.1
> line 1010                                         base =
> category_get(cfg, cur, 1);
> to    base = category_get(cfg, cur, 0)
> 
> Or if it is by design the comment on line 950 should be changed to
> "define a new category and inherit from category a" and line 948 can be
> deleted.
> 
> Should I report a bug and include the patch file? If so which of the
> two.

It's not a bug.  Any context can be a template.  The notation "(!)" after
the context name specifies that the following settings are not to be created
as a separate context.  That is, it's not denoting a template, but instead
preventing the set of values from being interpreted as a distinct context.

-- 
Tilghman



More information about the asterisk-dev mailing list