Prefix Routing
In addition to the traditional routing that engages the usage of rented phone numbers—DIDs—CarrierX allows its partners to use prefixes for outbound routing.
What is a Prefix?
Prefixes are virtual routing entries that any partner may create.
A prefix is simply any sequence of digits, which may coincide, for example, with the starting digits of a group of phone numbers you need to route to a certain trunk group.
The general rule is: when an outbound call is received by an endpoint, the dialed number is checked for a match with all the prefixes defined by its owner on the source trunk group of that endpoint. If a match is found, the routing defined on the prefix object will be used.
Partners can specify as many prefixes as they need.
The following limitations are applied when a partner chooses to use prefixes:
- Prefixes may only route to trunk groups that exist on the same partner.
- Normally, prefixes route any outbound calls you make from your partner. If you specify a source trunk group on it, it will apply only to calls from that specific trunk group.
How do Prefixes Work?
There are two ways how a prefix can be defined:
-
You can create a prefix that will apply to all the outbound calls from your partner.
For example, if a partner has a999
prefix set up on the account, then the traffic from any endpoint on this partner’s account that makes an outbound call to a number starting with999
will go to the trunk group configured and associated with that prefix. -
Another option is that you can define a prefix on a specific source trunk group and in this case that prefix will apply only to calls going through that source trunk group.
In any case, a prefix always has a destination trunk group defined, which must contain at least one trunk linked with a destination endpoint.
Prefix Routing Flow
Prefix routing flow is similar to DID routing. Here’s a diagram demonstrating basic routing flow steps:
When a call is created by a source endpoint (e.g., when it is initiated by an external application of the same partner), and it contains a match for a prefix set up on that endpoint’s trunk group, such call is then routed to a trunk group associated with that prefix. The trunk group contains a trunk that is linked to a destination endpoint. This endpoint serves as an exit point for the traffic to another external application of the partner (External application #4 in the figure above).
If no match for a prefix is found, the call is routed to another trunk group and further to a different external application of the partner (External application #5 in the figure above).
Prefixes vs. DIDs
As noted above, prefix routing is similar to DID routing. However, if routing is intended only within a partner’s internal traffic and no calls are aimed at going to the PSTN, prefixes are preferred since there is no reason to use up an actual phone number and it is obvious that it is not going to be PSTN traffic.
For example, if a partner has a prefix for 516
, any calls placed from this partner’s endpoints to phone numbers that have this digit sequence in the beginning will respect this routing.
Moreover, this routing will be respected even if this partner with this prefix set up does not own any numbers that start with 516
. In this case all the traffic to the numbers with this area code will also be routed to the trunk group associated with the specified prefix.
Prefixes can be used to create partners which use CarrierX for internal/CarrierX switching only and will never attempt to make calls to the PSTN.
LRN Prefixes
In addition to standard prefixes, you can also use LRN prefixes to route calls from your application. An LRN prefix works similarly to the standard prefix, but it is based on the LRN of the phone number that is dialed instead of the phone number itself. LRN stands for Location Routing Number, aka the phone number ID that is also used for routing purposes alongside with the phone number itself. An LRN usually has to be present in the call header, but if it is not, it can be looked up by using the LRN Lookup transformation. If such LRN is found it will be checked for a match with all the LRN prefixes defined on the source trunk group of the source endpoint. If a match is found, the routing defined on the LRN prefix object will be used.
Outbound Dialing Logic
When an outbound call occurs, it goes through the following steps:
-
The system first checks the dialed number for whether there is an LRN prefix match and if such LRN prefix is defined on the source trunk group and a match is found, the routing rules set up for that LRN prefix are applied and the call is sent to a trunk group and an endpoint configured for that LRN prefix.
-
If there is no LRN prefix match, then the system looks at the dialed number and checks it against all the standard prefixes for a prefix match.
-
The last step is a check for a partner DID match. If the dialed phone number is a number that a partner owns on its account, the call is routed to a dedicated trunk group.
-
If no match is found, the call is directed to the PSTN and the partner will be charged for a PSTN call in this case.
Further Reading
Prefix Object API Reference
Refer to the Prefix object API reference to get the complete list of the prefixes attributes and methods used with the prefixes:
LRN Prefix Object API Reference
- LRN Prefix Object
- Create an LRN Prefix
- Get LRN Prefixes
- Get an LRN Prefix by SID
- Update an LRN Prefix
- Delete an LRN Prefix
How It Works
Read the following articles to get a better understanding of how things work in CarrierX: