What is SMS routing?

It is a process that is used to make decision about where an SMS should end up.

Messages can end up in a mobile network or at a user or an application. The term SMS routing actually covers two areas: outbound SMS routing and inbound SMS routing. Outbound SMS routing is used to control which mobile network is used to send a message to a mobile handset. It is used for mobile terminated (MT) SMS messages. Inbound SMS routing is used to control which application will receive an SMS message sent from a mobile phone. It is used for mobile originated (MO) SMS messages.

Routing decisions are made based on conditions, such as sender phone number, recipient phone number, sender or recipient phone number prefix, or the content of the message text. For example a routing decision can be based on a keyword in the message: e.g.: if the keyword "red" is in the message route it to destination "A" otherwise route it to destination "B".

SMS routing can only be applied if more then one mobile network connection (or SMS service provider connection) and more then one SMS application is available is used in a system.

What is outbound SMS routing and how can I use it?

Outbound SMS routing refers to a process that is used to decide which SMS service provider connection will be used to send an SMS message.

Outbound SMS routing is only relevant if more then one SMS service provider connections are available in your system and each SMS service provider connection can be used to pass messages to the mobile network. In this case you can setup outbound routing to achieve various goals. For example you can configure backup SMS routing, which means that out of two or more connections one connection will be used only for backup purposes. Another setup could be used to route messages to the appropriate connection based on telephone number prefix to save costs. This is called least cost routing. You can also use outbound routing to do load balancing to increase message throughput.

What is inbound SMS routing and how can I use it?

Inbound routing is a process that is used to decide which user or application will receive an incoming SMS message.

Inbound SMS routing is only relevant if more then users or applications are configured in your system. In this case you can setup inbound routing rules to define which user or application will receive a copy of the incoming SMS message.

Inbound routing decisions can be based on sender and recipient phone number (or phone number prefix) or message content and if you have more then one service provider connection then, the connection itself can also be used as the base for decision making.

Inbound routing decisions can be configured in the inbound routing table of an SMS gateway application.

How can I send SMS messages reliably to different global destinations?

You should setup several SMS service provider connections, and you should configure backup routing.

When you use multiple service provider connections, each connection has a name. In the routing table you can refer to this name when you create outbound routes. Outbound routes determine which connection will be used to send a particular message.

If you want to increase reliability, you need at least two service provider connections. For example one can be an IP SMS connection and another can be a GSM modem connection. To configure the GSM modem connection as the backup connection for the IP SMS connection, you need to configuring the name of the IP SMS connection as backedup connection in the routing rule of the GSM modem connection in the outbound SMS routing table.

Backup SMS routing will make sure, that if the IP SMS connection stops functioning, the GSM modem connection will take over and your messages will be sent.

Is there any way I can tell if an incoming SMS message is a reply to my previously sent SMS?


The SMS technology does not provide any way to check if an incoming message is a reply to a previously sent SMS or not. All you can do is put some identifier into the message text itself, or rely on the timestamp of the sent and received messages to do the matching. Of course this matching will probably not be accurate.

In most cases keywords are used to distinguish between incoming messages. If you tell your mobile user to include a certain keyword in the messages text and you setup a proper inbound route, with this keyword in Condition #3 (message text), you can have some clue on which message was replied to. Of course this solution suggests that the user will include the appropriate keyword in the response SMS.

Can I change message parameters during routing?


You can modify telephone numbers and the message content itself during routing. This is useful if you want to add certain telephone number prefixes or postfixes to a number, or you would like to extend the message text with an advertisement.

How can I reject certain messages starting with a specified telephone number prefix?

You have to configure the outbound routing table.

If you want to prevent your customers to send messages to certain destinations, you have to setup a "dummy service provider connection". For this purpose an HTTP server SMS service provider connection is a good choice. After this connection is setup, you should add a new rule to the outbound routing table, that will route messages with the defined prefix to this dummy service provider connection. This way messages, that are destined for the defined destination, will not go to your normal SMS service provider connection. Instead they will be routed to this dummy connection and they will be dropped.

To specify the prefix, when you create the new rule in the outbound routing table, you should define Condition 2 (Recipient phone number). This condition should match be a regular expression, that matches your telephone number prefix. For example if you wish to prevent messages to be sent to prefix 123, put the following pattern into the field: /123.*/.

How can I change the recipient field to a fixed mobile number so all texts submitted go to that mobile?

You need to create a route in the outbound routing table, and you need to define a replace condition for the recipient.

The outbound routing table allows you to modify message content and telephone numbers on the fly. When you create an outbound route, you can define conditions for sender, receiver and message text. In the condition field, you can put a replacement rule, that will be applied to the SMS message, that matches the given pattern. Information on replacement and content manipulation can be found in the SMS content modification during routing page.

To replace the recipient number of each SMS to a specific number (e.g: to +123456), you should enter the following replacement pattern into Condition #2 when you create the outbound routing rule: s/^.*/[+]123456/

Is there a way to define outbound rules by phone ranges. I want to route a certain prefix to a certain carrier, is this possible?

Yes. You can define phone number prefixes and any other matching pattern in the outbound routing table using regular expressions.

You can define a regular expression for both sender and recipient phone numbers in the routing condition. I suspect, that you would like to route outgoing messages based on recipient phone number prefix. In this case you should put the following regular expression into "condition 2" when you define an outbound route:


Note that the condition is surrounded by slashes (/). This tells the Ozeki software to treat the condition as a regular expression. The first character ^ means, that the matching should start on the first character. [+] means that the phone number starts with a + sign and 3620 means that the phone number starts with +3620. Note that the .* wildchar means that any phone number can follow.

More information

Most popular

If you are insterested in how to setup automated SMS notifications, you should apply one of the following configurations:

SMS through HTTP requests
SMS from E-mail
SMS from the command line
SMS using txt files

If you are a software developer you can proceed to adding SMS functionality to your source code by clicking on one of the following links:

PHP SMS example
C# SMS example
ASP SMS example
SQL SMS example
Delphi SMS example

If you would like to send and receive SMS messages from MS Office applications, please check out the following links:

Send SMS from MS Excel
Send SMS from MS Outlook
Check out Ozeki SMS Client

< 2.3 General Information | 2.5 Message types >