Mobile Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreMobile Programming

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
Back in HEL
Click here for more information.
 
Join Date: Feb 2002
Location: Finland
Posts: 8,912 jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)  Folding Points: 57777 Folding Title: Beginner FolderFolding Points: 57777 Folding Title: Beginner FolderFolding Points: 57777 Folding Title: Beginner Folder
Time spent in forums: 3 Months 4 Weeks 1 Day 13 h 6 m 50 sec
Reputation Power: 1693
Send a message via ICQ to jabba_29 Send a message via AIM to jabba_29 Send a message via MSN to jabba_29 Send a message via Yahoo 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

# mdb4u | mobile movie database] | Please help to test and promote
# skiFFie | Home of the 'accessibility module' for Drupal
# Jamie Burns [me] Accessibility Module [drupal]
# guidelines | search | wap resources | not getting help | fold to cure

__________________

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: 30 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 14 m 40 sec
Reputation Power: 10
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: 8 mckay User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 55 m 13 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