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

Leif Madsen leif.madsen at asteriskdocs.org
Thu Apr 16 10:59:01 CDT 2009


Jared Smith wrote:
> (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

This looks fairly sane to me.

> === 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

I like this too. I'd be happy with either Option #1 or #2 at this point. You 
could easily use an #include here to make it act like option #1 if you don't 
like having everything in one file.

> === 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

I can agree that this probably doesn't make a lot of sense if we have the first 
2 options now, although personally I don't find the use of 'type=domain' to be 
all that confusing... but I can see why it might be confusing to other people 
because it's really more of a template than an object I guess. There's no way to 
use the templating system here is there? Or even something that appear like the 
template system?

[jaredsmith.net](!domain)

?

-- 
Leif Madsen.
http://www.leifmadsen.com
http://www.oreilly.com/catalog/asterisk



More information about the asterisk-dev mailing list