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

Mohamed OUALLA oualla.simohamed at gmail.com
Wed Aug 14 03:46:32 UTC 2024


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20240814/95ac443c/attachment.html>


More information about the Users mailing list