Full featured HTTP SMS service for 2n VoiceBlue (Next) GSM VoIP adapters with sending and receivig capabilities. Telnet or serial communications are available.
The service periodically checks the incoming SMS-es on the VoiceBlue adapter then stores in a local SQLite database. It can communicate via telnet, you can switch telnet off with USE_TELNET = False/True. If USE_TELNET = False, it will try to connect ONLY on serial (ttyUSB) ports (older VoiceBlue devices, but telnet preferred).
The HTTP REST service listens on a defined HTTP port (default 8080) and controllable via simple POST/GET calls. (In case of GET call the message should be URL encoded.) The HTTP responses from the service are simple XMLs for easy to use and parse. For details, control functions, output XML templates, please read the README document. There is a basic Apache+PHP WEB frontend available to control the service.
VoiceBlue AT commands reference: https://wiki.2n.cz/display/VBN30EN/4.2+AT+Interface
DEPENDENCIES:
- Python > 2.7.x
- Python-Messaging https://github.com/pmarti/python-messaging
PREFERRED way to install Python-messaging module: cd ~ git clone https://github.com/pmarti/python-messaging.git cd python-messaging sudo python setup.py install
OPTIONAL: For serial communication:
- Python-serial 2.5 > http://sourceforge.net/projects/pyserial/files/pyserial/2.5/pyserial-2.5.tar.gz/download
BASIC USAGE EXAMPLE: 0.) edit config variables below: # CONFIG START section 1.) start HTTP server on port: ./[program name] [server port] (default:8080) (root user requitred ONLY for serial communictaions) 2.) sending SMS: use a HTTP browser to call the server via GET method: http://[host address:port]/?rcpt=[full tel. number of recipient]&msg=urlencode([155 character sms])&smsc=[our telco's sms center full number (with + and country code, eg: +36...)] 3.) receiving SMS messages: http://[host address:port]/?action=listall
Licensed under GPL v2: http://www.gnu.org/licenses/gpl-2.0.html
For configuration, please edit the 2nVoiceBlueSMSServer.py file "CONFIG section."
SIMCARDSINUSE: how many SIM card installed on yout device. (0,1,2,3) SQLITE_PATH: the local SQLite database path, the server will creates it if not exist. The sent and received SMS-es stored here. IMPORTANT: the server deletes the SMS messages from the SIM cards after it fetched and stored in teh SQLite database. LOGFILE: the detailed log output of the server LOG_TO_LOGFILE: if you need ONLY print to CLI, use False here SERPORT: basic serial USB path root, without number! of the device, at startup, the server try to connect from ttyUSB[0] to ttyUSB[10] SERBAUD: baud rate for 2n device, fixed : 921600, do not change it! PORT: the HTTP server default port to listen on SMSC: default telco's SMSC number. It can be pass via HTTP GET also, but you can set it up. Can be fetched from the SMS, Message settings, or from the Internet. SIMPOLLINTERVAL: the server periodically polls the SIM cards in the device, fetches the SMS messages then stores in the local db, the poll interval in seconds #telnet settings USE_TELNET: True: use telnet to connect VB device, it is the default, False: try serial ports TELNET_HOST: telnet hostname or IP of VoiceBlue modem TELNET_PORT: telnet port TELNET_USER: Voice Blue modem user TELNET_PASSWORD VoiceBlue modem password TELNET_TIMEOUT: the telnet command timeout
USE_GSM_MODEM: True/False, workaround for CMS: 500 internal error, use GSM modem directly, workaround for Voice Blue Next devices, keep it True
example: http://127.0.0.1/?rcpt=+36120300001234&msg=tryitout
rcpt: recipient phone number msg: SMS message body, max 155 chars, accents removed. To avoid encoding problems, it should be urlencoded in case of GET. smsc: SIM's telco's SMS center number, not required if given at the config above.
[OK|ERROR] [datetime] <-- datetime format: YYYY-MM-DD hh:mm:ss --> [individual SMS ID]example: http://127.0.0.1/?action=listall
action: listall (list all plus deleted SMS messages stored locally) list (list only not deleted SMS messages) listdel (list deleted SMS) listrec (default / list only received - incoming - SMS messages) listrecdel (list deleted received messages) listsent (list sent - outgoing - messages) listsentdel (list received deleted messages) listqueue (list queued messages for sending - not sent yet) listerr (list of messages with sending errors occured)
[SHA1 hash id of SMS] [sent/received datetime] [datetime of message modification - queued -> sent, error] "[SIM card number: 0|1|2|3] [sender number - only incoming messages | None] [recipient's number - only sent messages | None] [queued | sent | senderror | received] [yes | no]example: http://127.0.0.1/?action=delete&id=[SMS id - hash]
action: delete id: SHA1 hash (40 chars long ID)
[OK|ERROR] [datetime] <-- datetime format: YYYY-MM-DD hh:mm:ss --> [individual SMS ID]example: http://127.0.0.1/?action=truncate
action: truncate
[OK|ERROR] [datetime] <-- datetime format: YYYY-MM-DD hh:mm:ss --> [number of truncated messages]insufficient request
For install instructions please check INSTALL file.