[Asterisk-Users] Conditional Contexts

Brancaleoni Matteo mbrancaleoni at espia.it
Tue Jul 15 10:03:50 MST 2003


Hi.

Il mar, 2003-07-15 alle 18:52, Derek Beaumont ha scritto:
> 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.


*CLI> show application GotoIf
                                                                                
  -= Info about application 'GotoIf' =-
                                                                                
[Synopsis]:
  Conditional goto
                                                                                
[Description]:
  GotoIf(Condition?label1:label2): Go to label 1 if condition is
true, to label2 if condition is false. Either label1 or label2 may be
omitted (in that case, we just don't take the particular branch) but not
both.  Look for the condition syntax in examples or documentation.
*CLI>


> 
> 
> 
> 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.
> 
> 
> _______________________________________________
> Asterisk-Users mailing list
> Asterisk-Users at lists.digium.com
> http://lists.digium.com/mailman/listinfo/asterisk-users
-- 
Matteo Brancaleoni
Espia System Administrator - IT services
Website : http://www.espia.it
Email   : mbrancaleoni at espia.it
                                                                                





More information about the asterisk-users mailing list