[asterisk-users] chan_sip and database integration

John Todd jtodd at digium.com
Tue Feb 24 14:10:06 CST 2009


On Feb 24, 2009, at 12:33 PM, Klaus Darilion wrote:
> Johansson Olle E wrote:
>> 24 feb 2009 kl. 11.31 skrev Michiel van Baak:
>>> On 10:56, Tue 24 Feb 09, Klaus Darilion wrote:
>>>> Hi!
>>>>
>>>> I tried to understand how chan_sip can be configured by means of a
>>>> database. I found these 2 different approaches (please correct me
>>>> if I
>>>> am wrong):
>>>>
>>>> static configuration: the sip.conf file is mapped to a database
>>>> table.
>>>> The table contains one line for each line in sip.conf.
>>>>
>>>> realtime configuration: the peers/users are stored in the database
>>>> using
>>>> a single line for each peer/user.
>>>>
>>>>
>>>> "Static" does not eases provisioning as configuring a SIP peer/user
>>>> using this approach is really complicated - it is just a method to
>>>> store
>>>> .conf files in database.
>>>>
>>>> "realtime" really eases provisioning of SIP peers/users. You only
>>>> have
>>>> to insert/update/delete a single line. But functionality is
>>>> different -
>>>> there are limitations as these objects are not stored in memory
>>>> (can be
>>>> cached), for example device status information.
>>>>
>>>>
>>>> What I am looking for is a method to provision peers/users with a
>>>> single
>>>> line in the database, but without limitations. Thus, the peers need
>>>> not
>>>> to be realtime but are loaded on "sip reload".
>>>>
>>>> So is there a possiblity to have static peer/users configuration
>>>> using a
>>>> nice and easy way?
>>> Store them in a database and use a combination of cron and some
>>> scripting to generate the configuration files.
>>>
>>> Some advice: keep track if an update has been done to the database
>>> since
>>> last reload and only regen files and issue a reload when this is  
>>> true.
>>
>> I think this is what FreePBX does.
>
> But wouldn't it be great for Asterisk to support the realtime DB  
> schema
> also for static peers/users?
>
> klaus


Of course, it would be great!  It sounds like this is of some value to  
you, and I expect it would be useful to others, as well.  So there is  
a high incentive for someone to code it - maybe you!  :-)

Another solution, though I don't think it does what you want, would be  
to use the "#exec" command in your configuration files, which then  
calls a script to build the config file.

Honestly, I don't know if #exec gets called every time that the  
dialplan is reloaded - I'd assume the answer to this is "yes" but I  
can't test - see PPS below.

PS: Remember to enable #exec mode in /etc/asterisk/asterisk.conf - it  
is disabled by default.

PPS: It seems that #exec is broken in SVN-TRUNK.  I've posted a bug. http://bugs.digium.com/view.php?id=14542

JT

---
John Todd                       email:jtodd at digium.com
Digium, Inc. | Asterisk Open Source Community Director
445 Jan Davis Drive NW -  Huntsville AL 35806  -   USA
direct: +1-256-428-6083         http://www.digium.com/






More information about the asterisk-users mailing list