@@ -566,7 +566,7 @@ impl ServerInviteDialog {
566566 tx. reply ( rsip:: StatusCode :: OK ) . await ?;
567567 return Ok ( ( ) ) ;
568568 }
569- rsip:: Method :: Invite | rsip :: Method :: Ack => {
569+ rsip:: Method :: Ack => {
570570 info ! ( id=%self . id( ) ,
571571 "invalid request received {} {}" ,
572572 tx. original. method, tx. original. uri
@@ -577,6 +577,7 @@ impl ServerInviteDialog {
577577 rsip:: StatusCode :: MethodNotAllowed ,
578578 ) ) ;
579579 }
580+ rsip:: Method :: Invite => return self . handle_reinvite ( tx) . await ,
580581 rsip:: Method :: Bye => return self . handle_bye ( tx) . await ,
581582 rsip:: Method :: PRack => return self . handle_prack ( tx) . await ,
582583 rsip:: Method :: Info => return self . handle_info ( tx) . await ,
@@ -652,6 +653,34 @@ impl ServerInviteDialog {
652653 Ok ( ( ) )
653654 }
654655
656+ async fn handle_reinvite ( & mut self , tx : & mut Transaction ) -> Result < ( ) > {
657+ info ! ( id = %self . id( ) , "received re-invite {}" , tx. original. uri) ;
658+ self . inner
659+ . transition ( DialogState :: Updated ( self . id ( ) , tx. original . clone ( ) ) ) ?;
660+
661+ if let Err ( e) = tx. reply ( rsip:: StatusCode :: OK ) . await {
662+ warn ! ( id = %self . id( ) , "failed to send 200 OK for re-invite: {}" , e) ;
663+ }
664+
665+ while let Some ( msg) = tx. receive ( ) . await {
666+ match msg {
667+ SipMessage :: Request ( req) => match req. method {
668+ rsip:: Method :: Ack => {
669+ info ! ( id = %self . id( ) , "received ack for re-invite {}" , req. uri) ;
670+ self . inner . transition ( DialogState :: Confirmed (
671+ self . id ( ) ,
672+ tx. last_response . clone ( ) . unwrap_or_default ( ) ,
673+ ) ) ?;
674+ break ;
675+ }
676+ _ => { }
677+ } ,
678+ _ => { }
679+ }
680+ }
681+ Ok ( ( ) )
682+ }
683+
655684 async fn handle_invite ( & mut self , tx : & mut Transaction ) -> Result < ( ) > {
656685 let handle_loop = async {
657686 if !self . inner . is_confirmed ( ) && matches ! ( tx. original. method, rsip:: Method :: Invite ) {
0 commit comments