[asterisk-users] Question on AEL2 string comparisons

Satish Barot satish4asterisk at gmail.com
Thu Jul 4 01:14:48 CDT 2013


On Thu, Jul 4, 2013 at 12:24 AM, James B. Byrne <byrnejb at harte-lyne.ca>wrote:

> I have this code in a dial plan:
>
> exten => _417XX,n,GotoIf($["${CALLERID(num)}" >
> "SIP/41799"]?notfromlocal)
> exten => _417XX,n,GotoIf($["${CALLERID(num)}" <
> "SIP/41700"]?notfromlocal)
>
> The value of "${CALLERID(num)}" appears to be "SIP/41712-00000181"
>
>     -- Executing [41720 at from-internal:5] GotoIf("SIP/41712-00000181",
> "0?notfromlocal") in new stack
>     -- Executing [41720 at from-internal:6] GotoIf("SIP/41712-00000181",
> "1?notfromlocal") in new stack
>     -- Goto (from-internal,41720,8
>
> This value is evidently comparing to be less than "SIP/41799" as
> expected but also is considered less than "SIP/41700" as well, which
> is not expected (by me).  What am I doing wrong here?
>
> What I am attempting to accomplish is to detect calls originally made
> from internal extension numbers in the range 41700..41799 inclusive.
> What is the correct method to accomplish this?
>
> James B. Byrne
>

${CALLERID(num)} should give you only number and not technology i.e. 41712.

Give this a shot,

exten => _417XX,n,Noop(CALLERIDNUM=${CALLERID(num)})
exten => _417XX,n,GotoIf($[$["${CALLERID(num)}" > "41799"] |
$["${CALLERID(num)}" < "41700"]]?notfromlocal:)

--Satish Barot
Ahmedabad, India
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20130704/2874e477/attachment.htm>


More information about the asterisk-users mailing list