Author |
Post |
|
#1 Thu Feb 18, 2010 15:06, 172 months ago.
|
Member
Registered: Feb 2010
Location: Gauteng, South Africa
|
Hi
I really need the SMS messages to only be saved to the sent folder once the received receipt comes in or alternatively have the same filename as the sent message for the file that is written to the report folder.
Any suggestions?
Thanks
Xen
|
|
#2 Thu Feb 18, 2010 18:09, 172 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
You can use an eventhandler to handle messages when delivery report comes. In the scripts directory of a package there is a sample script named eventhandler_report. That script will store delivery timestamp to the sent message file. It's probably not enough for you, but with minor changes that kind of script can move a sent and delivered message to a new folder which could be named like /var/spool/sms/delivered.
With an eventhandler your alternate solution can also be provided. When a report is received and sent file has been found, it can be renamed using the second argument of eventhandler script.
|
|
#3 Fri Feb 19, 2010 03:13, 172 months ago.
|
Member
Registered: Feb 2010
Location: Gauteng, South Africa
Topic owner
|
Thanks for the advice.
How do I setup the evenhandler, or does it run automatically?
I will look at the script and see what I can work out.
Any ideas would be most welcome.
Thanks for your help
|
|
#4 Fri Feb 19, 2010 06:20, 172 months ago.
|
Member
Registered: Feb 2010
Location: Gauteng, South Africa
Topic owner
|
I cant seem to find the script? Where is it located?
Thanks
|
|
#5 Fri Feb 19, 2010 10:16, 172 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
xenothan wrote How do I setup the evenhandler, or does it run automatically?
In the global part of smsd.conf file, define (for example): eventhandler = /usr/local/bin/smsd_eventhandler.shCreate this file and make it executable for smsd. xenothan wrote I cant seem to find the script? Where is it located?
You did not tell what OS you are running and how smsd was installed . Probably you did not install it from sources. Download the latest version to the directory /usr/local/src. cd /usr/local/src and extract the package using a command tar -zxvf smstools3-3*. Atfer this you have the script in the directory /usr/local/src/smstools3/scripts.
|
|
#6 Fri Feb 19, 2010 10:54, 172 months ago.
|
Member
Registered: Feb 2010
Location: Gauteng, South Africa
Topic owner
|
Thanks for your feedback
I am running Ubuntu 9.10 Server
I had installed SMStools using apt-get, do I need to reinstall manually using make for this or can I just extract the files and overwrite the existing ones in the /usr/local/src/smstools3 directory?
Also, the eventhandler.sh file I must create, do I just input a command in the file like /usr/local/src/smstools3/scripts/eventhandler_report?
I am a linux noob but am learning on a daily basis.
BTW - this tool is awesome!
|
|
#7 Fri Feb 19, 2010 11:09, 172 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
xenothan wrote I had installed SMStools using apt-get, do I need to reinstall manually using make for this or can I just extract the files and overwrite the existing ones in the /usr/local/src/smstools3 directory?
You do not have to reinstall. If you already have a /usr/local/src/smstools3 directory and there is scripts/eventhandler_report file, you do not need to download and extract new files. What is the version of smsd you are running? ( guess why I'm asking those details when a new support question is created... ) xenothan wrote Also, the eventhandler.sh file I must create, do I just input a command in the file like /usr/local/src/smstools3/scripts/eventhandler_report?
You can use the content of eventhandler_report to create your first version of customized eventhandler. For example: cp -p /usr/local/src/smstools3/scripts/eventhandler_report /usr/local/bin/smsd_eventhandler.shAfter smsd is restarted, you can check and see how details of delivery are stored into the message files.
|
|
#8 Fri Feb 19, 2010 11:28, 172 months ago.
|
Member
Registered: Feb 2010
Location: Gauteng, South Africa
Topic owner
|
I am using 3.1.3 I have done all but it doesn't seem to be working. The files in the sent directory remain unchanged. ie. there is no Received: value in them, but the sms is received. However the tool is creating files in the /report directory, although I can only tell the sms they are referring to by checking in the file for the Message ID:
|
|
#9 Fri Feb 19, 2010 11:35, 172 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
Test the eventhandler manually:
Check what is the latest received report file: ls -ltr /var/spool/sms/report
Run: /usr/local/bin/smsd_eventhandler.sh REPORT /var/spool/sms/report/latest_received_report_file
Probably you see some error messages?
Perhaps you do not have formail available. In this case, install it using apt-get install procmail.
|
|
#10 Fri Feb 19, 2010 11:45, 172 months ago.
|
Member
Registered: Feb 2010
Location: Gauteng, South Africa
Topic owner
|
I ran the script and got no error messages, and everything remained unchanged.
Not too sure why though?
Also, I have procmail installed - latest version
|
|
#11 Fri Feb 19, 2010 11:48, 172 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
Ok, show the content of a report and content of a sent message here. Use Private tags to protect the data.
|
|
#12 Fri Feb 19, 2010 11:50, 172 months ago.
|
Member
Registered: Feb 2010
Location: Gauteng, South Africa
Topic owner
|
Report file 1 Hidden private text. Report file 2 Hidden private text. And the Sent File Hidden private text. What do you make of the above?
|
|
#13 Fri Feb 19, 2010 12:00, 172 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
When you send a message your must write a phone number in international format. This is because reports you are receiving will always contain a number in this format. The script will use message id and GSM number to find a message, and it does not work when the format is not the same.
Your outgoing message file should not even work, as the number is in national format. However, for some reason, in your country this has worked.
|
|
#14 Fri Feb 19, 2010 12:10, 172 months ago.
|
Member
Registered: Feb 2010
Location: Gauteng, South Africa
Topic owner
|
It works!!!!
Now, I just need to figure out how to send the file to the /delivered folder once its updated.
If I get stuck, i'll let you know.
Thank you for your great support! and assitance
|
|
#15 Fri Feb 19, 2010 12:18, 172 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
formail -f -I "Received: $RECEIVED" < $TMPFILE2 > ${FNAME} unlink $TMPFILE2 mv ${FNAME} /var/spool/sms/delivered/ fi
If you are using filenames which are unique by a TicketNo, this may be enough for your system. But it depends on the naming convention.
|
|
#16 Fri Feb 19, 2010 12:40, 172 months ago.
|
Member
Registered: Feb 2010
Location: Gauteng, South Africa
Topic owner
|
This worked perfectly!
I owe you a beer!
|