Skip to content

Commit b572591

Browse files
committed
feat: add ringing response handling to ServerInviteDialog
1 parent e615a62 commit b572591

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

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.33"
3+
version = "0.2.34"
44
edition = "2021"
55
description = "SIP Stack Rust library for building SIP applications"
66
license = "MIT"

src/dialog/server_dialog.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,27 @@ impl ServerInviteDialog {
116116
&self.inner.initial_request
117117
}
118118

119+
pub fn ringing(&self, headers: Option<Vec<Header>>, body: Option<Vec<u8>>) -> Result<()> {
120+
if !self.inner.can_cancel() {
121+
return Ok(());
122+
}
123+
info!(id = %self.id(), "sending ringing response");
124+
let resp = self.inner.make_response(
125+
&self.inner.initial_request,
126+
if body.is_some() {
127+
StatusCode::SessionProgress
128+
} else {
129+
StatusCode::Ringing
130+
},
131+
headers,
132+
body,
133+
);
134+
self.inner
135+
.tu_sender
136+
.send(TransactionEvent::Respond(resp.clone()))?;
137+
self.inner.transition(DialogState::Early(self.id(), resp))?;
138+
Ok(())
139+
}
119140
/// Accept the incoming INVITE request
120141
///
121142
/// Sends a 200 OK response to accept the incoming INVITE request.

0 commit comments

Comments
 (0)