Overview:

    * This Python sample code will allow a user to send an sms message from a cell phone to the iSMS device and the iSMS device will send it to the Apache Web Server via IP. The Apache Web Server will then call the Python script to write the incoming sms message to a text file on the local hard drive.

Prerequisite:

    * Download and Install Python Interpreter 3.1.2 Windows x86 MSI Installer at http://www.python.org/download/
    * Download and Install Apache Web Server httpd-2.2.15-win32-x86-no_ssl.msi at http://httpd.apache.org/download.cgi
    * Download the Python sample source code iSMSSendAndReceive-Python.zip here

Modify the httpd.conf:

1. Find the 1st section:

Options +FollowSymLinks

Add +ExecCGI. So it looks like this:

Options +FollowSymLinks +ExecCGI

2. Find the second section:

Options Indexes FollowSymLinks

Edit it so it looks like: (add +ExecCGI)

Options Indexes FollowSymLinks +ExecCGI

3. Find the line:

#AddHandler cgi-script .cgi

Uncommented it and add .py. So, it should look like this:

AddHandler cgi-script .cgi .py

4. Save it and restart the Web Server.

iSMS device setup:

    * Go to your SMS finder -> SMS Service -> SMS API:
    * HTTP API status: Checked.
    * HTTP port: 81.
    * Click on Save Button.
    * None polling Receive API status: Checked.
    * Protocol: HTTP.
    * Click on Save Button.
    * Server: xxx.xxx.xxx.xxx (Enter your Web server IP address here)
    * Port: 80.
    * Click on Save Button.
    * Server Default Page: ismsResponse.py.
    * Click on Save Button.

5. Put the ismsResponse.py, ismsSend.py and ismsSend.html under the Apache /htdocs folder.

Notes:

    * If you send an sms message from your cell phone to the iSMS device, the iSMS device will send that sms message to the Web Server and Web Server will call the ismsResponse.py to write the message to a text file named – receive.log.
    * ismsSend.html is an html form that allows you to send the sms message from your web browser.
    * You must also modify the ismsSend.py to point to your iSMS device before you can send the sms message to iSMS device via Web browser.

Modify the ismsResponse.py:

Find the line

#!d:\python31\python.exe

and edit the path so that it points to your path.

Notes:

    * If you send an sms message from your cell phone to the iSMS device, the iSMS device will send that sms message to the Web Server and Web Server will call the ismsResponse.py to write the message to a text file named – receive.log.
    * ismsSend.html is an html form that allows you to send the sms message from your web browser.
    * You must also modify the ismsSend.py to point to your iSMS device before you can send the sms message to iSMS device via Web browser.

Modify the ismsSend.py:

a. Find the line

#!d:\python31\python.exe

and edit the path so that it points to your path.

b. Find the following line and put in your iSMS device ’s IP address.

httpServ = HTTPConnection("172.17.29.233", 81)

c. Find the following line and put in your user name and password.

httpServ.request('GET', '/sendmsg?user=admin&passwd=admin&cat=1' +
'&to=' + recipient + '&text=' + message)

c. Save it.

Now, you should be able to send a SMS message to your iSMS device through the Web browser. Bring up your web browser (IE or FireFox) and go to http://localhost/ismsSend.html. You will get a Send Message Form.