[asterisk-users] GotoIf Problem
Dave Fullerton
dfullertasterisk at shorelinecontainer.com
Fri Jul 18 12:05:32 CDT 2008
Doug Lytle wrote:
> Everybody,
>
> I have a fall though context that, among other things, tests to see if
> someone it trying to pick up a non-existent parked call (Defined from 90
> to 99). I have the following:
>
> [not-in-service]
>
> exten => _X.,1,Wait(1)
> exten => _X.,n,ResetCDR()
>
> ; **************************************************
> ; Check to see if the mis-dialed number was a parking
> ; slot. If so, jump to the not-parked context
> ; **************************************************
>
> exten => _X.,n,GotoIf($["${EXTEN}" = "90"]?not-parked,s,1)
> exten => _X.,n,GotoIf($["${EXTEN}" = "91"]?not-parked,s,1)
> exten => _X.,n,GotoIf($["${EXTEN}" = "92"]?not-parked,s,1)
> exten => _X.,n,GotoIf($["${EXTEN}" = "93"]?not-parked,s,1)
> exten => _X.,n,GotoIf($["${EXTEN}" = "94"]?not-parked,s,1)
> exten => _X.,n,GotoIf($["${EXTEN}" = "95"]?not-parked,s,1)
> exten => _X.,n,GotoIf($["${EXTEN}" = "96"]?not-parked,s,1)
> exten => _X.,n,GotoIf($["${EXTEN}" = "97"]?not-parked,s,1)
> exten => _X.,n,GotoIf($["${EXTEN}" = "98"]?not-parked,s,1)
> exten => _X.,n,GotoIf($["${EXTEN}" = "99"]?not-parked,s,1)
>
> I'd like to move it to just one line, such as:
>
> exten => _X.,n,GotoIf($["${EXTEN}" = "9?"]?not-parked,s,1)
>
> But, I'm not finding a way to do this. Any suggestions?
>
> Doug
>
>
How about something like this:
exten => _X.,n,GotoIf($["${EXTEN:0:1}" = "9"]?not-parked,s,1)
You may need to tweak the extension pattern as this will match anything
that begins with 9.
-Dave
More information about the asterisk-users
mailing list