I’m currently switching from chan_sip to pjsip and I’m running into an issue with setting headers:
I need to set some specific SIP headers, which my SIP trunk requires me to set on outbound calls.
With chan_sip, I simple set
SIPAddHeader(Header: value) somewhere in dialplan and this got inherited to the next SIP channel.
This is important, as some calls originate from Local channels (i.e. from scripts).
With pjsip using
Set(PJSIP_HEADER(add,Header)=value) I get
res_pjsip_header_funcs.c:513 func_write_header: This function requires a PJSIP channel. and of course no header when I try to set this header on the originating channel (which is, in this case, a “Local” or “IAX” channel).
At the moment, I’m trying to do this with a GoSub in the outbound dial to quickly add the header, but this is not a very nice solution in my case, since those headers vary in very specific ways and it’s simply just somewhat fiddly.
Is there a way to pre-define SIP headers to be set if a PJSIP channel is forked from the current channel - like the old (better?) behaviour of chan_sip?