Update mysql with failed messages

Update mysql with failed messages SearchSearch
Author Message
Blair
New member
Username: Bcotnam

Post Number: 22
Registered: 07-2011
Posted on Friday, February 10, 2012 - 07:54 pm:   

Hello,

Currently i have an sms accounting callback defined in nowsms config file, so when a new message gets submitted it calls a php file to insert the message into mysql database.

We are using modems, so when the message gets successfully dispatched through the modem, the callback is called and updates the record with the smscroute name also. We have the same thing working for delivery reports, posts to nowsms via same php file to insert into sms_in table. We are just checking the 'Type' variable for updates. SMSSend,SMSOUT,SMSIN, to update the records.

What i would like to do is update the records which are failed messages.

I sent 600 messages through nowsms, 90 of which were failed. The nowsms gui showed 90 failed. If i go into the 'Q' folder i can see all the failed message with a '.ERR. extension.

The problem is since nowsms tried to send the message through the com port, that record gets updated with the appropriate smscroute name. But if that message failed the record doesn't get updated for failed delivery, so when i query the database it looks like all the messages were sent out where in fact 90 of those were failed.

Is there an easy way to update a record if the message ends up failing? I have nowsms setup for 3 retry attempts, if the message still failed after those retry attempts update the record which is failed. I would just like an easy way to keep track of failed messages in the database. I noticed there are no variable for failed messages in the account callback documentation, so just wondering how to update DB with the failed messages.

Thanks,
Blair
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 3776
Registered: 08-2008
Posted on Friday, February 10, 2012 - 09:18 pm:   

Hi Blair,

If I understand you correctly, you want to modify your callback script, so that when it is processing Type=SMSOut, it looks at the "Status" parameter.

There is a parameter description for this callback found in the following thread:

http://support.nowsms.com/discus/messages/1/69916.html

--
Des
NowSMS Support
Blair
New member
Username: Bcotnam

Post Number: 23
Registered: 07-2011
Posted on Friday, February 10, 2012 - 09:37 pm:   

Thats perfect thank you. I got it working with adding the status variable to php.

Thanks,
Blair