Outbound CallID blocking: passing *67 dtmf vs. P-Asserted-Identity with Privacy: id

— Problem:

We’ve been unable to correctly block outbound CLID through our voip service provider (VSP), voicenetwork.ca. They do not process (nor accept) the DTMF tones, and therefore *67 (or (*81), in the dial string in SIP trunk call setup. They do, however, correctly honor the SIP protocol P-Asserted-Identity with the “Privacy: id” option.

If the “Privacy: id” is present the called party correctly sees “Private Number” in their display.

— Question:

How (and where) in the asterisk, freepbx (trixbox) technology stack can one set the “Privacy: id” field of an outbound call by one of its extensions on a selective basis (e.g. user prefixing *67)?

— Scenario:

We presently have two SIP trunks to the VSP. We have a two outbound route dial plans

(ROUTE-CLID-BLOCK)

*67|NXXNXXXXXX

mapping to trunk OUT-BLOCKED

(ROUTE-CLID-SHOW)

NXXNXXXXXX

mapping to trunk OUT-SHOW

Where the OUTBOUND PEER DETIALS for trunk OUT-BLOCKED includes,

privacy=on&full

Where the OUTBOUND PEER DETIALS for trunk OUT-SHOW does not,

OMITTED: privacy=on&full omitted

This results in a close approximation of a blocked caller id, as seen by the called party, where “0000000000” is what the called party receives. Nevertheless, it’s not a true “Private Number.”

Any help setting the “Privacy: id” field in the scenario described or other use-case scenario would be greatly appreciated.

Thanks,

Oh, the reason we know the “Privacy: id” field works …

We added a couple of LINKSYS SPA2102s. When the 2102;s “Block CID setting” is set to “yes,” the 2102 constructs a SIP header with the “Privacy: id” field present and set and then 2102 stripes off the *67 prefix and passes “xxxxxxxxxx” as the dial string. When set to “no,” the 2102 does NOT construct the “privacy: id” field and passes “*67xxxxxxxxxx” as the dial string.

The asterisk/freepbx/trixbox stack honors calls from the 2102 end points setting of the “Privacy id” and the called parties from the 2102 end points see the correct “Private Number” form in their display.

Thanks,
/S

I’ve been googling and found the following link

http://www.voip-info.org/wiki/view/P-Asserted-Identity+and+Remote-Party-ID+header

While it talks only to P-Asserted-Identity, the same call and hook should be valid for “Privacy: id” where…

exten => _NXXNXXXXXX,1,SipAddHeader(P-Asserted-Identity: sip:${CALLERIDNUM})

becomes

exten => _NXXNXXXXXX,1,SipAddHeader(Privacy: id)

Yes, no???

And where should this go, as the link’s suggested placement doesn’t align with my asterisk/freepbx/trixbox files.

Thanks,
/S

Maybe a bingo… I found the following (http://www.voip-info.org/wiki/index.php?page_id=77)

Sip header manipulation examples
These examples may be beneficial when interfacing Asterisk with a Nortel SST or an Acme Packet SBC.

Sending RFC-3323 compliant privacy headers in sip calls

ftp://ftp.rfc-editor.org/in-notes/rfc3323.txt

exten => _9.,1,SIPAddHeader(P-Asserted-Identity: sip:+1${CALLERID(num)}\;user=phone)
exten => _9.,n,SIPAddHeader(Privacy: id)
exten => _9.,n.SetCallerPres(prohib_not_screened) ; this might not be needed — needs further testing
exten => _9.,n,Set(CALLERID(num)=)
exten => _9.,n,Set(CALLERID(name)=Anonymous)
exten => _9.,n,Dial(SIP/+${EXTEN:1}@sipcarrier)
exten => _9.,n,Hangup()

But where do I stuff this and do I replace the “9." with "*67.”?

thanks,
/S

Anyone, please, where in the conf files would the above entries go?

I thought the CALLERID macro, but I can’t get it to work.

Thanks, anyone/everyone.

/S

if using “hidden” as your callerid name does not do it for you, then have a look at macro-dialout-trunk-predial-hook where you can do what ever you need, this being a prime example of why that was put there.

Thanks, Philippe.

“hidden” works if it’s entered into the EXTENSIONS > OUTBOUND CID; it does not work (for us) if entered into the TRUNKS > OUTBOUND CALLER ID field. The former causes EVERY call off that extension to be hidden. The latter, as we’ve set it up, would block the CID on this specific trunk only.

We have a OUTBOUND ROUTES > DIAL PATTERNS set as

*671|NXXNXXXXXX
*67|NXXNXXXXXX

This points to TRUNK SEQUENCE (0) SIP/TRUNK-STAR-SIX-SEVEN

TRUNK-STAR-SIX-SEVEN has its OUTBOUND CALLER ID: hidden

This setup allows our users to block CID – on a per call basis – if the TRUNK-STAR-SIX-SEVEN “hidden” worked.

I’m new to asterisk syntax and language, but to me, with regard to [macro-outbound-callerid], there’s a precedence flow (error). The macro, as modified below, works as we wish. It allows the outbound_route>trunk_caller_id to override the USEROUT CID, which is what I think is intended but not working as written.


[macro-outbound-callerid]
include => macro-outbound-callerid-custom
exten => s,1,ExecIf($["${CALLINGPRES_SV}" != “”],SetCallerPres,${CALLINGPRES_SV})
exten => s,n,ExecIf($["${REALCALLERIDNUM:1:2}" = “”],Set,REALCALLERIDNUM=${CALLERID(number)})
exten => s,n(start),GotoIf($[ $["${REALCALLERIDNUM}" = “”] | $["${KEEPCID}" != “TRUE”] | $["${OUTKEEPCID_${ARG1}}" = “on”] ]?normcid)
exten => s,n,Set(USEROUTCID=${REALCALLERIDNUM})
exten => s,n,GotoIf($[“foo${DB(AMPUSER/${REALCALLERIDNUM}/device)}” = “foo”]?bypass)
exten => s,n(normcid),Set(USEROUTCID=${DB(AMPUSER/${REALCALLERIDNUM}/outboundcid)})
exten => s,n(bypass),Set(EMERGENCYCID=${DB(DEVICE/${REALCALLERIDNUM}/emergency_cid)})
exten => s,n,Set(TRUNKOUTCID=${OUTCID_${ARG1}})
exten => s,n,GotoIf($[ $["${EMERGENCYROUTE:1:2}" = “”] | $["${EMERGENCYCID:1:2}" = “”] ]?trunkcid)
exten => s,n,Set(CALLERID(all)=${EMERGENCYCID})
exten => s,n(exit),MacroExit()
; -
exten => s,n(trunkcid),ExecIf($["${TRUNKOUTCID:1:2}" != “”],Set,CALLERID(all)=${TRUNKOUTCID})
exten => s,n(hidecid1),ExecIf($["${CALLERID(name)}"=“hidden”],SetCallerPres,prohib_passed_screen)
exten => s,n,MacroExit()
; -
exten => s,n(usercid),GotoIf($["${USEROUTCID:1:2}" = “”]?exit)
exten => s,n,Set(CALLERID(all)=${USEROUTCID})
exten => s,n(hidecid2),ExecIf($["${CALLERID(name)}"=“hidden”],SetCallerPres,prohib_passed_screen)

; end of [macro-outbound-callerid]

I’ve been chipping at this last night and the testing of the use of “hidden,” per your post, in the extension (works) field vs. trunk field (not work) lead me to the above modification.

Thanks,
/Scott

Ok, being a nobo, where do I place this modified macro so that it isn’t over-written by freepbx gui use.

Thanks,
/Scott

Corrected macro


[macro-outbound-callerid]
include => macro-outbound-callerid-custom
exten => s,1,ExecIf($["${CALLINGPRES_SV}" != “”],SetCallerPres,${CALLINGPRES_SV})
exten => s,n,ExecIf($["${REALCALLERIDNUM:1:2}" = “”],Set,REALCALLERIDNUM=${CALLERID(number)})
exten => s,n(start),GotoIf($[ $["${REALCALLERIDNUM}" = “”] | $["${KEEPCID}" != “TRUE”] | $["${OUTKEEPCID_${ARG1}}" = “on”] ]?normcid)
exten => s,n,Set(USEROUTCID=${REALCALLERIDNUM})
exten => s,n,GotoIf($[“foo${DB(AMPUSER/${REALCALLERIDNUM}/device)}” = “foo”]?bypass)
exten => s,n(normcid),Set(USEROUTCID=${DB(AMPUSER/${REALCALLERIDNUM}/outboundcid)})
exten => s,n(bypass),Set(EMERGENCYCID=${DB(DEVICE/${REALCALLERIDNUM}/emergency_cid)})
exten => s,n,Set(TRUNKOUTCID=${OUTCID_${ARG1}})
exten => s,n,GotoIf($[ $["${EMERGENCYROUTE:1:2}" = “”] | $["${EMERGENCYCID:1:2}" = “”] ]?trunkcid)
exten => s,n,Set(CALLERID(all)=${EMERGENCYCID})
exten => s,n(exit),MacroExit()
; -
exten => s,n(trunkcid),ExecIf($["${TRUNKOUTCID:1:2}" != “”],Set,CALLERID(all)=${TRUNKOUTCID})
exten => s,n(hidecid1),ExecIf($["${CALLERID(name)}"=“hidden”],SetCallerPres,prohib_passed_screen)
; -
exten => s,n(usercid),GotoIf($[ $["${USEROUTCID:1:2}" = “”] | ${TRUNKOUTCID:1:2}" != “”] ]?exit)
exten => s,n,Set(CALLERID(all)=${USEROUTCID})
exten => s,n(hidecid2),ExecIf($["${CALLERID(name)}"=“hidden”],SetCallerPres,prohib_passed_screen)

; end of [macro-outbound-callerid]

/S

And, I’m guessing

extensions_override_freepbx.conf

is the right place for my variant of this macro, right?

Thanks,
/S

instead of redoing the macro, which may likely cause you problems in the future, why don’t use use macro-dialout-trunk-predial-hook (can be declared in extensions_custom.conf) which is there for exactly this type of purpose. That maco is called just prior to a call going out a trunk and allows you to do anything you need at that point, including choosing to abandon this trunk and carry on to the next trunk in the sequence.

This is a hook that was put there for you, and you will see the documentation says we will always leave it for you.

Cool. I will investigate and see if I can make head-tails of [macro-dialout-trunk-predial-hook]. I enjoy this stuff, but it’s very new to me and it’s s-o-o-o vast a technology stack (asterisk-freepbx); therefore, I thank you for focusing me in the [right] direction.

Another question, if I may.

Is the default macro correct as written, though? I’m deducing the CALLERID assignment priority is off in the “as is” macro. The USEROUTCID always overrides the TRUNKOUTCID. It this a correct assignment flow?

Perhaps, it’s my nobo-ness, but a simpler (perhaps faster) macro core-fragment might be better as (not full syntax)

;
s,1,Set,CALLERID(name)="hidden"
s,n,Set,CALLERID(all)=IfExists(USERCID)
s,n,Set,CALLERID(all)=IfExists(TRUNKCID)
s,n,Set,CALLERID(all)=IfExists(EMERGENCYCID)
;

Where the “IfExists” is whatever test constructor needed (e.g. If( !(ISNULL(${USEROUTCID}))?${USEROUTCID} ).

Thanks, again, ever so much!
/S

I got side tracked with other priorities and I am again re-visiting this. Trying to follow your suggestion and use macro-dialout-trunk-predial-hook; however, I’m not sure what to “hook,” being still noob’ish.

Here’s my thinking…

I have a dial plan

*67|NXXNXXXXXX that selects a specific outbound trunk, called STAR-SIX-SEVEN.

So … in macro-dialout-trunk-predial-hook … I should

(i) test if this is TRUNK STAR-SIX-SEVEN
(ii) if yes, then apply the P-Asserted-Identity/Privacy: id logic.
(iii) if no, then just exit.

Guidance/examples very much appreciated.

Also, is there a way to “see” the execution. I believe it’s a CLI console thing. ALso, how can I display some of the variables’ actual values at run time. Is that what NOP does (can do)?

Thanks,
/S