Here is a Wiki page to share useful scripts you may have developed.
Please attach them and add a description to this page.
will show uncommented, non-blank lines in a config file. I put it in /usr/local/bin.
Example:$ active-lines /etc/ncid/ncidd.conf set ttyport = /dev/ttyACM1 # Linux USB modem 1 set verbose = 7 send cidlog send cidinfo set cidlogmax = 500000 set lineid = HOMERPi $
will add the most recent call to your blacklist. Handy when an annoying call comes in and you want to quickly and easily add it to the blacklist. The blacklist entry is also date stamped so the message from NCID will let you know when you blacklisted it. It's satisfying to see the message.
is another utility to help you manage your lists. I park it in /etc/ncid/. It parses the white and black lists, and looks in /var/log/cidcall.log (or a different file you specify from the command line), and prints out a list of phone numbers that have rung your number and aren't currently in a list. I run it using Python 2.7 on Fedora Core 24 currently. Only minor changes would be required for Python 3.x.
contains script csv2alias.sh to convert a CSV file to STDOUT in the format needed for ncidd.alias. Handles CSV files with and without the first row containing column headings. Also handles first and last names in separate columns. Safely parses escaped/embedded commas. Includes some sample .csv files. Run csv2alias.sh without any parameters to see usage. Requires csvtk. Put csv2alias.sh and csvtk into /usr/local/bin. You need to be root to update ncidd.alias.
Example to read customer-list.csv and append directly to ncidd.alias, then forcencidd
server to refresh the alias list in memory:$ sudo bash # csv2alias.sh customer-list.csv Phone First Middle Last >> /etc/ncid/ncidd.alias # pkill -HUP ncidd
Use Raspberry Pi to suppress the first ring when a call is on the blacklist. Detailed instructions below.
Last edit: Mike 2016-06-28
It is a nice script but you should check that the line you got is actually a CID line and not one of the other supported types. Just in case.
It's a good point. I only use it for caller ID so that's the only records
I ever see. It could make a bit of mess if it were not a CID line. Tail
can't filter so I'll need to come up with something that searches backwards
from the bottom of the file to find the last CID line.
On Tue, Jun 28, 2016 at 5:20 PM, John L. Chmielewski jlc@users.sf.net
wrote:
No need to search backwards. Start at 10 or so from the end and if it is a CID line save it in a variable. Check the next line and if a CID replace the previous CID. And so on.
After a little thinking, it was pretty straightforward. First grep the callerid log so only lines starting with 'CID:' come out and pipe it to tail to grab only the last line. Unless your log is ridiculously big, it should be plenty fast.
As a small way of giving back, here is a script similar to the one above that I wrote and have been using to keep my white and black lists up to date. I park it in /etc/ncid/. It parses the white and black lists, and looks in /var/log/cidcall.log (or a different file you specify from the command line), and prints out a list of phone numbers that have rung your number and aren't currently in a list. I run it using Python 2.7 on Fedora Core 24 currently.
Open to feedback to make it more robust.
Hi MoxieMan, Can you edit the Wiki? If yes, then go ahead and edit the page itself and attach your python script to main page. You're doing exactly what I hoped and adding your helpful tool.
Done.
Hello everyone,
Here is a block-phone solution with a raspberry and NCID.
So that only calls out blacklist make the phone ring:
(The original discussion: https://sourceforge.net/p/ncid/discussion/275236/thread/04a533b0/?limit=25)
Last edit: Alex 2016-12-12
Hi Alex, thanks for documenting this so thoroughly -- great job! The link to the hardware image appears to be broken, not sure if you're aware.
Ok thanks, the link is restored (this image is heberger on my site and i work on it ...)
Added
active-lines
attachment and added alphabetically to top post. Converted to bulleted list.Added
csv2alias.tar
.Put Alex's
ncid-prog_gpio.sh
andncid-run_prog.sh
scripts in the main attachment list to make it easier to find.Added contributors to main descriptions.