As we know, Asterisk only supports custom headers in INVITE messages. However, we have a scenario where we need to include the P-Early-Media: supported header in 183 Session Progress responses. This is required for our provider to accept media from our side.
Could you please guide me on which file needs to be modified to hardcode this header into every 183 Session Progress response?
Yes, I have found the section handling 183 Session Progress in chan_pjsip.c. Is there a method available that allows me to set a custom header, such as P-Early-Media: supported, within this response?
I have added ast_sip_add_header() function in below section, please check whether the syntax and location is correct as I am still not able to write required header in 183 response.
This code is handling connected line updates, which is not, I think, the case, in your scenario. Also, I’m not really sure what a SIP response code means on a channel that is in a RING state, as that would be an outgoing channel, so one would be expecting responses to come from it, rather than go to it; maybe it something to do with using UPDATE.
Also, you might want to note that the Sangoma staff need a clean room environment, so shouldn’t be looking at code changes without a contributor licence in place. I’m not Sangoma, and am extremely unlikely to submit a change in this area, and in that case, I would still expect them to require them to submitted as gitbub changes.
I have added required function in indicate but asterisk seems to crash when try to execute that function, see below screenshot I have added log line just before function execution.
I have successfully modified the indicate() function to write to the 183 Session Progress response only if the header is not already present in the packet. Below is the working implementation.