Crazy DLRs because of ts

Julien Buratto <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
Hello there,

upon a simple test I think kannel mixes the DLR-URL badly in the MySQL 
storage.

I don't know how does kannel identify each dlr but I think is using a 
timestamp (ts)?

That's very bad because with fast SMSC it happens that kannel deletes 
wrong dlrs from the DB and call bad URLs - that is really bad behaviour.

Does anyone has an idea how to solve this ?


Thanks
Julien


--------------------
Here is an example:

I'm sending 4 messages to phone A B C and D
The phone B is switched off

Phones A,C,D receive the SMS correcly but in the MySQL storage table I 
can still see a waiting DLR not for the phone B but for another phone.
The phone B result as a 'delivered' and the line from the table is DELETED.


----- PHONE B -----
Adding DLR smsc=smsitaly, ts=160305115627, src=Test, dst=** PHONE B **, 
mask=31, boxc=

2005-03-16 11:56:27 [8997] [8] DEBUG: sql: INSERT INTO gatewayDelivery 
(smsc, ts, source, destination, service, url, mask, boxc, status) VALUES 
('italy', '160305115627', 'Test', '** PHONE B **', 'italy', 
'http://www.censored.it/dlr.php?smsc_id=%i&status=%d&answer=%A&from=%P&to=%p&ts=%t&idmessaggio=4208', 
'31', '', '0');

----- PHONE A -----
Adding DLR smsc=italy, ts=160305115627, src=Test, dst=** PHONE A **, 
mask=31, boxc=

2005-03-16 11:56:27 [8997] [8] DEBUG: sql: INSERT INTO gatewayDelivery 
(smsc, ts, source, destination, service, url, mask, boxc, status) VALUES 
('italy', '160305115627', 'Test', '** PHONE B **', 'smsitaly', 
'http://www.censored.it/dlr.php?smsc_id=%i&status=%d&answer=%A&from=%P&to=%p&ts=%t&idmessaggio=4209', 
'31', '', '0');

As you can see, both the DLR have the same ts value, but the PHONE-B-DLR 
is inserted before A (that's ok, no problem).

As soon as the delivery arrives from the SMSC for PHONE A (phone B il 
switched OFF), kannel says:

2005-03-16 11:56:43 [8997] [8] DEBUG: DLR[mysql]: Looking for DLR 
smsc=smsitaly, ts=160305115627, dst=** PHONE A **, type=1

but the query to look for it is:
SELECT mask, service, url, source, destination, boxc FROM 
gatewayDelivery WHERE smsc='italy' AND ts='160305115627';

this will not return the DLR for ** PHONE A ** but the one for PHONE B 
because it has been inserted before resulting in a misleading DLR call back

it fetches a wrong URL: created DLR message for URL

and it deletes a wrong DLR entry
DELETE FROM gatewayDelivery WHERE smsc='italy' AND ts='160305115627' 
LIMIT 1;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.