Page tree
Skip to end of metadata
Go to start of metadata


The Trunks module is where you control connectivity to the PSTN and your VoIP provider(s). This is where you also control to interconnect other PBX’s for multi-site applications. The most common trunks are SIP and DAHDi (or Zap). Other than the Extensions module, the Trunks module is one of the most critical modules on the system and allows for a great deal of flexibility.

Logging in

  • From the top menu click Connectivity
  • In the drop down click Trunks

Adding a Trunk

You will want to click on the trunk type you wish to create. Please note in this guide we will cover the generic settings that are universal to all trunk types first. Following this we will cover technology specific settings.

General Settings

Trunk Name

Set a descriptive name for the trunk.

Outbound CallerID

Use this field to specify caller ID for calls placed out of this trunk with the <NXXNXXXXXX> format. You can also use the format: “hidden” <NXXNXXXXXX> to hide the caller ID sent out over digital lines, if supported (E1/T1/J1/BRI/SIP/IAX2).

CID Options

This setting determines what CIDs will be allowed out of this trunk. Please NOTE that Emergency CIDs defined on an extension or device will ALWAYS be used if this trunk is part of an emergency route regardless of these settings.

Allow Any CID

All CIDs, including foreign CIDs from forwarded external calls, will be transmitted.

Block Foreign CIDs

This will block any CID that is the result of a forwarded call from off the system. CIDs that are defined for an extension or device will be transmitted.

Remove CNAM

This will remove the CNAM (Name) from any CID sent out of this trunk.

Force Trunk CID

This will always use the CID defined for the trunk, except if the trunk is part of an emergency route with an emergency CID defined for the extension or device. Intra-Company routes will always transmit an extension’s internal number and name.

Maximum Channels

Controls the maximum number of outbound channels (simultaneous calls) that can be used on this trunk. To count inbound calls against this maximum, use the auto-generated context: from-trunk-[trunkname] as the inbound trunk’s context (see extensions_additional.conf). Leave blank to specify no maximum.

Continue if Busy

Normally the next trunk is only tried upon a trunk being 'Congested' in some form, or unavailable. Checking this box will force a failed call to always continue to the next configured trunk or destination even when the channel reports BUSY or INVALID NUMBER. This should normally be unchecked

Disable Trunk

Check this to disable this trunk in all routes where it is used.

Dial Pattern Manipulation Rules

These rules can manipulate the dialled number before sending it out of this trunk. If no rule applies, the number is not changed. The original dialled number is passed down from the route where some manipulation may have already occurred. This trunk has the option to further manipulate the number. If the number matches the combined values in the prefix plus the match pattern boxes, the rule will be applied and all subsequent rules ignored. Upon a match, the prefix, if defined, will be stripped. Next, the prepend will be inserted in front of the match pattern and the resulting number will be sent to the trunk. All fields are optional.

XMatches any digit from 0-9
ZMatches any digit from 1-9
NMatches any digit from 2-9
[1237-9]Matches any digit in the brackets (example: 1,2,3,7,8,9)
. (dot)Wildcard, matches one or more dialled digits.


Digits to prepend upon a successful match. If the dialled number matches the patterns in the prefix and match pattern boxes, this will be prepended before sending to the trunk.


Prefix to remove upon a successful match. If the dialled number matches this, plus the match pattern box, this prefix is removed before adding the optional prepend box and sending the results to the trunk.

Match pattern

The dialled number will be compared against the prefix, plus this pattern. Upon a match, this portion of the number will be sent to the trunks after removing the prefix and appending the prepend digits. You can completely replace a number by matching on the prefix only, replacing it with a prepend and leaving the match pattern blank.

Dialled Rules Wizard

Always dial with prefix

This is useful for VoIP trunks, where if a number is dialled as "5551234,” it can be converted to "16135551234.”

Remove prefix from local numbers

This is useful for ZAP and DAHDi trunks, where if a local number is dialled as "6135551234,” it can be converted to "555-1234.”

Setup directory assistance

This is useful to translate a call to directory assistance.

Lookup numbers for local trunk

