[SOLVED] PJSIP OPTIONS - tweaking headers

Hello everyone
I recently changed from chan_sip to PJSIP and want to know what are the configuration parameters responsible for the content of From and Contact headers in the OPTIONS request.

What are you wanting to change and why?

As stated at the beginning, I want to change From and Contact headers, userpart only.
My Asterisk configuration files are generated by FreePBX and currently I see the trunk names there as they were configured in FreePBX:

<--- Transmitting SIP request (451 bytes) to TLS:x.x.x.x:5061 --->
OPTIONS sip:12345678@domain.tld:5061 SIP/2.0
Via: SIP/2.0/TLS;rport;branch=xxxxxxxxxxxxxxx;alias
From: <sip:TRUNKNAME@domain.tld>;tag=xxxxxxxxxxxxx
To: <sip:12345678@domain.tld>
Contact: <sip:TRUNKNAME@;transport=TLS>

I want to get back to the old scenario where those messages were sent from asterisk as I recall.

PJSIP_HEADER allows you to read specific SIP headers from the inbound PJSIP channel as well as write(add, update, remove) headers on the outbound channel. But this is this functions works for INVITE request, and it wont allow you to change from and contact header

I think what you want is the “from_user” parameter on pjsip endpoints.

1 Like

Thank you, @gjoseph - that was obvious, but on the trunk I used as an example I intentionally had no “from_user” configured as I use “From:” header to dynamically send my Caller Id. Thanks again!