[asterisk-users] Blacklist callers from file

John Kiniston johnkiniston at gmail.com
Mon Aug 29 11:20:42 CDT 2016


Here is a quick and dirty bash script to do it that I wrote you.

#!/bin/bash
if ( asterisk -rx "database deltree blacklist")
        then
                echo "Blacklist Cleared"
        else
                err "ERROR Failed to clear Blacklist, Exiting."
                exit 1;
fi

while IFS=, read TN REASON
do
if ( asterisk -rx "database put blacklist \"${TN}\" \"${REASON}\"")
   then
           echo "Inserted $TN $REASON to Blacklist"
   else
         err "ERROR Insert Failed on $TN."
         exit 1;
fi

done < blacklist.csv
unset IFS


It reads from the file blacklist.csv in the same directory with the format
of NUMBER,"DESCRIPTION/REASON"


On Sat, Aug 27, 2016 at 8:59 AM, tux john <atux at null.net> wrote:

> Hi. I would like to blacklist a few callers and I have been using the
> *CLI> database put blacklist 1234 "annoying callers". Instead of putting
> the same command for every user is there any way to have a file? Ideally a
> file in /opt that I would update the blacklisted numbers (add,remove). Is
> there anything like that, please?
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> Join the Asterisk Community at the 13th AstriCon, September 27-29, 2016
>       http://www.asterisk.org/community/astricon-user-conference
>
> New to Asterisk? Start here:
>       https://wiki.asterisk.org/wiki/display/AST/Getting+Started
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users
>



-- 
A human being should be able to change a diaper, plan an invasion, butcher
a hog, conn a ship, design a building, write a sonnet, balance accounts,
build a wall, set a bone, comfort the dying, take orders, give orders,
cooperate, act alone, solve equations, analyze a new problem, pitch manure,
program a computer, cook a tasty meal, fight efficiently, die gallantly.
Specialization is for insects.
---Heinlein
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20160829/f3ac8077/attachment.html>


More information about the asterisk-users mailing list