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. Sun May 19, 2024 21:29
SMSTools3 Community » Help and support Bottom

[answered] Configuring filter

  This topic is locked

Page:  1

Author Post
Member
Registered:
Jul 2009
Location: Slovak Republic
Is it possible to filter recived sms?
The recived string contains a string witch is rule.
Example:

From: 491721234567
From_SMSC: 491722270333
Sent: 02-01-21 22:26:23
Received: 02-01-21 22:26:25
Subject: GSM1
Alphabet: ISO8859-15

DOMAIN.OK string string string...
'sms' Syntax Highlight powered by GeSHi


The first word in sms text is rule that can be folder in server.
My question:
Is it possible to configure in smstools or I need my script on CRON?

Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
Eventhandler can be used to create any functionality required. In the scripts directory of a package there are some samples.

Here is one more sample: in the global part of smsd.conf, define:
eventhandler = /usr/local/bin/smsd_eventhandler.sh

Create this script file with suitable content, for example:

#!/bin/bash

if [ "$1" = "RECEIVED" ]; then

  FROM=`formail -zx From: < $2`
  TEXT=`sed -e '1,/^$/ d' < $2`

  # List must start and end with space:
  ALLOWED_NUMBERS=" 358401234567 358401234568 "

  key=" $FROM "
  if [[ $ALLOWED_NUMBERS == *$key* ]]; then

    # Replace linefeeds with space:
    TEXT=`echo "$TEXT" | tr "\n" " " | tr "\r" " "`

    # Make an array of words:
    words=($TEXT)

    # First word is the key, make it uppercase:
    key=${words[0]}
    key=`echo $key | tr a-z A-Z`

    if [ "x$key" = "xIGNORE" ]; then
      key=${words[1]}
      CONTROLFILE="/etc/postfix/control_sms_ignore_from"

      if [ "x$key" = "x?" ]; then
        FILE=`mktemp /tmp/send_XXXXXX`
        echo "To: $FROM" >> $FILE
        echo "" >> $FILE
        echo "Ignore: " >> $FILE
        cat "$CONTROLFILE" >> $FILE
        FILE2=`mktemp /var/spool/sms/outgoing/send_XXXXXX`
        mv $FILE $FILE2
      else
        if [ "x$key" != "x" ]; then
          FILE=`mktemp /tmp/eventhandler_XXXXXX`
          cp "$CONTROLFILE" $FILE
          echo "$key" >> $FILE
          chmod 644 $FILE
          mv $FILE "$CONTROLFILE"
        fi
      fi
    fi
  fi
fi

exit 0
 
'bash' Syntax Highlight powered by GeSHi


Make the script executable and restart smsd.

This sample script is used to add ignored sender addresses to the file which is used to determine is SMS notification is sent when a new e-mail is received. With SMS "ignore @somedomain.com" this domain is added to the list and with SMS "ignore ?" current list is sent back. There is also authorization by number used to control who can use this feature.

  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.