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. |
|
|
@@RECIP@@ |
If available, the
phone number that is intended to receive
(or did receive, if the message was received
via a GSM modem connection) this 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.
In addition to supporting
the launch of command line programs, the “Command
to Execute” field can also be an HTTP
command, causing the gateway to connect via
HTTP to another application server to inform
the application server of details regarding
the received message. For example,
http://server:port/path?sender=@@SENDER@@&message=@@FULLSMS@@.
When an HTTP command is
used, if the command is to return a response
to the gateway directly, the HTTP response must
be of the MIME content type “text/plain”.
It is also possible for
any HTTP command to return an HTTP redirect
response to the gateway, which instructs the
gateway to fetch an alternative URL, even a
URL command that contains parameters to tell
the gateway to submit a message. This can be
useful for creating a 2-way command script that
responds with binary message content.
If an HTTP command requires
HTTP authentication with a username and password,
the URL format of “http://username:password@host.name/path”
is supported. When a URL command is defined
in this format, the gateway will connect to
“http://host.name/path” using an
authorization header of the specified username
and password.
The "Command to Execute" field can also specify an e-mail address, in which case any received SMS messages that match the configured "SMS Command Prefix" will be forwarded to the specified e-mail address. To specify an e-mail address for the "Command to Execute", use the format "mailto:user@domain.com".
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.
Return
to Now SMS/MMS Gateway Help
|
| ©
Copyright of NowMobile.com Limited 2003-2008 |
| |
NowMobile.com Limited
UK Tel: +44-20-8286-8080
Airport House, Purley Way, Croydon, London,
CR0 0XZ, UK
email : nowsms@nowsms.com
|
|