481 communication protocol_error ai_generated partial

SIP/2.0 481 Call/Transaction Does Not Exist

ID: communication/sip-481-loop-detected

Also available as: JSON · Markdown · 中文
78%Fix Rate
85%Confidence
1Evidence
2024-03-12First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
Kamailio 5.7 active
FreeSWITCH 1.10 active
Asterisk 20 active
opensips 3.5 active

Root Cause

SIP proxy or B2BUA receives a request for a dialog or transaction that it has already terminated or never created, often due to forked requests or out-of-order CANCEL.

generic

中文

SIP 代理或 B2BUA 收到了一个针对已终止或从未创建的对话或事务的请求,通常是由于分叉请求或 CANCEL 乱序导致。

Official Documentation

https://datatracker.ietf.org/doc/html/rfc3261#section-21.4.3

Workarounds

  1. 82% success Enable SIP dialog tracking in Kamailio: `modparam("dialog", "track_cseq_updates", 1)` and ensure `dlg_flag` is set on initial INVITE. Also add `failure_route` to handle 481 gracefully by sending ACK and clearing state.
    Enable SIP dialog tracking in Kamailio: `modparam("dialog", "track_cseq_updates", 1)` and ensure `dlg_flag` is set on initial INVITE. Also add `failure_route` to handle 481 gracefully by sending ACK and clearing state.
  2. 75% success Configure FreeSWITCH to handle 481 by setting `sip-force-expires` on re-INVITE and enabling `sip-call-id` validation in the dialplan to reject mismatched requests.
    Configure FreeSWITCH to handle 481 by setting `sip-force-expires` on re-INVITE and enabling `sip-call-id` validation in the dialplan to reject mismatched requests.
  3. 80% success Add a SIP route in Asterisk that matches 481 responses and sends a CANCEL or BYE to clean up the dangling transaction on the upstream leg.
    Add a SIP route in Asterisk that matches 481 responses and sends a CANCEL or BYE to clean up the dangling transaction on the upstream leg.

中文步骤

  1. Enable SIP dialog tracking in Kamailio: `modparam("dialog", "track_cseq_updates", 1)` and ensure `dlg_flag` is set on initial INVITE. Also add `failure_route` to handle 481 gracefully by sending ACK and clearing state.
  2. Configure FreeSWITCH to handle 481 by setting `sip-force-expires` on re-INVITE and enabling `sip-call-id` validation in the dialplan to reject mismatched requests.
  3. Add a SIP route in Asterisk that matches 481 responses and sends a CANCEL or BYE to clean up the dangling transaction on the upstream leg.

Dead Ends

Common approaches that don't work:

  1. Restart the SIP proxy service to clear all dialogs 95% fail

    The error is caused by dialog state mismatch, not by stale state. Restarting loses all active calls and won't fix the routing logic that creates the mismatch.

  2. Increase transaction timeout values in SIP config 85% fail

    481 is not a timeout error; it's a state machine inconsistency. Longer timeouts only delay the inevitable failure.

  3. Disable SIP forking entirely 60% fail

    While forking can contribute to 481 errors, disabling it breaks legitimate call distribution and is an overreaction. The root cause is usually improper dialog tracking.