November 3rd, 2006, 07:55 PM
-
How to send SMS with Kannel
I have configured sms kannel in the following manner, but I can't send any sms. I tried to use the sendsms.php script that comes with kannel but I just cant get any messages sent. What am I doin wrong? How can I actually send sms messages now that my kannel is up and running?
#The CORE group configuration
group = core
admin-port = 13000
smsbox-port = 13001
admin-password = bar
status-password = foo
#The SMSBOX configuration
group = smsbox
bearerbox-host = 192.168.9.50
sendsms-port = 13013
sendsms-port-ssl = true
log-file = "motapa.log"
access-log = "motapa.accesss"
#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"
November 3rd, 2006, 07:58 PM
-
Hi motapa, welcome to Dev Shed.
Please use a more descriptive subject line in future (I have edited it).
It doesn't help anyone searching for a solution to similar problems.
As to your problem, check your log files to see what is happening?
Do you get any errors with sendsms.php?
Cheers,
Jamie
>_ My Music Blog | Losing weight @notsoheavyblog | My Tweets
__________________
Let the might of your compassion arise to bring a quick end
to the flowing stream of the blood and tears .....
Please hear my anguished words of truth.
__________________
November 4th, 2006, 04:53 PM
-
I've looked into my log files and its contents are the same as the outputs I get when running the boxes. I tried looking at the output of the running boxes when I send an sms and there was no change in the outputs.
Could this be because the php script is not correctly corrected to kannel. I tried copying the ".inc" file into the same folder as the php script and nothing still happens.
November 6th, 2006, 12:25 AM
-
Originally Posted by motapa
I've looked into my log files and its contents are the same as the outputs I get when running the boxes. I tried looking at the output of the running boxes when I send an sms and there was no change in the outputs.
Could this be because the php script is not correctly corrected to kannel. I tried copying the ".inc" file into the same folder as the php script and nothing still happens.
hey motapa,would u mind sending the exact php scipt u r using so that i can see how and where ur problem might be! i might help u from there.
but again i just would like to know what OS u r using,webserver,php version...it will help help you.
November 6th, 2006, 07:41 AM
-
I am using Fedora core 4 box, with Apache 2.0.54 as my web server.
This is my sendsms.php script.
<html>
<head>
<title>SMS Message Sender</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<?php
include("config.inc");
include("functions.inc");
if ($submit)
{
echo "Sending the SMS Text message <b>\"$text\"</b> to the phone <b>$to</b>...<br>\n";
$URL = "/cgi-bin/sendsms?username=".USERNAME."&password=".PASSWORD."&from=".GLOBAL_SENDER."&to=$to&text=".urlencode($ text);
http_send($URL,13013);
echo "<address><a href=\"$PHP_SELF\">Back to Send SMS</a></address>\n";
} else {
?>
<h1>SMS Message Sender</h1>
<form name="sendsms" method="post" action="<?php echo "$PHP_SELF" ?>">
<p>
Telephone number:
<br>
<input type="text" size="30" name="to">
</p>
<p>
Message:
<br>
<textarea cols="20" rows="5" name="text"></textarea>
</p>
<input type="submit" value="Send Message" name="submit">
<input type="reset" value="Reset">
<br>
</form>
<?php
}
?>
<p>
</p>
<hr>
<table border="0" width="100%">
<tr>
<td width="50%"><address><a href="index.php">Back to admin</a></address></td>
<td width="50%" align="right"><address>Visit the Kannel homepage at <a href="(URL address blocked: See forums rules)">(URL address blocked: See forums rules)</a>.</address></td>
</tr>
</table>
</body>
</html>
and this is my sendsms script is my python script referenced by the php script.
HOST = localhost
PORT = 13013
USERNAME = "tester"
PASSWORD = "foobar"
NUMBERS = "~/.sendsms.dat"
def is_a_phone_number(str):
if not str:
return 0
for c in str:
if not c in "0123456789+- ":
return 0
return 1
def recipient(arg):
if is_a_phone_number(arg):
return arg
f = open(os.path.expanduser(NUMBERS), "r")
arg = string.lower(arg)
number = None
for line in f.readlines():
parts = string.split(line)
if len(parts) == 2 and string.lower(parts[0]) == arg:
number = parts[1]
break
f.close()
if number:
return number
print "Unknown recipient", arg
sys.exit(1)
def sendsms():
to = urllib.quote_plus(recipient(sys.argv[1]))
text = urllib.quote_plus(string.join(sys.argv[2:], " "))
url="http://%s:%d/cgi-bin/sendsms?username=%s&password=%s&to=%s&text=%s" \
% (HOST, PORT, USERNAME, PASSWORD, to, text)
f = urllib.urlopen(url)
print f.read()
f.close()
if __name__ == "__main__":
sendsms()
December 14th, 2006, 01:56 AM
-
I have done more home work and can now connect to my kannel. The only problem now is that when I try to send a sms it gives me a "Unknown Request" message. How can I overcome this.
January 13th, 2007, 12:26 AM
-
Originally Posted by mckay
I am using Fedora core 4 box, with Apache 2.0.54 as my web server.
This is my sendsms.php script.
<html>
<head>
<title>SMS Message Sender</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<?php
include("config.inc");
include("functions.inc");
if ($submit)
{
echo "Sending the SMS Text message <b>\"$text\"</b> to the phone <b>$to</b>...<br>\n";
$URL = "/cgi-bin/sendsms?username=".USERNAME."&password=".PASSWORD."&from=".GLOBAL_SENDER."&to=$to&text=".urlencode($ text);
http_send($URL,13013);
echo "<address><a href=\"$PHP_SELF\">Back to Send SMS</a></address>\n";
} else {
?>
<h1>SMS Message Sender</h1>
<form name="sendsms" method="post" action="<?php echo "$PHP_SELF" ?>">
<p>
Telephone number:
<br>
<input type="text" size="30" name="to">
</p>
<p>
Message:
<br>
<textarea cols="20" rows="5" name="text"></textarea>
</p>
<input type="submit" value="Send Message" name="submit">
<input type="reset" value="Reset">
<br>
</form>
<?php
}
?>
<p>
</p>
<hr>
<table border="0" width="100%">
<tr>
<td width="50%"><address><a href="index.php">Back to admin</a></address></td>
<td width="50%" align="right"><address>Visit the Kannel homepage at <a href="(URL address blocked: See forums rules)">(URL address blocked: See forums rules)</a>.</address></td>
</tr>
</table>
</body>
</html>
and this is my sendsms script is my python script referenced by the php script.
HOST = localhost
PORT = 13013
USERNAME = "tester"
PASSWORD = "foobar"
NUMBERS = "~/.sendsms.dat"
def is_a_phone_number(str):
if not str:
return 0
for c in str:
if not c in "0123456789+- ":
return 0
return 1
def recipient(arg):
if is_a_phone_number(arg):
return arg
f = open(os.path.expanduser(NUMBERS), "r")
arg = string.lower(arg)
number = None
for line in f.readlines():
parts = string.split(line)
if len(parts) == 2 and string.lower(parts[0]) == arg:
number = parts[1]
break
f.close()
if number:
return number
print "Unknown recipient", arg
sys.exit(1)
def sendsms():
to = urllib.quote_plus(recipient(sys.argv[1]))
text = urllib.quote_plus(string.join(sys.argv[2:], " "))
url="http://%s:%d/cgi-bin/sendsms?username=%s&password=%s&to=%s&text=%s" \
% (HOST, PORT, USERNAME, PASSWORD, to, text)
f = urllib.urlopen(url)
print f.read()
f.close()
if __name__ == "__main__":
sendsms()
Hello,
I am at previous stage than this. Can you please help me in how to create these scripts with what extensions? What is the default locations for these script files?
and how is sendsms.php using the python script? where is it placed?
January 13th, 2007, 01:13 AM
-
I need to enable content providing service on a keyword
Hello ppl,
can anybody tell me how should I use a keyword enabled content providing service? According to me I would have to add a sms-service group to kannel.conf with get-url as the depending upon keyword.
How should I create a cgi script for that?
January 14th, 2007, 02:38 PM
-
Re:
Originally Posted by vijay_pict
Hello ppl,
can anybody tell me how should I use a keyword enabled content providing service? According to me I would have to add a sms-service group to kannel.conf with get-url as the depending upon keyword.
How should I create a cgi script for that?
Right you are. you have to add a sms-service group to your script. The service you provide can either be from a web page in which case you have to specif the get-url, or just url. Or it can be plain text,then you have to have a line like "text = <Your service here>", or the service could be to fetch content from a file then you'd need to add "file = <your filename and path here>".
And you do not need a script for that, the ".../cgi-bin/sendsms" is not necessarily a script. It is just a tag, kinda like 'status' and 'shutdown' and 'restart'.
Try using the alligata server manual along with the kannel manual. It helped fill the spaces that the kannel user guide left in my case.
January 15th, 2007, 07:07 AM
-
Thanks
Thank you very much motapa.
i'll need your help for my further work. thank you
January 15th, 2007, 08:49 AM
-
3: Queued for later
3: Queued or later delivery
Description of above response by kannel:
The message has been accepted and is delivered onward to a SMSC driver. Note that this status does not ensure that the intended recipient receives the
message.
How can I resolve this problem
I tried many things.
Added
my-number = < no. of SIM inserted>
smsc-center = < my smsc no. of above SIM> to kannel .conf
Is that right?
my modem is SIEMENS TC35
I am connecting it with USB to pc and RS232 to modem
is there any prob. of device-type?
I've tried it with ttyS0 and ttyUSB0
but didnt work. I dont know why.
My kannel.conf is:
group = core
admin-port = 13000
smsbox-port = 13001
admin-password = mobile
#status-password = mobile
#admin-deny-ip = ""
#admin-allow-ip = ""
log-file = "/tmp/kannel.log"
log-level = 10
box-deny-ip = "*.*.*.*"
box-allow-ip = "127.0.0.1"
#box-allow-ip = "125.27.156.250"
#box-allow-ip = "135.27.153.123"
#unified-prefix = "+358,00358,0;+,00"
access-log = "/tmp/access.log"
store-file = "/tmp/kannel.store"
#ssl-server-cert-file = "cert.pem"
#ssl-server-key-file = "key.pem"
#ssl-certkey-file = "mycertandprivkeyfile.pem"
#dlr-storage = mysql
dlr-storage = internal
# SMSC CONNECTION
group = smsc
smsc = at
modemtype = auto
device = /dev/ttyS0
speed = 9600
smsc-id = BSNL
preferred-smsc-id = BSNL
port = 10000
connect-allow-ip = 127.0.0.1
#connect-allow-ip = 135.27.156.250
my-number = "919422772404"
sms-center = "+919422099997"
group = smsc
smsc = fake
smsc-id = FEAK
preferred-smsc-id = FEAK
port = 10001
group = modems
id = siemens_tc35
name = "Siemens TC35"
detect-string = "SIEMENS"
detect-string2 = "TC35"
init-string = "AT+CNMI=1,2,0,1,1"
speed = 19200
enable-hwhs = "AT\\Q3"
need-sleep = true
# SMSBOX SETUP
group = smsbox
bearerbox-host = localhost
sendsms-port = 13013
#global-sender = 13013
#sendsms-chars = "0123456789 +-"
log-file = "/tmp/smsbox.log"
log-level = 10
access-log = "/tmp/access.log"
# SEND-SMS USERS
group = sendsms-user
username = mobile
password = mobile
#user-deny-ip = ""
#user-allow-ip = ""
faked-sender = abc
group = sendsms-user
username = mobile
password = mobile
dlr-url = "(URL address blocked: See forum rules):4400/DeliveryReport?sender=%p&to=%P&time=%T&status=%A"
# SERVICES
group = sms-service
keyword = nop
get-url = (URL address blocked: See forum rules)
text = "You asked nothing and I did it!"
# there should be default always
group = sms-service
keyword = tel
exec = "c:/windows/systm32/pq2.exe %p+%a"
max-messages = 0
group = sms-service
keyword = default
accept-x-kannel-headers = true
send-sender = true
omit-empty = true
post-url = "(URL address blocked: See forum rules):4400/IncomingMessage"
max-messages = 0
So please help me with this problem
Last edited by vijay_pict; January 15th, 2007 at 08:52 AM.
Reason: Needed to add some data in it
January 17th, 2007, 07:16 AM
-
The problem is solved Now.
It was pc and kannel version problem. yum helped me.
Last edited by vijay_pict; January 17th, 2007 at 07:16 AM.
Reason: wanted to add someting more
January 18th, 2007, 02:12 PM
-
Problem of Stability of Kannel
I have all versions of kannel for fc6.
But it is not stable
After sending 2-3 outbound messages, it crashes and starts displaying errors.
Did anybody face this problem earlier? How should I resolve this?
June 14th, 2007, 10:50 AM
-
the same problem happened to me
Hi, I met the same problem and end up with "queued for later delivery".
Can you share some solutions with me? I am using ubuntu7.04 and a nokia n80 phone.
I would really appreciate your help.
Thanks in advance
Originally Posted by vijay_pict
The problem is solved Now.
It was pc and kannel version problem. yum helped me.
April 10th, 2009, 10:36 AM
-
i need to install kannel gateway and ksms manager fully runnin pls hw much will it co
am a young entpreneur interested i bulk sms business. i need to install kannel gateway and ksms manager fully runnin pls hw much will it cost.thanks