Getting Queue Status

Getting Queue Status SearchSearch
Author Message
Thiago Facchini
New member
Username: Tfacchini

Post Number: 4
Registered: 06-2010
Posted on Monday, June 28, 2010 - 05:27 pm:   

Hello,

I read some posts talking about the queues but Im still having no idea about how to make it work.

My situation is:

I have a 3G Modem connected and an PHP app the send all sms requests to NowSMS.

My question is do you guys have any PHP sample or hint that explain how to get queue status?

Thanks in advance.
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 2293
Registered: 08-2008
Posted on Tuesday, June 29, 2010 - 05:48 pm:   

Hi Thiago,

It depends on what you mean by "queue status".

Do you want to know if the message is still sitting in the queue on the NowSMS server, waiting to be sent out via the modem?

Or do you want to know whether or not the message has actually been delivered to the recipient? (Just because the message has left NowSMS does not mean that the operator has delivered the message.)

I'm guessing that you want to know whether or not the message has been delivered.

There is no way to query for this status. You can only request to be notified when the status changes (delivered or failure).

To request a delivery receipt, when submitting a message via HTTP, include the following URL parameter: "&ReceiptRequested=Yes"

It is also possible to edit the SMSGW.INI, and under the [SMSGW] header, add ReceiptRequested=Yes ... which will cause this flag to be set for all HTTP submissions.

When this "ReceiptRequested" flag is set, it causes NowSMS to request a delivery receipt when submitting the message to an upstream SMSC.

These receipt requests are supported when connecting to an SMPP, CIMD2 or UCP/EMI based provider or a GSM modem that supports receipts.

When you are connecting to a provider, it is then up to that provider whether or not they will send delivery reports back to you. (So even if you configure everything correctly in NowSMS, they might not support delivery receipts.)

If you are submitting to NowSMS via HTTP, then the "SMS Users" account that you are using should NOT have SMPP access enabled. (If the account has SMPP access enabled, NowSMS will queue any delivery receipts that it recieves back to the message queue for this SMPP client.)

When a message is submitted via HTTP, the HTTP 200 OK response includes text such as the following:

MessageID=54321098.req, Recipient=+xxxxxxxxxx

If the message was posted to multiple recipients, this will be repeated for each recipient.

You can parse the text from this HTTP response to determine the Message id that NowSMS has assigned to the message. (The ".req" extension is not part of the Message ID.)

When a delivery receipt comes back into the system, it gets routed to the 2-way command facility (unless SMPP access is enabled for the account that originally submitted the message to NowSMS, as I mentioned above).

Normally, the SMSC will prefix the text of all delivery receipts with "id:" ... and if the message is properly formatted as a delivery receipt, but this prefix is not present, NowSMS will reformat the message to include this prefix.

To define a 2-way command specific to processing delivery receipts, define the 2-way command with an "SMS Command Prefix" of id:*

Leave "Receive Phone Number(s)" blank (or in the context of receipts, it would be the sender address of the originally sent message, so you could define different scripts to process receipts for different sender phone numbers).

Then in the "Command to Execute" field, there is a parameter that you can use ... @@RECEIPTMESSAGEID@@, which will contain the message id for which this receipt applies. (This assumes that the service provider returns the message id properly in the receipt.)

The delivery receipt text needs to be parsed by your application to determine whether the notification is a delivery notification or a failure.

Look for the text that follows "stat:"

DELIVRD means successful delivery
ENROUTE is an interim OK response (some SMSCs cannot give delivery receipts, and by returning this response it indicates that the message has been queued for delivery, but an actual delivery receipt may not be available)
REJECTD means failed or rejected
EXPIRED means expired without being delivered
DELETED means message was deleted without being delivered
ACCEPTD is similar to ENROUTE
UNKNOWN means an unknown type of failure

Some providers may add additional error codes. Text other than the above would normally be considered an error.

All of this said ... you mention that you are using a modem. Unfortunately, many modems do not support delivery reports at all. So before you go to far with this, try sending a message and including the "&ReceiptRequested=Yes" parameter.

Then check to see if your NowSMS SMS-IN logs ever show any delivery receipt messages after these messages are delivered. There are quite a few modems that do not support them.

If your modem does not support the delivery reports, try going into the "Properties" for the modem in the "SMSC" list of NowSMS, and try changing "SMS Message Storage" to "Direct to Modem". In the past, this has worked to enable support in a few modems. (Current versions of NowSMS should enable support in the modem without this setting. But for historical reasons, it is worth a try.)

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

Post Number: 2294
Registered: 08-2008
Posted on Tuesday, June 29, 2010 - 05:50 pm:   

P.S. - If you need help parsing the message ID when posting the message to NowSMS, there is a PHP example that parses the HTTP response to extract it here: http://support.nowsms.com/discus/messages/1/24868.html