• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

sms status

New Here ,
Mar 06, 2009 Mar 06, 2009

Copy link to clipboard

Copied

Hi i have setup the sms utility and its working well sending sms, i now need to get the status of the sms back into my system,

i am just using the main.cfc but i am not sure what to do here?

all i want to do is have a sql stored proc update my database by passing in the Status and the id number from the sent sms.

<cffunction name="onBuddyStatus">
<cfargument name="CFevent" type="struct" required="YES"/>
<cfstoredproc procedure="spUpdateStaus" datasource="#datasource#">
<cfprocparam type="In" cfsqltype="cf_sql_varchar" dbvarname="ReferenceNumber" value="#ReferenceNumber#" null="No">
<cfprocparam type="In" cfsqltype="cf_sql_varchar" dbvarname="Status" value="#Status#" null="No">
</cfstoredproc>
</cffunction>
TOPICS
Event gateways

Views

9.7K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 06, 2009 Mar 06, 2009

Copy link to clipboard

Copied

OnBuddyStatus is for IM. For SMS, use onIncomingMessage. That is the name Coldfusion expects. However, if you insist on onBuddyStatus then you have to set the value of cfc-method in your SMS configuration file to onBuddyStatus.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 10, 2009 Mar 10, 2009

Copy link to clipboard

Copied

ok thanks so can i just add my stored proc to the onIncomingMessage function and that will automaically pic up any sms statuses that come in?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 10, 2009 Mar 10, 2009

Copy link to clipboard

Copied

Yes, the stored procedure will run when you put it in onIncomingMessage. That will happen automatically. The list of variables that come in automatically are those in the SMS cfevent structure. You have to find a way to pass any variables not in the list.


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 11, 2009 Mar 11, 2009

Copy link to clipboard

Copied

ok thank you, just been testing this with cfmail but i dont get an email, i am just using the main.cfc which i have altered the onIncomingMessage just to send me a email as below, do i have to specify some when sending the sms that i want message status updates?


<cffunction name="onIncomingMessage>
<cfargument name="CFEvent" type="struct" required="yes">
<!--- Get the message --->
<cfset data=cfevent.DATA>
<cfset message="#data.message#">
<!--- send the return message back --->

<cfmail to = "email" type="html" from = "email" subject = "income test"
username = "email" password = "email" server = "email" port = "25">
<cfdump var="#data#">
</cfmail>
<cfreturn retValue>
</cffunction>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 11, 2009 Mar 11, 2009

Copy link to clipboard

Copied

Have you checked that the following runs on an ordinary CFM page?

<cfmail to = "email" type="html" from = "email" subject = "income test"
username = "email" password = "email" server = "email" port = "25">
test message
</cfmail>


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 13, 2009 Mar 13, 2009

Copy link to clipboard

Copied

yes the cfmail does work i use it all over the site

so how does the actual status come back in do i have to request it from the smc?

i am currently sending like this
<cfscript>
/* Create a structure that contains the message. */
msg = structNew();
msg.command = "submit";
msg.destAddress = "447777777777";
msg.sourceAddress = "+44777777777";
msg.shortMessage = form.SMSMessage;

ret = sendGatewayMessage("SMS Menu App - 5551212", msg);
</cfscript>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 16, 2009 Mar 16, 2009

Copy link to clipboard

Copied

Hi any chance of some help on this, i really need this working asap,

i have added the param
msg.registeredDelivery = 1;

but i still am getting no response back any ideas?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 16, 2009 Mar 16, 2009

Copy link to clipboard

Copied

Come to think of it, there is no reason for you to be sending email within an SMS gateway. In fact, if I remember well, previous postings have suggested it might not even be possible to do so. I am looking into this and asking around.

Have a look at Kevin Schmidt's article, Sending messages through ColdFusion SMS gateways. It includes code for a complete working implementation of the SMS gateway.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 17, 2009 Mar 17, 2009

Copy link to clipboard

Copied

Hi Thanks, but that is the tutorial i used to setup this up!!

i can send sms find using what i have, its the sms status i need to get via the onIncomingMessage method, but i cannot get this working, and in that example it is not clear what is required for the sms status

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 17, 2009 Mar 17, 2009

Copy link to clipboard

Copied

kel45 wrote:
> i can send sms find using what i have, its the sms status i need to get via

