Using http method to post to SMSC server and delievery report in reply

Using http method to post to SMSC server and delievery report in reply SearchSearch
Author Message
Bipin Chandra
New member
Username: Xbipin

Post Number: 1
Registered: 05-2009
Posted on Saturday, May 16, 2009 - 03:56 pm:   

i was doing some testing but cant figure out a way to actually use the http method to post to remot server in which situation, on posting, the remote server replies with an xml file on the status of the sms being sent, normally on using the http method, i think now sms just marks the sms as successful when it gets a 200 ok from remote server but my SMSC server gives 200 ok but also replies with an xml such as the one below and i need to make now sms mark the status of each sms based on the reply from the SMSC server

<?xml version="1.0" encoding="utf-8" ?>
<SmsResponse>
<version>1</version>
<result>1</result>
<resultstring>success</resultstring>
<description />
<endcause />
</SmsResponse>


<?xml version="1.0" encoding="utf-8" ?>
<SmsResponse>
<version>1</version>
<result>0</result>
<resultstring>failure</resultstring>
<description>Invalid Number</description>
<endcause>19</endcause>
</SmsResponse>
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 808
Registered: 08-2008
Posted on Monday, May 18, 2009 - 03:11 pm:   

Hi,

There is no logic in NowSMS to parse the HTTP response to determine success or failure ... only based upon the HTTP status code.

Adding that logic would not be very difficult, however I'm not sure how this would be configured.

If you have any suggestions on how configuration parameters might be implemented to address this scenario, we can discuss it in our next engineering meeting.

--
Des
NowSMS Support
Bipin Chandra
New member
Username: Xbipin

Post Number: 2
Registered: 05-2009
Posted on Monday, May 18, 2009 - 04:39 pm:   

according to me almost all SNSC service through http respond with different status, for eg: clickatel etc and one way could be by allowing user to select the response that would determine success and failure accordingly, it could simply be some text similar to how i posted above for a success and failure, u could allow user to configure 2 boxes one for failure and one for success and nowsms could simply match it with the response it got and determine success or failure
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 820
Registered: 08-2008
Posted on Thursday, May 21, 2009 - 06:57 pm:   

Let me think about this a little more, and go over it with our engineering team.

Unfortunately, I don't have an answer for you today.

But perhaps in the near future we could allow some simple text parsing of HTTP responses to look for success or failure responses.

--
Des
NowSMS Support
Bipin Chandra
New member
Username: Xbipin

Post Number: 4
Registered: 05-2009
Posted on Friday, May 22, 2009 - 09:42 am:   

or what u could do is save the response with the message id and using php or so i can get the response linked with the message id and appropriately show success or failure to my clients
Bipin Chandra
New member
Username: Xbipin

Post Number: 5
Registered: 05-2009
Posted on Friday, May 22, 2009 - 01:32 pm:   

also one more thing, can u let me know if such a feature were to be added then when would it be because im running out of trial period time.
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 844
Registered: 08-2008
Posted on Friday, May 22, 2009 - 07:10 pm:   

The upstream message submission doesn't happen in real time. You get a response back from NowSMS before NowSMS has dispatched the message upstream.

I'll try to get an answer on this next week to see how long it will take. And if we need to extend the trial period, that is possible.

--
Des
NowSMS Support
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 864
Registered: 08-2008
Posted on Thursday, May 28, 2009 - 05:22 pm:   

Hi Bipin,

I've uploaded an update to http://www.nowsms.com/download/nowsms20090528.zip.

This update has SMSGW.INI settings to allow you to define a "Success" response to determine whether or not the message submission has succeeded.

One or more "success" responses can be defined by editing the SMSGW.INI file, and under the appropriate [HTTP - server:port] header, adding Success=somestring. If somestring is present in the response, the submission will be considered successful, otherwise it will be considered a failure. To specify more than one "success" response, add Success1=somestring on a separate line.

In your case, add:

Success=<resultstring>success</resultstring>


--
Des
NowSMS Support
Bipin Chandra
New member
Username: Xbipin

Post Number: 7
Registered: 05-2009
Posted on Thursday, May 28, 2009 - 07:09 pm:   

thanks a lot, that was quick, one more query though, i have a frontend in php so sms will be submitted to nowsms using http and in return nowsms generates an id for the SMS, now how can i store that in my db and later query nowsms with that to get the status as in was it successful or it failed based on the response from the http smsc.

the question is now how do i store it in my db the sms id generated but how do i query nowsms for its actual status
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 870
Registered: 08-2008
Posted on Thursday, May 28, 2009 - 09:50 pm:   

