Hi Thomas,

Thanks a lot for your help and clarifications. If I understand it correctly,
then I can either run a webserver OR use the exec-solution. Because I prefer
not to run all this http overlay and webserver-stuff (I prefer terminal),
then I modified my config file to reflect this:

--------------------------------------------------------
group = sms-service
keyword = default
text = "No service specified"
#get-url = http://127.0.0.1/receive_sms?from=%q&date=%t&text=%a
max-messages = 0
concatenation = true
catch-all = yes
exec = "/Users/mac/Documents/gateway/gw/sms.sh"
#white-list = "http://localhost/whitelist";


And sms.sh (will be modified when text-files have been written):
--------------------------------------------------------
 #!/bin/bash

  for var in $@; do
    echo "$var" | tee -a DELETE_THIS_sms_message.txt
  done
  echo "-----------------------" | tee -a DELETE_NEW_sms_message.txt



Now, here comes the hardest part I think... And in this case I think I need
to dig into Sony Ericsson K700i init-string or something... I tried
screen /dev/cu.MartinsPhone-SerialPort2 and entering a lot of AT commands. I
also successfully made the phone software come up with some reply, when I
sms'ed from another phone. Then I tried to read the sms, but
unsuccessfull... I read various tutorials on the internet saying I should be
able to type in something like (to read message number 17, which the phone
told me the received sms was numbered):

AT+CMGR=17 <ENTER>

>From this point I get a lot of CMS ERROR: 500 which I can see is an error
that is specifically targeted towards Sony Ericcson, so it's hard for me to
debug without a clue about what the problem exactly is. Now, back to my
kannel-program and log-file:



2010-06-06 22:21:29 [977] [6] DEBUG: AT2[/dev/cu.MartinsPhone-SerialPort2]:
+CMTI incoming SMS indication: +CMTI: "ME",18
2010-06-06 22:21:30 [977] [6] DEBUG: AT2[/dev/cu.MartinsPhone-SerialPort2]:
--> AT+CMGR=18^M
2010-06-06 22:21:30 [977] [6] DEBUG: AT2[/dev/cu.MartinsPhone-SerialPort2]:
<-- +CMS ERROR: 500
2010-06-06 22:21:30 [977] [6] ERROR: AT2[/dev/cu.MartinsPhone-SerialPort2]:
+CMS ERROR: +CMS ERROR: 500
2010-06-06 22:21:30 [977] [6] ERROR: AT2[/dev/cu.MartinsPhone-SerialPort2]:
+CMS ERROR: An unknown error occurred (500)
2010-06-06 22:21:30 [977] [6] DEBUG: AT2[/dev/cu.MartinsPhone-SerialPort2]:
failed to get message 18.
2010-06-06 22:21:30 [977] [6] ERROR: AT2[/dev/cu.MartinsPhone-SerialPort2]:
CMTI notification received, but no message found in memory!
2010-06-06 22:21:30 [977] [6] ERROR: System error 1: Operation not permitted
2010-06-06 22:21:58 [977] [6] INFO: AT2[/dev/cu.MartinsPhone-SerialPort2]:
Closing device
2010-06-06 22:21:58


So: I think I need a new init-string and I hope that init-string can enable
me to read text message and extract them from the phone... It's a good thing
that it at least gets the CMTI notification, so it understands that it
received a message....

Any clues from here on?

Thanks for all the help...


Regards,
Martin



On Jun 6, 2010, at 8:53 PM, Thomas Sieh wrote:

hi again,

At first you have to declare the location, which will handle the
incoming messages. In your case you selected in your config at group =
sms-service
"get-url = http://127.0.0.1/receive_sms?from=%q&date=%t&text=%a";.

You have to run an http server at your localhost. in its content
root-directory
(for example in /var/www/) have to exist a script with the name
"receive_sms.php",
if you use php. the file is very dependent on your environment - will
you store your messages in a database, in flat files, which data do you
need, ... the php script from my previous mail safes the parameter in
variables, with whom you can handle the content of the messages.
thats is!

if you would create a sms-service group with "exec = /home/thomas/sms.sh %q
%Q %t %u %a %b"
instead of your get-url line, only then you have to use the sms.sh script
I have sent in the last mail.
In this case the config says that the incoming messages have to be
handled by the script "sms.sh". in my example it was a little bash
script. you have to adjust the path in the config file accourding to the
destination of it in your filesystem. this basic script writes the
incoming message content into a flat file. you have to change the path
to the "sms_message.txt" according to your filesystem, too.
The file you have pasted with cat containt my users home, not your :)
It should look like /Users/<yourUserName>/sms_message.txt on a mac.

if your http-server is online und you have started your kannel
(bearerbox and smsbox) you can open the link "
http://localhost:13000/store-status?password=bar";
there you can see your outgoing sms in the queue.

i don't know the init string of your handset, but in the internet
someone wrote "init-string = "AT+CNMI=2,3,0,0,0" " works.
you could try it.


BR,
Thomas



