From 644766f032aebf4b687d021f6648c08c969a750e Mon Sep 17 00:00:00 2001 From: disa Date: Thu, 6 Nov 2025 11:26:18 +0300 Subject: [PATCH 1/4] swap resp order First 200 OK, then 487 --- sip/transaction_layer.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sip/transaction_layer.go b/sip/transaction_layer.go index b595d66..42f7034 100644 --- a/sip/transaction_layer.go +++ b/sip/transaction_layer.go @@ -107,15 +107,14 @@ func (txl *TransactionLayer) handleRequest(req *Request) error { tx, exists := txl.getServerTx(key) if exists { - // If ok this should terminate this transaction - if err := tx.Receive(req); err != nil { - return fmt.Errorf("failed to receive req: %w", err) - } - // Reuse connection and send 200 for CANCEL if err := tx.conn.WriteMsg(NewResponseFromRequest(req, StatusOK, "OK", nil)); err != nil { return fmt.Errorf("Failed to respond 200 for CANCEL: %w", err) } + // If ok this should terminate this transaction + if err := tx.Receive(req); err != nil { + return fmt.Errorf("failed to receive req: %w", err) + } return nil } // Now proceed as normal transaction, and let developer decide what todo with this CANCEL From 1f7177a8ca660134302f360dab1129344ab335f2 Mon Sep 17 00:00:00 2001 From: disa Date: Thu, 6 Nov 2025 11:31:04 +0300 Subject: [PATCH 2/4] fix "ACK missed" when an incoming call is canceled unanswered tx.stateProceeding better place to handle CANCEL req --- sip/transaction_server_tx_fsm.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sip/transaction_server_tx_fsm.go b/sip/transaction_server_tx_fsm.go index 39133b6..b638f69 100644 --- a/sip/transaction_server_tx_fsm.go +++ b/sip/transaction_server_tx_fsm.go @@ -16,7 +16,8 @@ func (tx *ServerTx) inviteStateProcceeding(s fsmInput) fsmInput { case server_input_request: tx.fsmState, spinfn = tx.inviteStateProcceeding, tx.actRespond case server_input_cancel: - tx.fsmState, spinfn = tx.inviteStateProcceeding, tx.actCancel +// tx.fsmState, spinfn = tx.inviteStateProcceeding, tx.actCancel + tx.fsmState, spinfn = tx.stateProceeding, tx.actCancel case server_input_user_1xx: tx.fsmState, spinfn = tx.inviteStateProcceeding, tx.actRespond case server_input_user_2xx: From 82addf6f17ee9f8b29eb5617d56637363fa32098 Mon Sep 17 00:00:00 2001 From: disacod <130170448+disacod@users.noreply.github.com> Date: Thu, 6 Nov 2025 12:11:21 +0300 Subject: [PATCH 3/4] Update go.mod --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 52f403a..83d13d1 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/emiago/sipgo +module github.com/disacod/sipgo go 1.23.0 From a5011d089a136c75fa8f961e911006f5d6658202 Mon Sep 17 00:00:00 2001 From: disacod <130170448+disacod@users.noreply.github.com> Date: Thu, 6 Nov 2025 12:18:46 +0300 Subject: [PATCH 4/4] Update go.mod --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 83d13d1..52f403a 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/disacod/sipgo +module github.com/emiago/sipgo go 1.23.0