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.

Liked this article?

Get notified of new articles
or share
You might also be interested in:
  1. Nathan Williams

    For the life of me I am unable to get rid of the +. I can get rid of the whole number but not just +. I tried copying and pasting the format listed along with other configs. But no luck.

    October 3, 2013 at 11:06 pm
  2. stefanw


    to cut the plus
    to convert the plus use


    October 5, 2013 at 2:40 pm
  3. Andrew

    How do I go about setting the outbound caller ID for a particular extension? I’ve set it on the Extension’s Other tab under Outbound Caller ID, but the Caller ID specified on the Voip Provider’s Other Options tab seems to override it.

    October 8, 2013 at 11:07 pm
    • @Andrew – blank out the provider cid from the options tab as a test and see if you can get the extensions outbound cid to show. Thats the first test you need to make. Or you can set the Extensions outbound cid to the provider outbound cid (as a test only) and see if you get the right cid. If not then your provider does not allow cid changes. if yes, then we will change some parameters in the inbound parameters. What is the provider in question?

      October 16, 2013 at 3:49 pm
  4. hello I can not run Reformatting in outgoing mode I have an internal 620 and i want reformating to 041 595 620 am not work I see only 620 in destination phone

    sorry for may not good English

    October 15, 2013 at 7:01 pm
    • @Ermes – Can you show me what you put in the outbound reformatting?
      Enter the original number and how you want it reformatted

      October 16, 2013 at 3:30 pm
  5. Craig

    how does this work on v11? There is a single line to set this up for all inbound calls. The problem now is numbers do not match the phonebook when they have a 1 in front of the area code.

    October 15, 2013 at 8:58 pm