Skip to content

Commit def3e48

Browse files
committed
bump version to 0.2.87 and add set_remote_target method for dialog updates
1 parent 474ed1a commit def3e48

2 files changed

Lines changed: 27 additions & 1 deletion

File tree

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rsipstack"
3-
version = "0.2.86"
3+
version = "0.2.87"
44
edition = "2021"
55
description = "SIP Stack Rust library for building SIP applications"
66
license = "MIT"

src/dialog/dialog.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,19 @@ impl DialogInner {
297297
Ok(())
298298
}
299299

300+
/// Update the dialog's remote target URI and optional Contact header.
301+
///
302+
/// When a 2xx/UPDATE response carries a new Contact, call this to ensure
303+
/// subsequent in-dialog requests route to the latest remote target.
304+
pub fn set_remote_target(
305+
&self,
306+
uri: rsip::Uri,
307+
contact: Option<rsip::headers::untyped::Contact>,
308+
) {
309+
*self.remote_uri.lock().unwrap() = uri;
310+
*self.remote_contact.lock().unwrap() = contact;
311+
}
312+
300313
pub(super) fn build_vias_from_request(&self) -> Result<Vec<Via>> {
301314
let mut vias = vec![];
302315
for header in self.initial_request.headers.iter() {
@@ -692,4 +705,17 @@ impl Dialog {
692705
Dialog::ClientInvite(d) => d.inner.can_cancel(),
693706
}
694707
}
708+
709+
/// Expose a safe hook to refresh the remote target URI/Contact after
710+
/// receiving responses such as 200 OK.
711+
pub fn set_remote_target(
712+
&self,
713+
uri: rsip::Uri,
714+
contact: Option<rsip::headers::untyped::Contact>,
715+
) {
716+
match self {
717+
Dialog::ServerInvite(d) => d.inner.set_remote_target(uri, contact),
718+
Dialog::ClientInvite(d) => d.inner.set_remote_target(uri, contact),
719+
}
720+
}
695721
}

0 commit comments

Comments
 (0)