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/

More information