Block/reroute based on CallerID


I’m trying to re-route calls that come in from a certain number like so:

exten => s,n,gotoif($[${CALLERID(num)} = 554443333]?othercontext,s,1)

When I create this I get these errors in my /var/log/asterisk/messages

[Nov 13 15:56:43] WARNING[29756] ast_expr2.fl: ast_yyerror(): syntax error: syntax error, unexpected ‘=’, expecting $end; Input:
= 5554443333

(I hope the formatting isn’t mangled)

I’m also trying to block calls using the same as above except routing them to a “blackhole” context that answers then hangs up.

I appreciate any suggestions or alternatives.

Thank you.

Formatting can be quite a bother sometimes…

Try this:

exten => s,n,Gotoif($["${CALLERID(num)}" = “554443333”]?othercontext,s,1)

try this
exten => s,n,GotoIf($[${CALLERID(num)} = 554443333]?otherwisecontext,s,1)

Thanks “a lot” :wink:

exten => s,n,Gotoif($["${CALLERID(num)}" = “554443333”]?othercontext,s,1)

You can route an incoming call by using the ex-girl friend extension. If you google on it you will find several examples. It will look something like:

exten => s/554443333,n,Goto(othercontext,s,1)