-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
executable file
·80 lines (64 loc) · 2.74 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
smsgw - gnokii based SMS Gateway written in PHP.
Installation
------------
Install gnokii with mysql backend. On Debian/Ubuntu, this is done by,
# apt-get install gnokii-common gnokii-smsd-mysql gnokii
Connect your phone to computer through USB cable. The 'dmesg' command
displays the device location. In many cases, it's /dev/ttyACM0
Modify /etc/gnokiirc to add the port information, model, baudrate, and
telephone number. Sample config is shown below.
[global]
port = /dev/ttyACM0
model = AT
initlength = default
connection = serial
use_locking = yes
serial_baudrate = 19200
smsc_timeout = 10
[xgnokii]
allow_breakage = 0
[gnokiid]
bindir = /usr/sbin/
[connect_script]
TELEPHONE = 1234567
[disconnect_script]
[logging]
debug = off
rlpdebug = off
Test if it's working,
$ echo "This is a test message." | gnokii --sendsms 987654321
1) Create mysql database
Example:
> create database 'smsgw';
> grant all privileges on `smsgw`.* to `smsgw-user`@`localhost` identified
by 's3cr37passw0rd';
2) Import smsgw.sql file
$ mysql -p -u smsgw-user smsgw < smsgw.sql
You may delete smsgw.sql after importing it.
2) Modify include/config.php to match the db details above
Example:
define("HOST","localhost");
define("DB_NAME","smsgw");
define("DB_USER","sms-user");
define("DB_PW","s3cr37passw0rd");
Running the application
-----------------------
For it to work, you need a domain with catch-all email address. Let's say
is forwarded to [email protected]. This is handy since we can use the user
portion of email address as Phone number.
Once the catch-all email is working, start by add email2sms.php and
sms2email.php cron job to run every minute, shown as below:
* * * * * /usr/bin/php /path/to/email2sms.php
* * * * * /usr/bin/php /path/to/sms2email.php
Assuming, the details above, start gnokii daemon by typing following on the
terminal:
$ /usr/sbin/smsd -u sms-user -d smsgw -c localhost -m mysql -b IN -f /var/log/smsgwd.log
The daemon will monitor the smsgw table for any incoming text message on the
phone first line of which is the email address and adds it to the outgoing
email queue. sms2email.php goes through the email queue and sends the email.
Incoming Text Message -> (phone) -> Send Email
Any email received on catch-all email address is inspected for phone number
regular expression in the user portion. (eg: [email protected]) The rest
of the email is then added to the outgoing text queue which is delivered by smsd.
Email (eg, To Address: [email protected]) -> (phone) -> Send Text to 12345