Support forum

Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_TopicIcon
remote process an auto response
sp_NewPost Add Reply sp_NewTopic Add Topic
February 21, 2011
8:45 pm
J
Guest
Guests

Henk, Thank you! works perfectly. If stable through tests, we are switching to Diafaan!

February 21, 2011
7:54 pm
Henk Helmantel
Guest
Guests

I have uploaded the whole script to our website. If you follow the five steps below it should work without compile errors.

1. Add the line System.Web.dll to the ReferenceList property in the Advanced tab

2. Download this zipped file and extract the script.

3. Change the httpHost value in the script from @"http://www.host.com/test.php" to the host and page name you want to use. You can also change the query value if you want to change the http GET values.

4. Replace the whole script in the Scripting Connector with the new script.

5. Click on Compile to check if everything is entered correctly.

Regards,
Henk

February 21, 2011
6:10 pm
J
Guest
Guests

Curious if this worked for you. I replaced code as described, however script will not compile. I apologize, I do not write C so potentially obvious errors are not so obvious to me. When this snippet is added it apparently affects the rest of the code. Are there any examples of working code? Thanks.

February 21, 2011
11:58 am
Henk Helmantel
Guest
Guests

Hi,
The Web Connector does not have the option to send the response from the website back as an SMS message, however it is possible to do this with the Scripting Connector. Just create a Scripting Connector with C# as the scripting language and replace the function "OnMessageReceived" with the function below. Of course you must change the httpHost variable to your own web page and perhaps make some other changes depending on your specific requirements.

Code:
First add the line:
System.Web.dll
To the ReferenceList property in the Advanced tab

using System.IO;
using System.Net;
using System.Web;

...

private void OnMessageReceived(string fromAddress, string toAddress, string message, string messageType,
string messageId, string smsc, string pdu, string gateway,
DateTime sendTime, DateTime receiveTime)
{

string httpHost = @"http://www.host.com/page.php";
string query = "from="+HttpUtility.UrlEncode(fromAddress)+
"&message="+HttpUtility.UrlEncode(message);
try {
HttpWebRequest httpWebRequest = (HttpWebRequest) WebRequest.Create(httpHost + "?" + query);
using (HttpWebResponse httpWebResponse = (HttpWebResponse) httpWebRequest.GetResponse()) {
string responseText = new StreamReader(httpWebResponse.GetResponseStream()).ReadToEnd();
PostSendMessage(fromAddress, "", responseText.Trim(), "", "", "", "");
}
}
catch (Exception e) {
PostEventLog("Message could not be forwarded to: "+httpHost, e.Message, EventLog.Error);
}
}

February 20, 2011
10:10 pm
J
Guest
Guests

I want to route incoming message via http to remote web page, process it and send results back to server as outgoing message.
I can get message through and response back, but doesn't send to gateway device outbox.

Forum Timezone: Europe/Amsterdam

Most Users Ever Online: 494

Currently Online:
9 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Member Stats:

Guest Posters: 364

Members: 0

Moderators: 0

Admins: 1

Forum Stats:

Groups: 2

Forums: 3

Topics: 532

Posts: 1845

Newest Members:

, Henk Helmantel

Administrators: Henk Helmantel: 552