Welcome to a quick post on how to block an incoming call when you know the calling number you want to block. Specifically, this is how I would block an incoming call on a Cisco voice gateway with an ISDN PRI attached. Your mileage might vary a little with SIP trunks and will definitely vary quite a bit with MGCP.*
The first thing you need to do is create yourself a voice translation rule, something like this ought to do the trick:
voice translation-rule 9
rule 1 reject /5550005555/ <<keep in mind this is the calling number you want to block, but I like to test initially with an outside number such as my cell phone that I can test with.
Then set yourself up a lovely translation profile that references the rule you just created. Name it something obvious so that the next administrator doesn’t have to beat you to death for your obscurity:
voice translation-profile CALLBLOCK
translate calling 9
To complete the configuration, add these two commands to your incoming POTS dial-peer. If you aren’t sure what your incoming dial-peer is, use the debug voip dialpeer all command and make a test call. This is a good idea even if you think you know what the inbound dial-peer is because sometimes life is whimsical, and dial-peer configurations even more so.
dial-peer voice 4445 pots
call-block translation-profile incoming CALLBLOCK
call-block disconnect-cause incoming unassigned-number
There are a few ways to test this. As I mentioned before, you can use your own cell phone number in the original configuration and confirm that the call blocking works. Then just substitute the to-be-blocked number into the voice translation rule.
You can also run the following command and see what the router *thinks* it will do when it sees the number you are trying to block:
test voice translation-rule 9 /5550005555/
/5550005555/ blocked on rule 1
As with all things voice, there are eleventy-billion ways to accomplish a task, this post just covers one. If you have another method you prefer, please share in the comments, would love to hear it.
*The process with SIP trunks is practically the same, your inbound dial-peer won’t be POTS, though. MGCP will require you to use CUCM 8.0 or later for this, check out this document.