Caller ID Reformatting

In 3CX Phone System Version 15, each port/trunk/PSTN gateway or VoIP Provider trunk can get the incoming Caller ID number and format it in a way that the administrator wishes in order to have add a prefix or present a unified number format in inbound and outbound calls.

CID Building rules

The configuration for inbound and outbound Caller ID formatting is the same. Due to the complexity of this task, basic string operations need to be understood.

  • ( ) Brackets – These are used to encapsulate variables and numbers. Each bracket will contain a variable.
  • (.*) – This means any sequence or number in a string. This should be always in the last position. Any variables added after this will be ignored.
  • 0-9,+ – Digits 0-9 and ‘+’ – These are used to match a corresponding symbol in a given CID.
  • (XXX) – Where X can be any digit from 0-9. Example if a number is 0203123456 and you put (0203) this means that the PBX will search for a string that matches 0203 exactly.
  • \1, \2 – \9 – This will be replaced with the content of variable 1, 2, ..9.
  • (.) – A dot is a place-holder for any symbol. Example (…) means pbx will match any 3 numbers. If you know that area code starts with 3 and contains three numbers you can do (3..)

Configuring Caller ID Reformatting

To configure Caller ID reformatting:

  1. Expand the “SIP trunks” node in the 3CX Management Console and select the Port/Trunk that you want to configure.
  2. Click on the Trunk, select “Edit” and then  select the “Caller ID” tab.
  3. In the section Inbound and Outbound, create and apply your rules for incoming or outgoing Caller IDs.
  4. You can apply more than one rule per direction. Rules have priority and the rule that is matched first will be applied.


Scenario 1 – Company ABC wants all USA international numbers to be formatted to a local number format instead of an international format that is being received through the VoIP provider, so we want to format +12021234567  as 1234567. In this case we can make a simple inbound Caller ID reformatting rule that states the following:

Source CID Pattern: +(1)(…)(.*)
New Source CID Pattern: \3

In this example:

  • + will be removed,
  • (1) refers to the country code for USA and is considered the first variable – \1
  • (…) refers to a 3 digit area code and is the second variable – \2
  • (.*) The remaining number and therefore this is the third variable – \3

This means is that we are keeping only the 3rd variable – the local number only. So an incoming number that is presented like this: +12021234567 will be shown as 1234567.

Scenario 2 – Company ABC wants to add a 0 to the incoming caller ID number for quick redial purposes. The incoming number looks like this: +17864722245. Plus they would like to format the number in national format.
Source CID Pattern: +(1)(…)(.*)
New Source CID Pattern: 0\2\3

In this example:

  • ZERO will be appended to the result
  • the PBX will take variable \2 (786) and variable \3 (4722245) to create the result: 07864722245.

Additional Notes

  • Requires the use of the “originator Caller ID” to be active in the trunk Settings options.
  • You can specify several reformatting rules per Trunk
  • The reformatting rule will apply in a top down order
  • These rules will nor re-write the  incoming From: Display value,which means that if the call has been received with +12021234567, the display will still show these numbers, but the “core part” of the number to be dialed has been updated.