GosubIf()

Jumps to the specified priority if a condition is satisfied and allows return.

        
          GosubIf(condition?labeliftrue:labeliffalse)
        
      

Jumps to the specified priority if a condition is satisfied (similar to GotoIf() ) but allows the subroutine to return with Return().

Returns 0 or -1 if the target is invalid.

exten => telcid,1,Set(CALLERID(all)=Widgets <212-555-3412>)
exten => telcid,n,Return()
exten => faxcid,1,Set(CALLERID(all)=Widgets <212-555-3412>)
exten => faxcid,n,Return()

exten => _0.,1,GosubIf($[${CHANNEL:4:2} = 43]?faxcid,1:telcid,1)
exten => _0.,n,Dial(${TRUNK}/${EXTEN:1},,T)
[Note]

Internal help for this application in Asterisk 1.4: 

  -= Info about application 'GosubIf' =- 

[Synopsis]
Conditionally jump to label, saving return address

[Description]
GosubIf(condition?labeliftrue[:labeliffalse])
  If the condition is true, then jump to labeliftrue.  If false, jumps t
o
labeliffalse, if specified.  In either case, a jump saves the return poi
nt
in the dialplan, to be returned to with a Return.

diff output to internal help in Asterisk 1.2: 

5c5
< Conditionally jump to label, saving return address
---
> Jump to label, saving return address

See also. the section called “Gosub(), the section called “Goto(), the section called “GotoIf(), the section called “Return(), the section called “Macro()