Skip to content

End 2 end CANCEL Reason (and other additional CANCEL headers)#165

Closed
ThomasSevestre wants to merge 1 commit intosems-server:masterfrom
ThomasSevestre:cancel_reason
Closed

End 2 end CANCEL Reason (and other additional CANCEL headers)#165
ThomasSevestre wants to merge 1 commit intosems-server:masterfrom
ThomasSevestre:cancel_reason

Conversation

@ThomasSevestre
Copy link
Copy Markdown
Contributor

This is a solution to #164

Please, be aware...

I've not tested the PR on master but it is working on an older version of sems.
I've used this with SBC application only.
It would be better to pass Reason header only.

@juha-h
Copy link
Copy Markdown
Contributor

juha-h commented Dec 17, 2020

Is relaying of CANCEL headers configurable in sbc profile?

@ThomasSevestre
Copy link
Copy Markdown
Contributor Author

Not in this PR.

First it could be a good idea to make sure this is triggered only in SBC module, we need to override onCancel in CallLeg (see here)

This looks simple, I can do it.

CallLeg does not have direct access to profiles, it requires more work to make this configurable. Relaying CANCEL Reason header looks like something that should be done by default.

@hecko
Copy link
Copy Markdown
Contributor

hecko commented Oct 14, 2025

@ThomasSevestre do you think we should revisit this PR - is it still something you would like to add into SEMS in its current proposed PR?

@ThomasSevestre
Copy link
Copy Markdown
Contributor Author

@hecko,

I beleive E2E Cancel Reason is an important features. I've used the proposed PR for years without issue in my setup.

Current implementation has a few limitations :

  • passes all headers (not only the Reason header) It would be safer to pass only the Reason header.
  • as @juha-h mentionned, it could also be interesting to add a configuration parameter to enable this functionality.
  • If I remember well I was thinking to to move the following change in SBC application :
void AmB2BCallerSession::onCancel(const AmSipRequest& req)
{
  terminateOtherLeg();
  terminateOtherLeg(req.hdrs);
  terminateLeg();
}

I do not have easy access to sems anymore to work on this PR.

Feel free to take over (or to close the PR if you prefer)

thanks for your work on sems

hecko pushed a commit that referenced this pull request Apr 17, 2026
Re-implementation of PR #165 with the concerns raised in review
addressed:

- Filter to RFC 3326 "Reason:" only. Other CANCEL headers (Via, CSeq,
  Route, Authorization, Privacy, P-Asserted-Identity, etc.) are no
  longer forwarded verbatim onto the peer leg's BYE — they are either
  nonsensical there or leak trust-boundary metadata.
- Keep the implementation inside apps/sbc so it doesn't touch
  AmB2BSession / AmB2ABSession virtual signatures. External modules
  that subclass those base classes continue to override correctly
  (the original patch silently broke their overrides because
  `terminateLeg()` / `terminateOtherLeg()` gained a defaulted
  parameter and the old zero-arg overrides stopped overriding).
- Propagate the filtered header between CallLegs via an SBC-local
  B2BEvent subclass that reuses the existing B2BTerminateLeg event
  id, so non-CallLeg receivers still terminate correctly.
- Not configurable: enabled unconditionally for SBC CallLeg, matching
  the PR's original behaviour.

https://claude.ai/code/session_01PWHzum8cu3oJhct3A4YEdd
hecko pushed a commit that referenced this pull request Apr 17, 2026
Re-implementation of PR #165 with the concerns raised in review
addressed:

- Filter to RFC 3326 "Reason:" only. Other CANCEL headers (Via, CSeq,
  Route, Authorization, Privacy, P-Asserted-Identity, etc.) are no
  longer forwarded verbatim onto the peer leg's BYE — they are either
  nonsensical there or leak trust-boundary metadata.
- Keep the implementation inside apps/sbc so it doesn't touch
  AmB2BSession / AmB2ABSession virtual signatures. External modules
  that subclass those base classes continue to override correctly
  (the original patch silently broke their overrides because
  `terminateLeg()` / `terminateOtherLeg()` gained a defaulted
  parameter and the old zero-arg overrides stopped overriding).
- Propagate the filtered header between CallLegs via an SBC-local
  B2BEvent subclass that reuses the existing B2BTerminateLeg event
  id, so non-CallLeg receivers still terminate correctly.
- Not configurable: enabled unconditionally for SBC CallLeg, matching
  the PR's original behaviour.

https://claude.ai/code/session_01PWHzum8cu3oJhct3A4YEdd
@hecko
Copy link
Copy Markdown
Contributor

hecko commented Apr 17, 2026

This has been re-implemented into SBC application in #369 - thanks for the suggestion and feedback @ThomasSevestre

@hecko hecko closed this Apr 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants