Migrated a customer in Canada to voip.ms. They had a requirement to be able to selectivly hide CNAM & CID by dialing *67, which was working fine with previous telco sip provider. With Outbound Caller ID set to hidden as per the tooltip. Calls failed, since no CID was sent, which is required by voip.ms.
Tried various options, but nothing worked without sending some sort of a valid CID, that matched voip.ms Caller ID rules. I could send a made up CID that matched required rules, but it would be displayed on the receiving end.
Based on post: 73783 - How To: effect per-call CIDblocking (PRIVATE/HIDDEN) on outbound calls, with FreePBX v15 and VoIP.ms
I created a new outbound route with Route CID set to “private” , and override extension on. Dial Pattern prefix set to *67 with match valid match pattern for expected outgoing calls. Using the same voip.ms trunk that already existed, which has a valid CNAM and CID configured for Outbound Caller ID. Placed this new route, before the normal outbound route.
Used the macro from the above post, placed at the bottom of /etc/asterisk/extensions_custom.conf, which matches on the CNAM being set to private.
[macro-dialout-trunk-predial-hook]
exten => s,1,NoOp(***** EnforceCIDblock-BEGIN [SuperVerbose] ***** EXTEN=${EXTEN} CIDnum=${CALLERID(number)} CIDname=${CALLERID(name)})
exten => s,2,ExecIf($[ "${CALLERID(name)}" = "private" ]?NoOp(***** EnforceCIDblock-CIDname [Verbose] Maybe matched - check for 0/1 before NoOp <-------)
exten => s,3,ExecIf($[ "${CALLERID(name)}" = "private" ]?Set(HASH(__SIPHEADERS,Privacy)=id))
exten => s,4,NoOp(***** EnforceCIDblock-END [SuperVerbose] ***** )
exten => s,5,MacroExit()
Applied config, and tested working.
During testing, before applying this macro, I had changed sendrpid=yes to sendrpid=pai in the trunk outgoing settings config . Not sure if this is necessary. But everything works as expected now.