Mobile Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsMobile ProgrammingMobile Programming
Receive the tools necessary to be the rock star of your field. Our 12-month program teaches you the evolving world of multi-channel marketing as well as the complex issues and opportunities found in the industry.

ASP Free and Iron Speed Designer are giving away $5,500+ in FREE licenses. Iron Speed's RAD CASE toolset can save up to 80% of your coding time. One free license per week, one perpetual license per month!
Download and Activate to enter!

Web development can be a daunting task, even for specialists. There is a lot of information to absorb and a lot of technologies to learn in order to manage a superior website. When trying to learn the ropes, developers need a reliable source to introduce new ideas that can be easily implemented. When working on large projects, even web veterans may run into a technology or an aspect of a technology that they are unfamiliar with.

Learn More!


Download to Enter
| Contest Rules

Tutorials | Forums

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 3rd, 2006, 07:55 PM
motapa motapa is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2006
Posts: 8 motapa User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 18 m 59 sec
Reputation Power: 0
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"

Reply With Quote
  #2  
Old November 3rd, 2006, 07:58 PM
jabba_29's Avatar
jabba_29 jabba_29 is offline
Retired
Dev Shed God 9th Plane (9000 - 9499 posts)
 
Join Date: Feb 2002
Location: Finland
Posts: 9,139 jabba_29 User rank is General 23rd Grade (Above 100000 Reputation Level)jabba_29 User rank is General 23rd Grade (Above 100000 Reputation Level)jabba_29 User rank is General 23rd Grade (Above 100000 Reputation Level)jabba_29 User rank is General 23rd Grade (Above 100000 Reputation Level)jabba_29 User rank is General 23rd Grade (Above 100000 Reputation Level)jabba_29 User rank is General 23rd Grade (Above 100000 Reputation Level)jabba_29 User rank is General 23rd Grade (Above 100000 Reputation Level)jabba_29 User rank is General 23rd Grade (Above 100000 Reputation Level)jabba_29 User rank is General 23rd Grade (Above 100000 Reputation Level)jabba_29 User rank is General 23rd Grade (Above 100000 Reputation Level)jabba_29 User rank is General 23rd Grade (Above 100000 Reputation Level)jabba_29 User rank is General 23rd Grade (Above 100000 Reputation Level)jabba_29 User rank is General 23rd Grade (Above 100000 Reputation Level)jabba_29 User rank is General 23rd Grade (Above 100000 Reputation Level)jabba_29 User rank is General 23rd Grade (Above 100000 Reputation Level)jabba_29 User rank is General 23rd Grade (Above 100000 Reputation Level)  Folding Points: 238337 Folding Title: Super Ultimate Folder - Level 1Folding Points: 238337 Folding Title: Super Ultimate Folder - Level 1Folding Points: 238337 Folding Title: Super Ultimate Folder - Level 1Folding Points: 238337 Folding Title: Super Ultimate Folder - Level 1Folding Points: 238337 Folding Title: Super Ultimate Folder - Level 1Folding Points: 238337 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 4 Months 6 Days 43 m 26 sec
Reputation Power: 2491
Send a message via AIM to jabba_29 Send a message via Google Talk to jabba_29 Send a message via Skype to jabba_29
Facebook
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

>_ skiFFie ? | Twitter

__________________

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.

__________________

Reply With Quote
  #3  
Old November 4th, 2006, 04:53 PM
motapa motapa is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2006
Posts: 8 motapa User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 18 m 59 sec
Reputation Power: 0
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.

Reply With Quote
  #4  
Old November 6th, 2006, 12:25 AM
royashoya royashoya is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2006
Posts: 31 royashoya User rank is Sergeant (500 - 2000 Reputation Level)royashoya User rank is Sergeant (500 - 2000 Reputation Level)royashoya User rank is Sergeant (500 - 2000 Reputation Level)royashoya User rank is Sergeant (500 - 2000 Reputation Level)royashoya User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 17 h 46 m 46 sec
Reputation Power: 13
Quote:
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.

Reply With Quote
  #5  
Old November 6th, 2006, 07:41 AM
mckay mckay is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2006
Posts: 9 mckay User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 21 m 49 sec
Reputation Power: 0
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()

Reply With Quote
  #6  
Old December 14th, 2006, 01:56 AM
motapa motapa is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2006
Posts: 8 motapa User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 18 m 59 sec
Reputation Power: 0
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.

Reply With Quote
  #7  
Old January 13th, 2007, 12:26 AM
vijay_pict vijay_pict is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2007
Posts: 7 vijay_pict User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 1 m 58 sec
Reputation Power: 0
Question

Quote:
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?

Reply With Quote
  #8  
Old January 13th, 2007, 01:13 AM
vijay_pict vijay_pict is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2007
Posts: 7 vijay_pict User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 1 m 58 sec
Reputation Power: 0
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?

Reply With Quote
  #9  
Old January 14th, 2007, 02:38 PM
motapa motapa is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2006
Posts: 8 motapa User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 18 m 59 sec
Reputation Power: 0
Re:

Quote:
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.

Reply With Quote
  #10  
Old January 15th, 2007, 07:07 AM
vijay_pict vijay_pict is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2007
Posts: 7 vijay_pict User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 1 m 58 sec
Reputation Power: 0
Thanks

Thank you very much motapa.

i'll need your help for my further work. thank you

Reply With Quote
  #11  
Old January 15th, 2007, 08:49 AM
vijay_pict vijay_pict is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2007
Posts: 7 vijay_pict User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 1 m 58 sec
Reputation Power: 0
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

Reply With Quote
  #12  
Old January 17th, 2007, 07:16 AM
vijay_pict vijay_pict is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2007
Posts: 7 vijay_pict User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 1 m 58 sec
Reputation Power: 0
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

Reply With Quote
  #13  
Old January 18th, 2007, 02:12 PM
vijay_pict vijay_pict is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2007
Posts: 7 vijay_pict User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 1 m 58 sec
Reputation Power: 0
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?

Reply With Quote
  #14  
Old June 14th, 2007, 10:50 AM
filedeliver filedeliver is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2007
Posts: 2 filedeliver User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 m 17 sec
Reputation Power: 0
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

Quote:
Originally Posted by vijay_pict
The problem is solved Now.


It was pc and kannel version problem. yum helped me.

Reply With Quote
  #15  
Old April 10th, 2009, 10:36 AM
onos onos is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2009
Posts: 1 onos User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 24 sec
Reputation Power: 0
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

Reply With Quote
Reply

Viewing: Dev Shed ForumsMobile ProgrammingMobile Programming > How to send SMS with Kannel


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.

© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 10 - Follow our Sitemap