Building SMS Gateway using UBUNTU
Project Name : SMS Gateway using UBUNTU
Hi all, now I am building sms gateway using UBUNTU.
$ uname -a
kernel Linux hardcorepolice 2.6.27-7-generic #1 SMP Tue Nov 4 19:33:20 UTC 2008 i686 GNU/Linux
I am using Nokia 6100 and DKU-5 as connector, free sms gateway source by Kannel version 1.4.3
source : http://www.kannel.org/download/1.4.3/gateway-1.4.3.tar.gz
download the source file, then extract it DO NOT compile. I only get the modems.conf from it
$ tar -zxvf gateway-1.4.3.tar.gz
The modems.conf located in gateway-1.4.3/doc/examples/modems.conf
Debian repository
Debian/apt repository is available at http://www.litux.org/debian.
Just apt-get install kannel for stable release or apt-get install kannel-devel for development release.
$ sudo apt-get install kannel
$ cp gateway-1.4.3/doc/examples/modems.conf /etc/kannel/
$ sudo gedit /etc/kannel/kannel.conf
#
# Sample configuration file for Kannel bearerbox on Debian.
# See the documentation for explanations of fields.
## HTTP administration is disabled by default. Make sure you set the
# password if you enable it.group = core
admin-port = 13000
admin-password = bar
admin-deny-ip = “”
admin-allow-ip = “*.*.*.*”
smsbox-port = 13001
wapbox-port = 13002
wdp-interface-name = “*”
log-file = “/var/log/kannel/bearerbox.log”
box-deny-ip = “”
box-allow-ip = “*.*.*.*”
include = “/etc/kannel/modems.conf”
group = wapbox
bearerbox-host = localhost
log-file = “/var/log/kannel/wapbox.log”group = smsbox
bearerbox-host = localhost
sendsms-port = 13013
# change global-sender to the appropriate cell service provider number
global-sender = xxxgroup = smsc
smsc = at
device = /dev/ttyUSB0
modemtype = auto
# change my-number and sms-center to the appropriate cell service provider number
my-number = xxx
sms-center = xxx
speed = 9600
pin = 2205
host = localhost
port = 13013
smsc-id = itegnogroup = sendsms-user
username = simple
password = elpmis
group = sendsms-user
$ bearerbox -v 1 kannel.conf
Open another terminal window
$ smsbox -v 1 kannel.conf
Yes, you will see warnings and errors, but dont worry that all run properly.
You may configure all things you want.
Test your send sms using Internet browser :
http://localhost:13013/cgi-bin/sendsms?username=simple&password=elpmis&dlr-mask=31&text=Hello%20world&sender=Helpdesk&to=TARGETPHONE
wait a moment , there will be incoming sms in TARGETPHONE , cek your inbox.
SMS gateway run successfully.
Thats all for now, be back later.
[…] I posted installing kannel sms gateway using Centos and Ubuntu […]
Pingback by Domain Name Yahoo || Configuring SMS Gateway kannel | April 14, 2009
Hi,
I have one question.
If i send an sms from a cell to the sms gateway, where i can find this message?
Is there any log service that i can use?
Because i need to pick up from the sms the number that send the message and the text to have some check.
Can you help me please???
Thank you for helping.
Nice job!!!
Comment by Morpheus | May 20, 2009
Incoming SMS log ?
I think you can create your own log. That is very simple.
Here it goes.
first, add/replace sms-service something like below :
group = sms-service
keyword-regex= .*
catch-all = yes
max-messages = 1
get-url = “http://domainnameyahoo.info/sms/sms.php?phone=%p&text=%a”
then, you create sms.php file within sms directory.
# cat sms.php
< ?phpextract($_GET);
// phone=%p&text=%a"
// echo "telp :".$phone." ";
// echo "text :".$text;
//-------------------------
// Write your own log method here, you may use mysql or text file database.
//----------------------------
$info = " Sent from domainnameyahoo.info";
if ( $phone!="" || $text != "" ){
if (trim(strtolower($text)) == "status" ){
// check server status
}
echo $info;
}
// all echo syntax will be reply-to sender
?>
I hope that will help.
Comment by admin | May 27, 2009
*After all the setting, I tried to run *bearerbox /etc/kannel.conf
*Then, it returns the following*:
*2009-04-15 18:24:39 [9679] [0] INFO: Kannel bearerbox II version 1.4.3
starting
2009-04-15 18:24:39 [9679] [0] INFO: Loading store file
`/var/log/kannel/kannel.store’
2009-04-15 18:24:39 [9679] [0] INFO: Store-file size 0, starting to unpack
2009-04-15 18:24:39 [9679] [0] INFO: Retrieved 0 messages, non-acknowledged
messages: 0
2009-04-15 18:24:39 [9679] [8] DEBUG: Thread 8
(gw/bb_store_file.c:store_dumper) maps to pid 9679.
2009-04-15 18:24:39 [9679] [8] DEBUG: Dumping 0 messages to store
2009-04-15 18:24:39 [9679] [0] DEBUG: Started thread 8
(gw/bb_store_file.c:store_dumper)
2009-04-15 18:24:39 [9679] [0] INFO: MAIN: Start-up done, entering mainloop
2009-04-15 18:24:39 [9679] [0] DEBUG: AT2[itegno]: start called
2009-04-15 18:24:39 [9679] [6] DEBUG: AT2[itegno]: device opened. Telnet
mode = 0
2009-04-15 18:24:40 [9679] [6] DEBUG: AT2[itegno]: device opened
2009-04-15 18:24:40 [9679] [6] INFO: AT2[itegno]: speed set to 115200
*2009-04-15 18:24:40 [9679] [6] DEBUG: AT2[itegno]: –> ^M
2009-04-15 18:24:40 [9679] [6] DEBUG: AT2[itegno]: AT^M
2009-04-15 18:24:40 [9679] [6] DEBUG: AT2[itegno]: AT&F^M
2009-04-15 18:24:40 [9679] [6] DEBUG: AT2[itegno]: ATE0^M
2009-04-15 18:24:44 [9679] [6] ERROR: AT2[itegno]: Couldn’t connect
(retrying in 10 seconds).
2009-04-15 18:24:54 [9679] [6] DEBUG: AT2[itegno]: detecting modem type
2009-04-15 18:24:54 [9679] [6] INFO: AT2[itegno]: opening device
2009-04-15 18:24:54 [9679] [6] WARNING: AT2[itegno]: trying to open device
with not closed device!!! Please report!!!
2009-04-15 18:24:54 [9679] [6] INFO: AT2[itegno]: Closing device**
***the italic part is always looping*
*then I start the *smsbox /etc/kannel.conf*
the result is as follows:
2009-04-16 09:26:03 [6086] [0] DEBUG: Kannel smsbox version 1.4.3 starting
2009-04-16 09:26:03 [6086] [0] DEBUG: dumping group (sendsms-user):
2009-04-16 09:26:03 [6086] [0] DEBUG: =
2009-04-16 09:26:03 [6086] [0] DEBUG: =
2009-04-16 09:26:03 [6086] [0] DEBUG: =
2009-04-16 09:26:03 [6086] [0] DEBUG: Started thread 4
(gw/smsbox.c:obey_request_thread)
2009-04-16 09:26:03 [6086] [4] DEBUG: Thread 4
(gw/smsbox.c:obey_request_thread) maps to pid 6086.
2009-04-16 09:26:03 [6086] [5] DEBUG: Thread 5
(gw/smsbox.c:url_result_thread) maps to pid 6086.
2009-04-16 09:26:03 [6086] [0] DEBUG: Started thread 5
(gw/smsbox.c:url_result_thread)
2009-04-16 09:26:03 [6086] [6] DEBUG: Thread 6
(gw/smsbox.c:http_queue_thread) maps to pid 6086.
2009-04-16 09:26:03 [6086] [0] DEBUG: Started thread 6
(gw/smsbox.c:http_queue_thread)
2009-04-16 09:26:03 [6086] [0] INFO: Connected to bearerbox at localhost
port 13001.
2009-04-16 09:26:03 [6086] [7] DEBUG: Thread 7
(gw/heartbeat.c:heartbeat_thread) maps to pid 6086.
2009-04-16 09:26:03 [6086] [0] DEBUG: Started thread 7
(gw/heartbeat.c:heartbeat_thread)
2009-04-16 09:26:22 [6086] [2] DEBUG: HTTP: Creating HTTPClient for
`127.0.0.1′.
2009-04-16 09:26:22 [6086] [2] DEBUG: HTTP: Created HTTPClient area
0×8340c80.
everything sounds OK , except for the bearerbox error and warning.
I tried to send an sms by hitting this URL:
*
http://localhost:13013/cgi-bin/sendsms?username=playsms&password=aaaaa&to=+62818095*****&text=test&from=test
**
*and the page result *3: Queued for later delivery*
after I checked the smsbox, it displayed:
2009-04-16 09:26:22 [6086] [3] INFO: smsbox: Got HTTP request
from
2009-04-16 09:26:22 [6086] [3] INFO: sendsms used by
2009-04-16 09:26:22 [6086] [3] INFO: sendsms sender:
(127.0.0.1) to: msg:
2009-04-16 09:26:22 [6086] [3] DEBUG: Stored UUID
1af5eba5-dba5-4d8b-b44f-8fbc5be01a27
2009-04-16 09:26:22 [6086] [3] DEBUG: message length 4, sending 1 messages
2009-04-16 09:26:22 [6086] [3] DEBUG: Status: 202 Answer:
2009-04-16 09:26:22 [6086] [3] DEBUG: Delayed reply - wait for bearerbox
I guess the smsbox waits for bearebox to connect to SMSC successfully, but
the bearerbox still cannot connect.
*2009-04-15 18:24:44 [9679] [6] ERROR: AT2[itegno]: Couldn’t connect
(retrying in 10 seconds).*
does anyone have solution about this issue??
thank you
Comment by chamira | March 7, 2010
Hi Chamira,
When I see your log above, the error part is begin with this line.
2009-04-15 18:24:44 [9679] [6] ERROR: AT2[itegno]: Couldn’t connect
I believe this is error when connecting to your cellphone device. Please re-check your kannel.conf file, especially this line.
device = /dev/ttyUSB0
modemtype = auto
Note:
ttyUSB0 is your modem connection type.
Confused ? use #dmesg for more information.
First, disconnect your modem connection cable (DKU-5) from your PC. Then from Unix terminal, type : # dmesg
At the last line, you will see that the cable is unplugged.
Plug the cable to USB, and see again on # dmesg
You will see what USB was used for the connection.
Comment by admin | March 8, 2010
By The Way, kannel will try to reconnect your modem.
So, every time it try to reconnect kannel will always logged the status. Thats why the log is looping for errors.
Comment by admin | March 8, 2010