[asterisk-dev] Defining new section type in sip.conf - question about syntax

Olle E. Johansson oej at edvina.net
Wed Apr 15 03:01:07 CDT 2009


14 apr 2009 kl. 23.23 skrev Russell Bryant:

> Kevin P. Fleming wrote:
>> Olle E. Johansson wrote:
>>
>>> I personally favour #1, even though it's not very beautiful. It's  
>>> used
>>> today in Asterisk.
>>
>> I prefer that as well, although there is of course the risk that the
>> chosen naming pattern will conflict with actual peer/user entry names
>> that some user is already using.
>
> I actually disagree.
>
> Personally, I would prefer option #2 (type=domain) versus option #1
> ([domain_<whatever>]).  In both cases, you're defining what type of
> object it is.  In option #2, you're just encoding the object type into
> the context name, where as with type=domain you're being much more
> explicit about it.
>
> There are certainly examples of both methods being used in Asterisk.
> However, I think the type=something method is used more often, is more
> explicit, and is more palatable.
>
> I also don't think that type=domain implies realtime support.  When
> setting up realtime in extconfig.conf, each realtime family is pretty
> explicit about what is being stored there (sippeers, for example).
>
>> There is a third option, not necessarily prettier, but that is to  
>> just
>> create another configuration file (sip_domains.conf or something
>> similar). The Asterisk configuration mechanism is really only  
>> designed
>> to handle one type of 'object' per configuration file, and even the
>> example you specified for extensions.conf they are still all the same
>> type of 'object' (a dialplan context), they just have different  
>> semantic
>> meaning.
>
> I'm sort of neutral on this idea.  If you go with multiple  
> configuration
> files for chan_sip (or any other module), it does buy you another  
> level
> in your tree of config.  There is even a precedent for this example
> today for SIP (sip_notify.conf).
>
> However, I'm not convinced there is a problem with defining object  
> type
> with type= syntax.  People can still split it up into multiple files  
> if
> they want to using #includes.

Well, there is a coding issue. I need to have all domains in memory  
before
I define devices. Having type= means more processing than just  
grabbing all
section names and parsing the ones that start with a well-known prefix.
Currently we only used type= for device types. Using it for something
different will be hard to explain in trainings (believe me, I've been  
doing
many, many trainings - and logic in configuration is important).

The section prefix is ugly, but easier to handle in the code. The  
type= I personally
think is confusing and a bad solution. Having a separate config file
makes more sense to me, given the syntax confusion.

Anyone else that can come up with another way, that works within
the syntax we already have or similar?

/O





More information about the asterisk-dev mailing list