<solved> help with BLACKLIST() function

I am trying to block inbound calls from certain number, telemarketing and so. But it doesn’t work.

I am running asterisk 1.8 it seems does not check blacklist with astdb.

Thanks.

exten => s,1,GotoIf(${BLACKLIST()}?blacklisted)
exten => s,n,Dial(SIP/123)
exten => s,n(blacklisted),Hangup()

The colon fails at the end of the GotoIf

No colon is required.

Normally one would need to use an expression context ( $[…]), but if the string is 0 or 1, I suppose it might work without that.

Strange, the book I’m using explicitly says that the colon is mandatory, but online documentation (voip-info.org/wiki/view/Asterisk+cmd+GotoIf) and my own tests say different.

I’ll ask my money back :smile:

I got it working :smiley:

[remote]
exten => s,1,GotoIf(${DB_EXISTS(BLACKLIST/${CALLERID(num)})}?banned,s,1)
exten => s,2,Dial(SIP/150,29,m)
exten => s,3,Voicemail(00000@default,u)
exten => s,n,Hangup()

[banned]
exten => s,1,Playback(silence/2&im-sorry)
exten => s,n,Playback(cannot-complete-as-dialed)
exten => s,n,Playback(privacy-you-are-blacklisted)
exten => s,n,Playback(goodbye)
exten => s,n,Hangup()