3CX technical support answers: conditions for switching to a backup route (trunk) in outgoing rules

We are often approached with a similar question: by what principle does the trunk switch in the outbound rule if the main trunk is unavailable?

We have prepared a comprehensive answer to this question. It can be divided into 3 parts:

  • Selecting and switching a route / trunk in an outbound rule
  • Features of handling Early Media and Ringing messages
  • Features of trunks with IP authorization (peer trunks without registration)

Introduction


As you know, 3CX can have up to 5 different routes in the outbound rule . You can prioritize these routes. If the first route (in fact, a trunk or VoIP gateway) cannot make a call, it is transmitted along the second route, etc. It is important for us to understand exactly what events can affect the refusal to terminate a call on the main trunk and switch to the backup trunk.

image



Route selection and switching


  • In the outbound 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
  • SIP Ringing message (180 or 183) from the service provider (or VoIP gateway) does not mean successful connection. Another trunk may be selected, or trunks enumeration may end depending on the received SIP messages in the future (see below)
  • The Busy SIP message completes the trunk enumeration and transmits a busy signal to the caller. Busy SIP message types:

    • 486 Busy Here - the subscriber is busy
    • 600 Busy Everywhere - the called user is busy and does not want to accept the call at the moment
    • 1408 No Response - 3CX Internal Error Code

  • SIP success message completes trunk enumeration. Types of success messages:

    • 200 OK - successful completion of the switch
    • Cancel - the called party rejected the call without picking up the phone

  • SIP connection error message starts enumeration of trunks (selection of the next trunk by priority). A list of SIP error messages is provided at the end of this manual.

Early Media and Ringing Options


When using more than one trunk in an outbound rule , processing of Early Media and Ringing messages has its own peculiarities. Since 3CX cannot predict in advance whether a switch to a fallback route will occur, it changes the rules for handling Early media messages (typically 183 Ringing).

After receiving SIP message 183 Ringing, which are usually used when transmitting specific messages from the operator (for example, service voice messages of the network type “expect subscriber response”), this message is converted to SIP message 180, and the audio stream from the operator is “muffled”. The subscriber on extension 3CX does not hear the operator’s service messages, but the SIP phone dial tone. For reference:

  • 180 Ringing - the location of the called user is determined, an incoming call signal is issued
  • 183 Session Progress - used to obtain in advance a description of the information exchange session from gateways on the way to the called user

Trunks with IP authorization


If the operator provided a trunk for the 3CX server to the public IP address of this server (a trunk with IP authorization), 3CX does not register the trunk on the operator's SIP server. Thus, 3CX cannot determine if this trunk is “working” 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.

Trunk Switch SIP Error Codes


SIP message codes (errors) at which the trunk is switched:

  • 400 Bad Request - the request is not understood due to syntax errors in it; an error in the alarm, most likely something with the hardware settings
  • 401 Unauthorized - a normal server response that the user has not logged in yet; usually after this the subscriber equipment sends a new request to the server containing the username and password
  • 402 Payment Required - Payment Required
  • 403 Forbidden - the subscriber is not registered
  • 404 Not Found - the called party was not found; no such SIP number
  • 405 Method Not Allowed - the method is not supported; may occur if the user tries to send voicemail, etc.
  • 406 Not Acceptable - User Not Available
  • 407 Proxy Authentication Required - requires proxy authentication
  • 408 Request Timeout - request processing timed out; 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 indicate the length of the content in the request header
  • 413 Request Entity too large - the request size is too large to process on the server
  • 414 Request URI too long - SIP URI size is too large to process on the server
  • 415 Unsupported Media Type - a call is made by an unsupported codec
  • 416 Unsupported URI Scheme - the server cannot process the request due to the fact that the recipient address scheme is not clear to him
  • 420 Bad Extension - unknown extension; server did not understand SIP protocol extension
  • 421 Extension Required - the request header does not indicate which extension the server should use to process it
  • 423 Interval too brief - the server rejects the request because the resource’s action time is too short
  • 433 Anonymity Disallowed - Anonymous Call Prohibited
  • 480 Temp Unavailable - temporarily unavailable direction, try calling later
  • 481 Call Transaction does not exist - action failed; normal response when a duplicate packet arrives
  • 482 Loop Detected - a closed request transmission route was detected
  • 483 Too many hops - a request in its path passed through a larger number of proxies than allowed
  • 484 Address Incomplete - Request received with incomplete address
  • 485 Ambiguos - the address of the called user is ambiguous
  • 487 Request Terminated - the request is canceled; usually comes when a call is canceled
  • 500 Server Internal Error
  • 501 Not Implemented - the server does not implement any functions necessary to service the request; SIP request method is 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 a request
  • 503 Service Unavailable - the server cannot currently service the call due to overload or maintenance
  • 504 Server Timeout - the server did not receive a response within the specified period of time from the server that it contacted to end the call
  • 505 Version Not Supported - version not supported; server does not support this version of SIP
  • 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 indicating the reason for the rejection
  • 604 Does not exist anywhere - the called user does not exist
  • 606 Not Acceptable - a connection to the server was established, but some parameters, such as the type of information requested, bandwidth or type of addressing are not available

Also popular now: