From bdfe39912af9bfd93c95c63654fb20e15c1c6d92 Mon Sep 17 00:00:00 2001 From: Pavel Shirshov Date: Fri, 31 Jul 2026 20:48:24 +0100 Subject: [PATCH] fix(dialog): warn when ServerInviteDialog::bye is skipped bye_with_headers returns Ok(()) without sending when the dialog is not Confirmed or WaitAck. B2BUA hangup paths treat Ok as success and leave the remote UA off-hook when state has diverged from the media path. Log a warning (with dialog id and state) when BYE is skipped for a non-terminated dialog. Terminated dialogs stay silent. Addresses restsend/rsipstack#136 --- src/dialog/server_dialog.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/dialog/server_dialog.rs b/src/dialog/server_dialog.rs index d2bc06f..8e86586 100644 --- a/src/dialog/server_dialog.rs +++ b/src/dialog/server_dialog.rs @@ -350,6 +350,16 @@ impl ServerInviteDialog { /// * `Err(Error)` - Failed to build/send BYE request. pub async fn bye_with_headers(&self, headers: Option>) -> Result<()> { if !self.inner.is_confirmed() && !self.inner.waiting_ack() { + // Silent success here is a footgun for B2BUA hangup paths: callers + // cannot tell BYE was never sent. Log when we skip so operators can + // correlate stuck endpoints with dialog state divergence. + if !self.inner.is_terminated() { + warn!( + id = %self.id(), + state = %self.state(), + "bye skipped: dialog not Confirmed/WaitAck" + ); + } return Ok(()); }