Trunk management with 3CX
Zero Admin
With the new Dashboard
Bulletproof Security
With SSL certs and NGINX
Install on $150 Appliance
Intel MiniPC architecture
New, Intuitive Windows Client
More themes, more UC
More CRM Integrations
Scripting Interface to add your own
Improved Integrated Web Conferencing
iOS and Android apps included
Personal Click2Meet URLs

Trunk management with 3CX

Trunk Management

On this topic

Trunk Management


Creating Outbound Call Rules

Creating DID Numbers / Inbound Rules

Adding DID’s

Configuring Different Office Hours per DID

Troubleshooting DID Numbers

Exporting & Importing DIDs

Exporting DIDs

Importing DIDs

Caller ID Reformatting (Caller ID Re-Write)

See Also


Outbound and inbound rules dictate how 3CX Phone System routes calls based on certain criteria. You can, for example, configure rules to control through which VoIP gateway or provider a call will be placed through, based on least cost routing, so that local calls go through your ISDN lines and international calls through your VoIP provider. You can also create DID (Direct Inward Dialing) numbers which will allow you to place calls directly to a user’s extension, bypassing the receptionist or IVR.

Creating Outbound Call Rules

An outbound rule denotes through which VoIP gateway/provider an outbound call should be placed. Based on who is making the call, the number that is being dialled or the length of the number.

When configuring a VoIP Gateway or a VoIP Provider, you will be asked to create an outbound rule that will be used to route calls to the Gateway or Provider. You can also edit these rules or create new ones from the outbound rules node.

To create an outbound rule:

  1. From the 3CX Management Console menu under select Outbound Rules” > “Add Outbound Rule”, and enter a name for the new rule.
  2. Specify the criteria that should be matched for this outbound rule to be triggered with. In the “Apply this rule to these calls” section, specify any of the following options:
  • Calls to numbers starting with prefix – Apply this rule to all calls starting with the number you specify. For example, enter 9 to specify that all calls starting with a 9 are outbound calls and should trigger this rule. Callers should dial “9123456” to reach number “123456”.
  • Calls from extension(s) – Select this option to define a particular extension or extensions range for which this rule applies. Specify one or more extensions separated by commas, or specify a range using a -, for example 100-120.
  • Calls to Numbers with a length of – Select this option to apply the rule to numbers with a particular digit length, for example 8 digits. This way you can capture calls to local area numbers or national numbers without requiring a prefix.
  • Calls from extension group – Rather than specifying individual extensions, you can select an extension group.
  1. Now specify how outbound calls matching the criteria should be handled. In the “Make outbound calls on section, select up to three routes for the call. Each defined gateway or provider will be listed as a possible route. If the first route is not available or busy, 3CX Phone System will automatically try the second route.

The alternative Outbound Routes will have to be configured in order for calls to take these routes, when the first is unavailable. By default the second and third routes Block Calls.

  1. You can transform the number that matches the outbound rule before the call is routed to the selected gateway or provider using the Strip Digits and Prepend fields:
  • Strip digits – Allows you to remove one or more digits from the called number. Use this to remove the prefix before a call is dialled on the gateway or provider if it is not required. In the example above, you would specify to remove one digit, in order to remove the prefix “9” before it is dialled.
  • Prepend – Allows you to add one or more digits at the beginning of the number if this is required by the provider or gateway.
  1. You can configure these options per outbound rule, since a rule that applies to a VoIP gateway connected to the local PSTN would normally require different criteria than a rule that applies to a VoIP Provider.

See our Outbound Rules – A Complete Example of how to create an outbound rule in 3CX Phone System.

Creating DID Numbers / Inbound Rules

Many companies provide users and/or departments with “Direct or DID numbers”, which allow their contacts to call them directly, bypassing the receptionist. DID numbers are referred to as DDI numbers in the United Kingdom and as MSN numbers in Germany. Even if you make use of a digital receptionist, a direct line / number is often preferable because it’s more convenient for the caller.

Direct dial numbers are easily implemented using “Inbound Rules”. DID numbers are provided by your VoIP provider or Phone Company and are virtual numbers assigned to your physical lines. Usually you are assigned a range of numbers, which are linked to an existing BRI/T1/E1. There will be an extra charge per number or per range, but this will be a fraction of the cost of adding physical lines. Enquire with your Phone Company or VoIP provider for more information about DID numbers.

Adding DID’s

