In a PBX environment, the dial-plans usually looks different than for normal SIP subscribers. PBX subscribers should be able to directly dial internal extensions (e.g. 100) instead of the full number to reach another PBX subscriber in the same PBX segment. Therefore, we need to define specific Rewrite Rules to make this work.
The PBX dial plans are different from country to country. In the Central European area, you can directly dial an extension (e.g. 100
), and if you want to dial an international number like 0049 1 23456
, you have to dial a break-out digit first (e.g. 0
), so the number to be dialed is 0 0049 1 23456
. Other countries are used to other break-out codes (e.g. 9
), which then results in 9 0049 1 23456
. If you dial a national number like 01 23456
, then the number to actually be dialled is 9 01 23456
.
Since all numbers must be normalized to E.164 format via inbound rewrite rules, the rules need to be set up accordingly.
Let’s assume that the break-out code for the example customers created below is 0
, so we have to create a Rewrite Rule Set with the following rules.
^([1-9][0-9]+)$
${caller_cloud_pbx_base_cli}\1
extension to e164
Inbound
Caller
These rules are the most important ones, as they define which number formats the PBX subscribers can dial. For the break-out code of 0
, the following rules are necessary e.g. for German dialplans to allow pbx internal extension dialing, local area calls without area codes, national calls with area code, and international calls with country codes.
PBX internal extension dialin
^([1-9][0-9]+)$
${caller_cloud_pbx_base_cli}\1
extension to e164
Inbound
Callee
Local dialing without area code (use break-out code 0
)
^0([1-9][0-9]+)$
${caller_cc}${caller_ac}\1
local to e164
Inbound
Callee
National dialing (use break-out code 0
and prefix area code by 0
)
^00([1-9][0-9]+)$
${caller_cc}\1
national to e164
Inbound
Callee
International dialing (use break-out code 0
and prefix country code by 00
)
^000([1-9][0-9]+)$
\1
international to e164
Inbound
Callee
When a call goes to a PBX subscriber, it needs to be normalized in a way that it’s call-back-able, which means that it needs to have the break-out code prefixed. We create a rule to show the calling number in international format including the break-out code. For PBX-internal calls, the caller name will be shown (this is handled by implicitly setting domain preferences accordingly, so you don’t have to worry about that in rewrite rules).
^([1-9][0-9]+)$
000\1
e164 to full international
Outbound
Caller
Create a new Rewrite Rule Set for each dial plan you’d like to support. You can later assign it to customer domains and even to subscribers, if a specific subscriber of a PBX customer would like to have his own dial plan.