Your network numbering plan
Telecommunication service providers use the E.164 format in their networks (e.g., PSTN, mobile, or SIP). This unifies the numbering format among different networks, simplifies routing, and indicates that phone numbers belong to residents of a certain geographical area.
Phone numbers in E.164 format (e.g., 12391232967) start with a country calling code (e.g., 1), followed by an area code (e.g., 239) and a user’s local number (e.g., 1232967).
It is common practice to write phone numbers in E.164 format (e.g., on a company’s web site or a business card) with the ‘+’ prefix (e.g., +12391232967). The ‘+’ indicates an international calling code (e.g., 00 or 011), though customers usually dial phone numbers from any phone (e.g., mobile, landline or SIP) without the ‘+.’
When PortaBilling receives the number with the “+” prefix (e.g., +1234567890,) it recognizes that the number following the prefix is in the E.164 format, so no local/custom dialing instructions apply.
This information gives administrators the ability to create internal dialing rules and adjust their customer’s/vendor’s numbering formats to the unified E.164 format used in PortaBilling. For this purpose, they use translation rules.
Very often you need to use different numbering systems on your VoIP network. For example, vendor A requires you to send all phone numbers with the technical prefix 12345#, Vendor B requires that all phone numbers be in the format 011<country-code><area-code><number>, and when you send calls to the local telecom (Vendor C) you have to strip the country code and area code off completely. Of course, you would like to have this information in a unified format in your billing, so that you do not need to enter multiple phone prefixes for the same destination. Another common situation is when customers located in different countries or regions (but all managed on the same PortaBilling platform) dial phone numbers in different formats, since every customer dials a number in the way he or she is used to.
Thus the solution is to maintain all the numbers inside your network and PortaBilling in a unified format – E.164 – and use translation rules to deal with situations when numbering formats differ.
There are two main classes of translation rules:
- Customer-specific dialing rules, used for converting numbers dialed by end users to the PortaSwitch format – E.164 format;
- Vendor-specific connection rules, used for converting numbers from the E.164 format to one required by a particular vendor for further call processing.
A translation rule is actually a set of Perl regular expressions which are applied to a phone number. So if you are familiar with regular expressions, you can make all kinds of transformations with phone numbers; for more information, see the PortaBilling online help. If you are not familiar with regular expressions, you can use a dialing rule wizard which will construct the correct rule based on the parameters you provide, such as country or area code. This allows you to easily manage a network with many different numbering plans for your customers and vendors. Also, translation rules can be applied to ANI (CLI) numbers, allowing caller information to be sent to a vendor in the format he requires (e.g., 10-digit phone numbers for US callers).
This is how dialing and connection rules work in conjunction:
When a customer makes a phone call, it arrives from outside your network and the customer’s dialing rule is applied. Thus the dialed number is converted from the customer’s format (e.g., 0114202123456) into the unified format (4202123456). Next, all the billing calculations (authorization, routing, etc.) are done, and then, if it appears that this call should go to a vendor who requires a special format, the outgoing connection rule associated with this vendor’s connection is applied, and the number is translated into the required format (e.g., 123#4202123456). Finally, when the call is disconnected and PortaBilling receives information about the completed call to phone number 123#4202123456, the vendor’s connection rule is applied, so that the number becomes 4202123456. This is the number that will be stored in the xDR information.
Frequently a customer will have his own numbering format, for example, dialing 00 for international numbers and just the phone number for local calls. Dialing rules allow you to convert a number from a format specific to a particular customer. Typically, dialing rules are either specified for the entire PBX environment (provisioned as customer in PortaBilling) or for an individual phone line (provisioned as account). Customers can manage their dialing format themselves via the self-care interface.
Dialing rules have two applications:
- When a number is submitted for authorization, these rules will be applied, with the resulting number used to search rates. Thus, if your customer dials 0042021234567, the billing engine will convert it to 42021234567 and find the correct rates for the 420 prefix.
- This number will be returned to the node which requested it.
To simplify the dialing rule configuration, they are divided into the following types:
- Residential – this is the simplest dialing rule type since it emulates the dialing habits of residential customers. In this dialing rule you define the international and national codes plus the special prefixes that residential customers must dial to access the network and make a call (e.g., when making calls from an PBX environment).
- PBX – this is a more extensive dialing rule. It includes the dialing parameters of the residential type plus the service codes (e.g., *70 for call parking) used within the PBX environment.
- Custom – this type allows you to define your own dialing rules by using Perl regular expressions.
Since dialing rules in North America are different from those in other countries and contain either 7- or 10-digit numbers, a separate North America dialing rule subtype exists that allows the administrator to easily configure and manage dialing rules for North American customers.
If your vendor requires a special number format (e.g., tech-prefix), it is possible to apply a connection rule to convert the number. When the billing engine returns a list of routes, the phone numbers for routes for this connection will be converted.
There are two types of connections:
- Outgoing connections via which calls leaving your network are sent to a vendor and
- Incoming connections via which calls to DID numbers are delivered from a vendor to your network.
Connection rules differ depending on connection type and consequently, contain different sets of options. Therefore, when creating a connection rule, the administrator needs to specify only those options relevant for a particular connection type. This significantly simplifies the rule creation process and eliminates configuration errors.
Outgoing connection rules
When the call has been terminated to the vendor in a vendor-specific format, it will be reported to billing in this same format (e.g. 01142021234567). Now it is necessary to convert this number to the proper format for billing (4202134567), which may be done using connection rules. These rules will be applied to all calls which go through a given connection (even those routed there using dial-peers or other external tools).
Incoming connection rules
Connection translation rules are also used on Calls from Vendor via SIP connections, when a number received from a vendor (e.g., 2065551234) must be translated into E.164 format, so that it will properly match an account whose ID is in E.164 format (12065551234).
Number translation on your network
- A customer dials a phone number on their SIP phone. They enter the number in the same format they use on their conventional phone, i.e. 0042021234567.
- The number is delivered to the PortaSIP server and translated using the customer’s dialing rule, which states that the international dialing prefix for this customer is 00. So the number becomes 42021234567 (E.164 format). This number is used to search for the customer’s rate for this destination.
- PortaSIP then requests routing for this number. Carrier ABC is defined for terminating calls to the Czech Republic in PortaBilling. However, this carrier requires the number to be in US dialing format, so the international number must be prefixed by 011. An outgoing translation rule s/^/011/; to carrier ABC has been defined, and is now applied to the phone number, with the result 01142021234567. Note that there may be several carriers who can terminate this call, each with its own numbering format. In such a case there will be several alternative routes with different phone numbers.
- PortaSIP attempts to establish a connection to remote gateway 18.104.22.168 using phone number 01142021234567.
- After the call is completed, PortaSIP sends an accounting request to PortaBilling, stating that the call to remote gateway 22.214.171.124 has just been completed. PortaBilling finds a connection to vendor ABC with remote IP address 126.96.36.199, and applies the translation rule s/^011//; for this connection in order to convert the number from the vendor-specific format into your billing format. Thus 011 is removed from 01142021234567, and the number becomes 42021234567. PortaBilling searches for the vendor and customer rates for this number and produces the CDRs.