Hi,
I have read and tested quite a few posts about how to insert a PAID Header, P-Asserted-Identity, and although I have it working for normal calls, I can’t get it working for caller withheld “hidden” calls.
I am using a fully up to date New Freepbx installation
PBX Firmware:12.7.6-1904-1.sng7
PBX Service Pack:1.0.0.0
Current Asterisk Version: 13.22.0
My trunks are setup as PJSIP trunks with
Trust RPID/PAI = Yes
Send RPID/PAI = Send P-Asserted-Identity header
Using this configuration with a normal outbound call, it shows this following line in the SIP (INVITE) header (I have replaced the outbound CID number with CID_NUMBER and my server IP address with IPADDRESS for security)
P-Asserted-Identity: sip:CID_NUMBER@IPADDRESS
I do not get any P-Asserted-Identity lines in the Wireshark if I dial out CallerWithheld.
My CallerWithheld outbound route is setup with a prefix of 141 and has “hidden” as the RouteCID which overrides the extension = yes.
Now when I dial out there is no P-Asserted-Identity: in the wireshark dump.
From reading other posts I realise I need to create some custom code in Config Edit - extensions_custom.conf
This one seemed nice and basic but didnt work, it didnt inject any P-Asserted-Identity: in the wireshark dump.
[macro-dialout-trunk-predial-hook]
exten => s,1,NoOp(Adding P-Asserted-Identity)
exten => s,n,SipAddHeader(P-Asserted-Identity: sip:${CALLERID(num)})
exten => s,n(done),MacroExit()
I then moved into more complicated ones like this one - I have commented some lines out as “pai-custom:continue” caused an error.
[macro-dialout-trunk-predial-hook]
;Call With a Hidden Number
exten => s,1,NoOp(The caller id name is: ${CALLERID(name)})
exten => s,n,NoOp(The caller id number is: ${CALLERID(num)})
exten => s,n,NoOp(The ampuser is: ${AMPUSER})
exten => s,n,NoOp(The real caller id is: ${REALCALLERIDNUM})
exten => s,n,NoOp(The outbound cli is: ${DB(AMPUSER/${REALCALLERIDNUM}/outboundcid)})
;exten => s,n,Set(real_cli=${IF($[ “${DB(AMPUSER/${REALCALLERIDNUM}/outboundcid)}” = “” ]?+442xxCID_NUMBER:${DB(AMPUSER/${REALCALLERIDNUM}/outboundcid)})})
;exten => s,n,GotoIf($[ “${CALLERID(name)}” = “anonymous” | “${CALLERID(name)}” = “Anonymous” ]?pai-custom:continue)
;exten => s,n,SipAddHeader(P-Asserted-Identity: “${real_cli}” sip:${real_cli}@IPADDRESS\;user=phone)
;exten => s,n,SipAddHeader(Privacy: id)
exten => s,n,NoOp(Adding P-Asserted-Identity)
exten => s,n,SipAddHeader(P-Asserted-Identity: sip:${DB(AMPUSER/${REALCALLERIDNUM}/outboundcid)})
exten => s,n(done),MacroExit()
exten => s,n,MacroExit()
Using this context I can see the FreePBX logs showing the following lines, is something happening where the PAI info is being injected ok, but then being removed by another piece of code?
pbx.c: Executing [s@macro-outbound-callerid:21] ExecIf("PJSIP/4000-00000070", "0?Set(CALLERID(all)=)") in new stack
pbx.c: Executing [s@macro-outbound-callerid:22] ExecIf("PJSIP/4000-00000070", "1?Set(CALLERID(all)=02xxCID_NUMBER)") in new stack
pbx.c: Executing [s@macro-outbound-callerid:23] ExecIf("PJSIP/4000-00000070", "1?Set(CALLERID(all)=hidden)") in new stack
pbx.c: Executing [s@macro-outbound-callerid:24] ExecIf("PJSIP/4000-00000070", "1?Set(CALLERPRES(name-pres)=prohib_passed_screen)") in new stack
pbx.c: Executing [s@macro-outbound-callerid:25] ExecIf("PJSIP/4000-00000070", "1?Set(CALLERPRES(num-pres)=prohib_passed_screen)") in new stack
pbx.c: Executing [s@macro-outbound-callerid:26] Set("PJSIP/4000-00000070", "CDR(outbound_cnum)=") in new stack
pbx.c: Executing [s@macro-outbound-callerid:27] Set("PJSIP/4000-00000070", "CDR(outbound_cnam)=hidden") in new stack
pbx.c: Executing [s@macro-dialout-trunk:14] GosubIf("PJSIP/4000-00000070", "0?sub-flp-4,s,1()") in new stack
pbx.c: Executing [s@macro-dialout-trunk:15] Set("PJSIP/4000-00000070", "OUTNUM=07xxMYMOBILE") in new stack
pbx.c: Executing [s@macro-dialout-trunk:16] Set("PJSIP/4000-00000070", "custom=PJSIP") in new stack
pbx.c: Executing [s@macro-dialout-trunk:17] ExecIf("PJSIP/4000-00000070", "0?Set(DIAL_TRUNK_OPTIONS=M(setmusic^default)T)") in new stack
pbx.c: Executing [s@macro-dialout-trunk:18] ExecIf("PJSIP/4000-00000070", "0?Set(DIAL_TRUNK_OPTIONS=TM(confirm))") in new stack
pbx.c: Executing [s@macro-dialout-trunk:19] Macro("PJSIP/4000-00000070", "dialout-trunk-predial-hook,") in new stack
pbx.c: Executing [s@macro-dialout-trunk-predial-hook:1] NoOp("PJSIP/4000-00000070", "The caller id name is: hidden") in new stack
pbx.c: Executing [s@macro-dialout-trunk-predial-hook:2] NoOp("PJSIP/4000-00000070", "The caller id number is: ") in new stack
pbx.c: Executing [s@macro-dialout-trunk-predial-hook:3] NoOp("PJSIP/4000-00000070", "The ampuser is: 4000") in new stack
pbx.c: Executing [s@macro-dialout-trunk-predial-hook:4] NoOp("PJSIP/4000-00000070", "The real caller id is: 4000") in new stack
pbx.c: Executing [s@macro-dialout-trunk-predial-hook:5] NoOp("PJSIP/4000-00000070", "The outbound cli is: 02xxCID_NUMBER") in new stack
pbx.c: Executing [s@macro-dialout-trunk-predial-hook:6] NoOp("PJSIP/4000-00000070", "Adding P-Asserted-Identity") in new stack
pbx.c: Executing [s@macro-dialout-trunk-predial-hook:7] SIPAddHeader("PJSIP/4000-00000070", "P-Asserted-Identity: sip:02xxCID_NUMBER") in new stack
pbx.c: Executing [s@macro-dialout-trunk-predial-hook:8] MacroExit("PJSIP/4000-00000070", "") in new stack
pbx.c: Executing [s@macro-dialout-trunk:20] GotoIf("PJSIP/4000-00000070", "0?skipcrm") in new stack
pbx.c: Executing [s@macro-dialout-trunk:21] Set("PJSIP/4000-00000070", "__CRM_DIRECTION=OUTBOUND") in new stack
pbx.c: Executing [s@macro-dialout-trunk:22] Set("PJSIP/4000-00000070", "__CRM_DESTINATION=07xxMYMOBILE") in new stack
pbx.c: Executing [s@macro-dialout-trunk:23] Set("PJSIP/4000-00000070", "__CRM_SOURCE=4000") in new stack
pbx.c: Executing [s@macro-dialout-trunk:24] AGI("PJSIP/4000-00000070", "sangomacrm.agi") in new stack
res_agi.c: Launched AGI Script /var/lib/asterisk/agi-bin/sangomacrm.agi
res_agi.c: <PJSIP/4000-00000070>AGI Script sangomacrm.agi completed, returning 0
pbx.c: Executing [s@macro-dialout-trunk:25] Set("PJSIP/4000-00000070", "CHANNEL(hangup_handler_push)=crm-hangup,s,1") in new stack
pbx.c: Executing [s@macro-dialout-trunk:26] NoOp("PJSIP/4000-00000070", "CRM Finished") in new stack
pbx.c: Executing [s@macro-dialout-trunk:27] GotoIf("PJSIP/4000-00000070", "0?bypass,1") in new stack
pbx.c: Executing [s@macro-dialout-trunk:28] ExecIf("PJSIP/4000-00000070", "1?Set(CONNECTEDLINE(num,i)=07xxMYMOBILE)") in new stack
pbx.c: Executing [s@macro-dialout-trunk:29] ExecIf("PJSIP/4000-00000070", "0?Set(CONNECTEDLINE(name,i)=CID:)") in new stack
pbx.c: Executing [s@macro-dialout-trunk:30] ExecIf("PJSIP/4000-00000070", "1?Set(CONNECTEDLINE(name,i)=CID:(Hidden))") in new stack
pbx.c: Executing [s@macro-dialout-trunk:31] GotoIf("PJSIP/4000-00000070", "0?customtrunk") in new stack
I was hoping to do this myself without having to bother the community but hitting my head against a wall and our main supplier is going to block all incorrect PAI calls soon so I need to get this fixed asap.
Hopefully its something quick you can help with,
Thanks
D