Anonymousprnt::Y
Click on images to see them in full screen

Routing Rules

smsROUTER offers intelligent routing using Routing Rules. The rules are configured by a system administrator or a developer (or both).

Context Routing
The router has a basic rule, which it attempts to use only after all rules fail to match. In this event, the router looks for a recent text message sent to the sender of the incoming message, and "links" to it. Thus, in the absence of any rules, the following process will take place:

  1. An smsPULSE user, Mary, sends a message to a person, Dave
  2. Dave replies to the text from Mary. As she uses the MM installation with a GSM device, the reply is received by smsPULSE
  3. As the router has no rules to work with, it looks for a recent message delivery to Dave, and uses the sender details (Mary) to respond back.
Note: As a refinement to Context Routing, an administrator may redirect messages destined to an individual user to an existing Action, without requiring it to match using the selection capabilities. For more information about Inbound Redirection, click here Database 'sms.HELP', View 'Help Documents', Document 'Inbound Redirection'.

Routing Rules
Rules are created and managed in the sms.ADMIN database. Each rule is based on two prime elements:
  1. Selection - determines which rule is to be used. The selection also produces the selection value.
  2. Action - determines what actions to take.
Each rule may also include follow-on actions.

A sample rule: (using a formula to compute the selection and saving the result to a database).
Web UI:

A "Write to Disk" action:

See a sample XML file:
20120510130657097_01.xml20120510130657097_01.xml

Notes UI:

A sample rule (using a token to compute the selection and emailing the result):



In the above examples, the email received by the user may be easily replied to as the "replyto" field is set to <senderNumber>@OurSMSdomain (using smsPULSE Foreign domain service).

Selection
The idea with selection is simple. The router looks in the message text for a sub string you specify (a Token) or, if you select to use a formula, the selection succeeds if the formula returns any text. Tokens have specific format, namely:
#Token Value#
For example: #to Mary Tzen#, the token in this case is "to", the value is "Mary Tzen". Another example #work 4.5#, could mean that the sender has worked for 4.5 hours today. If you register all your contacts on sms.OUT (smspulse.nsf), the sender is also matched with their contact record.

Using the Formula Selection mechanism allows you to devise your own textual notations. For example, a formula may be written like so:
@If( @Contains( smsBody; "*myToken*");"found-it";"")

Action
If a rule is selected, its action will be performed. There are two types of actions:
  1. Send an email - sends an email using the selection value, which you may override with computations
  2. Send SMS/MMS - send a message based on the text you just got (from smsPULSE V7.1)
  3. Update a database - creates a new record in a database you specify. You may add your own computations
  4. Issue an HTTP post - you specify the URL prefix and smsROUTER adds variables to. This is not suitable for MMS messages
  5. Write to Disk - you select a directory you wish messages to be dropped into, including MMS media files. The message is in the form of an xml file
Web UI:

Notes UI:


Response Rules
When sending SMS/MMS you can add the field "smsRule" with a value of rule key. Any reply to that SMS will be actioned by this rule, even if the rule is an "Action Only" rule. You can add the field smsRule when you use the Send SMS/MMS action type.


Follow-on Actions
You may string one or more actions to an existing rule. Please note that if a follow-on action includes additional actions, these will executed too. This recursive facility must be used with care as many actions can be triggered as a result of a single selection. To avoid action loops, the router will not execute a rule it encountered earlier in the execution cycle.

Sample Rules in the sms.ADMIN database:



Rules order
To learn about the execution order of Routing Rules by smsROUTER, click here Database 'sms.HELP', View 'Help Documents', Document 'Execution Order'.

Rules Validation and Testing
The best way to test a rule is to run the router and use test messages:
  1. At the console type: "load smsrouter" - you will need to restart the smsROUTER every time you modify your rules in any way
  2. Create a test inbound message by using the menu option: Create\Message in sms.IN
  3. Save your document ensuring the status field is empty. The smsROUTER will act on it

You may also use the "Re-process" function in the sms.IN views. The router will react as if the message has just arrived:

Or, using the Web UI, click on the messages then click on the function below:



Executing Agents
The smsPULSE Router will allow you to execute an agent after it posted data to a database, passing the posted record to the agent. This option is available for Domino databases only. For other environments, or when using the smsPULSE Windows server with products such as Microsoft Exchange or Microsoft IIS, use the HTTP Post option instead.

When developing an agent, select its Trigger to work "On Event" with the target as "None".
To bind to the posted record, use the DocumentContext property of the NotesSession class, as follows:

Dim s As New NotesSession
Dim inDoc As NotesDocument
Set inDoc= s.DocumentContext

You can now process the record and the data that was sent to the system. The field names you used in the Rule definition are available for manipulation by the agent.
Please note that if smsROUTER was able to match a record with a directory, the person name and the UniversalID of that record are also saved into the document, using "smsSenderName" and "UserID" respectively. The replica ID of the record is stored in the "repID" field.

Execution Order
smsROUTER Execution Order is as follows:
Rules are evaluated and executed in the order you specify. The following order applies:
Scan rules in the order you specify
  1. Attempt to match each rule in order. Rules are evaluated either using a token or formula you have specified. The first rule that matches is used
  2. If no rule matches, check for the user who has sent the most recent text message to the inbound text sender. This is called "Context Routing"
  3. If Inbound Redirection tables exist, smsROUTER checks if the internal user found above is listed for redirection. If listed, the appropriate rule is used (the one listed in the Inbound Redirection table, see Database 'sms.HELP', View 'Help Documents', Document 'Inbound Redirection'), and the message is no longer routed "in Context"
  4. If "Context Routing" cannot be used due to lack of matches, the "default" rule is used, if one exists
  5. Otherwise, mark the received messages as "Fail"

For information on rules, see here Database 'sms.HELP', View 'Help Documents', Document 'Routing Rules'.