[asterisk-dev] Defining new section type in sip.conf - question about syntax
Kaloyan Kovachev
kkovachev at varna.net
Thu Apr 16 03:23:15 CDT 2009
On Wed, 15 Apr 2009 17:51:56 -0400, Jared Smith wrote
> On Wed, 2009-04-15 at 16:17 -0500, John Todd wrote:
> > I'm not in favor of overloading the names to have separate meanings by
> > construction of the name itself in a place where the name is otherwise
> > free-form. XML starts to look appealing after staring at these
> > problems for too long.
>
> Well, from somebody sick and twisted enough to write books in XML, I'll
> add my 2 centi-dollars (with a nod to our metric friends). And no, I
> don't think XML would help us any here. :-)
>
> > I'd like to see either a separate config file (not my favorite idea)
> > or type= or perhaps even some separate value definition. (domain=
> > would be good, but we've already used that for other purposes, sort-of.)
>
> The problem here is that you wouldn't ever have a section that had both
> type= and this new setting (let's call it domaintemplate for lack of a
> better term). The sections with this new setting are going to look very
> much like the [general] section in sip.conf already does...
>
> So, in a nutshell, I think the question comes down to this: how do we
> differentiate between different kinds of *sections* within a config
> file. In rough pseudo-config files, I imagine the choices come down to
> one of the following (and I apologize in advance for the length).
>
> (Oh, and one more thing... Olle, if I've totally messed this up, please
> forgive me!)
>
> === Option #1 ===
> Use a separate config file
>
> sip_domains.conf
> --
> [jaredsmith.net]
> bindaddr=10.1.2.3
> bindport=5060
> domain=jaredsmith.net
> pedantic=yes
> context=verysecure
>
> [astrinomicon.com]
> bindaddr=192.168.123.222
> bindport=5070
> domain=astrinomicon.com
> autodomain=yes
> pedantic=no
> context=notdefault
>
> sip.conf
> --
> [general]
> ; snip
>
> [authentication]
> ; snip
>
> [george]
> domaintemplate=general
> type=friend
> context=blah
> username=georgejones
> secret=n0tnum3r1c
> disallow=all
> allow=ulaw
>
> [fred]
> domaintemplate=jaredsmith.net
> type=user
> context=blah
> secret=supersecret_955
>
> === Option #2 ===
> Try to combine both domaintemplate and user/peer/friend sections into
> the same configuration file, and use something other than type= to set
> them apart.
>
> sip.conf
> --
> [general]
> ; snip
>
> [authentication]
> ; snip
>
> [jaredsmith.net]
> thissectionisadomain=yes; and not a user/peer/friend
> bindaddr=10.1.2.3
> bindport=5060
> domain=jaredsmith.net
> pedantic=yes
> context=verysecure
>
> [astrinomicon.com]
> thissectionisadomain=yes; and not a user/peer/friend
> bindaddr=192.168.123.222
> bindport=5070
> domain=astrinomicon.com
> autodomain=yes
> pedantic=no
> context=notdefault
>
> [george]
> domaintemplate=general
> type=friend
> context=blah
> username=georgejones
> secret=n0tnum3r1c
> disallow=all
> allow=ulaw
>
> [fred]
> domaintemplate=jaredsmith.net
> type=user
> context=blah
> secret=supersecret_955
>
> === Option #3 ===
> Overload type= to use it for domain sections as well:
>
> [general]
> ; snip
>
> [authentication]
> ; snip
>
> [jaredsmith.net]
> type=domaintemplate ; and not a user/peer/friend
> bindaddr=10.1.2.3
> bindport=5060
> domain=jaredsmith.net
> pedantic=yes
> context=verysecure
>
> [astrinomicon.com]
> type=domaintemplate ; and not a user/peer/friend
> bindaddr=192.168.123.222
> bindport=5070
> domain=astrinomicon.com
> autodomain=yes
> pedantic=no
> context=notdefault
>
> [george]
> domaintemplate=general
> type=friend
> context=blah
> username=georgejones
> secret=n0tnum3r1c
> disallow=all
> allow=ulaw
>
> [fred]
> domaintemplate=jaredsmith.net
> type=user
> context=blah
> secret=supersecret_955
>
What about option prefix (using underscore as it is invalid char for domain)
in the general section
=== Option #4 ===
[general]
; some other options
domain_foo.bar_bindaddr=1.2.3.4
domain_foo.bar_bindport=5066
OR with name=val like for setvar
=== Option #5 ===
[general]
; some other options
domain_foo.bar=bindaddr=1.2.3.4
domain_foo.bar=bindport=5066
> --
> Jared Smith
> Training Manager
> Digium, Inc.
>
> _______________________________________________
> --Bandwidth and Colocation Provided by http://www.api-digital.com--
>
> asterisk-dev mailing list
> To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-dev
More information about the asterisk-dev
mailing list