# \<solved\> help with BLACKLIST() function

**URL:** <https://community.asterisk.org/t/solved-help-with-blacklist-function/43215>\
**Category:** Asterisk Support\
**Created:** [June 27, 2013, 6:20pm UTC](https://community.asterisk.org/t/solved-help-with-blacklist-function/43215 "2013-06-27T18:20:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![waxfuzz](https://avatars.discourse-cdn.com/v4/letter/w/f475e1/32.png) [@waxfuzz](https://community.asterisk.org/u/waxfuzz)\
**Post date:** [June 27, 2013, 6:20pm UTC](https://community.asterisk.org/t/solved-help-with-blacklist-function/43215/1 "2013-06-27T18:20:52Z")

</div>

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()

---

<div class="post-metadata">

**Author:** ![onlyme](https://avatars.discourse-cdn.com/v4/letter/o/ea666f/32.png) [@onlyme](https://community.asterisk.org/u/onlyme)\
**Post date:** [July 4, 2013, 9:25am UTC](https://community.asterisk.org/t/solved-help-with-blacklist-function/43215/2 "2013-07-04T09:25:46Z")

</div>

The colon fails at the end of the GotoIf

```auto

```

---

<div class="post-metadata">

**Author:** ![david55](https://avatars.discourse-cdn.com/v4/letter/d/e19adc/32.png) [@david55](https://community.asterisk.org/u/david55)\
**Post date:** [July 4, 2013, 10:54am UTC](https://community.asterisk.org/t/solved-help-with-blacklist-function/43215/3 "2013-07-04T10:54:39Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![onlyme](https://avatars.discourse-cdn.com/v4/letter/o/ea666f/32.png) [@onlyme](https://community.asterisk.org/u/onlyme)\
**Post date:** [July 5, 2013, 11:39am UTC](https://community.asterisk.org/t/solved-help-with-blacklist-function/43215/4 "2013-07-05T11:39:06Z")

</div>

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

I’ll ask my money back 😄

---

<div class="post-metadata">

**Author:** ![waxfuzz](https://avatars.discourse-cdn.com/v4/letter/w/f475e1/32.png) [@waxfuzz](https://community.asterisk.org/u/waxfuzz)\
**Post date:** [July 5, 2013, 1:57pm UTC](https://community.asterisk.org/t/solved-help-with-blacklist-function/43215/5 "2013-07-05T13:57:40Z")

</div>

I got it working 😃

[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()
