I’ve run into an issue where I’d like calls marked as anonymous or no caller ID to be routed to a separate area than calls that display their phone number.
This is because our system needs to log their phone number in order for some systems to operate.
As of such, I’d like callers who have not displayed their number to be played a pre-recorded message and then hung up on.
If anyone has a solution to this I’d be greatly thankful.
You can create another inbound route that looks for the CID ‘anonymous’, ‘blocked’ or ‘private’ and send the destination to terminate call.
You may need 3 individual inbound routes to take them all in, it depends on what called ID they usually show up in your system.
Or, set up your regular Inbound Route to have CallerID Number
and then create an Any (Caller ID Number left blank) route to catch anything that doesn’t begin with a digit.
Unfortunately, it doesn’t look like this works.
View this image on the config that I set and let me know if I’ve made a mistake:
Thanks for your reply!
You missed the
. at the end.
The forum does a bad job of showing inline code blocks.
But see how it was all in the grey background?
Sorry, I thought that the dot was the end of the sentence!
I’ll update it and see what happens.
I tried the setup above. Normal calls ended up being sent to the wrong destination.
Here is the image:
The one with the time conditions is where I want calls to go to.
Perhaps your onymous calls start with a + sign, in which case they won’t match the X and you should use
If that’s not your issue, paste a log of a normal call not matching the time condition route.
Didn’t look like it worked.
Real calls still went to the wrong destination.
Not sure how to get call logs. Also, I’m having an issue where it’s hard for me to mimic a withheld call because my number provider somehow still manages to find the number haha. That’s why its taking long for me to test it out.
On my mobile (T-Mobile, Google Pixel 4a 5G), I can call anonymously by dialing with *67 in front of the number, or by going to Phone -> Settings -> Calling Accounts -> T-Mobile -> Additional Settings -> Caller ID and choosing Hide Number.
Of course, if your trunking provider supplies P-Asserted-Identity on blocked calls and you have custom dialplan to fish that out, then your number will still be displayed. But if that’s the case, you should see very few ‘anonymous’ calls (only those from spammers, etc.)
Yeah, it’s a strange one! I’ve turned it off in my IOS settings and it shows as withheld to everyone I dial apart from my own number haha!
I’m not sure if this is what you’re after but its what’s showing in my asterisk logs:
/var/log/asterisk/full:[2021-08-24 18:37:08] VERBOSE[C-000061f3] pbx.c: Executing [[email protected]:21] Set("PJSIP/Dial_9_Inbound-00006279", "__CRM_LINKEDID=1629830228.27285") in new stack
/var/log/asterisk/full:[2021-08-24 18:37:09] VERBOSE[C-000061f3] pbx.c: Executing [[email protected]:1] Set("PJSIP/Dial_9_Inbound-00006279", "TOUCH_MONITOR=1629830228.27285") in new stack/var/log/asterisk/full:[2021-08-24 18:37:35] VERBOSE[C-000061f3] pbx.c: Executing [[email protected]:4] NoOp("Local/[email protected];1", "MASTER CHANNEL: 1629830229.27288 = 1629830228.27285") in new stack
/var/log/asterisk/full:[2021-08-24 18:37:35] VERBOSE[C-000061f3] pbx.c: Executing [[email protected]:4] NoOp("PJSIP/2001-0000627b", "MASTER CHANNEL: 1629830236.27291 = 1629830228.27285") in new stack
/var/log/asterisk/full:[2021-08-24 18:37:35] VERBOSE[C-000061f3] pbx.c: Executing [[email protected]:4] NoOp("PJSIP/2001-0000627c", "MASTER CHANNEL: 1629830236.27292 = 1629830228.27285") in new stack
/var/log/asterisk/full:[2021-08-24 18:37:35] VERBOSE[C-000061f3] pbx.c: Executing [[email protected]:4] NoOp("Local/[email protected];1", "MASTER CHANNEL: 1629830229.27286 = 1629830228.27285") in new stack
/var/log/asterisk/full:[2021-08-24 18:37:43] VERBOSE[C-000061f3] pbx.c: Executing [[email protected]:4] NoOp("PJSIP/2000-0000627a", "MASTER CHANNEL: 1629830229.27290 = 1629830228.27285") in new stack
/var/log/asterisk/full:[2021-08-24 18:37:43] VERBOSE[C-000061f3] pbx.c: Executing [[email protected]:4] NoOp("PJSIP/Dial_9_Inbound-00006279", "MASTER CHANNEL: 1629830228.27285 = 1629830228.27285") in new stack
The log for a call is typically a few hundred lines. Select all the entries for the incorrectly routed call, paste it at pastebin.freepbx.org and post the link here.
I believe that this is what you are after:
Thanks for all your help!
I’m suspecting that there is a quirk or bug associated with routes with DID set to Any.
See whether setting CID Priority Route for the time condition route causes it to take that path.
The called number on your logged call shows as 0 – do you know what causes that? I would expect 10 or 11 digits there.
How many DIDs do you have? Are they associated with multiple inbound trunking providers?
The trunk connects from [email protected], that may be what you’re meaning. Just how dial9 works.
Also, the caller number was obfuscated with NPANXXXXXX.
We don’t have any DID’s set in the routes along with only one trucking provider. Note, that they’re UK numbers which tend to start with 0 or +44.
I assume that you mean connects to [email protected] (that is what is in the SIP URI).
If setting CID Priority Route doesn’t help, try setting DID Number for both routes to 0
Or, setting the Context for the trunk to from-pstn-toheader will likely cause the actual dialed number to appear as the DID.
Looks like setting it to “_X.” and setting the CID priority to the time conditions route worked. I’ll need to get someone to test it for the withheld route and probably international calls to make sure those still work.
Will update here once I get both of those tested.
Just got it tested. Looks like its working for a withhold number!
Okay, I got an international caller to call. They were directed to the incorrect route.
To be precise a Canadian number.
Calls starting with a
+ are subject to that from what I can see.
Can this be resolved?