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

Daniel Zanutti daniel.zanutti at gmail.com
Wed Aug 14 14:40:58 UTC 2024


Where in the routing script are you adding the header? Did you try on
branch route?


Em qua., 14 de ago. de 2024 00:51, Mohamed OUALLA <
oualla.simohamed at gmail.com> escreveu:

> 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/d31ca750/attachment.html>


More information about the Users mailing list