[OpenSIPS-Users] Help with Adding Custom SIP Header to Relayed CANCEL Request in OpenSIPS

Bogdan-Andrei Iancu bogdan at opensips.org
Wed Aug 14 14:58:10 UTC 2024


Hi,

Take a look at this 
https://blog.opensips.org/2016/11/15/cancel-request-and-reason-header/

Regards,

Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
   https://www.opensips-solutions.com
   https://www.siphub.com

On 14.08.2024 06:46, Mohamed OUALLA wrote:
>
> Hello everyone,
>
>   I am currently working with OpenSIPs in stateful mode, and I am 
> encountering an issue with relaying a CANCEL request to cancel a 
> pending initial SIP INVITE.
>
>   The CANCEL request is hop-by-hop, so OpenSIPs act on it first 
> "*/send 200 canceling/*" then it generates a CANCEL SIP Request and 
> relay it to the next hop. My goal is to add a custom SIP header, 
> specifically "*X-Reason*", to this relayed CANCEL request. 
> Unfortunately, I am only able to add the standard "*Reason*" header.
>
>   The challenge I am facing is that FreeSWITCH, which receives the 
> relayed CANCEL request, removes the "Reason" header due to a parameter 
> I have set to disable adding Q.850 reasons. This parameter was 
> initially enabled to prevent FreeSWITCH from adding the "Reason" 
> header to negative SIP responses, but it's now also affecting the 
> CANCEL request, leading to the removal of the "Reason" header!
>
> Here’s my current OpenSIPs configuration that successfully adds the 
> "Reason" header to the CANCEL request:
>
> ```
>
> if(!is_present_hf("Reason")){
>     append_hf("Reason: Q.850;cause=32\r\n", "CSeq"); #the outgoing 
> CANCEL request has the Reason header value now
> }
>
> ```
>
>   However, when I try to add headers like "*X-Reason*" or 
> "*TestHeader*" for example, they don't seem to be included in the 
> relayed CANCEL request:
>
> ```
>
> if(!is_present_hf("Reason")){
>     append_hf("X-Reason: Q.850;cause=31\r\n", "CSeq"); # No changes 
> are reflected in the relayed CANCEL request :-/
>     # or
>     append_hf("TestHeader: Q.850;cause=31\r\n", "CSeq");# No changes 
> are reflected in the relayed CANCEL request :-/
> }
>
> ```
>
>   Has anyone faced a similar issue or have any suggestions on how I 
> can successfully add a custom "*X-Reason*" header or any other custom 
> "*/X-Header/*" to the relayed CANCEL request?
>
> Thanks in advance,
>
> Have a beautiful day
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20240814/98badb83/attachment.html>


More information about the Users mailing list