Outbound Calls

This section explains 3CX handling of Outbound Calls through SIP Trunks. Specifically, the INVITE message structure and how the SIP field values are populated.

Structuring the INVITE message

The values 3CX sends in outgoing INVITE messages can be configured in the SIP Trunk settings in the “Outbound Parameters” tab. From here, you can set what values will be placed in each SIP field, but this will be explained later in more detail.

The base INVITE message 3CX sends when making an outgoing call through a SIP Trunk looks like this:

INVITE sip:[email protected]:5060 SIP/2.0

Via: SIP/2.0/UDP 192.168.1.1:5060;branch=z9hG4bK-524287-1---41103210c7296225;rport

Max-Forwards: 70

Contact: <sip:[email protected]:5060>

To: <sip:[email protected]:5060>

From: "Extension Name"<sip:[email protected]:5060>;tag=f625b10b

Call-ID: 84MhAlm_yj3UmVbT7BK6nA..

CSeq: 1 INVITE

Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REGISTER, SUBSCRIBE, NOTIFY, REFER, INFO, MESSAGE, UPDATE

Content-Type: application/sdp

Supported: replaces, timer

User-Agent: 3CXPhoneSystem

Content-Length: 256

Configurable SIP Fields

3CX does not allow full customization of the INVITE, so its base structure always needs to contain the SIP fields shown above. 3CX enables the following fields to be configured:

  • Request Line URI : User Part
  • Request Line URI : Host Part
  • Contact : User Part
  • Contact : Host Part
  • To : Display Name
  • To : User Part
  • To : Host Part
  • From : Display Name
  • From : User Part
  • From : Host Part
  • User Agent : Text String
  • Remote Party ID - Called Party : Display Name
  • Remote Party ID - Called Party : User Part
  • Remote Party ID - Called Party : Host Part
  • Remote Party ID - Calling Party : Display Name
  • Remote Party ID - Calling Party : User Part
  • Remote Party ID - Calling Party : Host Part
  • P-Asserted Identity : Display Name
  • P-Asserted Identity : User Part
  • P-Asserted Identity : Host Part
  • P-Preferred Identity : Display Name
  • P-Preferred Identity : User Part
  • P-Preferred Identity : Host Part
  • P-Called-Party-ID : Display Name
  • P-Called-Party-ID : User Part
  • P-Called-Party-ID : Host Part

3CX Variables

The variables briefly described below can be assigned to each of the SIP Fields mentioned in section “Configurable SIP Fields”.

AuthID

The value of the AuthID variable is derived from the “Authentication ID” field in “SIP Trunks” function > Edit SIP Trunk > “General” tab > “Account details” section > Authentication ID (aka SIP user ID).

CalledName

As of v15 this variable is deprecated and should not be used.

CalledNum

The “CalledNum” variable contains the dialed/destination number the INVITE message is supposed to initiate the call to.

CallerName

The Caller's Name is composed by merging the values of the First Name and Last Name of the extension performing the call in the “Display name” field.

CallerDispName

In contrast to the “CallerName”, for this variable 3CX attempts to use the original Caller Name of the call initiator. This means that if the endpoint registered to 3CX makes a call to an external number and sends a value in the “From : Display Name”, 3CX tries to maintain this value when constructing the INVITE to be sent to the SIP Trunk provider SIP Server.

CallerNum

This variable has the same value as the “LineNumber” variable as explained in section LineNumber. Avoid using it as it is used internally by the system and use the “LineNumber” variable instead.

ContactUri

The “ContactUri” variable value containing the IP and port on which a SIP Trunk should contact 3CX, is typically used to populate the “Contact : Host Part”. The port is always the default 3CX SIP port configured during the installation. For the IP, 3CX first checks if in the SIP Trunk settings in the Options” tab, there is a valid IP address in the “Select which IP to use in 'Contact' (SIP) and 'Connection' (SDP) fields” field to use. If this option however is set to “Use Default Settings”, 3CX uses the system-wide default Public IP it has been configured to use under “Advanced” > Network > “External IP configuration” tab.

DevHostPort

The “DevHostPort” variable is only available for use by PSTN Gateways which share some of the same functionality in 3CX.

GWHostPort

This variable is the combined value of the “Registrar/Server” and “Port” fields of the SIP trunk settings.

LineId

