Call privacy/Hide Caller ID

I have setup a custom dial plan to make anonymous calls when dialing *67 followed by extension and permanently on extensions using the “hide-callerid” context.

extensions_custom.conf

[from-internal-custom]
exten => _*67X.,1,Set(CALLERPRES()=prohib_not_screened)
exten => _*67X.,n,Goto(from-internal,${EXTEN:3},1)

[hide-callerid]
exten => _[*0-9]!,1,Set(CALLERPRES()=prohib_not_screened)
exten => _[*0-9]!,n,Goto(from-internal,${EXTEN},1)

This is working exactly as expected and is applied to both internal and external calls

But I was wondering if there is some way in the dialplan to stop these calls from being inserted into the asterisk call trace database. When I run “database show CALLTRACE” form astersik CLI, I don’t want the anonymous calls to be showing.

That way the recipient can’t know who called by pressing *69 when the call is an anonymous call.

I see that private calls from trunk are being added to Asterisk’s DB CALLTRACE as unknown.
If the same could be done for internal calls without necessarily affecting CDR, that would solve my issue.

Ok so after further testing, the following seems to do exactly what we need…

extensions_custom.conf

[from-internal-custom]
exten => _*67X.,1,Set(CALLERID(name)=Anonymous)
exten => _*67X.,n,Set(CALLERID(num)=anonymous)
exten => _*67X.,1,Set(CALLERPRES()=prohib_not_screened)
exten => _*67X.,n,Goto(from-internal,${EXTEN:3},1)

[hide-callerid]
exten => _[0-9]!,1,Set(CALLERID(name)=Anonymous)
exten => _[0-9]!,n,Set(CALLERID(num)=anonymous)
exten => _[0-9]!,n,Set(CALLERPRES()=prohib_not_screened)
exten => _[*0-9]!,n,Goto(from-internal,${EXTEN},1)

Calls starting with *67 or from extensions with context set to “hide-callerid” now show up as Private Number and dialing *69 returns a prompt saying last caller unknown. And this works for both internal calls and outbound trunk calls.

And as the operator, we can still trace calls and bill properly using the Account Number set on each extension.

So your internal users want to hide their callerid from each other?

Yes as our users can be from different organizations.

Here is my final working script where users can toggle their own hide caller id feature with *77
Or use it on single call by prefixing *67 to the number they call.

[from-internal-custom]
exten => _*67X.,1,Macro(hidecid,)
exten => _*67X.,n,Goto(from-internal,${EXTEN:3},1)
exten => *77,1,GotoIf($["${DB(HIDECID/${CDR(accountcode)})}" = “”]?activate:deactivate)
exten => *77,n(activate),Set(DB(HIDECID/${CDR(accountcode)})=YES)
exten => *77,n,Playback(activated)
exten => *77,n,Macro(hangupcall,)
exten => *77,n(deactivate),Noop(Deleting: HIDECID/${CDR(accountcode)} ${DB_DELETE(HIDECID/${CDR(accountcode)})})
exten => *77,n,Playback(de-activated)
exten => *77,n,Macro(hangupcall,)
exten => _[0-9]!,1,ExecIf($["${DB(HIDECID/${CDR(accountcode)})}" != “”]?Macro(hidecid,))

[macro-hidecid]
exten => s,1,Set(CALLERID(name)=Anonymous))
exten => s,n,Set(CALLERID(num)=anonymous))
exten => s,n,Set(CALLERPRES()=prohib_not_screened))
exten => s,n,MacroExit()

FreePBX and Asterisk are not ideally suited to multi-tenant operations, and this is just one of the simplest problems. Glad to see that you’ve got it handled.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.