This is the relevant configuration part of the kannel.conf file;
group = sms-service
keyword = default
#keyword-regex = .*
catch-all = yes
max-messages = 0
get-url = "http://localhost:23456/sms.php?ORIGINATOR=%p&RECEIVER=%P&SMS=%a&SOURCE_PRV=%o"
At local host (same as where i run my kannel server) i have this code in the file sms.php;
$query = "insert into sms set sender='".$_GET["ORIGINATOR"]."', receiver='".$_GET["RECEIVER"]."', msg='".$_GET["SMS"]."', source_prv='".$_GET["SOURCE_PRV"]."'";
$result = mysql_query($query);
if(!$result) die(sql_error());
Make sure that you have defined your database connectivity parameters before this code. What kannel does is just he receive a SMS it calls the URL defined as the get-url in the .conf file. And passing the parameters in GET method. Now you are able to receive and save a SMS through kannel.
Hello, thanks for this. However I'm having a bit of trouble. Can you help me?
ReplyDeleteThanks
Sure if it is something I can help you...
ReplyDeleteplz tell me in sms service group how can i use keyword-regex for sending my keyword with my desired message e-g my key is
DeleteWIKI Q1: how we achieve data encapsulation?
how i can set it in keyword-regex .
hello., can i ask something? how will i define my database? i did a database using user guide in kannel. it goes like this.
ReplyDeletegroup = mysql-connection
id = mydlr
host = localhost
username = root
password = passw0rd
database = db_kannel
max-connections = 1
group = dlr-db
id = mydlr
table = tbl_dlr
field-smsc = smsc
field-timestamp = timestamp
field-destination = destination
field-source = source
field-service = service
field-url = url
field-mask = mask
field-status = status
field-boxc-id = boxc
is this correct?
You mean the database for saving the message?
Deleteyes., how will i define it?
DeleteDefining the database is a PHP work. Please refer some online tutorials for database connectivity according to your DB (mysql, mssql, etc..) .
DeleteFor kannel it need only four columns... sender, receiver, message and source_prv. Message date, time can be defined if want. They are simply just PHP coding.
And somebody had asked me about message filtering. Do it in PHP level. I don’t think you can do it in kannel.
plz tell what is localhost:23456 ? is this phpmyadmin port adress?
ReplyDeletei also want send msg what will be php code
Where you are using this port? at kannel? Phpmyadmin just runes on the normal web port (80 for http 443 for https)
DeleteIf this is something related to your sms gateway, at your kannel.conf file you can define the port number which you will be using to communicate with kannel.
And here is the sample php code that you can send sms through kannel
file_get_contents('http://127.0.0.1:13013/cgi-bin/sendsms?username=yourkannelusername&password=yourkannelpw&to='.$phone_num.'&text=your+text+here');
127.0.0.1 is just localhost.(Apache and Kannel both running on the same server.)
13013 is the default port for kannel
Refer this too on your port issue,
Deletehttp://www.speedguide.net/port.php?port=23456
thanks but i need little help sir.
ReplyDeleteSir i have face problem when implement MO type message .
ReplyDeletehow receive message in to my application from mobile.
I understand the kennele configuration but in get-url there are some parameters these parameter how to get the url.
Is this process use SMPP or HTPP .
and how I send sms from mobile to port and also how I test it.
You must connect your sim card through an interface (in my case I use an USB dongle). It will do the modem part for you. Then what kannel will do is access it same like you read your smses through your computer by connecting your mobile phone and put it to your database. So then you dont have to worry about the protocol, your modem or the dongle will take care of it. :)
DeleteThis is one of the best tutorials I have come across the internet on setting up kannel. Thanks a lot. Can you write a sample code about recieving sms into mysql database. It will be very helpful
ReplyDeletehello sir...i just want to ask if there's another way how can i save the received message continuously??i mean every time i text the system the kannel will automatically save the message in the database...
ReplyDeleteYes.. you dont have to implement any other thing. This process is automated. Every time kannel receives a message, it will call the URL automatically. So then you must be able to write a PHP code to get the parameters from GET method and write it to the mysql (or whatever) database.
DeleteHello Suhada! Amazing article you have here, very helpful. I have this little problem hope you can help. Not sure what's the problem, so please refer to the config-group
ReplyDeletegroup = sms-service
# keyword = default
# keyword-regex = .*
get-url="http://admin.kannel.com/index.php?c=sms&m=receive&from=%p&to=%P&text=%a&rtime=%t"
catch-all = true
max-messages = 0
concatenation = true
When you receive a SMS Kannel will call the URL in get-url. So it should be your own page with the coding to retrieve the message and save on DB, file etc..
ReplyDeleteHello sir , i got cms error 321 "memory out of index " ,cant access the message. please can you help me on this.
ReplyDeleteCMS errors are from your modem, not from your Kannel GW. Please refer below guide,
Deletehttp://www.ozekisms.com/index.php?owpn=380
You may try changing your modem or addressing the issue by referring to the vendor manual.
Thanks Sir.
DeleteThis comment has been removed by the author.
ReplyDeleteHi Suhada, is it possible to do this for a symbian OS phone e.g. a Nokia X2 phone?
ReplyDeleteI've got an SMSC, SMSC simulator and a Kennel being set up. I'm now able to send a message as an http request from my Java program to the SMSC. What I want to know is that, how can I receive an sms from SMSC, in Kennel?
ReplyDeleteForgot to mention in the above post, I don't need to save anything in my db. How can I check a message has been received in Kennel (from SMSC) ?
DeleteBonjour j'ai un souci avec kannel l'orque j'envoie le mot à partir de mon téléphone kannel ne me retourne rien
ReplyDeleteBonjour j'ai un souci avec kannel l'orque j'envoie le mot à partir de mon téléphone kannel ne me retourne rien
ReplyDeleteThanks for sharing.
ReplyDeletesms api php