To add a DID:

  1. From the 3CX Management Console, select  “Inbound Rules” > “Add DID.
  2. Enter a name for the DID (for example Sales). Note: The DID name can be prepended or appended to the Caller ID so as to identify on which number a caller has called you from. You can enable this from the “Settings” > “General” > “Global options” page under “Inbound name to Caller ID”.
  3. Under the new “Inbound Rule”, the “Inbound Rule Type” allows you to  choose between a DID/DDI or caller ID number mask.
  4. In the “DID/DDI Number/mask” field, enter the DID number as it will appear in the SIP “to” header (The number your provider has supplied as your main, or first, DID number). 3CX Phone System will match the number inserted in this field with the “to” header, starting from the last part of the received string, thus avoiding any differences in the format of the number. For example, if you are based in the UK and your DID number is 0845-2304024, then you can enter the number *2304024. This will match any DID number inserted in the “to” field ending with these numbers, including +448452304024, 08452304024, 00448452304024, and, of course, *2304024.
  5. Select for which Gateway or Provider ports you wish to add this DID to. If the DID number is associated with multiple ports, then you must select each port. An inbound rule will be created for each port that you select.
  6. Specify where you wish to direct calls made to this DID:
  • End Call
  • Connection to extension
  • Connect to Queue/Ring Group
  • Connect to Digital receptionist
  • Voicemail for extension
  • Forward to outside number
  • Send fax to email of extension
  1. You can specify that an incoming call is routed differently if it is received outside office hours. De-select the “Same as during office hours” option to specify a different route.
  2. Click “OK” to create the DID / Inbound rule.

Configuring Different Office Hours per DID

Businesses working globally across different time zones, will want to configure different office hours and holidays per DID.

To do this:

  1. From the 3CX Management Console menu, click “Add” > “DID / Inbound route”.
  2. Give the rule a descriptive name. This will be used to identify which DID has been used when troubleshooting, as it can be seen in the logs. It will also be used for identifying which DID is being used to to make the call, and will be displayed in the Caller ID of the destination phone. This option can be selected, in the Global Options, to prepend the name of the DID.
  3. In the DID number/mask type in the number. This can be a whole number, or a wildcard, both formats will be considered for processing. For example 1235551234 or *234.

  1. Choose the provider/gateway port. This is used to identify over which line the call will be coming in from. A VoIP provider will only have one available port. A VoIP (PSTN) Gateway, will have one port for each physical line, depending on the make and model. FXO gateways for example will have one port for each line. E1/T1 gateways will only have one port per gateway.

  1. In order to enable custom DID opening hours, uncheck the “Apply the same routing logic Outside of office hours” box.

  1. Choose where you want to route out of office hours calls in the “Outside Office Hours” section.

  1. Check “Set up Specific Office Hours”. This option will only be enabled if you disable “Apply the same routing logic Outside of office hours”. Click “Set up Specific Office Hours” to open up the dialog box.

  1. Set your office hours and click “OK”.
  2. Check “Play Holiday Prompt on Public Holiday” to play the holiday prompt whenever there is a holiday.
  3. Click “OK” to accept the configuration of both the routing of the call as well as the opening hours of the DID.
  4. Go to the “Settings” node > “General”.

  1. In the “Office Hours” section click on “Configure Holidays”. This will open up a special dialog box, where you can define holidays and record or select pre recorded .wav files to play for the holidays.

  1. Give the Holiday a name, for example, “New Year”.
  2. Choose the date for the holiday, for example 1 January. Since New Years Day recurs every year, you can choose “each” instead of a year. Holidays with a steady date each year can be defined like this. Dates which do not have a steady date each year can be defined as and when a holiday occurs, for example a bank holiday, you can define the current year or the next year.
  3. Choose a prompt to play for the Holiday. Click “Add”.
  4. Choose a prompt from the list of files already in the repository, and click “OK”.
  5. Click “Add” to add the holiday and prompt to the PBX.
  6. Click “OK” to exit the holiday configuration
  7. Click “OK” in the General Settings to save the configuration.

Troubleshooting DID Numbers

If you have created the DIDs, but calls are not being forwarded as expected, do the following:

  1. Go to the Server Activity log node in the 3CX Management Console. The Server Status screen lists current server activity and logs calls that are being received and for which number they were received on.
  2. Call the DID number that you configured, and monitor the Server Status log. You will see a line similar to:
    Incoming call from 1000 to <sip:789456123@3CXPhone System>
    where “1000” is the internal number of the line configured to receive calls from the VoIP Gateway or VoIP Provider and <sip:789456123@3CXPhone System> is the content of the “To” header of the INVITE, i.e. the intended recipient. (Note logging level should be set to Medium or Verbose to see additional messages.)
  3. Now analyse the To header carefully and ensure that the DID number you have dialled is present in the To header: <sip:789456123@3CXPhone System>.
  4. If you see a text ‘Review invite & adjust source identification’, you need to configure Source identification. See the chapter Configuring a VoIP Provider / SIP Trunk for more information.

Exporting & Importing DIDs

Exporting DIDs

If you need to export your Inbound Rules to a .CSV file format to either save them as backup or to make changes to them, follow these steps:

  1. Log into the 3CX Management Console.
  2. Click on the “Inbound Rules” node and select the DID’s that you want to export.
  3. Click on the “Export” button to begin exporting your DID rules.
  4. Select a location and a file name for your exported DID rule file and click Save. Your rules will be exported and saved in the CSV file.

Importing DIDs

If you want to create multiple DID rules you can do so by creating the necessary fields on a CSV file using the correct format, then importing them back into 3CX by using the import function.

