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. Thu Mar 28, 2024 21:22
SMSTools3 Community » Help and support Bottom

[answered] How to prevent receiving SMS from certain number

  This topic is locked

Page:  1

Author Post
Member
Registered:
Apr 2010
Location: Malaysia
Operating system name and version: Linux CentOS 4.8
Version of smsd: 3.1.11
Smsd installed from: sources
Name and model of a modem / phone: Wavecomm Fastrak Supreme 10
Interface: Serial

Hi,
I have implemented an eventhandler for my helpdesk system. So far things are looking great. And thanks for a superb piece of software Keke.

In my eventhandler, I have included certain checks for errors. Whenever there is an error, smsd will send an SMS to that person.

Problem is, the SIM also receives lots of promos that were sent by my telco. How do I make smsd reject those messages ?

Member
Registered:
Apr 2010
Location: Malaysia
Topic owner
... or is there a way to configure smsd to receive sms ONLY from a set of mobile numbers?

Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
It cannot be selected what messages are received by the modem, but in the eventhandler you can filter messages based on the numbers.

Usually all messages from ordinary phones are using international number format. Messages from operator may use national or alphanumeric format. Check from the one received promotion what is the value of From_TOA. If it's not international, you can use this kind of a filter in eventhandler:

#!/bin/bash

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

  FROM_TOA=`formail -zx From_TOA: < $2`

  if [[ "$FROM_TOA" == *$'international'* ]]; then

    FROM=`formail -zx From: < $2`

    # Do the actions...

  fi
fi
 
'bash' Syntax Highlight powered by GeSHi


It is also possible to filter messages based on the number, here is a simple example:

#/bin/bash

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

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

  FROM=`formail -zx From: < $2`
  key=" $FROM "
  if [[ $ALLOWED_NUMBERS == *$key* ]]; then

    # Do the actions...

  fi
fi
 
'bash' Syntax Highlight powered by GeSHi


If the list of allowed numbers is very large, it might be better to use a file, or database to store them. Similarly, you can also make a list of disallowed numbers:

#/bin/bash

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

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

  FROM=`formail -zx From: < $2`
  key=" $FROM "
  if [[ $DISALLOWED_NUMBERS == *$key* ]]; then
    FROM=""
  fi

  if [ -n "$FROM" ]; then

    # Do the actions...

  fi
fi
 
'bash' Syntax Highlight powered by GeSHi


Sample filtering by prefixes:

#!/bin/bash

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

  ALLOWED_PREFIXES="35845 35850"

  FROM=`formail -zx From: < $2`

  allow_from=0
  for tmp in $ALLOWED_PREFIXES
  do
    if [[ $FROM == $tmp* ]]; then
      allow_from=1
      break
    fi
  done

  if [ $allow_from -gt 0 ]; then

    # Do the actions...

  fi
fi
 
'bash' Syntax Highlight powered by GeSHi


Member
Registered:
Apr 2010
Location: Malaysia
Topic owner
I just came across the Blacklist and Whitelist features of smsd. Are those in any way related and can be useful in my case ?

Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
almangkok wrote
I just came across the Blacklist and Whitelist features of smsd. Are those in any way related and can be useful in my case ?

No, these are for outgoing messages only. You have to use the eventhandler for incoming messages.

Member
Registered:
Apr 2010
Location: Malaysia
Topic owner
Fully understood . Thanks Keke.

  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.