Freepbx sip custom header P-Preferred-Identity

Hi,

i use freebpx 14.0.3.6.
I need the sip header: P-Preferred-Identity in sip invite for sipgate.
How can i add the header?

regards Sven

edit: original post deleted, see better solution here:

thanks for your help.

Im sorry, i forgott: i use for all extensions and for the trunk pjsip.

regards Sven

i have try:

Asterisk Trunk Dial Options (override): Ttb(custom-sip-header^s^1)

extensions_custom.conf:

[custom-sip-header]
exten => s,1,Set(PJSIP_HEADER(add,P-Preferred-Identity)=sip:${CALLERID(num)}atsipconnec…)
exten => s,n,Return

result: no header in invite!

regards Sven

You just confirmed what was originally stated, that method won’t work for pjsip. I don’t know of a practical way of adding custom SIP headers to outbound pjsip calls.

Okay thanks.

Is this a known bug and will it be fixed in the upcoming releases?

I will use chan_sip for the trunk now.

best regards Sven

It’s not a bug, you are asking for a feature that doesn’t exist yet. There are projects in the works, but at present the work around is to use chan_sip.

Did it stop working?

Unfortunately yes it did.

I don’t understand why this is requiring the use of custom.conf files or a lot of confusion on how this should be done.

SIPGate is requiring that the CallerID be presented in PAI format and that only SIPGate numbers (i.e. ones on your account) can be presented as CallerID. In other words, they don’t just allow any ole number to be passed as CallerID.

So in this case you would set up at least ONE Outbound Route that has the Route CallerID set to the SIPGate number you want to present as CallerID and then you go into your PJSIP trunk configuration and do this:

That will take the Route CallerID from the Outbound Route (or even the Outbound CallerID from the extension if the route allows it) and present it in P-Asserted-Identity format.

Now if this is Chan_SIP trunk then everything is the same except for the trunk settings. In that case you just add (or modify) the sendrpid= setting to be sendrpid=pai and that will present P-Asserted-Identity format for the call.

OP states Sipgate wants P-Preferred-Identity not P-Asserted-Identity.

Oops. My bad.

It’s a little more complicated now. See the post I just added to Add custom SIP header to PJSIP trunk for an explanation. You CAN add custom SIP headers in PJSIP, but it not exactly a straightforward process, apparently due to changes on FreePBX.

edit - This method is out of date, and won’t work with pjsip trunks

Thanks @Wanderer for the reminder, I had totally forgotten about that technique when it made the rounds some months back. The following will work for both chan_sip and pjsip trunks:

[custom-sip-header]
; add "B(custom-sip-header^s^1)" (without quotes) to the dial options of a trunk in addition to the defaults already there
; this only affects calls on specific trunks
exten => s,1,Noop(entering user defined context custom-sip-header in extensions_custom.conf)
exten => s,n,Set(HASH(__SIPHEADERS,P-Preferred-Identity)=sip:${CALLERID(number)}@sipconnect.sipgate.de)
exten => s,n,Return
1 Like

Thanks a lot @ll.

It works perfectly!

best regards Sven

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