I recently had the oppportunity (necessity) to set up a web application that interacted with many of the users through SMS messages in addition to the more traditional HTML interface. While there are a number of possible software solutions for GSM modems on Windows, on Unix-like platforms the most commonly used one is Kannel. It also has the advantage of being open source and thus very, very free.
However, setting, configuring, and using Kannel tends to be a bit tricky. I’m writing this article (almost a HOWTO) in an attempt to help out anybody who’s undertaking the process themselves and might be able to get some tips and tricks from this. I expect this to not be a terribly popular article, but if I ever need to set this stuff up myself in the future, then I’ll have it written down somewhere at least!
Most of the instructions here will work on any Unix platform, such as Linux, FreeBSD, or Mac OS X. It’s worth noting that I got nearly everything working with OS X, only to be thwarted at the very end because Mac’s no longer have serial ports to use GSM modems. You could, however, easily use some of the more advaned HTTP based SMS services on a Mac server of some sort.
The Scenario
The web site written was a discounting service oriented around cell phones. Users would send the site a message, and then receive a discount at local venues. They could go to the site on the intarwebs to see their total savings and learn about more venues.
The usage pattern was always:
- User sends us a message.
- We might send them a reply after processing it.
- We might also periodically need to be able to send the user a message for other purporses, such as party invitations, etc (based on their preferences).
Downloading and Compiling
Kannel is trivially easy to download and compile. You visit the Kannel.org website and download the latest and greatest gateway-1.X.Y.tar.gz file.
From there:
# mkdir src
# cd src
# tar xfz ../downloads/gateway-1.4.1.tar.gz
# cd gateway-1.4.1
# configure --prefix=/usr/local/kannel
I chose to install to /usr/local/kannel just because I’m that kind of guy who likes to keep everything reasonably separated and organised. You’re free to put it anywhere.
Compile and install.
# make
# sudo make install
password: **************
Configuration Files
You can be forgiven for thinking Kannel is trivially easy thus far—it really is that easy to download, compile, and install. Unfortunately, here is where things get tricky.
You now need to set up a configuration file. This file has a zillion options to support all of the possible and powerful ways in which Kannel can be used. I will be showing strictly how I set it up for the GSM modem we had in the office (It’s a Siemens GSM modem connected to a serial port, and works quite well).
The basic smskannel.conf (in the gw/ directory) has much of the information we want, but we’ll need to add a few things for our GSM modems and to interact with our web server correctly.
Configuration is divided into a few key groups, each representing the key parts of the kannel system, including the server that handles sending and receving the actual SMSes (bearerbox) and the system that handles the final dispatching to your scripts (smsbox).
The core Group
The first part of the file is the “core” group, and the default is pretty close to what we want:
group = core
admin-port = 13000
smsbox-port = 13001
admin-password = bar
#log-file = "/tmp/kannel.log"
#log-level = 0
box-deny-ip = "*.*.*.*"
box-allow-ip = "127.0.0.1"
You’ll want to change the password of course, but everything else is nearly standard. We are assuming that all communication to the kannel server will come from the same physical computer (127.0.0.1). You can set a log file if you are going to be running kannel as a service on your server, or you can just redirect stdout to some file.
Be aware that kannel has various log levels, ranging from 0, which displays information that is only of interest when you’re in the development and debugging phases, to 4, which only displays critical errors and problems. I tend to develop at level 0 and run live servers at level 1. Disk space is cheap.
The smsc Group
Kannel supports a pretty insane number of ways of sending and receiving SMSes, ranging from SMS services over HTTP, to a fake SMS centre for testing/development purposes, to GSM modems, which is what I have used and is the smsc module. These modems use AT-style modem commands and typically hook up over the serial port. To get this going, I set up the smsc group in the smskannel.conf file:
group = smsc
smsc = at
modemtype = auto
device=/dev/ttyS0
my-number = 123123123123
connect-allow-ip = 127.0.0.1
log-level = 0
The my-number field contains the number of your GSM modem’s SIM chip. Again, I only allow connections from my local server, and the Ubuntu Linux serial port is on /dev/ttyS0.
The smsbox Group
The smsbox group helps configure the part of the system that dispatches SMSes received by the core SMS or receives SMSes before they’re sent out. I honestly don’t fully understand what this group really does, but it’s necessary, and pretty trivial to set up.
group = smsbox
bearerbox-host = 127.0.0.1
sendsms-port = 13013
global-sender = 123123123123
log-level = 0
The global-sender field is the outgoing-number of your GSM modem, which for me is the same as the my-number field above.
The Sendsms Group
This group is what allows your web applications to send SMS messages using Kannel. They do this via simple HTTP requests, and configuration here basically requires a user name and password:
group = sendsms-user
username = kanneluser
password = df89asj89I23hvcxSDasdf3298jvkjc839
concatenation= true
max-messages = 10
Since the password is semi-plain and unprotected here, I tend to use one that is complicated and nearly impossible to remember, but quite different from any other passwords that I actualy use for login accounts and the like.
Getting the Messages to your application
The sms-service group configures how Kannel gets messages to your web application. You are allowed to specify a number of these groups, each of which can “catch” incoming messages based on various criteria. My application had all messages go to one processing script, so I just set up one group that caught all incoming messages.
group = sms-service
keyword =
keyword-regex = .*
catch-all = yes
max-messages = 0
get-url = "http://localhost/sms?phone=%p&text=%a"
This particular configuration has Kannel set up to use an HTTP GET request to send the message to my application. The param phone contains the phone number of the sender and the text parameter contains their entire message.
NOTE: The max-messages value was particularly tricky and critical for me: When I first set up Kannel and tested sending messages, I would always get back '<Empty reply from service provider>'. Setting max-messages to 0 tells Kannel to never send a reply directly from the incoming message (you can, of course, initiate your own response later, of course).
Finally, Setting up the modems
Kannel and smsc tends to be pretty good at figuring out everything about your modem by yourself, but you can help them out by including modems.conf in your smskannel.conf file as I did:
include = "/usr/local/kannel/modems.conf"
Running the Server
The hard part is done; all we have to do now is copy over the config files and start the service up:
# cd /usr/local/kannel
# cp ~/src/gateway-1.4.1/smskannel.conf .
# cp ~/src/gateway-1.4.1/gw/modems.conf .
# sbin/bearerbox -v 0 smskannel.conf &
# sbin/smsbox -v 0 smskannel.conf &
I tend to run the last two commands in two separate shell windows when developing/debugging so that I can see the output from the two programs clearly and use the information to help me figure out what’s going on (level 0 really tells you a lot).
Receiving Messages
Kannel will simply call the URL you told it to in the sms-service group and you can process this with whatever HTTP server environment you want. We’re using LAMP right now, but, again, any will do. The incoming phone number and message are in GET parameters. You can, if you want, configure the sms-service to send them as POST messages as well.
Sending Messages through Kannel
The final part our puzzle is to send outgoing SMS messages through Kannel, and has only one little twist. It is also done via an HTTP interface. It requires you to be a little careful about the character set you use. I found I had the most success by using the UCS-2 character set. In PHP5, you can easily use the iconv function to do this for you.
Since I send both English and Chinese messages, my PHP scripts and langugage string files are all UTF-8. Here is the code I use to send messages:
function sendSmsMessage($in_phoneNumber, $in_msg)
{
$url = '/cgi-bin/sendsms?username=' . CONFIG_KANNEL_USER_NAME
. '&password=' . CONFIG_KANNEL_PASSWORD
. '&charset=UCS-2&coding=2'
. "&to={$in_phoneNumber}"
. '&text=' . urlencode(iconv('utf-8', 'ucs-2', $in_msg));
$results = file('http://'
. CONFIG_KANNEL_HOST . ':'
. CONFIG_KANNEL_PORT . $url);
}
To make this work, of course, you need to have allow_url_fopen set to On.
That’s It
That’s pretty much it. This has been a pretty dry article, but it does contain everything you need to get Kannel up and running and operational. The manual actually does contain everything you could possibly want to know, so keep digging in there if you’re stuck. Finally, there are mailing lists at kannel.org which tend to be quite helpful as well.
Good luck!
I'm sorry, but I don't have a good answer for your question - I have only used a small Siemens GSM modem so far, and I *DID* have some errors when I started, but by choosing the right modem from modems.conf (in fact, I didn't even need to do that - just including modems.conf was okay) all my problems went away.
If you're seeing weird problems, it might be best to go and ask the users@kannel.org mailing list ....
Good luck!
Hav been reading alot of articles and i dont want to get confused, i want to know what to do from scratch.
thanks
About your problem on Macs no longer having serial ports, you can get a USB/Serial converter. I'm using that on my Ubuntu box with Kannel, just configure device=ttyUSB0. Then you can use your OS X without problems :)
Nice article you've got here, it's been very helpful. I have a question. Will it be possible for you to give little tutor like this on how to use PHP to develop a Web Administration interface for Kannel.
so that one does not need to edit the kannel configuration code directly. Also one can be able to check/change the status of kannel via web interface.
your feedback on this will be highly appreciated.
cheers
Is there a command line I can script once set up to sent my required text ?
Do I need a GSM modem really or can it be done without ?
Any help/hints appreciated.
Nick
As for using things other than GSM modems, you most certainly can -- It's just that my experience thus far is entirely limited to GSM modems. Many people use actual cell phones as GSM modems, and others use service providers and other facilities to do the SMS work (some of them even provide their own programmable interfaces that obviate the need for kannel entirely ...).
Good luck!
im having problem using the HttpURLConnection and URL connection it always returns Server returned HTTP response code: 400 but when i paste the url through the web browser address bar, the url works.. any idea? because i already
set my tomcat rmi=to UTF-8 and set the mo-recode = true under smskannel.conf.
I am using nokia n70 as my smsc:
The status report is as shown below:
Kannel bearerbox version `1.4.1'.
Build `Oct 17 2006 02:55:06', compiler `4.1.2 20061007 (prerelease) (Debian 4.1.1-16)'.
System Linux, release 2.6.18-4-686, version #1 SMP Mon Mar 26 17:17:36 UTC 2007, machine i686.
Hostname localhost, IP 127.0.0.1.
Libxml version 2.6.26.
Using OpenSSL 0.9.8c 05 Sep 2006.
Compiled with MySQL 5.0.24a, using MySQL 5.0.32.
Using native malloc.
Status: running, uptime 0d 0h 0m 28s
WDP: received 0 (0 queued), sent 0 (0 queued)
SMS: received 0 (0 queued), sent 0 (0 queued), store size -1
SMS: inbound 0.00 msg/sec, outbound 0.00 msg/sec
DLR: 0 queued, using mysql storage
Box connections:
smsbox:(none), IP 127.0.0.1 (0 queued), (on-line 0d 0h 0m 27s)
SMSC connections:
FAKE FAKE:10001 (connecting, rcvd 0, sent 0, failed 0, queued 0 msgs)
N70 AT2[N70] (connecting, rcvd 0, sent 0, failed 0, queued 0 msgs)
- fakesmsc is working OK.
- when i try to send a test sms, i get the response "Authorization failed for sendsms".
- where could i be going wrong?
any help will be much appreciated.
Its a nice article , i come to understand major points . but i am facing some issues while configuring . If i am setting up GSM Modem with my ubuntu linux server will i am able to send SMS and how ? How to send SMS via http link ?
Can you please elaborate more on this ..you can also mail me on jhn_daz@yahoo.com . Please help me to set up it ..
Thanks ,
John
The error is:
Checking for C compiler defauult outputfile name...
Configure: Error: C compiler cannot create executables
see config.log
and I get the same error in that file.
Oh and I installing the Kannel Debian packeg.
Please help my email is nhlapoth@telkom.co.za
1) store received messages in a table in a mysql database
I read in some posts on Nabble forum that for this u need to write php scripts bt i dont have single idea how to do it...??
Regards,
wahib
I get the following error within my PHP script
"Warning: file(http://192.168.1.2:10000/cgi-bin/sendsms?username=root&password=kokodi&to=99999&text=test msg) [function.file]: failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request in D:\wamp\www\sms_trigger\incl\sms.php on line 27"
I tried file (http://192.168.1.2) and everything seemed fined. Could it be the port or the ":" ?
Please help
Thanks
can someone tell me how I send a SMS to a lot of users, located in Mysql data base, with KANNEL.
But then, I'm trying to set up a Fake SMSC and do some proof of concept work before we hook it up to a real SMSC. Both bearerbox and smsbox fail on startup, though I have tried to get the .conf correct. Searching for more answers (the 139 page Kannel Guide is a complete waste of paper), I only come across more copies of this article. Are there any other resources on Kannel (that WORK)?
i think you should give a try and have a look at "playsms". it's written in php but it's easy to understand and so you could translate it to java, it shouldn't be a big deal!
and now i have also a question (or two):
do you know how is it possible to send not only the sender's number but also a name (string) along with it? i want the receiver to see the sender's name without asking the receiver to insert the sender's details into its phonebook... hope you understand what i want to achieve!
second is, im trying to send some special characters (hungarian) like é,á,ö,ü,ó,í and theirs uppercase variants. are there any restrictions in sending them? a list? a documentation? or is it iconv('utf-8', 'ucs-2', $in_msg) all?
btw nice article, thanks for it. the internet is not full of kannel related articles :S
cheers,
b
nyasha@nyasha-laptop:~$ sbin/bearerbox -v 0 smskannel.conf &
bash: sbin/bearerbox: No such file or directory
[1] 24049
[1]+ Exit 127 sbin/bearerbox -v 0 smskannel.conf
nyasha@nyasha-laptop:~$
when i start kannel in this way it seems to start but i cant proceed. see below
nyasha@nyasha-laptop:~$ sudo /etc/init.d/kannel start
Starting WAP gateway: bearerbox wapbox smsbox.
nyasha@nyasha-laptop:~$
nyasha@nyasha-laptop:~$ smsbox
2008-11-26 15:52:18 [21712] [0] INFO: Debug_lvl = -1, log_file = <none>, log_lvl = 0
2008-11-26 15:52:18 [21712] [0] ERROR: fopen failed: couldn't open `kannel.conf'
2008-11-26 15:52:18 [21712] [0] ERROR: System error 2: No such file or directory
2008-11-26 15:52:18 [21712] [0] PANIC: Failed to load main configuration file `kannel.conf'. Aborting!
2008-11-26 15:52:18 [21712] [0] PANIC: smsbox(gw_panic+0x107) [0x80872a7]
2008-11-26 15:52:18 [21712] [0] PANIC: smsbox(cfg_read+0x4bf) [0x807579f]
2008-11-26 15:52:18 [21712] [0] PANIC: smsbox(main+0x118) [0x8054208]
2008-11-26 15:52:18 [21712] [0] PANIC: /lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe5) [0xb796c685]
2008-11-26 15:52:18 [21712] [0] PANIC: smsbox [0x8053961]
I have already implemented an application to send and receive SMS messages via SMPP connection. Now I want to use a GSM modem to send/receive messages. So could anyone show me how to archive this goal with Kannel (not change my application, that mean using SMPP connection)?
I appreciate it,
K
im thankful for this very intuitive steps on set-upping the kannel.
But i want more ;-), how can i set the DLR , delivery notification on kannel config. I am using the SMPP, can you share your tips & tricks on how-to, without using the SQLBOX module, just plain kannel cfg tweaks.
The my final step is: send a sms throught kannel to my phone with text : "hello world!!!"
What i must do?
Please help me...Thanks in advanced
i need some urgent help! i have installed an SMS-Gateway Kannel 1.4.1 on a test-server and everything is working fine, i can send sms and i can check the status of the gateway by the http command like localhost:1300/status
now i've installed the same environment on a "real-server" and i'm able to send sms but when i try to check the status over the browser, i receive an empty result. the status.html site is empty and when i try to get the status.xml file i get an error "xml error <.". Does anybody has a clue what the problem could be?
help!!
thx
Thanks
can you give me tips ;-)
im having a problem in setting up my kannel + modem ( itegno 3800 )
everything is okay in receiving sms
followed your tips from this page
works fine.
but, on the sending of msg, logs seems said to be okay.
but i didnt receive the actual msg on my phone
#bearerbox-log
2009-04-29 09:52:32 [14442] [11] DEBUG: boxc_receiver: sms received
2009-04-29 09:52:32 [14442] [11] DEBUG: send_msg: sending msg to box: <127.0.0.1>
2009-04-29 09:52:33 [14442] [6] DEBUG: AT2[wavecom]: TP-Validity-Period: 24.0 hours
2009-04-29 09:52:33 [14442] [6] DEBUG: AT2[wavecom]: --> AT+CMGS=18^M
2009-04-29 09:52:33 [14442] [6] DEBUG: AT2[wavecom]: <--
2009-04-29 09:52:33 [14442] [6] DEBUG: AT2[wavecom]: <-- >
2009-04-29 09:52:33 [14442] [6] DEBUG: AT2[wavecom]: send command status: 1
2009-04-29 09:52:33 [14442] [6] DEBUG: AT2[wavecom]: --> 0011000A9156187509850000A705E8329BFD06
2009-04-29 09:52:33 [14442] [6] DEBUG: AT2[wavecom]: --> ^Z
2009-04-29 09:52:54 [14442] [6] DEBUG: AT2[wavecom]: send command status: -1
2009-04-29 09:52:54 [14442] [6] DEBUG: AT2[wavecom]: --> AT+CMGS=18^M
2009-04-29 09:52:54 [14442] [6] DEBUG: AT2[wavecom]: <--
2009-04-29 09:52:54 [14442] [6] DEBUG: AT2[wavecom]: <-- OK
2009-04-29 09:52:54 [14442] [6] DEBUG: AT2[wavecom]: send command status: 0
@smsbox-log
2009-04-29 09:52:32 [14454] [3] INFO: smsbox: Got HTTP request </cgi-bin/sendsms> from <127.0.0.1>
2009-04-29 09:52:32 [14454] [3] INFO: sendsms used by <tester>
2009-04-29 09:52:32 [14454] [3] INFO: sendsms sender:<tester:+6598540029> (127.0.0.1) to:<+6581579058> msg:<hello>
hope you can help me
thanks,
mark
I am having probleam installing installing Kannel 1.4.3 in Debian..., did you has been install kennel in Debian.., somebody has some idea about it, could you help me with some tips.
In the User guide only explaind how to install in debian the 1.4.1 version, but I was thinking install the last verison, but this is not in the distribution packet Debian.
Thanks in advance..
Luis
Other countries will be different. I bet many (most) countries will not support them and mangle them.
i m thankful for this very intuitive steps on set-upping the kannel.
But i want more ;-), how can i set the DLR , delivery notification on kannel config. I am using the SMPP, can you share your tips & tricks on how-to, without using the SQLBOX module.
I'll will create a HowTo section...for this.Soon will post a link here... thanks for the help.
Rgds
JoeEd
But with this tutorial we are able to get it rolling.
Thanks again for the tips
It is easy to read the reply message. You only have to use a script such as php to get the passed information. If you set the following sms-service as,
get-url = "http://localhost/sms.php?phone=%p&text=%a"
you can easily run a php script @ localhost and get the values of phone and text. (you can use most of the languages. not only php)
I need your help too. What type of a modem did you used? I'm new in Linux environment and I'm struggling to find Linux drivers for GSM phones. Do i need drivers with Linux.
I allready installed Kannel.
Sending messages is OK.
My question is about incomming messages.
Each time I receive a new message on kannel from a phone, Kannel automatically respond with a message defined in sms-service.
How can I block this sending or cancel it ?
I just want receive messages but not sending automcatically response.
Thank you for your help.
@Fred - I had the same problem after running
sudo apt-get install libxml2
So I just did:
sudo apt-get install libxml2*
which may have been overkill, but Kannel is installed now. Tomorrow I'll work on the configuration files.
I installed kannel and web server in the same PC. I need some help for kannel configuration part. I am using ADSL line(Broadband/phone) with Siemens SL2_ 141 as modem. I am little confused about smsc group values that will have for my modem configuration.
Is my modem is same as that GSM ? If not then what are the alternative options?
This part i need to filled up->
*******************************
#group = smsc
#smsc = at
#modemtype = auto
#device=/dev/ttyS0
#my-number = 123123123123
#connect-allow-ip = 127.0.0.1
#log-level = 0
*******************************
Also i got the following configuration in http://forums.devshed.com/mobile-programming-20/how-to-send-sms-with-kannel-399149.html
*******************************
#The SMSC as modem configuration
group = smsc
smsc = at
modemtype = auto
device = /dev/ttyS1
speed = 9600
pin = 1111
sms-center = 0926655820088
#The MODEM group configuration
group = modems
id = wavecom
name = Wavecom
speed = 9600
no-pin = false
init-string = "ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0"
detect-string = "WAVECOM"
detect-string2 = "MODEM"
*************************************
Can anyone plz. help me out for the above configuration?
Thanks in advance
Dav
Thanks for all your help.
i am now compiling kannel “gateway-1.4.3″
every thing is OK with ./configure like bellow:
sh ./configure –prefix=/usr/kannelnew –with-mysql –with-mysql-dir=/usr/include/mysql
but “sudo make” gives an error at the end of compiling:
……………………………
/bin/bash: ./utils/foobar-config.sh : permission denied
make: *** [gw-config] Error 126
……………………………
i dont know why this error occurs, i install all kannel Requirements.
what i miss here??
plz help
thnx
Our software using GSM modem to send out message, coz local network doesn't support SMTP outgoing port(25) that's via we are using GSM modem. Now when local network internet is down why GSM modem can not send out the sms message?? GSM modem it self have radio wave to sending out and receiving, why it's still depend on local network? Can you help me to clear this confusion?
Best Regards,
Rajesh
I am very happy with the article but I cannot recieve sms. I can send sms using your code, but when i send sms to my connected phone, which sends sms fine through kannel but doesnt recieve, below is my configuration, can any one help please?
group = sms-service
keyword-regex = .*
catch-all = yes
max-messages = 0
get-url = "http://localhost/getsms?from=%p"
pravesh24in@yahoo.com
i tried it in Fedora with huawei 220E modem - in here i was able to run bearbox successfully but when i run the smsbox there was following error
[0] ERROR: System error 111: Connection refused
ERROR: error connecting to server
`127.0.0.1' at port `13001'
[0] PANIC: Couldn't connect to the bearerbox.
plz can anyone help with this issu
when i try to send a sms using following command the command line get stucked
lynx -dump "http://127.0.0.1:13012/cgi-bin/sendsms?username=kan&password=abc&to=0776995106&text=text"
I can see the port 13012 is listning in the machine.
heare is my kannel.conf
+++++++++++++++++++++++++++++++
box-allow-ip = "127.0.0.1"
group = smsbox
bearerbox-host = 127.0.0.1
sendsms-port = 13012
#SMS CENTER NUMBER
global-sender=094077000003
log-level = 0
group = smsc
smsc = at
modemtype = auto
device=/dev/ttyUSB0
my-number =+0940776995106
connect-allow-ip = 127.0.0.1
#sms center
sms-center=094077000003
log-level = 0
group = sendsms-user
username = kan
password = abc
concatenation= true
max-messages = 0
group = sms-service
keyword =default
catch-all = yes
max-messages = 10
get-url = http://localhost/sms/inc/getsms.php?user=john&passwd=1234&mobile=%p&text=%a
+++++++++++++++++++++++++++++++++
i dont get any error in my log
This is my log
++++++++++++++++++++++++++++++++++++++++++++=
10-03-06 07:44:15 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: detecting modem speed.
2010-03-06 07:44:15 [990] [6] INFO: AT2[/dev/ttyUSB0]: opening device
2010-03-06 07:44:15 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: device opened. Telnet mode = 0
2010-03-06 07:44:16 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: device opened
2010-03-06 07:44:16 [990] [6] INFO: AT2[/dev/ttyUSB0]: speed set to 115200
2010-03-06 07:44:16 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: --> ^M
2010-03-06 07:44:18 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: --> AT^M
2010-03-06 07:44:18 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: <-- AT
2010-03-06 07:44:18 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: <-- OK
2010-03-06 07:44:18 [990] [6] INFO: AT2[/dev/ttyUSB0]: Closing device
2010-03-06 07:44:18 [990] [6] INFO: AT2[/dev/ttyUSB0]: detect speed is 115200
2010-03-06 07:44:18 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: detecting modem type
2010-03-06 07:44:18 [990] [6] INFO: AT2[/dev/ttyUSB0]: opening device
2010-03-06 07:44:18 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: device opened. Telnet mode = 0
2010-03-06 07:44:19 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: device opened
2010-03-06 07:44:19 [990] [6] INFO: AT2[/dev/ttyUSB0]: speed set to 115200
2010-03-06 07:44:19 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: --> ^M
2010-03-06 07:44:21 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: --> AT^M
2010-03-06 07:44:21 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: <-- AT
2010-03-06 07:44:21 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: <-- OK
2010-03-06 07:44:21 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: --> AT&F^M
2010-03-06 07:44:21 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: <-- AT&F
2010-03-06 07:44:21 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: <-- OK
2010-03-06 07:44:21 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: --> ATE0^M
2010-03-06 07:44:21 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: <-- ATE0
2010-03-06 07:44:21 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: <-- OK
2010-03-06 07:44:21 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: --> ATI^M
2010-03-06 07:44:21 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: <-- Manufacturer: huawei
2010-03-06 07:44:21 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: <-- Model: E220
2010-03-06 07:44:21 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: <-- Revision: 11.117.10.00.00
2010-03-06 07:44:21 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: <-- IMEI: 354137027933854
2010-03-06 07:44:21 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: <-- +GCAP: +CGSM,+DS,+ES
2010-03-06 07:44:21 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: <-- OK
2010-03-06 07:44:21 [990] [6] DEBUG: Loading include file `/etc/kannel/modems.conf' (on line 2 of file /etc/kannel/kannel.conf).
2010-03-06 07:44:21 [990] [6] DEBUG: Loading include file `/etc/kannel/modems.conf' (on line 2 of file /etc/kannel/kannel.conf).
2010-03-06 07:44:21 [990] [6] DEBUG: Loading include file `/etc/kannel/modems.conf' (on line 2 of file /etc/kannel/kannel.conf).
2010-03-06 07:44:21 [990] [6] DEBUG: Loading include file `/etc/kannel/modems.conf' (on line 2 of file /etc/kannel/kannel.conf).
2010-03-06 07:44:21 [990] [6] DEBUG: Loading include file `/etc/kannel/modems.conf' (on line 2 of file /etc/kannel/kannel.conf).
2010-03-06 07:44:21 [990] [6] DEBUG: Loading include file `/etc/kannel/modems.conf' (on line 2 of file /etc/kannel/kannel.conf).
2010-03-06 07:44:21 [990] [6] DEBUG: Loading include file `/etc/kannel/modems.conf' (on line 2 of file /etc/kannel/kannel.conf).
2010-03-06 07:44:21 [990] [6] DEBUG: Loading include file `/etc/kannel/modems.conf' (on line 2 of file /etc/kannel/kannel.conf).
2010-03-06 07:44:21 [990] [6] DEBUG: Loading include file `/etc/kannel/modems.conf' (on line 2 of file /etc/kannel/kannel.conf).
2010-03-06 07:44:21 [990] [6] DEBUG: Loading include file `/etc/kannel/modems.conf' (on line 2 of file /etc/kannel/kannel.conf).
2010-03-06 07:44:21 [990] [6] DEBUG: Loading include file `/etc/kannel/modems.conf' (on line 2 of file /etc/kannel/kannel.conf).
2010-03-06 07:44:21 [990] [6] DEBUG: Loading include file `/etc/kannel/modems.conf' (on line 2 of file /etc/kannel/kannel.conf).
2010-03-06 07:44:21 [990] [6] DEBUG: Loading include file `/etc/kannel/modems.conf' (on line 2 of file /etc/kannel/kannel.conf).
2010-03-06 07:44:21 [990] [6] DEBUG: Loading include file `/etc/kannel/modems.conf' (on line 2 of file /etc/kannel/kannel.conf).
2010-03-06 07:44:21 [990] [6] DEBUG: Loading include file `/etc/kannel/modems.conf' (on line 2 of file /etc/kannel/kannel.conf).
2010-03-06 07:44:21 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: Cannot detect modem, using generic
2010-03-06 07:44:21 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: Reading modem definitions from </etc/kannel/kannel.conf>
2010-03-06 07:44:21 [990] [6] DEBUG: Loading include file `/etc/kannel/modems.conf' (on line 2 of file /etc/kannel/kannel.conf).
2010-03-06 07:44:21 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: Found <14> modems in config
2010-03-06 07:44:21 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: --> AT+CSMS=?^M
2010-03-06 07:44:21 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: <-- +CSMS: (0-1)
2010-03-06 07:44:21 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: <-- OK
2010-03-06 07:44:21 [990] [6] INFO: AT2[/dev/ttyUSB0]: Closing device
2010-03-06 07:44:21 [990] [6] INFO: AT2[/dev/ttyUSB0]: opening device
2010-03-06 07:44:21 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: device opened. Telnet mode = 0
2010-03-06 07:44:21 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: device opened
2010-03-06 07:44:21 [990] [6] INFO: AT2[/dev/ttyUSB0]: Logging in
2010-03-06 07:44:22 [990] [6] INFO: AT2[/dev/ttyUSB0]: init device
2010-03-06 07:44:22 [990] [6] INFO: AT2[/dev/ttyUSB0]: speed set to 115200
2010-03-06 07:44:22 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: --> ATZ^M
2010-03-06 07:44:22 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: <-- OK
2010-03-06 07:44:22 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: --> AT^M
2010-03-06 07:44:22 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: <-- AT
2010-03-06 07:44:22 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: <-- OK
2010-03-06 07:44:22 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: --> AT&F^M
2010-03-06 07:44:22 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: <-- AT&F
2010-03-06 07:44:22 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: <-- OK
2010-03-06 07:44:22 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: --> ATE0^M
2010-03-06 07:44:22 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: <-- ATE0
2010-03-06 07:44:22 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: <-- OK
2010-03-06 07:44:22 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: --> AT+IFC=2,2^M
2010-03-06 07:44:22 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: <-- OK
2010-03-06 07:44:22 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: --> AT+CPIN?^M
2010-03-06 07:44:22 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: <-- +CPIN: READY
2010-03-06 07:44:22 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: <-- OK
2010-03-06 07:44:22 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: --> AT+CSCA="094077000003"^M
2010-03-06 07:44:22 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: <-- OK
2010-03-06 07:44:22 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: --> AT+CMGF=0^M
2010-03-06 07:44:23 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: <-- OK
2010-03-06 07:44:23 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: --> AT+CSMS=?^M
2010-03-06 07:44:23 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: <-- +CSMS: (0-1)
2010-03-06 07:44:23 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: <-- OK
2010-03-06 07:44:23 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: --> AT+CNMI=1,2,0,1,0^M
2010-03-06 07:44:23 [990] [6] DEBUG: AT2[/dev/ttyUSB0]: <-- OK
2010-03-06 07:44:23 [990] [6] INFO: AT2[/dev/ttyUSB0]: AT SMSC successfully opened.
++++++++++++++++++++++++++++++++++++++++++++
What could be the reason? Thanks in advance :)
I have configured and successfully and sent sms using my huawei E156 modem,
But the problem is with recieving messages . I donnow what the case is , the message is pending.ie, not being delivered to the modem.
my sms service configuration is :
group = sms-service
keyword = default
get-url = "http://127.0.0.1/sms.php?phone=%p&text=%a"
catch-all = true
max-messages = 0
any one got idea how I can recieve messages? and get it to the sms.php. I have written the script also , but not working.
Any suggestions please give in full detail .I will really appreciate it.
ntmsajith@gmail.com
sajith(UOP)
Kandy, Sri lanka.
I am using Kannel 1.4.3 on windows. I am using my GSM phone(9810689924) as
modem. smskannel.conf file which is used to run bearerbox and smsbox is also
attached.
When I try an dsend sms using following url :
http://100.1.1.15:13015/cgi-bin/sendsms?username=test&password=test&to=9899796363&from=9810689924&text=tcs
I get a "sent" response but the sms is delivered to the from number i.e
9810689924
I checked access.log and I could see following :
2010-05-20 16:06:55 Receive SMS [SMSC:HTTP] [SVC:test] [ACT:] [BINF:] [FID:]
[from:9810689924] [to:9899796363] [flags:-1:-1:-1:-1:-1] [msg:3:tcs]
[udh:0:]
2010-05-20 16:06:55 SMS request sender:9810689924 request: 'tcs' fixed
answer: ' testing again : Please let me know if you get this message
:Tarun'
2010-05-20 16:07:03 Sent SMS [SMSC:E62] [SVC:] [ACT:] [BINF:] [FID:]
[from:9810689924] [to:9810689924] [flags:-1:0:-1:-1:-1] [msg:66:testing
again : Please let me know if you get this message :Tarun] [udh:0:]
If you see in first log line...from and to numbers are correct but in the
third/last line above i do know how the from and to number have become equal
or same.
Please help!!
My Conf File:
#
#
# This works with the default binary Kannel distribution for cygwin
#
# It is run like this from the cygwin shell -
#
# 1% bin/bearerbox smskannel.conf
# 2% bin/smsbox smskannel.conf
# 3% test/fakesmsc -p 10000 -H localhost -i 1 -m 100 "123 345 text nop"
#
# ..all 3 commands in separate shells (or screen sessions)
#
# The binaries bearerbox, smsbox, fakemsc are located in the default kannel
distro
#
# For any modifications to this file, see Kannel User Guide
# If that does not help, send email to users@xxxxxxxxxx
#
# Kalle Marjola May 2000
# Changed for new fakesmsc version by Uoti Urpala Jan 2001
# Added service and sendsms for HTTP SMSC by Kalle Marjola Mar 2001
#
group = core
admin-port = 13000
smsbox-port = 13001
admin-password = bar
#admin-deny-ip = ""
#admin-allow-ip = ""
log-file = "/tmp/kannel.log"
log-level = 2
box-deny-ip = "*.*.*.*"
box-allow-ip = "127.0.0.1"
unified-prefix = "00358,0"
access-log = "/tmp/access.log"
#store-file = "kannel.store"
#ssl-certkey-file = "mycertandprivkeyfile.pem"
# SMSC CONNECTIONS
#group = smsc
#smsc = fake
#smsc-id = FAKE
#port = 10000
#host=localhost
#connect-allow-ip = 127.0.0.1
group = smsc
smsc = at
smsc-id = E62
modemtype = nokiaphone
device = /dev/com7
connect-allow-ip = 127.0.0.1
log-level = 2
speed = 460800
log-file = "/tmp/e62.log"
group = smsc
smsc = http
smsc-id = HTTP
system-type = kannel
smsc-username = test
smsc-password =test
port = 13015
send-url = "http://100.1.1.15:13015/cgi-bin/sendsms"
connect-allow-ip = "*.*.*.*"
log-level = 2
device = /dev/com7
log-file = "/tmp/http.log"
# SMSBOX SETUP
group = smsbox
#smsbox-id = abc
bearerbox-host = 100.1.1.15
sendsms-port = 13013
global-sender = 9810689924
#endsms-chars = "0123456789 +-"
#log-file = "/tmp/smsbox.log"
log-level = 2
access-log = "access.log"
sendsms-url = /cgi-bin/sendsms
log-file = "abc.log"
# SEND-SMS USERS
group = sendsms-user
username = tester
password = foobar
#user-deny-ip = ""
user-allow-ip = "*.*.*.*"
# this sender is for Kannel relay testing (http_smsc)
group = sendsms-user
username = kannel
password = rL4y
user-deny-ip = "*.*.*.*"
user-allow-ip = "*.*.*.*"
#
# The services should go in a separate file to make it easier for
development
#
# SERVICES
group = sms-service
keyword = tcs
text = "testing again : Please let me know if you get this message :Tarun"
# this service is for Kannel relay testing, when this Kannel
# works as relay gateway
group = sms-service
keyword = relay
get-url =
"http://localhost:15130/sms?user=kannel&pass=rL4y&from=%p&to=%P&text=%r";
max-messages = 0
#
# Skava test service
#
group = sms-service
keyword = hello
text = "Hello world there!"
# there should be default always
group = sms-service
keyword = default
text = "No service specified"
exec = /kannel_incoming %t %q %a
#
# modems.conf, again should be a different file and included as
# include = "/path/to/modems.conf"
#
# Modems configuration
#
# Example and default values
#
group = modems
id = nokiaphone
name = "Nokia Phone"
detect-string = "Nokia Mobile Phone"
detect-string2 = "E61i"
need-sleep = true
keepalive-cmd = "AT+CBC;+CSQ"
#init-string = "AT Q0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
init-string = "AT"
#enable-mms = true
I also need to receive SMS through the Huwawei Modem in GSM mode and process it and then reply the sender with fetched data from the database!
I am using PHP and I have to process the SMS sin PHP,dont I? SSo how can I use this to accomplish my task....I mean how to access the received SMS to Kannel and when sending the reply!So can please someone help me!
Each feedback is greatly appreciated!
Mithila KArunarathne
first of all i appologise if u got disturbed by my pvt message.i got your email id from a kannel forum. i am just a beginner in kannel, n lokking for ur suport and guidance.ill be really thankful 2 u for ur kind support n guidance.
i want to make a sms server came to know about kannel.
i want that i sould make a sms server n sell some sms account to clients suppose i purchased 10,0000 sms from any caarrier which cost me 100 USD,
now ill configure those 10,0000 sms accounts in kannel and sell it to client according to their need like Client A needs 5000 sms package, Client B need 50,000 sms package. so i have to give a http path and make user name and password of client, how to do that.
On which os i should install kannel fedora,cnetos,rhel
plz guide me what are the important things to know. i heard that api will be nedded which will communicate between server and client. can i make api on python. friends may be i am not that much clear in asking question, but if u guys understand my requirement than plz guide me from the beginning.
thx
The problem was that the UDHL was missing. I should have added "06" at the beginning (there are 6 octets in "05040E06FDE8"). When I use "X-Kannel-UDH: 0605040E06FDE8" it all works fine.
For some reason I thought kannel adds this by itself (not very difficult...), but now I know it doesn't...
Thanks for the effort.



It is a simple, but illustrative article.
I am trying to use a mobile telephone nokia shape 3250, as modem for the service SMS, but on having executed smsbox, this part send the command AT+CNMI=1,2,0,1,0 and the telephone answers with "EROR". Might you say to me please that I am doing badly?
Other one asks, some guide of user exists of kannel better explain of the own one of kannel?
Thanks and regards
I wait for your response,please!!!!