-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME
116 lines (85 loc) · 4.13 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
pysmsd
--------------------------------------------------------------------------------
A python daemon which exposes a JSON based HTTP API for sending and receiving
SMS messages to an attached SMS compatible phone or modem.
License
--------------------------------------------------------------------------------
pysmsd is pusblished by HIIT under the MIT License. See LICENSE for further information.
Authors
--------------------------------------------------------------------------------
Konrad Markus, HIIT, <[email protected]>
Jani Turunen, HIIT, <[email protected]>
Dependencies
--------------------------------------------------------------------------------
pysmsd relies on the python bindings to the gammu library for hardware
communications, thus hardware compatibility is determined by compatibility
with gammu. http://wammu.eu/python-gammu/
To get started you should have:
- python 2.5 or above
- sqlite3
* apt-get install sqlite3
- libGammu with python bindings
* apt-get install python-gammu
- A gammu compatible phone or modem with a suitable connection to
the machine running pysmsd
* check http://wammu.eu/phones
Installation
--------------------------------------------------------------------------------
1) Create an empty database. The database file is by default:
pysmsd/data/pysmsd.db
To create this file and the needed schema run the following:
$ cd pysmsd/data
$ sqlite3 pysmsd.db
SQLite version 3.6.16
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .read schema.sql
sqlite> .quit
2) Edit the gammurc file to match your hardware.
See the gammurc file for examples and further information.
Running
--------------------------------------------------------------------------------
to run pysmsd enter the following:
$ ./daemon.py --debug
if correctly configured and running, you should see output something like the following:
/usr/local/src/dev/pysmsd/pysmsd/daemon/../handlers/enabled
2010-08-05 15:15:53 [MainThread] {'ME': 2, 'SM': 0}
2010-08-05 15:15:53 [http-thread] starting cherrypy httpd daemon on port 33380...
Once running point your web browser at:
http://127.0.0.1:33380/ (default host & port)
This displays the homepage which has pointers to the various parts of the HTTP API.
To see other startup options:
$ ./daemon.py --help
Other running options
--------------------------------------------------------------------------------
An upstart compatible init script is supplied (pysmsd.upstart.conf).
To use this:
1) check that the options you require are being specified correctly in this file
2) copy the file to /etc/init/pysmsd.conf
- or the equivalent on your system
3) run:
$ start pysmsd
It is recommended that the daemon is run behind a full-featured web server
such as NginX. Optionally SSL support can be added at this point.
An example nginx configuration file is provided in:
pysmsd/http/nginx.conf
For testing purposes a self-signed SSL certificate can be created using guide
here:
http://www.akadia.com/services/ssh_test_certificate.html
Clients
--------------------------------------------------------------------------------
- Every API call must be authorized by a client name/password combination.
Client details are stored in the database in the 'clients' table.
- By default a client named 'pysmsd_test' is created in the database.
This is for testing purposes only and should be removed before putting into production.
- A utility script called hash.py is provided for creating encrypted passwords
which are suitable for inserting into the client table.
An exmple of creating a new client named 'foo' with password 'bar' is shown below:
$ ./hash.py bar
$2a$12$1QoVM8Uhd998FkKNsip7a.HiM7guEgsY24KRsP1alEO2suKZekQFi
$ sqlite3 pysmsd/data/pysmsd.db
SQLite version 3.6.16
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> INSERT INTO `clients` (`name`, `password`, `created`, `updated`) VALUES('foo', '$2a$12$1QoVM8Uhd998FkKNsip7a.HiM7guEgsY24KRsP1alEO2suKZekQFi', datetime('now'), datetime('now'));
sqlite> .quit