Re: [asterisk-users] Blacklist callers from file

2016-08-31 Thread Frank Vanoni
On Sat, 2016-08-27 at 17:59 +0200, tux john wrote:

> Hi. I would like to blacklist a few callers 

Example: callers with CallerID 0123456789, 9876543210 and 7410258963 are
sent to tt-monkeys. Callers from area code 555 are also blocked.


In "extensions.conf" file add

#include "blacklist.conf"


In "blacklist.conf" 

exten => s/0123456789,1,playback(tt-monkeys)

exten => s/9876543210,1,playback(tt-monkeys)

exten => s/7410258963,1,playback(tt-monkeys)

exten => s/_555XXX,1,playback(tt-monkeys)


...
..
.




-- 
_
-- 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


Re: [asterisk-users] Blacklist callers from file

2016-08-30 Thread Tim S
Hi Kevin,

Looks like your gmail did the same thing mine did, took the conversation
off-list (unless you meant to do that).

If as you mention you're running a mix of POTS and SIP, I'd recommend
sticking with the transfer call method (set the hook/trigger in the
features.conf file).  That way if anyone picks up ANY phone in your house
they have a consistent procedure for dealing with those calls.  It will add
to the confidence of your users and will score points with wife not having
to learn and remember several procedures - a label with the hint would go a
long way here.

That's what I'll be doing for my aging parents, who feel helpless to the
effect of the bothersome calls, and don't want a complicated solution to
the issue.

-Tim
-- 
_
-- 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

Re: [asterisk-users] Blacklist callers from file

2016-08-29 Thread Tim S
Sorry, Gmail took my conversation with John off-list somehow,  I'll repost
what I had set here (sorry, it's going to be a bit big now), and I will be
more careful in the future:

First part:

I'm using Grandstream phones, so I have XML soft-keys, what hardware do you
have and how good are you with dialplans?  You'll have to do some re-work
unless you have an exact match for my setup.  I'm doing my best to give you
the functional code, I have to change a bunch of stuff to not leak the
security things I do in my code and some of the way more involved stuff I
do.  this should at least get you running I think.  Portions between "CODE:
 /CODE" tags are the functional dialplan code, I tried to comment a lot
here to explain what's happening, but I may have broken something in the
process.  Also, be aware that I generate custom sound files, so if you try
to run the code and it throws an error about sound-file does not exists,
that's why.

For this, I am using the internal DB in Asterisk (https://wiki.asterisk.org/
wiki/display/AST/Asterisk+Internal+Database).

The first part is easy, but also very important - filter your Caller-ID
data (in computers, we NEVER trust data from a source we don't generate),
CODE:

[incommingcall]
exten => 1551234,1,Set(CalledNumber=${1551234})   ;
Primary incoming phone line, number changed to protect my phone number
same => Set(CallEventTime=${STRFTIME(${EPOCH},,%m-%d-%Y_%H.%M.%S)}
same => n,Set(CALLERID(name)=${FILTER(A-Z0-9\s,${CALLERID(name)})})
same => n,Set(CALLERID(num)=${FILTER(0-9,${CALLERID(num)})})
same => n,Verbose(Incomming call to main phone number)
same => n,Goto(IVR-Menu,IVRStart,1)

/CODE - Then you hit phone numbers that don't have caller ID with the
special three-tone application that sounds like a phone company message,
CODE:

[IVR-Menu]
exten => IVRStart,1,Zapateller(nocallerid) ; Before
answering we do the sound for no-caller ID calls
same => n,Zapateller(answer,nocallerid); This is where
the phone call gets answered, we hit no-caller ID calls again here
same => n,Wait(1)
same => n,Playback(call-recording-warning)  ; Legally required
message: "For quality control purposes, this call may be monitored."
same => n,Wait(2)
same => 
n,Monitor(wav,Inbound_to_${CalledNumber}_from_${CALLERID(num)}_${CallEventTime})
 ; Yes, I record every call in an out.
same => n,GotoIf($["${CalledNumber}" != "1551234"]?BlacklistFilter)  ;
Number changed to protect my toll-free costs!!!

/CODE - I had a problem with political phone calls to my 855 number this
past spring, so I added this little routine to prompt the caller for a
single random digit to be entered to prove they could interact, that
stopped all the calls from getting through.  CODE:

; special human test for toll-free
same => n,Set(TOLLFREERAND=${RAND(0,9)})
same => n,Read(HUMANTEST,thank-you&human-test&${TOLLFREERAND}&now,1,,1,5)
; Says "Thank you. If you're a human, please press the number: {RANDOM},
now.", like a captcha.
same => n,GotoIf($["${HUMANTEST}" = "${TOLLFREERAND}"]?BlacklistFilter) ;
If the random number matches what they entered they move on in the dialplan
same => n,Playback(do-not-call-warning)
; I have a message that states when this number was added to the FTC
do-not-call list,
; requests removal of the number from the current list, and warns that the
call and information was recorded
; and will be turned over to the FTC if the calls continue.
same => n,Hangup()  ; Yes, if a human can't be bothered to press one button
when calling a number I pay the minutes for, I won't be bothered to talk to
them.

/CODE - now we can get into the stuff that handles the blacklists and
telemarketers.  CODE:

; return to regular program
same => n(BlacklistFilter), Verbose(Checking caller ID against blacklist)
same => n,GotoIf($[DB_EXISTS(blacklist\${CALLERID(num)})]?:TelemarketerFilter)
; If the caller ID is not in the blacklist DB family, it goes to the
telemarketer check
same => n,VoiceMail(Blacklist@OtherAccounts,s)
same => n,Hangup()
same => n(TelemarketerFilter), Verbose(Checking caller ID against
telemarketer list)
same => 
n,GotoIf($[DB_EXISTS(telemarketer\${CALLERID(num)})]?:IVRInteractiveStart)
; If the caller ID is not in the blacklist DB family, it goes to the
telemarketer check
same => n,VoiceMail(Telemarketer@OtherAccounts,s)
same => n,Hangup()

/CODE: Then if the caller ID is not on either list, they go into the start
of the IVR.  Everything up until now takes about 8 seconds, I limit
"appeal" voicemails to 30 seconds by account limit, so that if one managed
to come in through my toll-free number, it wouldn't finish the first minute
of billing.  CODE:

same => n(IVRInteractiveStart),Verbose(Dialplan continues here)
;
; ...redacted...
;
same => n,Hangup()

/CODE.


You'll have to tell me more about your phones to know what you are doing
with called user prompts.  You can enter the numbers into the DBs manually
from the console using the DB 

Re: [asterisk-users] Blacklist callers from file

2016-08-29 Thread John Kiniston
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  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
-- 
_
-- 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

Re: [asterisk-users] Blacklist callers from file

2016-08-28 Thread Steve Edwards

Please don't top-post.


On 27/8/2016 10:48 μμ, Steve Edwards wrote:


Other alternatives involve modifying your dial plan. If you are 
comfortable with that then you can consider alternatives like an AGI 
that reads your text file and sets a channel variable.


On Sun, 28 Aug 2016, john wrote:


Script seems good, but i am stuck on how to make it.


Sounds like time for a bit of reading.

The AGI protocol is simple. You give Asterisk a request. You get a 
response. It's all text based and you can enable AGI debug mode and watch 
the 'conversation' on the console.


There are lots of examples on the net.

You can pick any language you're comfortable with. Save yourself a lot of 
frustration and use an existing AGI library.


For your needs, your AGI may be as simple as:

) Read the AGI environment if your library does not do it automagically.

) Look for the ANI/caller ID in your text file (or database).

) Either set a channel variable (like AGISTATUS) or set the 
context/extension/priority. I've written AGIs both ways. I think setting a 
channel variable makes for more reusable code.


