Automatic reply based on modem response

Automatic reply based on modem response SearchSearch
Author Message
GSM TEST
New member
Username: Gsmtest

Post Number: 11
Registered: 04-2006
Posted on Tuesday, September 15, 2009 - 04:45 am:   

Is there an easy way to create an auto reply if a message generates an “error-modem response”? For the carrier I am dealing with you must compose WAP Push messages in a specific manner to prevent them from being rejected. I posted clear instructions but some people ignore the warning and clog the system with messages that will never get sent and nowsms will retry multiple times before discarding it. If the message generates this error I would like to reply with the instructions.

Error example - +CMS ERROR:38
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 1248
Registered: 08-2008
Posted on Tuesday, September 15, 2009 - 07:26 pm:   

Hi,

Indirectly, you could do this.

You'd need to implement an SMS accounting callback.

NowSMS calls this URL before accepting each message, when accepting each message, and after processing each message.

However, it doesn't make this call after each retry attempt ... only after the final retry.

In particular, you would be interested in the "SMSOut" callback, which looks like this:

http://server/path?Type=SMSOut&From=useracct&To=xxxxxxxxx&MessageID=4A8743BD.req &SubmitIP=127.0.0.1&Text=test&SMSCName=Sony%20Ericsson%20MD300%20Wireless%20Mode m&Status=OK

In the case of "CMS ERROR:38", that information should be included in the "Status=" parameter after the final retry attempt, so you could parse that out.

Alternatively, if you can easily parse the binary of the problem messages to identify them, then you could reject them in the PreAuth callback. (The PreAuth callback is described in more detail here: http://www.nowsms.com/support/bulletins/tb-nowsms-001.htm ... however that link doesn't describe all parameters. This link is a little better: http://blog.nowsms.com/2009/01/dynamic-sms-message-routing-with-http.html).

--
Des
NowSMS Support
GSM TEST
New member
Username: Gsmtest

Post Number: 12
Registered: 04-2006
Posted on Wednesday, September 16, 2009 - 05:53 am:   

I really appreciate the quick response.

I assume that I need to add "smsout=" to my smsgw.ini file and then add my unique server attributes to the URL. That is where I'm getting tripped up. I've got 2-way messaging figured out and I'm trying to apply some of that logic to figure out how this string would operate, but I'm not getting anywhere.

I can't figure out what elements would be hard coded and which ones would require wild cards. I'm also confused about the server /path since it does not have login credentials included. Can you break this down a bit more for me?

SMSOut=http://server/(smsout file path?)path?Type=SMSOut&From=useracct&To=xxxxxxxxx&MessageID=(wildcard?)4A8743BD. req &SubmitIP=(wildcard?)127.0.0.1&Text=test&SMSCName=Samsung%20Mobile%20USB%20 Modem%20II&Status=CMS ERROR:38
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 1266
Registered: 08-2008
Posted on Wednesday, September 16, 2009 - 10:39 pm:   

Sorry, I should have explained better.

The links that I referenced include some more information.

The parameter is SMSAccountingURL= under the [SMSGW] header of SMSGW.INI.

If you specified SMSAccountingURL=http://server/path ... then NowSMS would append parameters like I described when it makes various accounting callbacks to your script.

You would basically ignore (just be sure your script returns a valid HTTP 200 OK response when you do ignore) all events except when "Type=SMSOut". This event tells you that a message has been submitted upstream "Status=OK", or that an error has occurred and no more retries will be attempted "Status=ERROR+++more+info".

--
Des
NowSMS Support
GSM TEST
New member
Username: Gsmtest

Post Number: 13
Registered: 04-2006
Posted on Thursday, September 17, 2009 - 06:42 am:   

Sorry……I’m reading over the discussion boards, service descriptions and your posts, but I still can not figure this out.

I added SMSAccountingURL=http://server.name.com:port/&User=ID&Password=PW?Type=SMSOut&text=test&status=CM S%20error:38

I expected the text to be sent to the destination address in the event an error 38 was generated, but nothing happen

Can you give me a step by step procedure with the assumption, not too far fetched based on this exchange, that I have no idea what is going on here?

Thanks in advance for your help and patience.
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 1273
Registered: 08-2008
Posted on Thursday, September 17, 2009 - 07:22 pm:   

Ok ... let me take a step back and try to clarify.

This is not a solution that is specific to the particular error you are trying to trap.

It may not even be a good solution for you, it is just the only potential solution that I can think of.

NowSMS has the ability to issue HTTP accounting callbacks to notify another application about events and activities.

The typical usage case for these accounting callbacks is charging/billing.

When SMSAccountingURL is defined, every time someone submits a message, NowSMS performs two accounting callbacks. One is a PreAuth verifying that the user is allowed, and the other is a callback to indicate that NowSMS has accepted the message.

Those callbacks are described in the links that I posted previously.

Basically, you would configure this:

[SMSGW]
SMSAccountingURL=http://server/path

NowSMS appends all of the other parameters to this URL to tell you what is happening.

So far, the accounting callbacks don't have anything to do with what you're trying to accomplish.

But there is also a callback that occurs every time a message is dispatched to an upstream SMSC connection, or when that message fails and all retries have been exhausted.

You would need to write a script that runs on a web server and processes these callbacks.

When you see "Type=SMSOut", you would look at "Status=" to see if it contains "CMS ERROR:38". If it does, then you would know that a message failed with this error ... and you could take some action from within your script to notify the submitter.

Now, if you're not seeing any accounting callbacks occurring ... here are a few things to look for.

SMSAccountingURL= must be in the [SMSGW] section of SMSGW.INI.

The NowSMS service must be restarted after adding/changing the SMSAccountingURL setting.

Callbacks only occur if user authentication is used. If users do not have to enter a username and password to access the NowSMS web page, then no accounting callbacks occur.

--
Des
NowSMS Support
GSM TEST
New member
Username: Gsmtest

Post Number: 14
Registered: 04-2006
Posted on Thursday, September 17, 2009 - 10:16 pm:   

Thanks Des!

I got it! Your email + some much needed sleep paved the way.