We are often addressed with a similar question: on what principle does a trunk switch occur in an outbound rule if the primary trunk is unavailable?
We have prepared a comprehensive answer to this question. It can be divided into 3 parts:
- Selecting and switching route / trunk in outbound rule
- Features processing messages Early Media and Ringing
- Features of trunks with authorization by IP (peering trunks without registration)
Introduction
As you know, 3CX can have up to 5 different routes in the
outgoing rule . You can prioritize these routes. If the first route (in fact, a trunk or a VoIP gateway) cannot complete a call, it is transmitted via the second route, etc.
')

It is important for us to understand which events can affect the failure to terminate the call on the main trunk and switch to the backup trunk.
Select and switch route
- In the outgoing rule, 3CX polls all available trunks and bridges (inter-station trunks) in order from 1 to 5
- If the trunk is not registered, it is automatically excluded.
- A Ringing SIP message (180 or 183) from a carrier (or VoIP gateway) does not mean a successful connection. A different trunk may be selected, or the trunking of the trunks may complete depending on the received SIP messages in the future (see below)
- The Busy SIP message terminates trunking and transmits a busy signal to the calling subscriber. Busy SIP message types:
- 486 Busy Here - the subscriber is busy
- 600 Busy Everywhere - the called user is busy and does not want to receive a call at the moment
- 1408 No Response - Internal Error Code 3CX
- SIP message about successful completion completes enumeration of trunks. Types of messages about successful proklyucheniya:
- 200 OK - successful completion of the switch
- Cancel - the called party rejected the call without lifting the handset.
- The SIP error message starts looping through trunks (selecting the next trunk by priority). A list of SIP error messages is given at the end of this manual.
Early Media and Ringing options
When using
more than one trunk in an outbound rule, the processing of Early Media and Ringing messages has its own characteristics. Since 3CX cannot predict in advance whether it will switch to the backup route, it changes the Early media message processing rules (usually 183 Ringing).
After receiving SIP 183 Ringing messages, which are usually used when transmitting specific messages from the operator (for example, service voice messages of the “wait for a subscriber” network), this message is converted to SIP message 180, and the audio stream from the operator is “silenced”. The subscriber on the extension number 3CX hears not the operator’s service messages, but the dial tone of the SIP telephone (CPV). For reference:
- 180 Ringing - the location of the called user is determined, the incoming call is signaled
- 183 Session Progress - used to obtain in advance a description of an information exchange session from gateways on the way to the called user
Trunks with IP authorization
If the operator has provided a trunk for the 3CX server to the public IP address of this server (trunk with IP authorization), 3CX does not register the trunk on the operator’s SIP server. Thus, 3CX cannot determine whether this trunk “works” or not. From the point of view of 3CX, it always “works” (in 3CX it “glows” in green). When processing an outbound rule, 3CX will always try to use this trunk. If the trunk is “idle”, it will delay 32 seconds. before switching to the next trunk. Unfortunately, this behavior cannot be changed.
SIP error codes for trunk switching
SIP codes of messages (errors), in which the trunk is switched:
- 400 Bad Request - the request is not understood due to syntax errors in it; error in the alarm, most likely something with the settings of the equipment
- 401 Unauthorized - normal server response that the user has not logged in yet; usually after this, the user equipment sends a new request to the server containing a username and password
- 402 Payment Required - required payment
- 403 Forbidden - the subscriber is not registered
- 404 Not Found - the called subscriber is not found; there is no such SIP number
- 405 Method Not Allowed - method is not supported; may occur if the user tries to send voicemail, etc.
- 406 Not Acceptable - User Unavailable
- 407 Proxy Authentication Required - proxy server authentication required
- 408 Request Timeout - the request has expired; the subscriber could not be found in the allotted time
- 409 Conflict - Conflict
- 410 Gone - no access to the resource; the resource at the specified address no longer exists
- 411 Length Required - for the specified resource, the client must specify the length of the content in the request header
- 413 Request Entity too large - request size is too large to be processed on the server
- 414 Request URI too long - SIP URI size is too large for server processing
- 415 Unsupported Media Type - a call is made by an unsupported codec
- 416 Unsupported Scheme URI - the server could not process the request due to the fact that the scheme address of the recipient is not clear to him
- 420 Bad Extension - unknown extension; the server did not understand the SIP protocol extension
- 421 Extension Required - the request header does not indicate which server extension should be used to handle it.
- 423 Interval too brief - the server rejects the request because the resource time is too short
- 433 Anonymity Disallowed - anonymous call denied
- 480 Temp Unavailable - temporarily inaccessible direction, try to call later
- 481 Call Transaction does not exist - action not performed; normal response when receiving a duplicate package
- 482 Loop Detected - A closed request path was detected.
- 483 Too many hops - the request went through more proxy servers than allowed
- 484 Address Incomplete - a request with an incomplete address is accepted
- 485 Ambiguos - the address of the called user is ambiguous
- 487 Request Terminated - the request is canceled; usually comes when you cancel the call
- 500 Server Internal Error - internal server error
- 501 Not Implemented - the server does not implement any functions necessary to service the request; SIP request method not supported
- 502 Bad Gateway - a server functioning as a gateway or proxy server, receives an incorrect response from the server to which it sent the request
- 503 Service Unavailable - the server is unable to handle the call at the moment due to overload or maintenance
- 504 Server Timeout - the server did not receive a response within the set period of time from the server to which it turned to end the call
- 505 Version Not Supported - version not supported; the server does not support this version of the SIP protocol
- 513 Message Too Large - the server is unable to process the request due to the length of the message
- 603 Decline - the called user does not want to accept incoming calls without specifying the reason for the refusal.
- 604 Does not exist anywhere - the called user does not exist
- 606 Not Acceptable - the connection to the server has been established, but certain parameters, such as the type of information requested, the bandwidth or the type of addressing are not available