what do you think "SMS status" is?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 17, 2009 Mar 17, 2009

Copy link to clipboard

Copied

well i have this from my sms provider which i need to get the dr back so i know what the status of the sms is

SMPP parameters are:
system_id <provided for each client>
password <provided for each client>
IP address url
port 8888
Timeout (keep alive or msg) 30 sec
Optional parameters:
system_type <r:route_code>

You are allowed to bind like transmitter, receiver or transmitter. In order to receive delivery
reports, you must bind as transciever or receiver.
You will receive delivery reports only if your route provides delivery reporting.
We will send delivery reports to your first acceptable bind session (transciever or receiver).
You are allowed to bind with at most 4 sessions.

PDUs supported:
bind_transmitter, bind_receiver, bind_transciever, unbind, submit_sm, deliver_sm,
enquire_link

DR format:
“id:<message_id> sub:<message_sub> dlvrd:<message_dlvrd>
submit date:<message_submit_date> done date:<message_done_date>
stat:<message_stat> err:<message_err>”

Delivery statuses (message_stat):
DELIVRD, EXPIRED, DELETED, UNDELIV, ACCEPTD, UNKNOWN, REJECTD

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 17, 2009 Mar 17, 2009

Copy link to clipboard

Copied

kel45 wrote:
> DR format:
> ?id:<message_id> sub:<message_sub> dlvrd:<message_dlvrd>
> submit date:<message_submit_date> done date:<message_done_date>
> stat:<message_stat> err:<message_err>?

and the delivery receipt is what you mean by "SMS status"? or are do you mean
what's returned when you send the SMS (if your gateway's in synchronous mode
that should be the SMS message ID)?

so...is your SMS gateway config "mode" set to "synchronous"? and your SMS
provider actually returns something in this mode for your out-going phone
numbers? have you tested against the SMS test server that comes w/cf?


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 17, 2009 Mar 17, 2009

Copy link to clipboard

Copied

hi yes "mode" set to "synchronous" and i do get the message id back, but how do i know what the message status is?

ie DELIVRD, EXPIRED, DELETED, UNDELIV, ACCEPTD, UNKNOWN, REJECTD

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 17, 2009 Mar 17, 2009

Copy link to clipboard

Copied

kel45 wrote:
> hi yes "mode" set to "synchronous" and i do get the message id back, but how do i know what the message status is?

if you get a message ID back then it's delivered (at least out of your cf server
& to your SMS provider). save the ID & wait for the SMS provider to send a
delivery receipt (as long as you set "registeredDeliver" on the outgoing SMS &
the SMS provider supports this for your out-going phone numbers/regions).

by "wait for the SMS provider" i mean for each incoming SMS you have to check to
see what type of SMS message it is by examining the CFEvent.Data.esmClass data.
if it's a delivery receipt you match it's ID up with the out-going message ID
you saved from the sendGatewayMessage(). i *think* the esm class codes are
something like:

0==normal SMS
1==delivery receipt
2==delivery acknowledgment
3==no idea
4==manual delivery acknowledgment
5==no idea
6==no idea provider dependent (i *think*)
7==no idea
8==intermediate delivery notification (somewhere along the network something has
received the SMS but not final recipient).

get a copy of the SMS 3.4 specs PDF (free, all over the place) to be sure of the
codes. don't expect the delivery receipt to be synchronous just be prepared to
handle it whenever you get an SMS in.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 17, 2009 Mar 17, 2009

Copy link to clipboard

Copied

ok great thats what i want, so now back to my original question , i have set msg.registeredDelivery = 1; on the outgoing sms and also setup the onIncomingMessage to send me an email just to test this, buti never get the email and my provider has checked and they did send the registeredDelivery

<cffunction name="onIncomingMessage>
<cfargument name="CFEvent" type="struct" required="yes">
<!--- Get the message --->
<cfset data=cfevent.DATA>
<cfset message="#data.message#">
<!--- send the return message back --->

<cfmail to = "email" type="html" from = "email" subject = "income test"
username = "email" password = "email" server = "email" port = "25">
<cfdump var="#data#">
</cfmail>
<cfreturn retValue>
</cffunction>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 18, 2009 Mar 18, 2009

Copy link to clipboard

Copied

kel45 wrote:
> onIncomingMessage to send me an email just to test this, buti never get the
> email and my provider has checked and they did send the registeredDelivery

