GosubIf() — Conditionally branches to a new location, saving the return address.
GosubIf(condition?labeliftrue:labeliffalse)
Based upon the evaluation of condition,
Gosub will branch execution either to
labeliftrue or
labeliffalse. You may return to this same
place in the dialplan by later calling Return.
![]() |
Tip |
|---|---|
The word |
; Specify a default outgoing Caller*ID if one is not set by a specific channel.
exten => _NXXXXXX,1,GosubIf($["${CALLERID(num)}" = ""]?setcallerid,1)
exten => _NXXXXXX,n,Dial(Zap/g1/${EXTEN})
exten => _1NXXNXXXXXX,1,GosubIf($["${CALLERID(num)}" = ""]?setcallerid,1)
exten => _1NXXNXXXXXX,n,Dial(Zap/g1/${EXTEN})
exten => setcallerid,1,Set(CALLERID(num)=6152345678)
exten => setcallerid,n,Return