Modify P-Asserted-Identity header for autodial callee

Hi, I’ve found quiet a few topics on this but they all seem to be old and no longer work. We are doing auto-dial calls where we need to change the outbound callee to have a custom P-Asserted-Identity header. But, have run into the following errors:

[macro-dialout-trunk-predial-hook]
;exten => s,1,Noop("DOING PAID TEST")
;exten => s,n,Set(HASH(__PJSIPHEADERS,P-Asserted-Identity)="CUST PAID" <sip:1234567890>)
"No application 'SIPAddHeader' for extension"

[macro-dialout-trunk-predial-hook]
;exten => s,1,Noop("DOING PAID TEST)
;exten => s,n,Set(PJSIP_HEADER(add,P-Asserted-Identity)="CUST PAID" <sip:1234567890>)
"This function requires a PJSIP channel."

What is the proper way to be adding the custom header? Thanks!

Add this to extensions_custom.conf and reload

[macro-dialout-trunk-predial-hook]
exten => s,1,Noop()
exten => s,n,GoSub(func-set-sipheader,s,1(P-Asserted-Identity,CUST PAID))
exten => s,n,MacroExit

If you need to apply this selectively based on trunk name, there’s a hint how to do this here: Hooking for fun and income - #6 by lgaetz

Thank you, but I forgot to add that I’ve also tried that one as well and get the following response:

    -- Executing [s@func-apply-sipheaders:5] Set("PJSIP/Prisma_static-0000012f", "SIPHEADERKEYS=Alert-Info,P-Asserted-Identity") in new stack
    -- Executing [s@func-apply-sipheaders:6] ExecIf("PJSIP/Prisma_static-0000012f", "1?Set(Rheader=1)") in new stack
    -- Executing [s@func-apply-sipheaders:7] While("PJSIP/Prisma_static-0000012f", "1") in new stack
    -- Executing [s@func-apply-sipheaders:8] Set("PJSIP/Prisma_static-0000012f", "sipheader=unset") in new stack
[2023-05-15 12:08:12] WARNING[21507][C-0000014a]: pbx.c:2928 pbx_extension_helper: No application 'SIPAddHeader' for extension (func-apply-sipheaders, s, 9)

Is it possible I need to call the this from another hook so that the PJSIP header add call works?

Finally got this to work, I apparently had a typo in my original attempt:

[macro-dialout-trunk-predial-hook]
exten => s,1,Noop("MACRO TEST")
exten => s,n,Set(HASH(_SIPHEADERS,P-Asserted-Identity)= "MACRO PAID" <sip:9990009090>)

too many ‘_’ for the _SIPHEADERS. But, now I need the FROM header to match this header. Where would I go about seeing where that is set in the CONF files and doing an update?

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