Hi
You are all overcomplicating this..
Its really simple
1. to track which dlrurl is for "exactly" which msg, simply build your dlr-url up when you call kannel and include a extra param say mymsgid.. so your dlr-url will look like "http://host:port/..../myscript?mymsgid=XXXXX&all the rest of the kannel escape sequences you use"
then you just generate XXXXX on the fly with each message. Kannel will preserve all of this and callback to the dlr-url with your msg-id.
2. For your legal purposes. Your app inserts into a db and whatever handles your callbacks (some php scripts or some dedicated server) either updates the db entry or inserts extra records.
simple, no triggers (ugh), no kannel mods, no fancy anything, just Kannel doing its stuff :-)..
nisan
At 02:54 AM 2004/05/17, fred wrote:
Hi Lourens and group,
Please see "In Support of Billing MT sms" in the devel list for our solution to add a transaction id to the sendsms, I added a %z feature. The so and sos of this list dismissed this idea. We did this on the 1.3.1 kannel code, could supply a patch if interested.
May i comment that your solution has a lot of if(s) this then if ...not sure
how reliable that can be, the transaction No. idea is a more elegant.
At 07:54 PM 5/12/2004, you wrote:In response to Paul Wolstenholme <[EMAIL PROTECTED]> and Peter Beckman <[EMAIL PROTECTED]>:
Let's say for legal reasons I need to keep record of exactly when my SMSes have been delivered (or not delivered, or anything in between).
The problems you guys must be having are: 1) Kannel deletes the DLR from the database when the SMS was delivered OR when it was not delivered, and 2) that there is no escape code that you can use in your dlr-url to specify exactly which message the DLR is for (%I does not work, %t only inserts the timestamp). Inside the database (in you DLR table) the combination of (smsc, ts) uniquely identifies a message.
My solution may seem complicated but bear with me -- maybe it could work for you, too.
When I send my message I always use dlr-mask=31 to get all possible values of delivery status (even though not all values are implemented by all SMSCs). In my DB I have the DLR table as specified in my .conf file, let's say I call it kannel-dlr. Then I have another table where I keep my own track of the DLRs, let's say it's called my-dlr.
My own table "my-dlr" looks exactly the same as the "kannel-dlr" table used by Kannel, but I also have a create_time and an update_time column, which are self-explanatory.
Now on the kannel-dlr table I have database triggers, so that when Kannel creates an entry, it is also created in my-dlr table. When Kannel updates the entry, the corresponding one in my-dlr table is also updated. (Found by matching the smsc + ts fields.)
When the message is delivered to the mobile, or delivery fails, Kannel deletes the DLR from the kannel-dlr table without updating the dlr-status. So what do I do now?
In this case my trigger function finds the corresponding DLR in my-dlr table (by matching smsc + ts), and looks at its create_time timestamp. The time difference between the DLR create time and the time that Kannel deletes the DLR, is then compared to my message validity period as specified in the smsc-group in my .conf file. If Kannel deletes the DLR before the validityperiod has expired (i.e if current_time-create_time < validityperiod), I know that the message was delivered.
If Kannel deletes the DLR after the validity period has expired, I know that the delivery failed.
Now I know the final status of my DLR, and the last thing my trigger function does is to update the status of the DLR in my-dlr table accordingly.
In the end my-dlr table contains complete details of all past and present DLRs.
Incidentally I use PostgreSQL and my trigger functions are written in PL/Python. If anybody wants the Python code just e-mail me directly.
Regards & good luck.
Lourens...
(In the end I believe the developers should just add an escape code for message ID to the dlr-url, but I know it couldn't be as simple as it sounds.)
__________________________________ Do you Yahoo!? Yahoo! Movies - Buy advance tickets for 'Shrek 2' http://movies.yahoo.com/showtimes/movie?mid=1808405861