Skip to main content
June 30, 2009
Question

event gateway handling

  • June 30, 2009
  • 2 replies
  • 2168 views

Hi i am using the main.cfc in the examples using the onIncomingMessage event

i am gettnig back a variable

<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>

retValue.shortMessage contains all the data and is then written to a text file like this

"Information","Thread-15","06/30/09","21:07:17","IM_MENU","echo: id:869990453 sub:001 dlvrd:001 submit date:0906301507 done date:0906301507 stat:DELIVRD err:000 text:"

what i need is to set 2 variables

1. MessageId = this is the "id" in the echo

2. MessageStatus = this is the "stat"

i am not sure how to get to this info?

This topic has been closed for replies.

2 replies

Participating Frequently
June 30, 2009

ReFindNoCase("id:() .*stat:() ", retValue.shortMessage, 1,

true) will get you the position and length of the id and stat in the

message (you can use Mid to extract them).

Mack

Dileep_NR
Inspiring
June 30, 2009

Hi,

could you please paste ur main.cfc

June 30, 2009

main.cfc below, instead of writing to a txt file i need to create 2 variables to insert into my database

<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: " & messageId>

<cflog file="smsTest" text="#retValue.shortMessage#">

</cffunction>

Dileep_NR
Inspiring
June 30, 2009

Hi,

try this

<cfset temp= listgetat(retValue.shortMessage,6)>
<cfset temparray= listtoarray(temp," ")>
<cfset MessageId  = listgetat(temparray[2],2,":")>
<cfset MessageStatus  = listgetat(temparray[9],2,":")>