This looks up your local number on (NA-only), and sets up so you can dial either 7 or 10 digits (regardless of what your PSTN is) on a local trunk (where you have to dial 1 + the area code for long distance, but only “5551234” (7-digit dialling) or “6135551234” (10-digit dialling) for local calls.

Upload from CSV

Upload patterns from a CSV file, replacing existing entries. If there are no headers, then the file must have 3 columns of patterns in the same order as in the GUI. You can also supply headers: prepend, prefix and match pattern in the first row. If there are less than 3 recognized headers, then the remaining columns will be blank.

Outbound Dial Prefix

The outbound dialling prefix is used to prefix a dialling string to all outbound calls placed on this trunk. For example, if this trunk is behind another PBX or is a Centrex line, then you would put “9” here to access an outbound line. Another common use is to prefix calls with “w” (to add a 500ms wait per w) on a POTS line that needs time to obtain a dial tone to avoid eating digits. Most users should leave this option blank.

SIP (chan_sip)/IAX2 Specific Settings

Trunk Name

Give the trunk a descriptive name such as “mysiptrunk.”

PEER Details

Here you give the PEER connection parameters supplied by your VoIP provider. You may need to add to the provided default settings and in some cases remove default settings depending on your provider or application.

Order is important, as it will be retained. For example, if you use an “allow/deny” directive, then make sure the “deny” is first (reading top down).

USER Context

This is most often the account name or number your provider expects.

USER Details

Here you supply the USER connection parameters supplied by your VoIP provider. You may need to add to the provided default settings and in some cases remove default settings depending on your provider or application.

Order is important, as it will be retained. For example, if you use an “allow/deny” directive, then make sure the “deny” is first (reading top down).

Register String

Most VoIP providers require your system to register with theirs. If required, you will need to enter the string the provider specifies,

such as username:[email protected]

In some cases you may need to provide a DID and the end of the string:

such as username:[email protected]/7045551212.

DAHDI Specific Settings

DAHDi (Digium Asterisk Hardware Device interface) is the driver framework for interfacing with telephony hardware, such as a T1/PRI card. You would refer to the hardware documentation for initial installation. Then turn to the DAHDi Trunk module for integration of the hardware into your dial plan (usually in conjunction with the Inbound Route and/or Extensions module. See their respective user guides for more info).

DAHDI specific configurations are handled by the DAHDI Config module. Available trunks will show up under DAHDI Trunks

DAHDI Trunks

When not using the DAHDI Module this will be replaced with DAHDI Trunk Identifier. With the module you get a select box with "Group #" and the hunt scheme. See the table below for explanation. In the table we will reference as Group 0 (Zero)

Group 0 Round Robin Assendingr0Take turns using each available Channel on group from lowest to highest
Group 0 Round Robin DescendingR0Take turns using each available Channel on group from highest to lowest
Group 0 Ascendingg0Use first available channel from lowest to highest
Group 0 DescendingG0Use first available channel from Highest to lowest



When the configuration mode is set to simple you will see the following items.

Permanent Auth Rejection

Determines whether failed authentication challenges are treated as permanent failures.

Retry Interval

How long between retries


Expiration time for registrations in seconds.

Forbidden Retry Interval

Interval used when receiving a 403 Forbidden response.

Max Retries

Maximum number of registration attempts.

Qualify Frequency

Interval at which to qualify.


SIP Username


SIP Password

SIP Server

SIP Server you register to

SIP Server Port

SIP Port

Outbound Proxy 

SIP Proxy

Contact User

Contact User to use in request.


Context to send the Inbound Call to.


The Transport to use for connection


Check the desired codecs, all others will be disabled. Drag to re-order.


When the configuration mode is set to Advanced the following fields are added to the above.

Client URI

Client SIP URI used when attempting outbound registration

Server URI

SIP URI of the server to register against

AOR Contact

Permanent contacts assigned to AoR


ENUM (E.164 Number Mapping) is a method, which uses a special DNS record to translate a telephone number into a URI (Uniform Resource Identifier). URI’s in turn can translate into an IP address or a specific extension at a specific IP address or perhaps end up back on the PSTN locally from the receiving system. This facility can be very useful for PSTN unification.

ENUM lookups are done automatically on the domain, therefore little configuration is required. Although it is possible to offer outside access to local resources (PSTN) that would be beyond the scope of this guide. See for more information.

DUNDi Trunk

DUNDi (Distributed Universal Number Discovery) is a trusted, peer-to-peer network that functions somewhat like ENUM, however instead of using centralized service, DUNDi is fully
distributed and uses no centralized authority mechanism. See for more information and for a dundi.conf example.

The PBX offers limited support for DUNDi trunks and additional manual configuration is required. The trunk name should correspond to the [mappings] section of the remote dundi.conf systems. For example, you may have a mapping on the remote system and corresponding configurations in dundi.conf locally, that looks as follows:

priv => dundi-extens,0,IAX2,priv:${SECRET}@${NUMBER},nopartial

In this example, you would create this trunk and name it priv. You would then create the corresponding IAX2 trunk with proper settings to work with DUNDi. This can be done by making an IAX2 trunk in PBX or by using the iax_custom.conf file

DUNDi Mapping

This is the name of the DUNDi mappings as defined in the [mappings] section of the remote dundi.conf peers. This corresponds to the “include” section of the peer details in the local dundi.conf file.

Custom Trunk

Custom trunks are useful when attempting to integrate certain devices like cellular gateways or perhaps when setting up least cost routing schemas.

Custom Dial String

Define the custom dial string here. Use the token $OUTNUM$ wherever the number to dial should go. For example:


Permanent Auth Rejection?:
Retry Interval?:
Forbidden Retry Interval?:
Max Retries?:
Qualify Frequency?:
SIP Server?:
SIP Server Port?:
Outbound Proxy?:
Contact User?:
  • No labels