Message content modification during routing

Ozeki NG gives you the ability to perform sender address modification, recipient address modification and message data manipulation on the fly. This feature makes Ozeki NG much more powerful then any other mobile messaging product out there.

Message sender, message recipient and message text modification is available for both outgoing and incoming messages. It can be performed by formulating a custom routing rule, with a regular expression pattern. The regular expression pattern consist of two parts. The first part is matched against the phone number or the message text, and the second part is used for replacement. You can use this feature to append a text to the outgoing message, to add a telephone number prefix to the phone number and for many other purposes.

For example to add the prefix +36 to the sender phone number of every outgoing message, you need to create an outbound route that matches all sender addresses, and prepends a prefix to the phone number (Figure 1). You can do this by placing the following regular expression replacement command into Condition 1 (sender phone number): "s/^(.*)$/+36$1/".

using a replace regexp in the routing condition
Figure 1 - Using a replace regexp in the routing condition

If you examine this regular expression "s/^(.*)$/+36$1/" closely, you will see it consists of three parts. The first part is the letter "s". This s letter tells the software, that a substitution will take place. The second part is "^(.*)$" a regular expression that is used to match the telephone number. In this regular expression the ^ sign, tells that matching should start from the first character of the phone number, the .* means, that all characters are accepted, the $ sign means, that the match should stop at the last character of the phone number. Note that the .* is placed in parentheses. This means that we can refer to it's content in the substitution. The content of the parentheses can be referred to as $1. The third part is +36$1 the text that should replace the matched part of the phone number. In this case it will replace the whole phone number. This third part is a simple text and a reference to the contents of the first parentheses. The text part "+36" will be put as is, and "$1" will be replaced to the phone number.

Append advertisement

This content manipulation technology can also be used to append some text to the end of each SMS messages. This way you can put advertisements after each message that goes through a certain route. To do this, you should enter the following rule into Condition 3 (Keyword):

"s/^(.*)$/$1 This text will be appended./"

To improve this functionality, you can modify the expression to take only the first 10 characters of the original message and include your text after it. In this case the expression will be:

s/^(.{10}).*/$1 hello world/


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

For reliable SMS delivery, consider setting up multiple connections with different SMS service providers. Think of these connections as named pathways. You can then define "outbound routes" that specify which connection to use for each message.

Here's why redundancy is important: If you have only one connection (like an IP SMS connection) and it goes down, your messages won't be sent. To prevent this, you can add a backup connection (like a GSM modem connection).

How to configure backup routing: In the outbound SMS routing table, find the rule for your GSM modem connection. Within that rule, you can specify the name of your IP SMS connection as the "backed-up connection." This ensures that if the IP connection fails, the GSM modem takes over and keeps your messages flowing.

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

Unfortunately, standard SMS messaging doesn't inherently tell you if a received message is a reply to one you sent. It's like a plain conversation without reference numbers.

Here's why:

  • No built-in reply function: SMS lacks a feature like email "reply" that tracks the original message.
  • Chronological order only: Messages are simply received in the order they arrive.

There are a few workarounds, though they're not foolproof:

  • Time-based matching: You can compare timestamps of your sent message and the received one. This might work for recent exchanges, but accuracy drops as time passes.
  • Keyword identification: Include a specific word or phrase in your outgoing message. Then, set up a filter in your system to look for that keyword in incoming replies. However, this relies on the recipient remembering and using the keyword.

Overall, identifying replies within SMS is tricky. These methods offer some clues, but they're not guaranteed.

Can I change message parameters during routing?

Absolutely! SMS routing allows you to modify messages on the fly, giving you more control over what gets delivered. Here's how you can use it:

  • Number manipulation: Add prefixes or suffixes to phone numbers. For instance, you can include country codes for international messages.
  • Content modification: Extend the message text. This is handy for adding disclaimers, promotions, or unsubscribe options.
Think of it like customizing postcards before sending them out in bulk. SMS routing lets you tailor each message for its destination.

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

Here's a simpler way to rephrase the instructions on changing the recipient field:

  • Head to the outbound routing table. This is where you can control how messages are sent.
  • Create a new route. Think of this route as a dedicated pathway for your messages.
  • Focus on the "recipient" field. Here's where the magic happens.
  • Set a replacement condition. This tells the system to swap the original recipient with your chosen number.
  • Enter the replacement pattern: Use s/original/replacement/ (source/original/ destination). In your case, replace original with .* (any characters) and replacement with your fixed mobile number (e.g., +123456). So the complete pattern would be: s/^.*/+123456/

With this setup, any message submitted will have its recipient field automatically changed to your fixed mobile number.

For advanced details: You can find more information about replacement rules and content manipulation on the "SMS content modification during routing" page (reference that page if available).

More information