2-Way SMS and VBS

2-Way SMS and VBS SearchSearch

SMS & MMS Technical Forum » NowSMS Support - SMS Issues (Product Support Only) » Archive through June 21, 2007 » 2-Way SMS and VBS « Previous || Next »
Author Message
Simon Jones
New member
Username: Elsrj

Post Number: 1
Registered: 04-2007
Posted on Thursday, April 26, 2007 - 12:14 pm:   

We are currently evaluating packages for a new SMS application. We think we can implement the service in vbs running as a command script (no web pages or other such stuff).

We are having some difficulty working out how in VBS you return a value such that NowSMS sends a text message out. We have tried the incall example and that works fine. However, incall only writes output to a file - it returns nothing to the SMS sender.

We can't work out how to return a text string to the SMS sender. incall does not do that and experiments with 'msgbox' statements don't seem to work. The modem checks out OK and so because of this and successful operation of 'incall' we think the system is configured correctly.

So..... we think the right question to ask is 'what vbs statement do we have to use to return a string such that 2-way nowsms will send it on to someone'?
Thanks in Advance

Simon
Waleed Hameed
New member
Username: Waleed_k

Post Number: 22
Registered: 02-2007
Posted on Friday, May 11, 2007 - 08:31 am:   

Hello Simon,

I was having the same problem and most of scripts here are in Jscript or they start talking about having server side and ASP or PHP remote script running there and you trigger it by HTTP GET from NowSMS.

My test plane is to use WSH environment and try to do the basic functionalities. Get SMS elements, log in file, log in DB, and send back SMS to the sender or any other number.

Ok your concern is about sending back SMS!!!
What I did is, by using the 127.0.0.1:xx I send HTTP GET request and the gateway will send SMS. This case is all hosted by the gateway computer, but it is useful for understanding the sending SMS concept. To link to remote script you just need to change the (http:\IP:Port).

Well see the code bellow …………… hope it helps!!!??

httpget.vbs
----------------------------------

Set argsNamed = WScript.Arguments.Named

Dim strRequest
NowSMSServerAddress = "http://127.0.0.1:80"


Sender = argsNamed.Item("sender")
Prefix = argsNamed.Item("prefix")
Sms = argsNamed.Item("message")
Smstime = argsNamed.Item("time")
Smsdate = argsNamed.Item("date")

‘Log SMS into DB (Access)
Dim strCN, objCN, objRS1, strSQL

strCN = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & "c:\database\db1.mdb"
Set objCN = WScript.CreateObject("ADODB.Connection")
objCN.Open strCN
Set objRS1 = objCN.OpenSchema(20)

strSQL = "INSERT INTO smstable ( [sender], [perfix], [sms], [smstime], [smsdate] ) VALUES ( '" & Sender & "','" & Prefix & "','" & Sms & "','" & Smstime & "','" & Smsdate & "')"

Set objRS1 = objCN.Execute(strSQL)
‘To replace + with “%2B” to be suitable for URL format
Sender = Replace (Sender, "+" , "%2B")
strRequest = NowSMSServerAddress +"/?PhoneNumber="+ Sender +"&text=Got your SMS"

‘By Echo the response of HTTPGET function the gateway will capture it as send ‘command

Wscript.Echo(HTTPGET(strRequest))


Set argsNamed = nothing


‘Function sends HTTP GET and return response
function HTTPGET(strURL)

Dim strResult
Dim Http

Set Http = CreateObject("MSXML2.XMLHTTP")

Http.Open "GET", strURL , False

Http.send
strResult = Http.ResponseText


HTTPGET = strResult


End function

--------------------------------

Thanks anyway, look forward to hear from you,

Regards

Waleed Hameed
MSc. Mobile Computer Systems
Staffordshire University

Simon Jones
New member
Username: Elsrj

Post Number: 2
Registered: 04-2007
Posted on Monday, May 14, 2007 - 12:26 pm:   

Thanks Waleed - this has been very helpful and moved us on quite a bit.

Right now we are extending the framework such that we receive an MMS and send out an SMS. This is proving intriguing. No file ever gets stored in MMS-IN but the 2-way script runs (presumably because an MMS receive is preceded by a 2-SMS according to GSM/GPRS. If only I could persuade our GPRS modem handset to tell me where it puts the file (as it doesn't keep it on the handset but does report 17KB of data retrieved).
Waleed Hameed
New member
Username: Waleed_k

Post Number: 24
Registered: 02-2007
Posted on Tuesday, May 15, 2007 - 08:03 am:   

Hi Simon,
Good to hear that!
I wish to help with MMS issue but I didn’t work with it yet!!!
I didn’t understand you clearly. But I think we can control the MMS routing from modem setting in CSMS tab. and don’t forget to enable the 2-way MMS.
I am going to bigger integration for our office use.............. Thanks for sharing!
Please u may update me with any information

Regards

Waleed Hameed
MSc. Mobile Computer Systems
Staffordshire University
Mukund Daga
New member
Username: Daga0001

Post Number: 1
Registered: 05-2007
Posted on Wednesday, May 16, 2007 - 06:46 am:   

Hello ,

I was wondering if you could help me out is some way. I wanted to extract a portion of the string that a sender is sending via SMS. The incoming SMS would then act as an input for a script code that would process the data and give me the output which I wanted to send back to the sender. Is it possible to do so ? How do I program this via NowSMS ?
Mukund Daga
New member
Username: Daga0001

Post Number: 2
Registered: 05-2007
Posted on Wednesday, May 16, 2007 - 06:51 am:   

For example, if the SMS is "LT 1234" , the SMS should first trigger a script and then take 1234 as the input for that particular script. And I wanted to send the output of the script back to the sender of the SMS. I would really appreciate any help. Thanks a lot.
Simon Jones
New member
Username: Elsrj

Post Number: 5
Registered: 04-2007
Posted on Wednesday, May 16, 2007 - 04:12 pm:   

This is probably best done inside the VBS script rather than inside NowSMS.

As an example here is a 2-way SMS command to execute entry
Of course tou would substitute your website address (where the ASP file is) for mywebsite.com

http://mywebsite.com/ASP-TEST/Page_1.asp?sender=@@SENDER@@&text=@@FULLSMS@@
Note the text variable in the command line which passes the SMS message to the VBS

The following code has a variable message called TextToAnalyse which is set to the text
It also outputs the received text back to the sender.

you can then use all of VBS string search functions to look inside it.

HTH

Simon

<%
Response.ContentType = "text/plain"
Dim TextToAnalyse
TexttoAnalyse = Request.QueryString("text")
If Request.QueryString("sender") = "" Then
Response.Write ("ERROR : 'sender' parameter missing!")
Else If (Request.QueryString("text") = "") Then
Response.Write ("ERROR : 'text' parameter missing!")
Else
Response.Write ("I received your message : ")
Response.Write (Request.QueryString("text"))
End If
End If
%>
Mukund Daga
New member
Username: Daga0001

Post Number: 6
Registered: 05-2007
Posted on Friday, May 18, 2007 - 03:34 am:   

Hey,
Thanks for your help but we don't have sufficient knowledge on VBS for to submit a project on time. Would it be too much to ask from you to help me out with the source code. Basically, a program that functions as I had mentioned in my previous example. I would highly appreciate if a detialed explanation is given so that I could enhance my knowledge on Visual Basic

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