The LineId is the virtual extension number of the SIP Trunk or Gateway. This is by default in the 10000 range. This is not visible in the 3CX Admin console, but is visible in the Active Calls page.

LineNumber

The Line number is taken from the “Main Trunk No” field of the SIP Trunk

Location: Voice & Chat → SIP Trunk → General (tab) → Account Details → Main Trunk Number

OutboundCallerId

During an outbound call the PBX will check for an Outbound Caller ID in four different locations with descending priority. The highest priority is the "Outbound Caller ID" field that can be set in the Outbound Rules.

Location: Outbound Rules → Select the Outbound Rule → Make outbound calls on

If that is empty, then the Outbound Caller ID is taken from the Extension settings.

Location: Users → Select Extension → General (tab) → Outbound Caller ID.

If this field is empty, then 3CX will check the SIP Trunk settings → “Options” tab → “Caller ID Control”“Default Outbound Caller ID” field.

If this field is also empty, the 3CX will use the Main Trunk Number that is configured in the “General” tab of the SIP Trunk settings.

If an endpoint registered to 3CX uses the anonymous dial code to make an outbound call, this variable will be populated with the value “anonymous”.

OriginatorCallerID

The “OriginatorCallerID” variable attempts to use the original number of the Caller, even if that number has not originated from the 3CX system.

However, 3CX will first check if the "Outbound Caller ID" in the Outbound Rules is populated and will use that value as the Caller ID. If the "Outbound Caller ID" under the Outbound Rules is empty, 3CX will check if the “CallerNum” in Inbound Parameter is populated. An example where this can happen is when there is an incoming call from a SIP Trunk provider that is then redirected to another outside/external number through a SIP Trunk provider. The “CallerNum” Inbound Parameter will have been populated during the incoming call information collection, as explained in section 5..

If the “CallerNum” Inbound Parameter is empty, 3CX performs the same checks as for the “OutboundCallerId” variable explained in section 6.1.2.12.

If an endpoint registered to 3CX uses the anonymous dial code to make an outbound call, this variable will be populated with the value “anonymous”.

EnforcedOriginatorCallerID

The “EnforcedOriginatorCallerID” variable is exactly the same as the “OriginatorCallerID” variable (section 6.1.2.13) with one important difference. When the anonymous dial code is used to make a call, instead of using the value “anonymous”, it still performs the same checks described as if the dial code was not used.

EnforcedOutboundCallerId

The “EnforcedOutboundCallerId” variable is exactly the same as the “OutboundCallerId” variable (section 6.1.2.12) with the difference that when the anonymous dial code is used to make a call, instead of using value “anonymous”, it still performs the same checks described as if the dial code was not used.

OutboundLineId

The Outbound Caller ID is taken from the SIP Trunk Settings.

Location: SIP Trunks → SIP Trunk → Caller ID (tab) → Default caller ID (section) → Configure Caller ID

If this field is empty, the 3CX will use the Main Trunk Number that is configured in the “General” tab of the SIP Trunk settings.

OutHostPort

The IP/Hostname of this variable is taken from the Outbound Proxy fields.

Location: Voice & Chat → SIP Trunk → General (tab) → Server Details (section) → Outbound Proxy

Leave default value

When selecting this option as a variable, 3CX will use the default value it has for the corresponding SIP field. The SIP fields that had default values assigned to them in 3CX can be seen by examining the default/base INVITE message as shown at the beginning of section 6.1.

Any SIP fields for which 3CX does not have a default value, when “Leave default value” is set, will remain blank.

Custom Field

Choosing this as a variable will allow you to enter a value manually.

Custom IP Range

Choosing this as a variable will allow you to enter a value manually. When selected, it is expected to enter a value that is an IP address.

Other Settings

“Via” header

The “Via” header in the INVITE message follows the same logic as for the REGISTER messages explained in section 3.3.2 and is configured the same way.

In short, the “Via” header by default is populated with the IP Address of the NIC of the server. This can either be a Local LAN IP or a Public IP, depending on whether the 3CX server is behind NAT or Full Public.

The default behavior however can be overridden so that any IP address can be entered in this header. To set the override, in the “Options” tab of the SIP Trunk settings you must check the option ”Put Public IP in SIP VIA Header” and fill in the IP address to be presented.

Last Updated

This document was last updated on 25 July 2024

https://www.3cx.com/docs/sip-trunk-outbound-calls/