Skip to content

Commit e9efb09

Browse files
committed
fix: update version to 0.2.42 and enhance response handling in transaction management
1 parent 7bb8998 commit e9efb09

File tree

2 files changed

+12
-8
lines changed

2 files changed

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

src/transaction/transaction.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,9 @@ impl Transaction {
462462
TransactionEvent::Received(msg, connection) => {
463463
if let Some(msg) = match msg {
464464
SipMessage::Request(req) => self.on_received_request(req, connection).await,
465-
SipMessage::Response(resp) => self.on_received_response(resp).await,
465+
SipMessage::Response(resp) => {
466+
self.on_received_response(resp, connection).await
467+
}
466468
} {
467469
if let Some(ref inspector) = self.endpoint_inner.inspector {
468470
return Some(inspector.after_received(msg));
@@ -578,7 +580,11 @@ impl Transaction {
578580
None
579581
}
580582

581-
async fn on_received_response(&mut self, resp: Response) -> Option<SipMessage> {
583+
async fn on_received_response(
584+
&mut self,
585+
resp: Response,
586+
connection: Option<SipConnection>,
587+
) -> Option<SipMessage> {
582588
match self.transaction_type {
583589
TransactionType::ServerInvite | TransactionType::ServerNonInvite => return None,
584590
_ => {}
@@ -594,7 +600,9 @@ impl Transaction {
594600
}
595601
_ => {
596602
if self.transaction_type == TransactionType::ClientInvite {
597-
need_ack = true;
603+
if connection.is_some() {
604+
need_ack = true;
605+
}
598606
TransactionState::Completed
599607
} else {
600608
TransactionState::Terminated
@@ -725,10 +733,6 @@ impl Transaction {
725733
.take()
726734
.map(|id| self.endpoint_inner.timers.cancel(id));
727735
}
728-
self.timer_a.replace(self.endpoint_inner.timers.timeout(
729-
self.endpoint_inner.option.t1,
730-
TransactionTimer::TimerA(self.key.clone(), self.endpoint_inner.option.t1),
731-
));
732736
}
733737

734738
self.timer_b

0 commit comments

Comments
 (0)