TryLearn More

Use SIP trunks, WebRTC & Apps

Slash your Phone Bill by 80%

Outbound Calls

On this topic:

Outbound Calls

Structuring the INVITE message

Configurable SIP Fields

3CX Variables

AuthID

CalledName

CalledNum

CallerName

CallerDispName

CallerNum

ContactUri

DevHostPort

GWHostPort

LineId

LineNumber

OutboundCallerId

OriginatorCallerID

EnforcedOriginatorCallerID

EnforcedOutboundCallerId

OutboundLineId

OutHostPort

Leave default value

Custom Field

Custom IP Range

Other Settings

“Via” header

This section will explain how 3CX handles Outbound calls through SIP Trunks. Specifically, it will explain how the INVITE messages are structured and how the values in the SIP fields 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 as 3CX will send it when making an outgoing call through a SIP Trunk looks like the following:

INVITE sip:123456789@sip.contoso.com: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:auth_ID@2.2.2.2:5060>

To: <sip:123456789@sip.contoso.com:5060>

From: "Extension Name"<sip:auth_ID@sip.contoso.com: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 15.5.10244.4 (9880)

Content-Length: 256

Configurable SIP Fields

Although 3CX does allow customization of the INVITE, it does not allow full customization, so the base structure of the INVITE will always contain the SIP fields shown above. What can be configured however is what values will populate all the “Display Name”, “User Part” and “Host Part” fields.

More specifically, the SIP fields 3CX can configure are the following:

  • 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

Following are the variables that can be allocated to each of the SIP Fields mentioned in section 6.1.1. In the following sections, there will be a brief description of where each variable retrieves its value from.

AuthID

The value of the AuthID variable is taken from the “Authentication ID” field in the SIP Trunk settings.

Location: SIP Trunks → SIP Trunk → General (tab) → Authentication (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 dialled/destination number the INVITE message is supposed to initiate the call to.

CallerName

The Callers Name will be constructed, by taking the values of the First name and Last Name of the extension and show it in the “Display name” fields.

CallerDispName

As opposed to the “CallerName” variable, for this variable 3CX attempts to use the original Caller Name of the entity initiating the call.

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 will try to maintain this value when constructing the INVITE that will be sent to the SIP Trunk provider SIP Server.

CallerNum

This variable works the same as the “LineNumber” variable as explained in section 6.1.2.11. You should avoid using it as this is used internally by the system. Instead, use the “LineNumber” variable.

ContactUri

The “ContactUri” variable value contains the IP and port on which a SIP Trunk should contact 3CX. The port is always the default SIP port that 3CX has been configured to use during the installation.

For the IP, 3CX first checks if in the SIP Trunk settings in the ‘Options” tab, there is a valid IP value in the “Select which IP to use in 'Contact' (SIP) and 'Connection'(SDP) fields” field. If there is an IP here, that IP will be used.

If this option however is set to “Use Default Settings”, 3CX will use the system wide default Public IP it has been configured to use. This is set under Settings → Network → Public IP tab.

This variable is typically used to populate the “Contact : Host Part”.

DevHostPort

The “DevHostPort” variable should not be used for SIP Trunks even though the variable is available. It is used by PSTN Gateways which share some of the same functionality in 3CX.

GWHostPort

The value of this variable is taken from the SIP trunk settings and in combination of the Registrar and Port.

Location: SIP Trunks → SIP Trunk → General (tab) → Trunk Details (section) → Registrar/Server/Gateway Hostname or IP

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 Management 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: SIP Trunks → SIP Trunk → General (tab) → Route calls to (section) → Main Trunk Number

OutboundCallerId

The Outbound Caller ID is taken from the Extension settings

Location → Extensions → Extension → General (tab) → User Information (section) → Outbound Caller ID.

If this field is empty, then 3CX will check the SIP Trunk settings → “Caller ID” tab → “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 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.

First 3CX will check if for the specific call session that it is trying to create the INVITE for, if the “CallerNum” 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 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 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: SIP Trunks → SIP Trunk → General (tab) → Trunk 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

Apart from the variables that are located in the “Outbound Parameters” tab of the SIP Trunk settings, there are some additional options you can use to further customize the INVITE messages 3CX generates.

“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 option ”Put Public IP in SIP VIA Header” and fill in the IP address to be presented.