diff --git a/sip/transaction_layer.go b/sip/transaction_layer.go index cf00b16..d652839 100644 --- a/sip/transaction_layer.go +++ b/sip/transaction_layer.go @@ -108,15 +108,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 diff --git a/sip/transaction_server_tx_fsm.go b/sip/transaction_server_tx_fsm.go index 5cf48eb..435371b 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: