User Guide

Table Of Contents
Sending outgoing messages 1079
Synchronization mode
You can specify asynchronous or synchronous message mode in the gateway configuration file.
If you specify asynchronous mode, the sendGatewayMessage function returns an empty string
when the message is submitted by the gateway to service code for sending to the SMSC.
ColdFusion logs errors that might occur after this point, such as if a message sent by the
gateway to the SMSC times out or if the gateway gets an error response; the application does
not get notified of any errors.
If you specify synchronous mode (the default), the sendGatewayMessage function does not
return until the gateway gets a response from the SMSC or the attempt to communicate times
out. If the message is sent successfully, the function returns the SMPP message ID string. If an
error occurs, the function returns an error string.
Use synchronous mode if your application must determine whether its messages reach the SMSC.
Also use synchronous mode if the application requests return receipts.
Note: If you use synchronous mode and the SMSC returns the messgeID as a hexadecimal string,
ColdFusion MX converts it automatically to its decimal value.
The following example is an expansion of “Example: Using the submit command in
sendGatewayMessage function” on page 1076. It checks for a nonempty return value and displays
the message number returned by the SMS. This example uses the SMS gateway that is configured
when ColdFusion MX is installed. If you change the gateway specified in the
SendGatewayMessage function, make sure that you gateways configuration file specifies
synchronous mode.
<h3>Sending SMS From a Web Page Example</h3>
<cfif IsDefined("form.oncethrough") is "Yes">
<cfif IsDefined("form.SMSMessage") is True AND form.SMSMessage is not "">
<h3>Sending a Text Message: </h3>
<cfoutput>#form.SMSMessage#</cfoutput><br><br>
<cfscript>
/* Create a structure that contains the message. */
msg = structNew();
msg.command = "submit";
msg.destAddress = "5551234";
msg.shortMessage = form.SMSMessage;
ret = sendGatewayMessage("SMS Menu App - 5551212", msg);
</cfscript>
</cfif>
<cfif isDefined("ret") AND ret NEQ "">
<h3>Text message sent</h3>
<cfoutput>The Message Id is: #ret#</cfoutput>
<br><br>
</cfif>
<hr noshade>
</cfif>
<!--- begin by calling the cfform tag --->
<cfform>