[asterisk-users] GotoIf Dialplan inquiry

Gordon Henderson gordon+asterisk at drogon.net
Tue Jun 12 14:03:03 CDT 2007


On Tue, 12 Jun 2007, Steve Finkelstein wrote:

> Hi all,
>
> I have the following in my extensions.conf:
>
> exten => s,4,GotoIf($["${CALLERID(number)}" = "8585979857" |
> "8585970327"]?15:5)
>
> The numbers listed above are known spammer numbers. However, when I call
> from any other CALLERID, it still directs me to s,15 which is the
> Hangup() application. Here are logs from the asterisk CLI:

I'm not convinced the parser is clever enough to do a comparison on 2 
different right-hand-sides... Split it into 2 different statements, and 
USE n rather than absolute line numbers:

   exten => s,n,GotoIf($["${CALLERID(number)}" = "8585979857"]?bad)
   exten => s,n,GotoIf($["${CALLERID(number)}" = "8585970327"]?bad)

   ...

   exten => s,n(bad)Hangup()

If you use the 'n' mechanism to number lines then you can trivially add in 
more tests for spammers numbers without having to renumber every time. 
(although this may not ultimately be the best way to do it, it is easy for 
a few simple cases)

Gordon


More information about the asterisk-users mailing list