SMS Server Tools 3
This site is hosted by Kekekasvi.com
 Menu
Basic information:
Additional information:
Support:
Get SMS Server Tools 3:
Additional Options

 Sponsored links

 Search
Custom Search

 Visitor locations
 
 SMS Server Tools 3 Community
Welcome, Guest. Please login or register. Sat Apr 20, 2024 14:47
SMSTools3 Community » Help and support Bottom

[answered] Can we only save SMS messages to sent folder on received receipt = yes.

  This topic is locked

Page:  1

Author Post
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

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.

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

Member
Registered:
Feb 2010
Location: Gauteng, South Africa
Topic owner
I cant seem to find the script? Where is it located?

Thanks

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.sh

Create 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.

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!

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.sh

After smsd is restarted, you can check and see how details of delivery are stored into the message files.

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:

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.

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

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.

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?

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.

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

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.

Member
Registered:
Feb 2010
Location: Gauteng, South Africa
Topic owner
This worked perfectly!

I owe you a beer!

  This topic is locked

Page:  1

SMSTools3 Community » Help and support Top

 
Time in this board is UTC.  

Privacy Policy   SMS Server Tools 3 Copyright © Keijo Kasvi.