Hi Jarl,

1) Explanation about dlrmask=31 is in chapter 9 of user guide.

2) Rather than requesting Kannel to store the delivery report in its built-in 
(mysql) database (with "group = dlr-db" and so on), the other way is to make 
our own database to store outgoing sms with delivery report status. We need 
to create the database and write scripts which will write to and update the 
delivery report status.  

Let's use the following mysql table, named "sms", as an example: 

create table sms
(
id  int unsigned primary key not null,
date timestamp,
dest char(16),
message char(160),
status tinyint null
);

"date", "dest" and "message" is to store date-time, destination phone number 
and the sms message, respectively. The "id" field is an incrementing number 
starting from "1" (not sure why I didn't use auto_increment) to give a unique 
id number for each outgoing SMS. This "id" is very important as, later, it  
keeps track of which messages get delivered. The "status" field is where I 
keep the delivery report status ("16" for smsc reject, "8" for smsc submit 
and "1" for delivery success. In my case "2" and "4" is not supported by the 
smsc).    

For sending SMS, I have a script which do the following:

(a) Get the variables (destination number and the SMS itself) from HTML Form.  
(b) Store those variables in above mysql table and keep note of the id number 
of the particular record/row it writes to (say we store the value of "id" of 
that particular record in variable named "$id" and for that particular 
record, say the "id" has a value of "1", for it is the first message store in 
the table). 
(c) Call /cgi-bin/sendsms function to send SMS, appending 
"&dlrmask=31&dlrurl=http://localhost/dlr.php?type=%d&id=$id";

Later, upon receiving delivery report status, Kannel will call the script we 
put in dlrurl (the "htpp://...." parts pointed by dlrurl needs to be  
urlencoded).

For example, when Kannel successfully submitted a message to SMSC, Kannel  
will call "http://localhost/dlr.php?type=8&id=1";, which means status is "8" 
for message with id number "1". And when the destination has received the 
SMS, Kannel call the dlrurl again. But this time with different value of 
type:  "http://localhost/dlr.php?type=1&id=1"; which means message with id 
number "1" has been successfully delivered to destination (represented by 
type=1). 

It is dlr.php which should update the "status" field  according to the "type" 
value send back by Kannel. And with "id" number as parameter, the script 
knows the delivery report status is for which particular record. 

Hope this helps,

P.S. I also got a better understanding about dlr after reading Navjot's post. 
Thanks to Navjot.

Regards,
Rudy
 

On Monday 10 November 2003 07:10, Jarlco wrote:
> I've found an old post by  "Navjot Singh", in the thead at:
>  http://www.mail-archive.com/[EMAIL PROTECTED]/msg00909.html
>
> Now this is very interesting, however I've got some questions after reading
> up on all this mysql stuff...
>
> Navjot said:
> "
> You need to set 1 variable dlrmask (another is optional). You just need to
> append &dlrmask=31 and send the request.
> See in the dlr table and you will find one row.
> "
> Now for every message I send do I always have to add: &dlrmask=31  to my
> message command?
> Then, what does that mean exactly? what's 31? and why the command? can you
> make sure any automated replies etc gets stored in the mysql database as
> well?
>
> Thanks a lot for any replies, (a little alone in this converstion)
>
> /Jarl
>
> "Jarlco" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>
> > Hmm fear maybe not a lot of people actually use mysql to store
> > messages... my earlier post, details the problem... however I've now got
> > a question in order to be able to work on the problem unless someone
> > figures it out....
> >
> > (old message below as well)
> > (using gentoo linux with kannel-cvs with mysql built in)
> >
> > What triggers storing of messages? Is it when you send one? Recieve one?
> > have one on hold? anything in the config file(that I didn't have in
>
> there)?
>
> > or all of them? or none...?
> >
> > any ideas?
> >
> > Any help is greatly appreciated, I've gone so far, just need to be able
> > to store messages properly and my project is more than halfway :p
> >
> > Thanks a lot in advance,
> > Jarl
> >
> >
> > "Jarlco" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> >
> > > Got a strange problem on my hands that I can't seem to figure out...
>
> I've
>
> > > got mysql and would like to store any messages coming in our out in my
> > > database, the database is set up with:
> > > #CREATE TABLE SmsEvent (
> > > #smsc VARCHAR(255),
> > > #ts VARCHAR(255),
> > > #destination VARCHAR(255),
> > > #service VARCHAR(255),
> > > #url VARCHAR(255),
> > > #mask VARCHAR(255),
> > > #status VARCHAR(255),
> > > #boxc VARCHAR(255),
> > > #source VARCHAR(255),
> > > #PRIMARY KEY(smsc) )
> > > #;
> > >
> > > However when I check the actual database after sending/recieving
>
> messages
>
> > > there is nothing in it....
> > > The status of the boxes looks like this:
> > >
> > >
> > > Kannel bearerbox version `cvs-20031101'. System Linux, release
> > > 2.4.20-gentoo-r6, version #1 Fri Sep 26 23:43:56 BST 2003, machine
> > > i686. Hostname jarlco, IP 192.168.0.10. Libxml version 20508. Using
> > > OpenSSL
> >
> > 0.9.6k
> >
> > > 30 Sep 2003. Using MySQL 4.0.14. Using native malloc.
> > > Status: running, uptime 0d 0h 22m 7s
> > > WDP: received 0 (0 queued), sent 0 (0 queued)
> > > SMS: received 0 (0 queued), sent 3 (0 queued), store size 0
> > > SMS: inbound 0.00 msg/sec, outbound 0.00 msg/sec
> > > DLR: 0 queued, using mysql storage
> > > Box connections:
> > >     smsbox:(none), IP 127.0.0.1 (0 queued), (on-line 0d 0h 14m 6s)
> > > SMSC connections:
> > >     wavecom_1    AT2[wavecom_1] (online 1327s, rcvd 0, sent 3, failed
> > > 0, queued 0 msgs)
> > >
> > >
> > > and my config file looks like this:
> > > ------------------------------------------
> > > group = core
> > > admin-port = 13000
> > > admin-password = bar
> > > smsbox-port = 13001
> > > store-file = "/tmp/kannel.store"
> > > log-level = 2
> > > log-file = "/tmp/kannel.log"
> > > access-log = /tmp/kannel.access
> > > dlr-storage = mysql
> > >
> > > # SMSC CONNECTIONS
> > >
> > > group = smsc
> > > smsc = at
> > > smsc-id = wavecom_1
> > > allowed-smsc-id = wavecom_1
> > > modemtype = wavecom
> > > device = /dev/ttyS0
> > > speed = 9600
> > >
> > >
> > > # MODEM GROUP
> > >
> > > group = modems
> > > id = wavecom
> > > name = Wavecom
> > > detect-string = "WAVECOM"
> > >
> > > # SMSBOX SETUP
> > >
> > > group = smsbox
> > > bearerbox-host = localhost
> > > sendsms-port = 13013
> > > sendsms-url = "/cgi-bin/sendsms"
> > > sendota-url = "/cgi-bin/sendota"
> > > sendsms-chars = "0123456789 +-"
> > > global-sender = 079
> > > reply-couldnotfetch = "Sorry, service was unable to fetch content..."
> > > reply-couldnotrepresent = "Sorry, real message could not be represented
>
> as
>
> > > SMS"
> > > reply-requestfailed = "Sorry, the request failed"
> > > reply-emptymessage = "Empty SMS was recieved"
> > > log-file = "/tmp/smsbox.log"
> > > access-log = "/tmp/kannel.access"
> > > log-level = 3
> > >
> > > # SEND SMS USER CONFIG
> > >
> > > group = sendsms-user
> > > username = jarl
> > > password = cornell
> > >
> > > group = sendsms-user
> > > username = tester
> > > password = foobar
> > >
> > > # SMS SERVICE
> > >
> > > group = sms-service
> > > keyword = xxx
> > > aliases = "af;ta;argh;tsk"
> > > name = test1
> > > header = Jarl's SMS Service
> > > footer = J.C
> > > text = xxx service
> > >
> > > group = sms-service
> > > keyword = www
> > > get-url = "http://%S";
> > >
> > > group = sms-service
> > > keyword = vote
> > > text = "Thank you for your vote it will now be processed"
> > >
> > > group = sms-service
> > > keyword = nop
> > > text = "service"
> > >
> > > # DEFAULT SERVICE
> > >
> > > group = sms-service
> > > keyword = default
> > > text = "default"
> > >
> > >
> > > # MYSQL CONFIGURATION
> > >
> > > group = mysql-connection
> > > id = mydlr1
> > > host = localhost
> > > mysql-username = jarl
> > > mysql-password = xxx
> > > database = kannel
> > >
> > > # STORAGE GROUP
> > >
> > > group = dlr-db
> > > id = mydlr1
> > > table = SmsEvent
> > > field-smsc = smsc
> > > field-timestamp = ts
> > > field-destination = destination
> > > field-service = service
> > > field-url = url
> > > field-mask = mask
> > > field-status = status
> > > field-boxc-id = boxc
> > > field-source = source
> > >
> > >
> > >
> > > Cheers a lot for any help in this matter, I'm sure i'm just not
> > > understanding this properly, which is why I'm hoping someone here will
> > > maybe..
> > > /Jarl


Reply via email to