To import your DIDs into 3CX from a CSV file follow these steps.

  1. Log into the 3CX Management Console.
  2. Click on the “Inbound Rules” node and click on the “Import” button.
  3. Browse to the file that contains the DID rules that you want to import, select it and click “Open”.
  4. The rules will be imported in 3CX Phone System.

See Creating and Importing DIDs for more information.

Caller ID Reformatting (Caller ID Re-Write)

Here you can find more information about Caller ID Reformatting 

See Also

You might also be interested in:

Ask a Question

Please only post questions in regards to the document you are currently reading.
Technical support or pre sales questions must be posted via the support or sales channels and such comments will be deleted. Thank you for understanding

Leave a Reply

  1. Mukesh

    I want to know more about inbound and outbound telephony system operated in india

    August 28, 2015 at 8:03 pm Reply
    • Charalambos Eleftheriou

      @Mukesh, thanks for the question. Please contact our sales department for more information.

      September 5, 2015 at 9:02 am
  2. jim

    This does not seem to relate to v14. Specifically this:
    From the 3CX Management Console, select “Inbound Rules” > “Add DID”.
    Enter a name for the DID (for example Sales). Note: The DID name can be prepended or appended to the Caller ID so as to identify on which number a caller has called you from. You can enable this from the “Settings” > “General” > “Global options” page under “Inbound name to Caller ID”.
    Under the new “Inbound Rule”, the “Inbound Rule Type” allows you to choose between a DID/DDI or caller ID number mask.

    How do you make inbound caller id name prepended with the DID name in v14?

    March 2, 2016 at 6:29 pm Reply
    • Charalambos Eleftheriou

      @jim, This guide is for v14 but the option you require is actually under the Company Phonebook options. To set this option, from the 3CX management console navigate to ‘Settings’ > ‘Company Phonebook’, then click on the ‘Phonebook Options’ tab, tick the option under ‘Inbound name to caller ID’ to ‘Add Queue, group and DID names to Caller ID’ and choose the setting to Prepend name to caller ID’.

      March 2, 2016 at 7:55 pm
  3. Maarten van Kaam

    Hi Charalambos,

    I have a challenging question regarding the holiday setting.
    In this article it is mentioned tha you can edit the opening hours and different holidays per DID.

    “Businesses working globally across different time zones, will want to configure different office hours and holidays per DID.”

    Now I have deployed a 3CX pro PBX in a company that has inbound numbers for multiple countries.
    for each DID I can configure the opening hours BUT, I can’t configure a different holiday timetable per DID. The only possible selection is to include the checkbox for public holidays, but this configuration is not separate for each DID (or country).
    Is this a request that I need to send to the supportdesk of 3CX, or can you point me in the right direction?

    April 6, 2016 at 4:24 pm Reply
    • Charalambos Eleftheriou

      @Maarten, it is not possible to configure Holidays Per DID, the holiday schedule is global. You may also post this in our feature request page: and if it gets enough votes and is technically possible it may very well get implemented.

      April 6, 2016 at 4:33 pm
    • Maarten van Kaam

      thanks for the reaction.

      I’ve added this tread to the ideas page and saw that there are more users struggling with holiday issues.

      i think it is strange that this functionality has never been implemented before, because 3CX is very usefull for connecting customers in different countries. and also because it is clearly specified on this page that it should be configurable per DID.

      Maybe you should (let someone) change the text on this page regarding the holidays because as you mentioned it is not configurable at this moment.

      April 6, 2016 at 5:22 pm
    • Charalambos Eleftheriou

      @Maarten, configuring different office hours per DID is possible, the Holiday setting though is not set per DID it is set up globally as mentioned in this guide under the following section:

      April 6, 2016 at 8:24 pm
  4. Nuri

    It doesn’t seem to be working.

    I have the Patton 4114 FXO and since v14 when adding a pstn gateway, it only creates 1 virtual port

    and when I add DIDs to match my external numbers it keeps just going through whatever set under Ports/Trunks

    June 9, 2016 at 2:48 am Reply
  5. Craig Mortassagne

    On version 15 it is not possible to do live trunk monitoring to assist in seeing which outgoing call goes out the respective trunk. Is this a feature that will get included or have I missed a setting.

    July 13, 2016 at 12:07 pm Reply
    • @Craig – This is coming in an update which will be published in the next couple of days.

      July 13, 2016 at 4:02 pm
  6. Derrick K

    All my calls inbound calls Caller ID shows “90001”

    August 15, 2016 at 5:37 pm Reply
    • Charalambos Eleftheriou

      @Derrick, Check under Phonebook Options from Settings > Company Phonebook and un-tick ‘Add Queue, Group and DID names to Caller ID’

      August 18, 2016 at 2:44 pm
  7. Armandos Constantinides

    Is there a possibility to add HOLIDAYS per trunk and not only in Global Settings? Like you do with office hours? Version 15 please.

    November 13, 2016 at 11:07 pm Reply