SMS Least Cost Routing
On this page you can find out how to set up least cost routing with Ozeki NG - SMS Gateway. You can read about the motivation, the resultant task you can set for the program, how the task is solved, and how the solution is tested.
You may want to use a specific GSM service provider to send out a message, because:
- a GSM service provider usually charges less money for an SMS message sent within its network than for one sent outside.
- one of the GSM service providers you use may charge less money than the others for an SMS message sent to a foreign network.
- a GSM service provider may only accept an SMS message for delivery to a phone number within its network when the message is sent over an IP SMS connection. (This is often the case with premium rate SMS services.)
Task for the program
According to the considerations listed in the Motivation section, you can expect Ozeki NG - SMS Gateway to decide which GSM service provider connection to use to send out a message. The decision is based on the telephone number of the recipient (the user the SMS message is destined to). This is possible because you can identify which GSM service provider a phone number belongs to. The identification is based on the pre-dial number of the phone number. E.g., a phone number starting with "+3670" belongs to the network of Vodafone, while one starting with "+3630" belongs to T-Mobile.
Ozeki NG - SMS Gateway can be configured to use a specified GSM service provider to send out an SMS message destined to a recipient phone number including a specified pre-dial number.
Then, according to the configuration, the sending process consists of three steps:
- An installed user or application (called "John" in the example) submits the SMS message to Ozeki NG - SMS Gateway.
- Ozeki NG - SMS Gateway makes a decision based on the (pre-dial number of the) phone number.
- Ozeki NG - SMS Gateway sends out the SMS message using the GSM service provider connection it has chosen (Figure 1).
To enable the program to take the action described above, you have to do the following:
- Install and configure 3 GSM service provider connections. Give each of them a name, such as Vodafone, T-Mobile, etc.
- Configure the outbound routing.
To start installing and configuring a service provider connection, click the Add button or the Add service provider link in the Service providers panel in the Management Console (Figure 2).
After selecting a service provider connection from the list, give it a name in the SMPP settings tab (Figure 3).
Install and configure all 3 service provider connections.
For more details about the installation and configuration of service provider connections, check out the Service Provider Connectivity page.
Once you have installed and configured all of the service provider connections, configure the outbound routing, i.e. set appropriate outbound routing rules.
To start editing the outbound routing rules, click the Edit button in the Outbound routing panel in the client area of the Management Console (Figure 4).
In the panel for creating a new outbound routing rule, specify a regular expression as the recipient phone number for each service provider connection.
The regular expression should look like this: /\+3670.*/
I.e.: right slash - backslash - pre-dial number in international format - period - asterisk - right slash.
To enable the program to send out messages using any of the service provider connections, set a fourth routing rule as well. This is useful, as you may need to send a message to a network that is not specifically one of the service providers in the example. Also, it may occur that none of them charges less than the others for sending a message. In the example this additional rule is named outbound4, in which the other directives are specified as ANY. If the service provider is specified as ANY, Ozeki NG - SMS Gateway will send out the message using the first service provider connection to have the free capacity to send a message. In a way, it may not matter which service provider connection is used if they charge the same amount of money. However, it may well be important to send out the message as soon as possible. The ANY specification for the service provider serves this purpose. Make sure this "unspecified" rule is the last in the table. The reason for its position will be explained in the Testing section below.
Now, your routing table should look like the one in Figure 5 below:
For each service provider connection, you have specified a regular expression as the recipient phone number, including the pre-dial number belonging to the GSM service provider. This regular expression in each rule ensures that the program will identify any recipient telephone number including the pre-dial number as belonging to the service provider specified in the rule.
For instance, if you send an SMS message to the +36703355678 phone number, the program will identify it as one belonging to Vodafone (whose pre-dial number is +3670). This is because the regular expression in the respective rule covers all phone numbers with the +3670 pre-dial number. The local pre-dial number could also be 0670, which is not in international format. In this case, you should also specify a regular expression for the service provider connection in a separate rule. It should look like this:
The user in Figure 1 above is sending a message (saying "Hello world") to a +36309678756 phone number. When John has composed and submitted it to Ozeki NG SMS Gateway, the engine will match the routing rules in the outbound routing table. As it goes from top to bottom, the first rule the message is compared with is outbound1. The regular expression in the cell for the recipient phone number does not cover the +36309678756 phone number, so the engine will go on to the next rule.
The regular expression in the cell for the recipient phone number in the next rule (outbound2) does not cover the +36309678756 phone number either. Consequently, the engine will go on to the third rule.
The regular expression in the cell for the recipient phone number in the outbound3 rule covers the +36309678756 phone number. As a result, John's message will be sent out using the service provider connection specified in this rule.
When the engine finds a rule that applies to the message, the message will be sent out, and the subsequent rules will be ignored. Accordingly, no further copies of the message will be sent out. In this example, the fourth rule would match the message: the ANY specification would cover +36309678756 phone number, and it would use the first service provider connection that has the free capacity to send out the message. However, the outbound4 rule will be ignored, and the message will not be sent out in another copy using "ANY" (the first available) service provider connection. The message will only be sent out according to the outbound3 rule, because it is higher in the routing table and it matches the message.
In conclusion, you can see that Ozeki NG allows a configuration of routing requiring the least possible cost for sending out messages. The configuration requires the appropriate editing and positioning of routing rules in the Outbound routing panel of the software.
Making use of a regular expression in the editing process will result in the program identifying which network the recipient phone number of the message belongs to. This identification of the network will enable Ozeki NG - SMS Gateway to send out the message using the service provider owning the network. Accordingly, the sending will be performed within the network. This will allow sending messages at the least possible cost (or sending messages at all).