did you check your undelivered email folder?

> <cffunction name="onIncomingMessage>
> <cfargument name="CFEvent" type="struct" required="yes">
> <!--- Get the message --->
> <cfset data=cfevent.DATA>
> <cfset message="#data.message#">
> <!--- send the return message back --->
>
> <cfmail to = "email" type="html" from = "email" subject = "income test"
> username = "email" password = "email" server = "email" port = "25">

are you really using "email" for the to/from/etc.?

> <cfdump var="#data#">
> </cfmail>
> <cfreturn retValue>
> </cffunction>

retValue isn't created/used anywhere in that function. have you looked at your
exception logs? are they by any chance full of errors?




Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 17, 2009 Mar 17, 2009

Copy link to clipboard

Copied

BKBK wrote:
> Come to think of it, there is no reason for you to be sending email within an
> SMS gateway. In fact, if I remember well, previous postings have suggested it
> might not even be possible to do so. I am looking into this and asking around.

huh?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 17, 2009 Mar 17, 2009

Copy link to clipboard

Copied

PaulH wrote:
huh?

Have you succeeded in sending mail by implementing <cfmail> within the listener CFC of the SMS gateway? I haven't. If you have, could please show us the code you used.


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 17, 2009 Mar 17, 2009

Copy link to clipboard

Copied

BKBK wrote:
> PaulH wrote:
> huh?
>
> Have you succeeded in sending mail by implementing <cfmail> within the listener CFC of the SMS gateway? I haven't. If you have, could please show us the code you used.

yup, works fine on cf8, no rocket science here.

<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>
<cflog file="smsTestCrapola" text="going to send some email now...">
<cfmail to="paul@sustainableGIS.com" from="paul@sustainableGIS.com" subject="SMS
gateway test">
just a test: #retValue#
</cfmail>
<cfreturn retValue>
</cffunction>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 18, 2009 Mar 18, 2009

Copy link to clipboard

Copied

Hi i have tested your code exactly but i still get no email i do however get a logfile entry

so i tried doing this
<cflog file="smsTestCraig" text="#retValue#">
but then i get no entry?

how can i test adding the retValue to the logfile?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 18, 2009 Mar 18, 2009

Copy link to clipboard

Copied

kel45 wrote:
> Hi i have tested your code exactly but i still get no email i do however get a
> logfile entry

i get email when i tested against the test SMS server that comes w/cf8.

> so i tried doing this
> <cflog file="smsTestCraig" text="#retValue#">
> but then i get no entry?

because retValue is not a simple variable, it's a structure.

> how can i test adding the retValue to the logfile?

output the individuals parts.

looks like one of my messages didn't get thru the NNTP gateway & i deleted it
from the sent folder.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 19, 2009 Mar 19, 2009

Copy link to clipboard

Copied

PaulH wrote:
yup, works fine on cf8, no rocket science here.

<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>
<cflog file="smsTestCrapola" text="going to send some email now...">
<cfmail to="paul@sustainableGIS.com" from="paul@sustainableGIS.com" subject="SMS
gateway test">
just a test: #retValue#
</cfmail>
<cfreturn retValue>
</cffunction>


Rocket science or not, that couldn't have worked. I expect Coldfusion to halt at the line, just a test: #retValue#. You cannot output a structure like that. Still, I take the point that you have a working version.



Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 20, 2009 Mar 20, 2009

Copy link to clipboard

Copied

BKBK wrote:
> just a test: #retValue#
>
> Rocket science or not, that couldn't have worked. I expect Coldfusion to halt
> at the line, just a test: #retValue#. You cannot output a structure like
> that. Still, I take the point that you have a working version.

yeah you're right that's supposed to be retValue.message. must have deleted it
when formatting for the forum.

are you sure you're not getting the email? nothing silly like wrong server,
etc.? SMS working ok? what SMS server did you use? besides this thread, any
other reports of this issue?

in any case, i'll double check that i'm not doing anything silly.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 20, 2009 Mar 20, 2009

Copy link to clipboard

Copied

BKBK wrote:
> that. Still, I take the point that you have a working version.

i just re-tested & i an confirm 2 things:
- cfmail certainly works in an SMS gateway listener
- & i'm an idiot when it comes to moving code from editors to other
things...that of course should be "retValue.shortMessage".

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation