2 Way SMS Commands

2 Way SMS Commands SearchSearch

SMS & MMS Technical Forum » NowSMS Support - SMS Issues (Product Support Only) » Archive through May 20, 2013 » 2 Way SMS Commands « Previous || Next »
Author Message
Grant Hathaway
New member
Username: Ghath

Post Number: 1
Registered: 10-2012
Posted on Thursday, November 15, 2012 - 09:03 am:   

Hi there

Any help on this would be great!!

I have 2 Cinterion modems with O2 sims setup to send and receive sms messages, I would like delivery receipts to be turned on and the results to append a text file on the local machine (for now).

The delivery receipts ReceiptRequested=Yes url parameter has been added when sending messages and the following 2 way command is in place.
SMS Command Prefix: id:*
Command to execute: c:\windows\system32\cmd.exe /c Echo @@SENDER@@ @@RECEIPMESSAGEID@@ >> c:\deliveryreceipts-test.txt

But the results aren't appending the text file, the delivery receipts are being recieved by the modems as I have watched the counter go up on the "service" tab. Is there limitations on some carriers for delivery receipts as this was working last week using a Vodafone Sim?

Also something else which is an easy one (if you know how!), I have another command setup which is to be used for receiving account numbers from customers in replied messages.

SMS command prefic: ???????
Command to execute: c:\windows\system32\cmd.exe /c Echo @@SENDER@@ @@FULLSMS@@ >> c:\Accountnumbers-test.txt

What I would like to do is set a response text which sends back a message when the above has been successfully received but I'm unsure how to add this part to the command to execute??

Any help is much appreciated.

G
G Hathaway
New member
Username: Ghath

Post Number: 2
Registered: 10-2012
Posted on Thursday, November 15, 2012 - 01:27 pm:   

Hi there, can you shed any light on some of these points?

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

Post Number: 4201
Registered: 08-2008
Posted on Thursday, November 15, 2012 - 06:25 pm:   

Hi Grant,

I don't think the >> output redirection is going to work for a 2-way command.

What I'd suggest is creating a batch (.BAT) file.

For simplicity, let's call it dr.bat, and I'll put it in the root directory.

c:\windows\system32\cmd.exe /c c:\dr.bat @@SENDER@@ @@RECEIPMESSAGEID@@

Content of dr.bat:

@ECHO OFF
ECHO %1 %2 >> c:\deliveryreceipts-test.txt


In a .BAT file, %1 and %2 are placeholders for the 1st and 2nd parameters passed.


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

Post Number: 4202
Registered: 08-2008
Posted on Thursday, November 15, 2012 - 06:46 pm:   

Sorry I missed the second part of your question.

The "Command returns response text" attribute of the 2-way command specifies whether or not NowSMS expects a response. In the case of command line programs, NowSMS parses screen output from the command.

For your second example, the SMS Command Prefix should be * (this will catch anything not otherwise explicitly defined, so id:* will still handle delivery receipts).

Then just add additional ECHO statements to the .BAT file to contain the desired message response.

For example:

ECHO Thank you for your message


That said, doing this type of thing with just batch files is awkward at best. @@FULLSMS@@ may contain multiple words which will confuse the %1 %2 %3 batch file placeholders. You could put quotes around it to make it be considered a single parameter ... i.e., "@@FULLSMS@@"

--
Des
NowSMS Support
G Hathaway
New member
Username: Ghath

Post Number: 3
Registered: 10-2012
Posted on Wednesday, November 21, 2012 - 09:33 am:   

Hi Des, thanks for your responses they are very helpful.

I created a batch file for delivery receipts exactly as you suggested but the results aren't creating/appending the text file on the root directory.
I have now removed all other 2 way commands to eliminate these as the problem but still the id:* prefix isn't handling the dr's correctly.
As soon as an sms is sent I can see them going to the outbound queue and then the same amount of sms messages are being sent back (suggesting delivery receipts are being recieved) but these aren't appending the text file as per the batch file. This is the same as what was happening before.
Help! Thanks
G Hathaway
New member
Username: Ghath

Post Number: 4
Registered: 10-2012
Posted on Wednesday, November 21, 2012 - 09:48 am:   

Just to clarify Des, I would like to have 3 different 2 way commands setup, I think we will need all 3 for our requirements.

- one for delivery receipts
- one for collecting account numbers and then send reply SMS to number if received successfully (message starts with 7 digit account number so though command prefix ??????? whould work?)
- And one command to echo back a reply SMS to the sender if they fail to prefix their message with 7 digit account number. Stating "please resend including just a 7 digit number".

I have already stated the delivery receipts are causing me a headache in my above post but the latter of the 2 way commands I have setup as follows are working successfully, should all three work together without problems?


???????
c:\windows\system32\cmd.exe /c Echo @@MSGDATE@@ @@SENDER@@ @@FULLSMS@@ >> c:\Accountnumbers.txt && Echo Your account number has been gratefully received, have a nice day

*
Command to execute:
c:\windows\system32\cmd.exe /c Echo @@MSGDATE@@ @@SENDER@@ @@FULLSMS@@ >> c:\IncorrectlyReceivedSMS.txt && Echo This is not a valid account number, please resend your account number.

Any advice you have is gratefully received.. thanks
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 4208
Registered: 08-2008
Posted on Wednesday, November 21, 2012 - 01:22 pm:   

Hi Grant,

Let's enable the SMSDEBUG.LOG (checkbox option on Serial # page) and see what it shows is happening to the receipt messages as they are received.

Actually, that does give me an idea of what might be happening. The SMS User account that you created in NowSMS ... does it have "Accept Received Messages for this User" enabled? If it does, disable it, as this will queue the receipts back to the user account (normally for pick up via SMPP).

--
Des
NowSMS Support
G Hathaway
New member
Username: Ghath

Post Number: 5
Registered: 10-2012
Posted on Wednesday, November 21, 2012 - 01:47 pm:   

Hi Des, the sms user account DOESN'T have "Accept received messages for this user" enabled.

Heres the SMSDEBUG.LOG attached.
text/plainSMSDEBUG.LOG
SMSDEBUG.LOG (25.7 k)


Thanks!
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 4209
Registered: 08-2008
Posted on Wednesday, November 21, 2012 - 03:04 pm:   

Hi Grant,

I don't see any evidence of delivery reports being received. (It might be worth looking at your SMSIN-yyyymmdd.LOG to confirm.)

And unfortunately, I think it may be a modem limitation.

Most modems that support delivery reports only support routing them directly, pushing them as they are received, without having the application poll for them.

In the SMSDEBUG.LOG, I can see that the modem does not support this type of direct routing, either for delivery reports or normal messages. (AT+CNMI=? tells us what modes the modem supports.)

This means we have to poll for messages (well, there is a notification that tells us when to poll) ... and I do not see any indication that delivery reports are available. Some modems do use a different storage area for delivery reports, but I can see from the init commands and responses that the modem does not have this particular separate storage area.

Unfortunately, the only thing I could recommend is trying alternative modems.

--
Des
NowSMS Support
G Hathaway
New member
Username: Ghath

Post Number: 6
Registered: 10-2012
Posted on Wednesday, November 21, 2012 - 03:45 pm:   

Des - Thanks for the update. I'm sure I had delivery reports working using Vodafone Sims previously (Currently using O2 Sims). This is not the end of the world for now!

I have now added the folowing 2 way commands and sent out 5 messages:

*

Command to execute:
c:\windows\system32\cmd.exe /c c:\failacc.bat @@MSGDATE@@ @@SENDER@@ @@FULLSMS@@

???????
c:\windows\system32\cmd.exe /c c:\acc.bat @@MSGDATE@@ @@SENDER@@ @@FULLSMS@@

After sending the 5 messages to the Nowsms function I can see the 5 messages go to the outbound queue but then I can see that I'm receiving messages inbound soon after. I can then see more messages appear in the outbound queue, its almost like the system is looping. Just to confirm, I haven't sent an SMS message inbound to the Nowsms gateway and delivery receipts are turned off.
I'm having to remove the 2 way commands and turn off the sms service, and manually clear the outbound queue to stop this looping.
Why are messages coming back to the modem using the above 2 way commands?

Many thanks
text/plain
SMSIN-20121121.LOG (46.4 k)
text/plain
SMSDEBUG.LOG (138.0 k)
G Hathaway
New member
Username: Ghath

Post Number: 7
Registered: 10-2012
Posted on Wednesday, November 21, 2012 - 03:48 pm:   

Here are the batch file details used in the 2 way commands btw

acc.bat

@ECHO OFF
ECHO %1 %2 %3 >> c:\Accountnumbers.csv
ECHO - Your account number has been gratefully received, have a nice day.

failacc.bat

@ECHO OFF
ECHO %1 %2 %3 >> c:\IncorrectlyReceivedSMS.csv
ECHO - This is not a valid account number, please resend your account number.
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 4213
Registered: 08-2008
Posted on Wednesday, November 21, 2012 - 04:06 pm:   

Sorry Grant, I should have noticed your O2 reference earlier. They have a strange SMS system in the UK. It does not support standard delivery reports.

What they want you to do to request a delivery report is to start the message text with *0#

That gets stripped off the message that is actually sent, and they send you a text message with a delivery report when the message is delivered.

Regarding the message loop, it looks like you are initially submitting the test messages using NowSMS, so the 2-way commands are replying to themselves...the reply is received and routed back to the 2-way command. Or am I misunderstanding?

Another issue I see is messages that include "HTTP/1.0" as part of the text. It appears that the program submitting via HTTP is missing a space between end of URL and "HTTP/1.0".
G Hathaway
New member
Username: Ghath

Post Number: 8
Registered: 10-2012
Posted on Thursday, November 22, 2012 - 08:14 am:   

Hi Des

I will look into the O2 delivery reports issue.

Yes, that appears to be whats happening, it looks like the submitted test messages are replying (by themselves automatically) and then looping in the 2 way commands. Why is this happening and how do I stop this? To confirm, nobody is actually replying to these messages yet there are still messages coming back to the modem soon after an outbound message has been sent!

I have since removed the space in the PHP code to resolve the submitting error.

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

Post Number: 4216
Registered: 08-2008
Posted on Thursday, November 22, 2012 - 01:55 pm:   

Hi Grant,

Basically you just don't want to send a message from one modem to another (or to itself) when you have automated responders like this.

Or you can include logic in your commands to skip replying to these numbers.

For example, looking at your batch file commands, add something like this as the second line (after @ECHO OFF):

if [%2] == [+44123456789] goto EXIT

Then for the last line:

:EXIT


Repeat for any numbers you want to ignore.

--
Des
NowSMS Support
G Hathaway
New member
Username: Ghath

Post Number: 9
Registered: 10-2012
Posted on Friday, November 23, 2012 - 01:31 pm:   

Hi Des - thanks for your posts. I have amended the batch files to skip replying to the modem numbers and the messages are no longer looping which is great! I'm able to process received messages and the responders are being sent out successfully.
The O2 delivery reports is still an ongoing problem and I would welcome any further suggestions you may have.

The 2 way for delivery receipts is currently setup as follows

id:*
c:\windows\system32\cmd.exe /c c:\dr.bat @@SENDER@@ @@RECEIPMESSAGEID@@

dr.bat is set as follows:

@ECHO OFF
if [%2] == [+447899063301] goto EXIT
if [%2] == [+447768556165] goto EXIT
ECHO %1 %2 >> c:\deliveryreceipts.csv
:EXIT

I have added the "*0#" before the body of the text which is sent to the NowSMS function and the recipient receives the message successfully with the "*0#" stripped off the message. I can see the received SMSIN-yyyymmdd.LOG (see uploaded attachment) for the said message contains the "id:*" which suggests the delivery report is being sent back.
However the 2 way command isn't processing these to append the file which it's set to do.
Can you help explain why the delivery report isn't being processed using the 2 way command in place?

Cheers
text/plain
SMSIN-20121123.LOG (3.2 k)
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 4217
Registered: 08-2008
Posted on Friday, November 23, 2012 - 03:29 pm:   

Hi Grant,

I think I'd need to see SMSDEBUG.LOG.

Also, could you do a screen capture of the 2-way command screen?

--
Des
NowSMS Support
G Hathaway
New member
Username: Ghath

Post Number: 10
Registered: 10-2012
Posted on Friday, November 23, 2012 - 03:32 pm:   

Des - here you go. Tks
text/plain
SMSDEBUG.LOG (37.9 k)
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 4218
Registered: 08-2008
Posted on Friday, November 23, 2012 - 04:11 pm:   

I'm puzzled Grant.

I did notice that the last message in the log, at around 14:46, did get routed properly to dr.bat.

Is it possible that Apply was not pressed after a change was made? It may take about a minute for the service to react to command changes.

Is the "Receive Phone Number" field blank for all commands (the logic gives more weight to a command match if the receive number matches).
G Hathaway
New member
Username: Ghath

Post Number: 11
Registered: 10-2012
Posted on Monday, November 26, 2012 - 09:31 am:   

Hi Des, here is the issue as it stands.

The 2 way command for id:* is now appending the csv file using the batch file. This part is working..