--
Thanks in advance,
-
Steve Edwards   sedwa...@sedwards.com  Voice: +1-760-468-3867 PST
https://www.linkedin.com/in/steve-edwards-4244281-- 
_
-- 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

Re: [asterisk-users] Blacklist callers from file

2016-08-28 Thread john
Hi. Thanks a lot for the reply. Script seems good, but i am stuck on how 
to make it.





On 27/8/2016 10:48 μμ, Steve Edwards wrote:

On Sat, 27 Aug 2016, tux john 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?


If you are happy with the way blacklisting with the Asterisk database 
works, how about a shell script that loads all of the entries in your 
blacklist file?


Other alternatives involve modifying your dial plan. If you are 
comfortable with that then you can consider alternatives like an AGI 
that reads your text file and sets a channel variable.


If you need more 'immediacy' maybe storing the blacklist in a 'real' 
database is more appropriate -- especially if you want the users to 
maintain their own black list via a web page.





--
_
-- 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

Re: [asterisk-users] Blacklist callers from file

2016-08-27 Thread Steve Edwards

On Sat, 27 Aug 2016, tux john 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?


If you are happy with the way blacklisting with the Asterisk database 
works, how about a shell script that loads all of the entries in your 
blacklist file?


Other alternatives involve modifying your dial plan. If you are 
comfortable with that then you can consider alternatives like an AGI that 
reads your text file and sets a channel variable.


If you need more 'immediacy' maybe storing the blacklist in a 'real' 
database is more appropriate -- especially if you want the users to 
maintain their own black list via a web page.


--
Thanks in advance,
-
Steve Edwards   sedwa...@sedwards.com  Voice: +1-760-468-3867 PST
https://www.linkedin.com/in/steve-edwards-4244281

--
_
-- 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