[Asterisk-Users] Conditional Contexts

Derek Beaumont dbeaumont at telantek.com
Tue Jul 15 09:52:31 MST 2003


Follow up question:
Could you explain the following line:
exten => s,4,GotoIf(${notte}?5:6)
I really don't know what ?5:6 means.



yes, see the db app.
you can have a main context from which you go to
context A or B depending on a var stored in the db.

here's a snippet of my extension.conf
(I use that to switch into/from 'night' state)

Inbound calls falls into:
[inbound]
exten => s,1,Wait(1)
exten => s,2,agi,cid_lookup.agi
exten => s,3,DBget(notte=ServizioNotte/status)
exten => s,4,GotoIf(${notte}?5:6)
exten => s,5,Goto(espia_chiuso_full,s,1)
exten => s,6,Goto(telecom,s,1)

and in my local context, I can set the status via:

;
; night service
; 7000 enable ; 7001 disable
; 7002 get status
;
exten => 7000,1,Authenticate(1234) 
exten => 7000,2,DBput(ServizioNotte/status=1)
exten => 7000,3,Hangup
exten => 7001,1,Authenticate(1234)
exten => 7001,2,DBput(ServizioNotte/status=0) 
exten => 7001,3,Hangup
exten => 7002,1,DBget(notte=ServizioNotte/status)
exten => 7002,2,Answer
exten => 7002,3,SayDigits(${notte})
exten => 7002,4,Hangup


That's all ;)

Matteo.





More information about the asterisk-users mailing list