# Blocking Numbers?

**URL:** <https://community.asterisk.org/t/blocking-numbers/6754>\
**Category:** Asterisk Support\
**Created:** [May 30, 2006, 9:38pm UTC](https://community.asterisk.org/t/blocking-numbers/6754 "2006-05-30T21:38:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jasenr](https://avatars.discourse-cdn.com/v4/letter/j/a88e4f/32.png) [@jasenr](https://community.asterisk.org/u/jasenr)\
**Post date:** [May 30, 2006, 9:38pm UTC](https://community.asterisk.org/t/blocking-numbers/6754/1 "2006-05-30T21:38:42Z")

</div>

I am trying to find a way to block certain numbers from being able to call my home line. I cannot block them with the block feature from the phone company. Can Asterisk do this?

---

<div class="post-metadata">

**Author:** ![pdm](https://avatars.discourse-cdn.com/v4/letter/p/f6c823/32.png) [@pdm](https://community.asterisk.org/u/pdm)\
**Post date:** [May 30, 2006, 9:46pm UTC](https://community.asterisk.org/t/blocking-numbers/6754/2 "2006-05-30T21:46:39Z")

</div>

> [@jasenr](#):
>
> I am trying to find a way to block certain numbers from being able to call my home line. I cannot block them with the block feature from the phone company. Can Asterisk do this?

Thats simple in the extension logic, based on Caller ID.

-Andy

---

<div class="post-metadata">

**Author:** ![dswartz](https://avatars.discourse-cdn.com/v4/letter/d/45deac/32.png) [@dswartz](https://community.asterisk.org/u/dswartz)\
**Post date:** [May 31, 2006, 1:35am UTC](https://community.asterisk.org/t/blocking-numbers/6754/3 "2006-05-31T01:35:57Z")

</div>

there’s a blacklist AGI function you can stick in the inbound logic…

---

<div class="post-metadata">

**Author:** ![damialok](https://avatars.discourse-cdn.com/v4/letter/d/6f9a4e/32.png) [@damialok](https://community.asterisk.org/u/damialok)\
**Post date:** [May 31, 2006, 9:56pm UTC](https://community.asterisk.org/t/blocking-numbers/6754/4 "2006-05-31T21:56:35Z")

</div>

In Asterisk you can add number matching to the dial plan. It is called the exgirlfriend extension.

This is just an example to give you an idea:

exten =\> 0592399999,1,Goto(blocking,s,1) ;the number that has been called

[blocking]  
exten =\> s/31621899999,1,Playback(blocking/mary\_please\_do\_not\_call\_me)  
exten =\> s/31621899988,1,Playback(blocking/Anna\_please\_do\_not\_call\_me)  
exten =\> s,1,Dial(501) ; the receptionis or your own phone

exten =\> s/31621899999,2,Hangup  
exten =\> s/31621899988,2,Hangup  
exten =\> s,2,Voicemail(502)

This concept can be used in many ways, to offer personized moh, to route customers directly to their accountmanager or to refuse the incoming call. Your creativity and fantasy are the limits. If you google on exgirlfriend extension an/or number matching you will find a lot more info.
