| 2-Way
SMS Support
The “2-Way”
tab of the gateway configuration dialog contains settings relevant to
the creation of 2-way applications that can receive SMS messages, and
return a response based upon the content of the received SMS message.
The “Process
Received SMS Messages” checkbox must be checked in order to enable
the gateway to receive and process SMS messages.
When an SMS
message is received, the gateway will evaluate the content of the message,
and can either execute a program, or connect to an HTTP URL, based upon
the content of the message. The decision of how to process a received message
is based upon the first “word” of the received SMS message. In the terminology of the gateway, this first
word of the received message is called the “SMS
Command Prefix”. Based upon
this “SMS Command Prefix”, the gateway will execute a command associated
with the prefix. If the received
prefix does not match any defined prefix, then it is considered to be
a match for a special wildcard prefix, denoted as “*”.
When a command
is executed based upon the receipt of an inbound message, the command
line for the program or HTTP request can include replaceable parameters
from the contents of the SMS message. The following replaceable parameters are supported:
| @@SENDER@@ |
The phone number of the
sender of the SMS Message. |
| @@SMSPREFIX@@ |
The first word of the SMS
message. |
| @@SMS@@ |
The content of the SMS message,
except the first word of the message. |
| @@FULLSMS@@ |
The complete content of
the SMS message. |
To
return results back to the user, the command can either return a simple
text response directly to the gateway (“Command returns response text” is checked), or the command can generate
a more complex response to the gateway via a separate HTTP request to
the gateway. An executable program
returns a simple text response to the gateway by printing results to the
screen, where the gateway captures the screen output, and generates an
SMS response to send the screen output text back to the sender via SMS. An HTTP request returns a simple text response
to the gateway by returning content of the MIME type “text/plain”.
The example
dialog above illustrates a simple command that can be used for testing
this 2-way capability.
Define an “SMS
Command Prefix” of “*” (wildcard), or any prefix of your choosing.
Define “Command
to Execute” as “c:\winnt\system32\cmd.exe /c echo Echo
@@FULLSMS@@”.
Check “Command
returns response text”.
Press “Add”
to add the command to the “Received
SMS Command Table”.
When an SMS
is received that matches this SMS command prefix (in the case of “*”,
any SMS that doesn’t match another defined prefix), the gateway launches
a command processor (CMD) that simply echoes the text back to the screen
adding the word “Echo” to the beginning of the received text. In this example, the sender of the SMS message
will receive an “Echo” back of the command that they sent in to the
gateway. While not an extremely
useful command, this is a useful way of testing to see that the gateway
is alive and capable of receiving SMS messages.
If the wildcard
SMS command prefix is not associated with any command, any inbound SMS
messages that do not match a prefix will be saved to the SMS-IN directory
with a file extension of “.SMS”, and they may be processed by another
application independent of the gateway.
|