[asterisk-users] Using a DB for Configurations

Dovid Bender asteriskusers at dovid.net
Sun Aug 6 06:31:55 MST 2006


The easiest thing is to use the asterisk data base to store variables. Here 
is a short example that I have where people can call in and set if they want 
to be available or not for emergency calls. Below they call in and they set 
if they want to opt in or out. In the dial plan it checks to see if the 
opt'd in or out. If the opt'd in it calls them if not it goes to the next 
prioroty in the dial plan.

exten => _*XX,1,Set(thierexten=${EXTEN:1}) ; They dial * plus thier 
extension the system sets thier extension number to the variable thierexten
exten => _*XX,2,Goto(emergent-opt,s,1)  ; System sends call to the setting 
context (had to transfer to seperate context so that when the user presses 1 
it wont interfear with my reg. dial plan)

[emergent-opt]
exten => s,1,Set(TIMEOUT(digit)=3)
exten => s,2,Set(TIMEOUT(response)=6)
exten => s,3,Background(techmast/to-opt-in-for-emergent) ; Tells them to 
make a selection
exten => 1,1,Set(DB(emergent-opt-${thierexten}/selected)=1) ;If they press 
one it sets that  thier extension is avialable (it sets the value in the DB 
to1)
exten => 1,2,Playback(techmast/been-optd-in-for-emergent) ; Tells them they 
opt'd in
exten => 1,3,Hangup
exten => 2,1,Set(DB(emergent-opt-${thierexten}/selected)=0) ;If they press 
two it sets that thier extension is avialable (it sets DB value to 1)
exten => 2,2,Playback(techmast/been-optd-out-for-emergent)
exten => 2,3,Hangup
exten => t,1,Goto(s,1)
exten => i,1,playback(pbx-invalid)
exten => i,2,goto(s,1,)

Now here is where I see if they want to be botherd or not:

Exten => 1234,1,GotoIf($[${DB(ssn-opt-10/selected)}  = 1]?2:3) ;Checks if 
the option is set to 1, if it is it goes to prioroty 2 which calls the 
person
Exen => 1234,2,Dial(SIP/10) ; Calls the person
Exen => 1234,3,Playback(person-is-busy) ; If they pressed 2 above the value 
was set to 0 and the go to if statement above sends the call to prioroty 3. 
here we politly tell the call that the person is not available.

Also have a look here:
http://www.voip-info.org/wiki/view/Asterisk+database

Good luck !!

Dovid
----- Original Message ----- 
From: "Barry Fawthrop" <barry at ttienterprises.org>
To: "Asterisk Users Mailing List - Non-Commercial Discussion" 
<asterisk-users at lists.digium.com>
Sent: Sunday, August 06, 2006 9:03 AM
Subject: [asterisk-users] Using a DB for Configurations


> Hi All
>
> Is there a benefit to using a database to hold the extensions and sip 
> .conf information/configurations
> or is using the standard Text file just as good and no benefit is 
> received?
>
> Also how does one go about converting the text .conf files to a database, 
> and the have asterisk read it instead ?
>
> Thank all
> B
> _______________________________________________
> --Bandwidth and Colocation provided by Easynews.com --
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-users
>
> 




More information about the asterisk-users mailing list