Asterisk GoToIf

Home » Asterisk Users » Asterisk GoToIf
Asterisk Users 7 Comments

This application will set the current context, extension, and priority in the channel structure based on the evaluation of the given condition. After this application completes, the pbx engine will continue dialplan execution at the specified location in the dialplan. The labels are specified with the same syntax as used within the Goto application. If the label chosen by the condition is omitted, no jump is performed, and the execution passes to the next instruction. If the target location is bogus, and does not exist, the execution engine will try to find and execute the code in the i (invalid) extension in the current context. If that does not exist, it will try to execute the h extension. If neither the h nor i extensions have been defined, the channel is hung up, and the execution of instructions on the channel is terminated. Remember that this command can set the current context, and if the context specified does not exist, then it will not be able to find any ‘h’ or ‘i’ extensions there, and the channel and call will both be terminated!.

Syntax

GotoIf(condition?[labeliftrue][:labeliffalse])
Arguments
  • condition
  • destination
    • labeliftrue – Continue at labeliftrue if the condition is true.
    • labeliffalse – Continue at labeliffalse if the condition is false.

 

7 thoughts on - Asterisk GoToIf

  • No, it is not a space issue, I tried:

    exten => s,3,GotoIf($[“${CALLERID(num)}”=”4715665”]?4:6)

    but it still goes to priority “6”

  • Joseph wrote:

    Yours on the top, mine on the bottom.

    GotoIf($[“${CALLERID(num)}” = “4715665”]?4:6)
    GotoIf($[“${CALLERID(num)}” = “4715665” ]?4:6)

    If that wasn’t it, then lets see your console output

    Doug

  • On Wed, 29 Dec 2010 16:41:17 -0700
    Joseph wrote:

    Have you verified the value of CALLERID(num) by passing it to Verbose?
    Could it be that there are blanks? If you put this line in:

    exten => s,3,Verbose(3,CALLERID(num) is :${CALLERID(num)}:);

    …you would see if there are any blanks between the colons. Then you
    can match it exactly.