File tree Expand file tree Collapse file tree 4 files changed +44
-8
lines changed
Expand file tree Collapse file tree 4 files changed +44
-8
lines changed Original file line number Diff line number Diff line change 11[package ]
22name = " rsipstack"
3- version = " 0.2.57 "
3+ version = " 0.2.58 "
44edition = " 2021"
55description = " SIP Stack Rust library for building SIP applications"
66license = " MIT"
Original file line number Diff line number Diff line change @@ -380,9 +380,6 @@ impl DialogInner {
380380 body : Option < Vec < u8 > > ,
381381 ) -> rsip:: Response {
382382 let mut resp_headers = rsip:: Headers :: default ( ) ;
383- self . local_contact
384- . as_ref ( )
385- . map ( |c| resp_headers. push ( Contact :: from ( c. clone ( ) ) . into ( ) ) ) ;
386383
387384 for header in request. headers . iter ( ) {
388385 match header {
@@ -430,11 +427,22 @@ impl DialogInner {
430427 }
431428 }
432429
430+ resp_headers. retain ( |h| {
431+ !matches ! (
432+ h,
433+ Header :: Contact ( _) | Header :: ContentLength ( _) | Header :: UserAgent ( _)
434+ )
435+ } ) ;
436+
437+ self . local_contact
438+ . as_ref ( )
439+ . map ( |c| resp_headers. push ( Contact :: from ( c. clone ( ) ) . into ( ) ) ) ;
440+
433441 body. as_ref ( ) . map ( |b| {
434442 resp_headers. push ( Header :: ContentLength ( ( b. len ( ) as u32 ) . into ( ) ) ) ;
435443 } ) ;
436444
437- resp_headers. unique_push ( Header :: UserAgent (
445+ resp_headers. push ( Header :: UserAgent (
438446 self . endpoint_inner . user_agent . clone ( ) . into ( ) ,
439447 ) ) ;
440448
Original file line number Diff line number Diff line change @@ -369,8 +369,17 @@ impl EndpointInner {
369369 match last_message {
370370 SipMessage :: Request ( ref mut last_req) => {
371371 if last_req. method ( ) == & rsip:: Method :: Ack {
372- if resp. status_code . kind ( ) == rsip:: StatusCodeKind :: Provisional {
373- return Ok ( ( ) ) ;
372+ match resp. status_code . kind ( ) {
373+ rsip:: StatusCodeKind :: Provisional => {
374+ return Ok ( ( ) ) ;
375+ }
376+ rsip:: StatusCodeKind :: Successful => {
377+ if last_req. to_header ( ) ?. tag ( ) . ok ( ) . is_none ( ) {
378+ // don't ack 2xx response when ack is placeholder
379+ return Ok ( ( ) ) ;
380+ }
381+ }
382+ _ => { }
374383 }
375384 if let Ok ( Some ( tag) ) = resp. to_header ( ) ?. tag ( ) {
376385 last_req. to_header_mut ( ) . and_then ( |h| h. mut_tag ( tag) ) . ok ( ) ;
Original file line number Diff line number Diff line change @@ -873,7 +873,26 @@ impl Transaction {
873873
874874 let last_message = {
875875 match self . transaction_type {
876- TransactionType :: ClientInvite => self . last_ack . take ( ) . map ( SipMessage :: Request ) ,
876+ TransactionType :: ClientInvite => {
877+ //
878+ // For client invite, make a placeholder ACK if in proceeding or trying state
879+ if matches ! (
880+ self . state,
881+ TransactionState :: Proceeding | TransactionState :: Trying
882+ ) {
883+ if self . last_ack . is_none ( ) {
884+ if let Some ( ref resp) = self . last_response {
885+ if let Ok ( ack) = self
886+ . endpoint_inner
887+ . make_ack ( self . original . uri . clone ( ) , resp)
888+ {
889+ self . last_ack . replace ( ack) ;
890+ }
891+ }
892+ }
893+ }
894+ self . last_ack . take ( ) . map ( SipMessage :: Request )
895+ }
877896 TransactionType :: ServerNonInvite => {
878897 self . last_response . take ( ) . map ( SipMessage :: Response )
879898 }
You can’t perform that action at this time.
0 commit comments