This interface enables SMSServer to act as a mini web server, accepting HTTP requests as remote commands. SMSServer uses the Jetty web server as its embedded server.
The following operations are currently supported:
The HTTPServer interface implements a REST-like calling scheme, where each supported call gets a number of parameters and response with an XML document. The functionality of each call is described below.
Starting from v3.4, the HTTPServer Interface class file has been pulled out of the main source directory. In order to install and use it, please do the following:
HttpServer.java
(found in the /misc/SMSServer/Interfaces/Stable/
directory) to the /src/java/org/smslib/smsserver/interfaces/
directory.Displays the status of the SMSServer application. This method returns an HTML document and is meant to be called from a web browser.
To see the status, point your browser to: http://smsserver-ip:port
, where
smsserver-ip
is the IP address of the machine that is running SMSServer, andport
is the port that you have defined as the listening port.For example: http://192.168.10.15:8080
You will get a simple web page where you can see:
You can request SMSServer to send a specific message. The message details are given using parameters to the base URL. The minimum parameters are recipient
and text
.
URL: http://smsserver-ip/send
Parameters
Option | Description |
password | The SEND password, as defined in the relevant section of the configuration file. |
recipient | The recipient's number. |
text | The message text. |
encoding | Requests a specific encoding. Allowed values are:
|
priority | The priority of the message. |
from | The originator string of the message. |
gateway | Requests the dispatch of the message from a specific gateway. If the parameter is missing, SMSServer decides which gateway to use. |
Examples:
http://smsserver/send?password=1111&recipient=3012341234&text=Hello World!
http://smsserver/send?password=1111&recipient=3012341234&text=Hello World!&gateway=mySpecificGateway
http://smsserver/send?password=1111&recipient=3012341234&text=Hello World!&priority=-100
You can request SMSServer to read and return to you the messages received from its gateways. What you do is that you call a specific URL and you get an XML document with all messages read. By default (i.e. if no parameters are given) SMSServer will read messages from all the gateways. You can customize the message query by using one or more of the supported parameters.
URL: http://smsserver-ip/read
Parameters
Option | Description |
password | The READ password, as defined in the relevant section of the configuration file. |
gateway | If given, SMSServer will try to read messages from the gateway with the specific gateway id. Otherwise, it will read all gateways. |
Returns an XML structure like the following, which contains all messages read:
<?xml version='1.0' encoding='UTF-8'?> <messages> <message> <message_type>Inbound</message_type> <message_date>2008-09-15T20:23:05+03:00</message_date> <originator>306974xxxx</originator> <text>Test</text> <encoding>ENC7BIT</encoding> <gateway>modem1</gateway> </message> ... </messages>
Examples:
http://smsserver/read?password=0000
http://smsserver/read?password=0000&gateway=myModem
This interface requires the following configuration settings:
Option | Description |
port | The TCP port to which the interface listens to. Default is 8080. |
password.read | The password required to perform a remote READ operation. |
password.write | The password required to perform a remote SEND operation. |
Example:
interface.0=httpServer, HttpServer
httpServer.port=8080
httpServer.password.read=0000
httpServer.password.send=1111