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.
Published 03/10/2015
*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.
Ewww@mgcp, but doing this in CUCM (regardless of gateway/trunk protocol) is more scalable if your blacklist is potentially longer than 15 numbers. On the plus side, if your ingress gateway is also your SRST gateway, it is usually preferable to do this in ios for single-point configuration. …and you can do a ‘call-block translation-profile incoming’ in conjunction with a ‘translation-profile incoming’ (which isn’t entirely clear in the documentation) statement on the same dial-peer. Good stuff. That said, a ‘call-block translation-profile outgoing’ on your cell # would be beneficial too! Hopefully that’ll come in an upcoming ios release.
Thanks for the reply! You make excellent points! There is the limit on the number of numbers that can be blocked to consider and SRST considerations that you mentioned as well. All very good things to keep in mind!
Hi, thanks for writing this, I have bookmarked it ready for when (not if!!) I’ll need it. Just a question on your dial-peer configuration – it says the incoming translation profile is called call_block but above your config says it is called CALLBLOCK. I’m no voice guru so I just wanted to check if these are referring to the same thing?
Thanks again!
Nice catch, error corrected! That’s what I get for deciding that all caps would stand out better mid-post. Thanks for pointing that out!
Thanks for this. A good reminder of working with CME or gateways. I am finally taking my CIPT1 test in a couple weeks.
As you said in the last para that there are 11 billion ways to do this. I think this would be the easiest of them all. And you’re gracious enough to accept the mistake you’ve never done (above comment). Will surely follow you regularly. Good stuff!
I was asking an honest question – like I said I’m not a guru, just learning myself and asked a question. I wasn’t trying to be a smart ass, just trying to take it all in from someone who knows an awful lot more than me…
I didn’t take offense at all! I appreciate your seeing the discrepancy, I wish I had caught it in the proof reading, but I’m glad you pointed it out so I could fix it! 🙂
I’ve also heard of this being done within CUCM to match the “block list” and then forward to Unity to play a greeting that advises the caller that their call has been blocked, why it was blocked and how to contest inclusion within the block list. It’s not the “quick” approach you’ve outlined here, but could be worth considering in some Enterprises that want to provide feedback to the caller beyond simply dropping the call.
I never thought about doing it that way, but it makes sense. Definitely adding that to my bag of potential solutions. Thanks for sharing!
We have an issue where the caller ID being presented is just three numbers (For example: 212) Have you ever run into this situation? Or have any input on a possible solution?
Worked out the Answer! RegEx: /^212$/ It will block calls that are presenting a 3 digit ANI but allows for and ANI presenting a full set of digits through the gateway.
That’s really great to hear! I’m was thinking about this and haven’t had a chance to respond until now. Glad you found a solution!
Thanks for this post. I have a query. An user dont want to receive incoming calls from a particular number. Is there a way to block incoming calls from a particular numbers to a single user
I think you could accomplish this with the destination-pattern command. Let’s say for an example, you want to block calls to extension 6789. Amend the above dial-peer configuration to the following:
dial-peer voice 4445 pots
destination-pattern 6789
call-block translation-profile incoming CALLBLOCK
call-block disconnect-cause incoming unassigned-number
This would only apply the call blocking translation to calls to 6789.
Please correct me if I’m wrong–also not a voice guru!
please help me in this,
we have two fxo ports,one going to auto attendant and other going directly to a line,
and we want to block a particular incoming PSTN number say 1111 on the port going directly to a dn.
we dont use incoming dial-peer
following is voice-port config:
voice-port 0/0/3
supervisory disconnect anytone
supervisory custom-cptone UAE-CUSTOM-ALCATEL
supervisory dualtone-detect-params 1
cptone BE
timeouts initial 5
timeouts wait-release 1
timing hookflash-out 500
timing guard-out 1000
timing sup-disconnect 50
connection plar opx 1025
impedance complex2
description STC
caller-id enable
caller-id alerting line-reversal
caller-id alerting dsp-pre-allocate
cable-detect
and i tried creating translation rule and profile, applied it on the dn level, voice port level, but nothing seem to work at all. i even tried creating a incoming dial-peer also
Please help me in this ASAP
Thanks Amy…This post was very helpful!
Belated, but really glad to hear this! Glad this helped!
Thanks Amy great help. I’m trying to block all calls incoming with same NPA and same NNX. Would I follow above procedure only use a voice translation rule as follows
rule 1 reject /^NPANNX…./ where npa and nnx are the digits I’m trying to block.
We are getting spam calls from numbers using our area code and prefix.
Please help
Thanks
Great site and new to this as well
Hi, Ed! I might be missing something, but since you said that it’s your own NPANNX, I’m thinking your rule would block any thing that matched that and would probably catch legit calls as well.
Hi Amy
I need to block an entire NPA/NNX. They are using our own area code and prefix to spam us. Would this rule work?
Voice Translation rule 1
rule 1 reject /^NPANNX…./ Where npa and nnx are our area code and prefix
voice translation -profile Call Block
translate calling 1
Dial Peer Voice
Call Block translation profile incoming Call Block
Call Block Disconnect-cause incoming Call Reject
I’m new to this but have been tasked to look into this
Great site
Thanks for your help
I posted before but my email address was wrong
Hello Amy,
Need your help on this please. Our provider is sending calls with a “+” in front of the number, ex. +12127654321. I’ve tried a few translation rules, but they never match. How can I get it to block these numbers?
We have another provider that does not send the + and the call block works fine there.
Thank you!
Hi, Eric! I don’t have a sample of what would work, but I’m pretty sure the issue is that the + means something different in working with translations. https://www.cisco.com/c/en/us/support/docs/voice/call-routing-dial-plans/61083-voice-transla-rules.html
I’m not sure it’s possible to escape the + character so that it’s read as a plus sign and not as a modifier, but this section from the above doc indicates you can. The example is on hyphens, but may work with + as well?
“Notes on special characters:
The hyphen character is used to indicate a range in a match pattern, for example [0-9]. In order to indicate in this rule that you want to match on the hypen character, it is necessary to use the ‘\’ character to escape its meaning. This is because the hyphen character is a special character. The ‘\-‘ characters really means hyphen. The trailing ‘\’ indicates that the number is sliced here.”
Awesome!
Nice and short. Thank you so much for this! Really useful even five years later.
Regards.
Thank you so much for this information Amy it works great – my only issue is we have more than 15 numbers to block – any suggestions on how to go beyond this limitation?