PJSIP Header add - Question and limitations

Good afternoon, all.

I’m trying to add a SIP header to an inbound call (x-reason-info). On the surface (based on documentation), this sounds relatively straight forward. However, when it didn’t seem to work I started searching the forum and the inter-webs and found some caveats on earlier versions of PJSIP that may be causing our issues (if those caveats are still in play in current versions).

The goal is, if we’re going to reject a call (603), we wanted to add a header explaining specifically why we rejected the call (from the receiving system’s perspective). Another need is, while navigating an IVR structure, updating a custom header to inject data onto the call based on the menu options chosen.

I’ve come across a few things suggesting the PJSIP_HEADER and PJSIP_HEADER_PARAM features are limited to only an INVITE. I was surprised by that limitation, but if that’s still a limitation in today’s versions, is there a work-around to it (mentioned below)?

For example, can we do a session refresh (either via UPDATE or REINVITE) that allows us to insert the new header and push it back to the caller? Since an UPDATE/REINVITE isn’t viable until after a call is answered, I would ultimately like to be able to insert this header into response codes as well (not just on initial invites) (not having to answer them), but I’m open to a session update for calls we can answer first (Some use cases prevent me from being able to answer the calls first, wanting to insert a custom header on the response code)…

Equally, is there a global or endpoint-dependent setting required in order to allow that endpoint to receive such header modifications? Since UPDATE was in the allow header, I was surprised when my update didn’t work at all (suggesting it’s not enabled on that endpoint by default)…

; **Send a SIP UPDATE with X-Reason-Info header**
same => n,Set(PJSIP_HEADER(add,X-Reason-Info)=${REASON_INFO})
same => n,Set(PJSIP_SEND_SESSION_REFRESH()=invite)
;same => n,Set(PJSIP_SEND_SESSION_REFRESH()=update) <-- Commented these out to toggle testing each

Thanks.

No, there is no workaround. The code isn’t written/doesn’t exist to do it.

Awww man… :frowning: Well thank you.