On Sun, Jun 06, 2010 at 07:35:53PM +0200, Martin J. wrote:
| Hello,
|
| Thanks a lot (also to Rene K.). I somehow made it reply with the message:
| "Could not fetch content, sorry", but I'll google that and look in the
| archive later about that...
|
| Forgive me for the stupid question, but I still don't completely
understand
| the 2 examples (exec and get-url)...
|
| Re.1)
| /gateway/gw
| macbookpro:gw mac$ cat sms.sh
|  #!/bin/bash
|
|    for var in $@; do
|      echo "$var" | tee -a /home/goofy/sms_message.txt
|    done
|    echo
|
| What do I do next/what do you do next? This is probably a very stupid
| question, but when does the sms.sh run? Will it be called from ./smsbox or
| ./bearerbox and do I need to modify my .conf-file?
|
|
| Re.2)
| I modified my .conf-file (get-url) and tried browsing to
| http://127.0.0.1/receive_sms?from=%q&date=%t&text=%a but I think I have to
| struggle with my AT command list / init... I don't think I have the exact
| right init-list...
|
| If anyone has any comments, here's my config-file...
|
|
| ====================
|
| group = core
| admin-port = 13000
| smsbox-port = 13001
| admin-password = bar
| #status-password = foo
| #admin-deny-ip = ""
| #admin-allow-ip = ""
| #log-file = "/tmp/kannel.log"
| #log-level = 0
| box-deny-ip = "*.*.*.*"
| box-allow-ip = "127.0.0.1"
| #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"
|
| group = modems
| id = ericsson
| name = "Sony Ericsson "
| detect-string = "K700"
| # AT+CMEE=1 gives extra error information!
| #
| # use this init-string for non sim-buffering
| #init-string = "AT+CNMI=3,2,0,0;+CMEE=1"
| # use this init-string for sim-buffering
| init-string = "AT+CNMI=2,3,0,1,0;+CMEE=1"
| keepalive-cmd = AT+CSQ
| reset-string = ATZ
| message-storage = ME
| broken = true
|
| group = smsc
| smsc = at
| modemtype = ericsson
| device = /dev/cu.MartinsPhone-SerialPort2
| log-level = 0
| log-file = "MJ_log_DELETE_THIS.txt"
| #speed = 9600
| #validityperiod = 167
|
| group = smsbox
| bearerbox-host = 127.0.0.1
| sendsms-port = 13013
| global-sender = 13013
| #sendsms-chars = "0123456789 +-"
| #log-file = "/tmp/smsbox.log"
| #log-level = 0
| #access-log = "/tmp/access.log"
|
| group = sendsms-user
| username = tester
| password = foobar
| #user-deny-ip = ""
| #user-allow-ip = ""
|
| #group = sms-service
| #keyword = nop
| #text = "You asked nothing and I did it!"
|
| # There should be always a 'default' service. This service is used when no
| # other 'sms-service' is applied.
|
| group = sms-service
| keyword = default
| #text = "No service specified"
| get-url = http://127.0.0.1/receive_sms?from=%q&date=%t&text=%a
|
| ====================
|
|
|
| Regards,
| Martin
|
|
|
| On Jun 6, 2010, at 5:51 PM, Thomas Sieh wrote:
|
| hi,
|
| if you want to receive messages you have to set up a sms-service in your
| config. there are multiple ways. you can send the content via parameters
| to a script (see exec) or to an url, for example (get-url). the content
| of the message is accessible by the parameters like %b for full binary
| message, %p for the sender-number... (see documentation).
| two very simple examples:
| 1.
|  exec = /home/thomas/sms.sh %q %Q %t %u %a %b
|
|  sms.sh:
|    #!/bin/bash
|
|    for var in $@; do
|      echo "$var" | tee -a /home/goofy/sms_message.txt
|    done
|    echo "-----------------------" | tee -a /home/thomas/sms_message.txt
|
| 2.
|  get-url = http://127.0.0.1/receive_sms?from=%q&date=%t&text=%a
|
|  http://127.0.0.1/receive_sms:
|
|  <?php
|    $from = $_GET['from'];
|    $date = $_GET['date'];
| $text = $_GET['text'];
| echo "The message - From: ".$from.", Date: ".$date.", Text:
".$text."\r\n";
|
|
| For sending sms in a script you can use lynx -dump ... for example or
| the GET and POST commands.
| For example:
| lynx -dump "
|
http://localhost:13013/cgi-bin/sendsms?username=tester&password=foobar&to=30957095&text=insert+you+text+here
| "
| your sending string should be inside a loop over an array with the
| destination addresses.
|
|
| BR,
| Thomas
|
|
| On Sun, Jun 06, 2010 at 05:04:08PM +0200, Martin J. wrote:
| | Hi,
| |
| | I have a newbie question: I just started to use Kannel and successfully
| made
| | this work:
| |
| | ./bearerbox -v 1 sms_GATEWAY_k700i.conf
| | ./smsbox sms_GATEWAY_k700i.conf
| |
|
http://localhost:13013/cgi-bin/sendsms?username=tester&password=foobar&to=30957095&text=(insertyou
| | text here)
| |
| | So, I can send sms'es... Still haven't figured out how to receive them
| yet,
| | however... My question is this: I'm volunteer in an organization and we
| | talked about the possibility of having this kannel-software send out
mass
| | sms'es to multiple recipients... However, I don't want to type each sms
| | message in the browser bar... I don't know much about http
| | send/get/receive/whatever so I hoped I could just send sms'es from the
| | terminal/console under Mac os X....
| |
| | How to send sms'es from terminal, so I can make a script to send same
| | message to multiple sms recipients?
| |
| |
| | Thanks...

Reply via email to