CALLERID GotoIF problem

Hi guys,

I was using this script below on an older version of asterisk to block spammers from calling - they call like 5 times a day.

I recently upgraded to a new ver of asterisk and it stopped working.

The NoOp dumps the correct num… but that same number doesn’t seem to be there when processing the GotoIfs … any ideas???

I found an example exactly like this, but this doesn’t work?!?!?

Thanks.

exten => 5555555,1,NoOp(${CALLERID(num)})
exten => 5555555,2, Goto(11)

exten => 5555555,11,GotoIf($["${CALLERID(num):0:2}" = “647”]?40:12)
exten => 5555555,12,GotoIf($["${CALLERID(num):0:2}" = “888”]?40:13)
exten => 5555555,13,GotoIf($["${CALLERID(num):0:2}" = “877”]?40:14)
exten => 5555555,14,GotoIf($["${CALLERID(num):0:2}" = “866”]?40:15)

exten =>5555555,26,GotoIf($["${CALLERID(num):0:4}"=“anony”]?40:30)

exten => 5555555,30,Dial(SIP/Rob_Home,22)
exten => 5555555,n,Goto(in5555555-${DIALSTATUS},1)
exten => 5555555,n,Hangup
exten => in5555555-BUSY,1,Hangup(17)
exten => in5555555-CONGESTION,1,Hangup(3)
exten => in5555555-CHANUNAVAIL,1,Hangup(3)
exten => in5555555-NOANSWER,1,Voicemail(u5555555@home)
exten => _in5555555-.,1,Hangup(16)

exten => 5555555,40,Congestion
exten => 5555555,41,Hangup

Here’s an output from the last call a few mins ago:

-- Executing [5555555@default:1] NoOp("SIP/5555555-cc001250", "8885565140") in new stack
-- Executing [5555555@default:2] Goto("SIP/5555555-cc001250", "11") in new stack
-- Goto (default,5555555,11)
-- Executing [5555555@default:11] GotoIf("SIP/5555555-cc001250", "0?40:12") in new stack
-- Goto (default,5555555,12)
-- Executing [5555555@default:12] GotoIf("SIP/5555555-cc001250", "0?40:13") in new stack
-- Goto (default,5555555,13)
-- Executing [5555555@default:13] GotoIf("SIP/5555555-cc001250", "0?40:14") in new stack
-- Goto (default,5555555,14)
-- Executing [5555555@default:14] GotoIf("SIP/5555555-cc001250", "0?40:15") in new stack
-- Goto (default,5555555,15)


– Executing [5555555@default:26] GotoIf(“SIP/5555555-cc001250”, “0?40:30”) in new stack
– Goto (default,5555555,30)
– Executing [5555555@default:30] Dial(“SIP/5555555-cc001250”, “SIP/Rob_Home|22”) in new stack
– Called Rob_Home
– SIP/Rob_Home-00fed610 is ringing

Hi

you need to change

exten => 5555555,11,GotoIf($["${CALLERID(num):0:2}" = “647”]?40:12)

to

exten => 5555555,11,GotoIf($["${CALLERID(num):0:3}" = “647”]?40:12)

so you match 3 digits not 2

Ian

That worked, thanks!!