Author |
Post |
|
#1 Sat Jun 12, 2010 16:28, 178 months ago.
|
Member
Registered: Apr 2010
Location: Germany
|
Operating system name and version: Debian Lenny Version of smsd: 3.1.8 Smsd installed from: repository Name and model of a modem / phone: TC35 Interface: serial
Hello,
I am not sure how to elegantly track the SMS from sending, receiving SENT and receiving a REPORT. Does sending an SMS allow me to set some unique identifier which re-appers in the SENT and REPORT messages?
SENT and REPORT are sharing Message_id which is fine, but how do I connect these two messages with my original SMS? I do not want to check the content of the SMS, as there will be lots of SMS, many of them with the same content and they may even be sent to the same destination, too. This makes it hard for me to track which SENT and REPORT messages concern which original SMS.
Thanks, Erik
|
|
#2 Sun Jun 13, 2010 09:13, 178 months ago.
|
Member
Registered: Apr 2010
Location: Germany
Topic owner
|
If I decide to use keep_filename = yes I can use my internal message ID as filename. Hence SENT returns the filename, I can keep track of the my ID. SENT and REPORT can be linked my Message_id.
Is there a better way to go, say by adding a header field which is given in each successive message? Otherwise I have to keep track of the Message_id in a database.
Thanks, Erik
|
|
#3 Sun Jun 13, 2010 11:42, 178 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
First, with a large number of messages it is possible that the same message id is obtained for two messages to the same number. This is because there is only 255 id's available. However, if sending of single SMS takes about 10 seconds, numbers are used again after 40 minutes. Usually reports are received faster, but if the phone is switched off or out of the GSM coverage, there can be much longer delay.
It's a good idea to use the unique id as a filename. Also there can be an additional header telling this id, so formail can be used to retrieve it. The eventhandler script can then update the status to the database. When a report is received, there is only the number of receiver and message id available. You have to check what (latest) sent file contains the same number and the same id to find out your unique id. With a large number of messages, let's say some couple of thousands, this will take time. And all completed messages, which have received "ok" status, should be removed or moved to the another directory. Because of large number of files, the smsd has an option report = /different/directory to keep number of files in the incoming directory smaller.
Instead of using the filesystem, the database can do the job faster. If your table can contain a field for Message_id, the eventhandler can just retrieve the last record which matches to the number and message id which were received in the status report. That record can then be updated. Actually, the sample eventhandler in the scripts directory does this kind of a job. Also, another table could be used to store unique id's, message id's and numbers. SENT and REPORT parts in the eventhandler could use this table.
|
|
#4 Sun Jun 13, 2010 12:17, 178 months ago.
|
Member
Registered: Apr 2010
Location: Germany
Topic owner
|
Thanks, I think I have to extend my current database to keep trak of the Message_id. I do not know how difficult it is, but extending the SMS format would be nice: The SENT, REPORT and FAILIED message just would give this User_id in the header. This would be allow to keep track of the lifecycle without any database or filesystem tricks. That's just an idea :-) -Erik
|
|
#5 Sun Jun 13, 2010 12:51, 178 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
Erik wrote The SENT, REPORT and FAILIED message just would give this User_id in the header. This would be allow to keep track of the lifecycle without any database or filesystem tricks.
That's just an idea :-)
With outgoing, SENT and FAILED messages there can be User_id header and it works. But when you receive a report, it has random filename and no that kind of a header. For example the report is: From: 358401234567 From_TOA: 91 international, ISDN/telephone From_SMSC: 358447983500 Sent: 10-05-04 16:04:58 Received: 10-05-04 16:05:21 Subject: GSM1 Modem: GSM1 IMSI: 3506122XXXXXXXX Report: no Alphabet: ISO Length: 119
SMS STATUS REPORT Message_id: 144 Discharge_timestamp: 10-05-04 16:04:59 Status: 0,Ok,short message received by the SME 'email' Syntax Highlight powered by GeSHi You have From and Message_id, but some trick or database must be used to resolve the User_id. But this is not a problem because it's easy to get User_id from the database using those two fields with type = SENT. Have you checked that scripts/mysmsd sample?
|
|
#6 Sun Jun 13, 2010 12:59, 178 months ago.
|
Member
Registered: Apr 2010
Location: Germany
Topic owner
|
Ok, I guess it is not feasable to add User_id to the REPORT header, though it would be really nice. smsd could work with a map internally:
Message_id -> User_id
and then add the User_id field to the header in case of a REPORT.
However, I will solve the problem via the database. Thanks! Erik
|
|
#7 Sun Jun 13, 2010 13:10, 178 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
Erik wrote smsd could work with a map internally:
Message_id -> User_id
and then add the User_id field to the header in case of a REPORT.
Also the number of receiver is required, but anyway, this would be a database and we already have one with all required fields. Erik wrote However, I will solve the problem via the database.
Ok, it's the best choice.
|