Hi carlostico,
Here is what I use on my Warp to collect SMS and distribute them via email.
Basically I have created a script that runs every hour which is called by cron. Here is the cron setup in '/var/spool/cron/crontabs/root':
1 * * * * /persistent/msgsend.sh
This msgsend.sh script resides in the persistent folder on Warp and can be found below. This script requires ssmtp.conf to be correctly setup for emailing. It is also necessary to supply the correct email address in the script in place of xxxxxxxx@mydomain.com.
Finally to note the 'gsm fetch' command pulls the SMS off the SIM card and places it in a file on Warp (*.sms). So during testing you may want to omit the final removal of the SMS files off the Warp until you are satisfied everything is working.
/persistent # vi msgsend.sh
#!/bin/sh
echo "Running SMS cron"
# fetch messages - port 1 only
asterisk -rx "gsm fetch sms 1"
sleep 1
if [ -d /var/spool/asterisk/smsin ] ; then
cd /var/spool/asterisk/smsin
TEST=`ls *.sms`
if [ "$TEST" != "" ] ; then
for file in $TEST ; do
echo "Message found."
echo "$file"
# create mail
echo "From: Warp" > msg
echo "Subject: SMS message received" >> msg
echo >> msg
echo `date` >> msg
echo >> msg
cat $file >> msg
cat msg | sendmail xxxxxxxx@mydomain.com
# remove the file so it is not sent twice
rm $file done else
echo "- No messages"
exit 0
fi fi
Hope this is helpful. But I agree a formal module would be ideal.