That's a bit problematic.

NowSMS doesn't have a query for status.

It can push delivery notifications back to you as it receives them. It just doesn't save them for you to query them.

Using the HTTP SMSC interface, you're only going to get non-delivery notifications when the SMSC rejects a message like discussed above. (And if memory serves me correctly, NowSMS is only going to generate a non-delivery notification when a message delivery fails if a delivery receipt was requested in the message submission.)

To get actual delivery notifications from the SMSC, you need to be connecting using a standardised SMS protocol like SMPP.

There's a lot of detail on how to request a delivery receipt, and what they look like in the following thread:

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

Skip down to the 12th post in that thread to get started, as I went back and explained it all in more detail after some initial queries.

--
Des
NowSMS Support
Bipin Chandra
New member
Username: Xbipin

Post Number: 8
Registered: 05-2009
Posted on Sunday, May 31, 2009 - 09:19 am:   

firstly, what i was thinking is using php i submit sms to nowsms and in return store the sms id in my db, then nowsms tries to connect to smsc using http and sends the sms, if it is successful then in return it runs a php script that actually changes the status of the sms id it generated earlier to success or failed based on the response from the smsc using the new feature that u added, this way it can have a delievery report for http conenctions to smsc. all that needs to be done is not make nowsms to wait for a response from smsc which happens in smpp and then run a script or command but in http conenctions when it gets the success or failure response, make it run a script or command.

secondly if i were to send broadcast sms, i was reading throught the forum but the scripts present send sms one by one to nowsms for processing but isnt there any way i can use php and send a single long submittion and then nowsms broadcasts to all the ppl defined in that request bcoz if there were like 20,000 sms to be broadcasted then php script would timeout if it were to sumbit each sms to nowsms using a for loop
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 879
Registered: 08-2008
Posted on Monday, June 01, 2009 - 01:56 pm:   

I replied to the second question over in the other posting at http://support.nowsms.com/discus/messages/485/20322.html

Regarding the first question, the problem is that the response from the HTTP SMSC only tells us whether or not that service accepted the message. It doesn't tell us that the message was actually delivered.

So we can know right away if the service rejected the message submission. But we can't know what happened to the message after the service accepted the message. It is extremely like that the HTTP service that you are using submits the message to yet another service provider who actually delivers the message.

In SMPP environments, a delivery (or non-delivery) notification comes later which indicates final delivery status of the message.

There are just too many variations in formats for this to work reliably in an HTTP SMSC environment.

--
Des
NowSMS Support
Bipin Chandra
New member
Username: Xbipin

Post Number: 10
Registered: 05-2009
Posted on Monday, June 01, 2009 - 02:54 pm:   

i totally agree with u that there are many variations in HTTP smsc environment but basically in smpp, which is the standard protocol, nowsms waits for the actual delivery report and then accordingly run the command after it receives the confirmation that way nowsms doesn't have to store anything but if only in HTTP smsc sms submittion, one feature was added which actually made nowsms run a command after it submits the message to the remote HTTP smsc, its true that it doesn't prove that message was delivered or no but just it was submitted but in most situations that is one of the reasons y ppl would buy softwares like nowsms as using a web language its not always reliable and efficient in delivering messages to remote gateway so guys like me prefer to make the delivery of the sms to remote gateways more reliable by using such software as web languages stay alive till the user triggers it and chances of timeouts, failures etc r very high so if nowsms was just added with a feature to even run a command after message submittion then i could make it call my php script and atleast show the status as sent to carrier and if u see most sms carriers, if u use the HTTP way of sending sms to their gateway then they normally provide u with a url to query for status or some good ones run a command on ur server and submit reports to ur php or whatever script u host to make sure messages go through reliably
Bipin Chandra
New member
Username: Xbipin

Post Number: 16
Registered: 05-2009
Posted on Sunday, June 07, 2009 - 01:31 pm:   

i was just trying out the older versions, specifically 5.51K bu cant seem to get the 2-way command to run at all, the delievery report comes from the SMSC but nowsms doesnt seem t run the 2-way command configured at all, its basically a php script hosted on the same system using wampserver
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 920
Registered: 08-2008
Posted on Monday, June 08, 2009 - 10:22 pm:   

What 2-way command is configured? (What command prefix is used?)

Also note that 5.51k is not perfect at resolving all SMPP delivery receipt message id formats.

An SMSDEBUG.LOG would help because it would show the message being received and the 2-way command that is being processed. (But we need to know what 2-way commands are defined with what prefixes to understand whether or not a message would trigger a particular command.)

--
Des
NowSMS Support