User Guide

Table Of Contents
Sending outgoing messages 1075
Incoming message handling example
The following example code is an SMS-only version of the echo.cfc example that is included in
the ColdFusion MX gateway/cfc/examples directory. This example shows the minimal code
needed to receive and respond to an SMS message.
<cfcomponent displayname="echo" hint="Process events from the test gateway and
return echo">
<cffunction name="onIncomingMessage" output="no">
<cfargument name="CFEvent" type="struct" required="yes">
<!--- Get the message --->
<cfset data=cfevent.DATA>
<cfset message="#data.message#">
<!--- where did it come from? --->
<cfset orig="#CFEvent.originatorID#">
<cfset retValue = structNew()>
<cfset retValue.command = "submit">
<cfset retValue.sourceAddress = arguments.CFEVENT.gatewayid>
<cfset retValue.destAddress = arguments.CFEVENT.originatorid>
<cfset retValue.shortMessage = "echo: " & message>
<!--- send the return message back --->
<cfreturn retValue>
</cffunction>
</cfcomponent>
Sending outgoing messages
Your ColdFusion application can send submit, submitMulti, and data commands to the event
gateway in an outgoing message. The following sections describe these commands in detail,
followed by information on some of the more common options for sending messages.
The submit command
To send a message to a single destination address in an SMPP SUBMIT_SM PDU, the structure
used in the Data parameter of a
SendGatewayMessage function or the return variable of the CFC
listener method normally has the following fields:
Field Contents
command If present, the value must be
"submit". If you omit this field, the event gateway
sends a submit message.
shortMessage
or
messagePayload
The Message contents. You must specify one of these fields, but not both. The
SMPP specification imposes a maximum size of 254 bytes on the
shortMessage field, and some carriers might limit its size further. The
messagePayload field can contain up to 64K bytes; it must start with 0x0424,
followed by 2 bytes specifying the payload length, followed by the message
contents.
destAddress The address to which to send the message (required).
sourceAddress The address of this application. You can omit this field if it is specified in the
configuration file.