However the delivery receipt ID data isn't being added to the csv file. The parameter is @@SENDER@@ @@RECEIPMESSAGEID@@ but in the .csv file I get "+4478990633** @@RECEIPMESSAGEID@@" and not the ID identifier which should be something like id:5090C3F2.
The id identifier is being received as I can see it in the SMSDebug.log but its just not being processed. Very strange.
The "receive phone number" fields are blank for all commands.
This is a big problem as it's important that we have delivery reports up and working, we may have to revert back to using Vodafone Sims as this only appears to be an issue with O2...which just doesn't sense.
Any more suggestions Des? Thanks
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 4220
Registered: 08-2008
Posted on Monday, November 26, 2012 - 05:28 pm:   

Hi Grant,

@@RECEIPMESSAGEID@@ should be @@RECEIPTMESSAGEID@@

--
Des
NowSMS Support
G Hathaway
New member
Username: Ghath

Post Number: 12
Registered: 10-2012
Posted on Tuesday, November 27, 2012 - 11:47 am:   

Thanks Des, well spotted. It's working now cheers
G Hathaway
New member
Username: Ghath

Post Number: 13
Registered: 10-2012
Posted on Friday, January 11, 2013 - 09:35 am:   

Hi Des

I'm afraid I need further assistance on getting delivery reports to work.
I made the change to @@RECEIPTMESSAGEID@@ and the command is routing to the dr.bat and the result appends a file but the information in the appended csv file isn't correct.

2 way Command
id:*
c:\windows\system32\cmd.exe /c c:\dr.bat @@SENDER@@ @@RECEIPMESSAGEID@@ @@MSGDATE@@ @@MSGTIME@@


dr.bat is set as follows:

@ECHO OFF
if [%2] == [+447899063301] goto EXIT
if [%2] == [+447768556165] goto EXIT
ECHO %1 %2 >> c:\deliveryreceipts.csv
:EXIT

This is whats outputted to the CSV:
+447899063301 5090D045.req 20121127 162159

Shouldn't the above contain the delivery receipt ID file instead of the .req reference. I have proven that NOWSMS is receiving delivery receipts as they appear in the SMSDebug.log.

I'm sure I'm close to getting DR's to work and not ready to give up just yet, please help.

Cheers
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 4257
Registered: 08-2008
Posted on Friday, January 11, 2013 - 02:19 pm:   

Hi Grant,

That parameter should have the ID of the originally submitted message, to allow the receipt to be matched with the message that was sent.

Is that what you see?

--
Des
NowSMS Support
m wasim
New member
Username: Mwasim

Post Number: 1
Registered: 01-2013
Posted on Monday, January 14, 2013 - 06:04 am:   

i m using Audiotel Industrial GSM BASE modem, by using SMSLIST application i can send and receive

messages, but i want to use this modem with some flow meters from which i want to send temperature

and pressure values through sms. My Question is, how do i configure this modem to send sms without

using any application.

This modem could receives pressure/temperature value directly from flow meter and sms to a specific number.

i can access my modem through hyper terminal
G Hathaway
New member
Username: Ghath

Post Number: 14
Registered: 10-2012
Posted on Monday, January 14, 2013 - 08:38 am:   

Thanks Des
So this is working correctly? Just to clarify, how do I match up the sent message ID with the received message ID.
Where does NOWSMS put the ID for all sent messages, is it the SMSOUT files?
Bryce Norwood - NowSMS Support
Board Administrator
Username: Bryce

Post Number: 8045
Registered: 10-2002
Posted on Tuesday, January 15, 2013 - 02:08 pm:   

Hi Grant,

Des is unfortunately out sick, so I'm trying to read back through these posts to understand your concern.

Normally customers are after the original message ID in the receipt, so that they can determine which message was delivered.

I guess the confusion here is that you are submitting SMS messages via a 2-way command response, so you don't have any knowledge of the original message ID.

You could retrieve it from the SMSOUT file.

Alternatively, you would need to submit via HTTP (instead of simple command response) and parse that response to acquire the message ID. Of course, that is considerably more complex than the process you are currently using.

-bn

Bryce Norwood
NowSMS/MMS Support
m wasim
New member
Username: Mwasim

Post Number: 2
Registered: 01-2013
Posted on Sunday, January 20, 2013 - 06:17 am:   

Dear Bryce,

would you please shed some lite on my previous query.
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 4260
Registered: 08-2008
Posted on Monday, January 21, 2013 - 03:05 pm:   

Hi m wasim,

For information on submitting SMS Messages to NowSMS, or NowSMS Lite, please see http://www.nowsms.com/doc/submitting-sms-messages

If there are any further questions I can clarify, please start a new discussion thread, as I do not think your questions are necessarily related to those of Grant on this thread.

--
Des
NowSMS Support

Login Login / Register Logout Logout Search Last 30 Days Topics Topics