[asterisk-users] Re: ${CALLERIDNUM}

Leo Ann Boon
Thu, 02 Nov 2006 17:28:15 -0000

Benny Amorsen wrote:
>>>>>> "SP" == Scott Pinhorne
<scott@scottpinhorne.co.uk> writes:
>>>>>>
>
> SP> I am setting up my phones so that if the callerID is 3 digits the
> SP> phones ring one way if it is more than 3 digits it rings another
> SP> i.e. internal calls and external calls.
>
> SP> exten => 2222,1,GotoIf($["${CALLERIDNUM}" =
"1111"]?5)
>
> SP> This will tell it to jump to 5 if callerID if 1111 but how do i
> SP> tell it do jump based on length of callerID?
>
> There has been lots of answers to this one, but how about simply:
>
> exten => 2222/XXX,1,Goto(threedigits)
> exten => 2222/XX,1,Goto(twodigits)
> exten => 2222/.,1, ...
>
One of the earlier replies suggested using the LEN function, an example:
exten => 2222,1,GotoIf(LEN(${CALLERID(num)}) = 3?4)

This will jump to priority 4 if extension is 3 digits

Leo