Git Product home page Git Product logo

2n-sms-server's Introduction

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:

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:

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


DETAILED CONFIG

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


HTTP COMMUNICATION, GET/POST CALLS AND RESPONSES


SMS SENDING via POST/GET:

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.

Response XML:

[OK|ERROR] [datetime] <-- datetime format: YYYY-MM-DD hh:mm:ss --> [individual SMS ID]

SMS FETCH via POST/GET:

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)

Response XML:

[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]

SMS DELETE via POST/GET:

example: http://127.0.0.1/?action=delete&id=[SMS id - hash]

action: delete id: SHA1 hash (40 chars long ID)

Response XML:

[OK|ERROR] [datetime] <-- datetime format: YYYY-MM-DD hh:mm:ss --> [individual SMS ID]

TRUNCATE DELETED SMS FROM DB via POST/GET:

example: http://127.0.0.1/?action=truncate

action: truncate

Response XML:

[OK|ERROR] [datetime] <-- datetime format: YYYY-MM-DD hh:mm:ss --> [number of truncated messages]

INSUFFICIENT RESPONSE:

insufficient request

For install instructions please check INSTALL file.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.