Page 427 - Asterisk™: The Future of Telephony
P. 427

Sends the call to label1 if condition is true or 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.
               A label can be any one of the following:

                 • A priority, such as 10
                 • An extension and a priority, such as 123,10
                 • A context, extension, and priority, such as incoming,123,10
                 • A named priority within the same extension, such as passed
               Each type of label is explained in this example:
                   [globals]
                   ; set TEST to something else besides 101 to see what GotoIf()
                   ; does when the condition is false
                   TEST=101
                   ;
                   [incoming]
                   ; set a variable
                   ; go to priority 10 if ${TEST} is 101, otherwise go to priority 20
                   exten => 123,1,GotoIf($[ ${TEST} = 101 ]?10:20)
                   exten => 123,10,Playback(the-monkeys-twice)
                   exten => 123,20,Playback(tt-somethingwrong)
                   ;
                   ; same thing as above, but this time we'll specify an extension
                   ; and a priority for each label
                   exten => 124,1,GotoIf($[ ${TEST} = 101 ]?123,10:123,20)
                   ;
                   ; same thing as above, but these labels have a context, extension, and
                   ; priority
                   exten => 125,1,GotoIf($[ ${TEST} = 101 ]?incoming,123,10:incoming,123,20)
                   ;
                   ; same thing as above, but this time we'll go to named priorities
                   exten => 126,1,GotoIf($[ ${TEST} = 101 ]?passed:failed)
                   exten => 126,15(passed),Playback(the-monkeys-twice)
                   exten => 126,25(failed),Playback(the-monkeys-twice)

               See Also
               Goto(), GotoIfTime(), GosubIf(), MacroIf()


               GotoIfTime()                            Conditionally branches, depending on the time and day
               GotoIfTime(times,days_of_week,days_of_month,months?label)

               Branches to the specified extension, if the current time matches the specified time. Each
               of the elements may be specified either as * (for always) or as a range.
               The arguments to this application are:




                                                                           GotoIfTime() | 399
   422   423   424   425   426   427   428   429   430   431   432