Using Coldfusion MX 7, I had the developed an SMS based program that receives 
SMS text and returns the appropriate acknowledgment.

I have since upgraded to Coldfusion 8 and I though my SMS' are received and 
properly processed, I receive not acknowledgment. What am I doing wrong? or 
What is wrong with ColdFusion 8?

My code is below (say I send R 2 23 m.myself):

<cfcomponent displayname="SMS Voting Listener" hint="Process SMS messages.">
<cffunction name="onIncomingMessage" output="no">
   <cfargument name="CFEvent" type="struct" required="yes" />

<!--- Get voting data and sender number--->
<cfset voteResults=arguments.CFEvent.data.message />
<cfset agentNumber=arguments.CFEvent.originatorID />

<!--- Set up return struct with needed arguments--->
<cfset retValue=structNew() />
<cfset retValue.command="submit" />
<cfset retValue.sourceAddress=arguments.CFEvent.gatewayid />
<cfset retValue.destAddress=agentNumber />

<!--- Break the vote string sent into its individual components using the 
function ListToArray()  --->
<cfset resultsArray=ListToArray("#voteResults#"," ")>


<!--- Separate and add voting information to database  --->
<cfswitch expression="#resultsArray[1]#">

<!--- Begin processing for updating authorized polling agent list --->  
    <cfcase value="R">
                
                <cftransaction>
<!--- update Agent table with agents name and mobile phone number --->
        <cfquery datasource="#request.datasource#">
                
            INSERT INTO Agent(AgentPhoneNo, NameOfAgent)
                        VALUES('#agentNumber#', '#resultsArray[4]#')
                        
        </cfquery>
 
  <!--- update polling station information with agents mobile phone number --->
        <cfquery datasource="#request.datasource#">
                
            UPDATE PollingStation
                        SET AgentPhoneNo = '#agentNumber#'
                        Where StationNo = #val(resultsArray[2])# AND 
ConstituencyNo = #val(resultsArray[3])#
                        
        </cfquery> 
                
                        
</cftransaction>


<!--- Acknowledge reciept of the SMS for polling agent --->
        <cfset retValue.shortMessage="Thank you , your name and phone number 
has been registered" />
                        
    </cfcase>
 <cfdefaultcase>
        <cfset retValue.shortMessage="Please resend SMS with the proper 
format"/>
    </cfdefaultcase>
</cfswitch>

<!--- Send the return struct to gateway --->
<cfreturn retValue />
</cffunction>
</cfcomponent>


Processing code:

<!--- Break the vote string sent into its individual components using the 
function ListToArray()  --->
<cfset resultsArray=ListToArray("R 2 23 m.myself"," ")>


<!--- Separate and add voting information to database  --->
<cfswitch expression="#resultsArray[1]#">

<!--- Begin processing for updating authorized polling agent list --->  
    <cfcase value="R">
                
                <cftransaction>

 <!--- Insert polling agent information into agent table --->
        <cfquery datasource="#request.datasource#">
                
            INSERT INTO Agent(AgentPhoneNo, NameOfAgent)
                        VALUES('#agentNumber#', '#resultsArray[4]#')
                        
        </cfquery> 
 
 
  <!--- update polling station information with agents mobile phone number --->
        <cfquery datasource="#request.datasource#">
                
            UPDATE PollingStation
                        SET AgentPhoneNo = '#agentNumber#'
                        Where StationNo = #val(resultsArray[2])# AND 
ConstituencyNo = #val(resultsArray[3])#
                        
        </cfquery> 
                
                        
</cftransaction>

<!--- Acknowledge reciept of the SMS for parliamentary elections --->
        <cfset retValue.shortMessage="Thank you , your phone number has been 
registered" />
                        
    </cfcase>
        
    <cfdefaultcase>
        <!---cfset retValue.shortMessage="Please resend results with the proper 
format"/--->
    </cfdefaultcase>
</cfswitch>




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:313928
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to