or
How to Automatically Hang Up on Telesales Using .net, a Modem and Caller ID
or
Using Serial Ports from Mono on Raspbian
Since we seem to get a never-ending series of calls from telesales, market research and “your ISP”, I decided to start adding their caller IDs to our cordless phone book as “Scam n”.
The problem with this plan was that you still had to head to the phone to see that it wasn’t someone you wanted to bother with. If only there was something that could read a caller ID and automatically pick up the phone and hang up.
Like a modem.
Connected to a Raspberry Pi.
So I bought a cheap USB modem from Amazon, and wrote something in C# to check incoming CLID against a blacklist. I tested it on a Windows laptop, and then installed Mono on the Raspberry Pi. Watched it do nothing. Then I wrote it again. Twice.
1. Getting the modem to work
One important step was to tell the modem which country it was in, I did this via the properties page on the Windows laptop. Without this stage, it didn’t recognise the caller id information coming along with the calls.
The name of the port can be found on the device properties page in Windows, or on Raspbian / Debian / Ubuntu / whatever-linux by running
lsusb
And finding the entry for the modem
Bus 001 Device 007: ID 0572:1329 Conexant Systems (Rockwell), Inc.
And then finding the symlink to that device, of the form /dev/tty…
ls -l `find /dev -name '*Conexant*'`
(there’s backqoutes and single quotes in there, not smart quotes gone nuts)
2. Getting Mono on the Raspberry Pi
sudo apt-get install mono-complete
wait.
3. Using Serial Ports in Mono
Forget the DataReceived event. Spin up threads for the reading and writing from the serial ports.
4. TimeSpan in Mono 2.10.8.1 on Raspbian 3.2.27+ #250 PREEMPT
Forget it. Use an int for milliseconds. The following code
Console.WriteLine(TimeSpan.FromSeconds(1));
Produces
00:00:00
5. The source code
It’s quick and dirty, and it’s available on bitbucket.
6. Get your own
You can get a Raspberry Pi here, and there’s an Amazon ad for the modem I used below.
TRIXES USB 56K External Dial Up Voice Fax Data Modem Windows 7
Hi Mark,
ReplyDeleteCould your project be modded to show caller ID over a network?
Maybe, but if networked caller ID is the only feature you need, you could try getting ncidd working, from http://ncid.sourceforge.net/ncid/ncid.html
DeleteThanks for the reply, I have the same modem as the one listed above and am I correct in thinking this should work out the box with the Pi or if not do you have a more detailed guide showing how to get it working? i have played with NCID on Ubuntu but I could not get it working.
DeleteYes, it connected without drivers on raspbian. The only tricky bit was finding the /dev/... entry, which I did with the lsusb and ls commands in the post.
ReplyDeleteBut to get it set to UK standards, I connected it to a Windows box and set the modem properties to UK, then put it back on the Pi.
NCID 0.86 (released Mar 24 2013) now has support for Raspberry Pi. http://ncid.sourceforge.net/ncid/INSTALL-Raspbian.txt
ReplyDeleteThat's great. Thanks for letting me know!
DeleteNo problem. I was looking for the same type of solution as you were and ran across your blog where I learned the RPi could talk with a modem. Aside from the initial challenges of setting up ncid, it is very stable on the RPi for the couple of weeks I have been running it.
ReplyDeleteIEEE Final Year Project centers make amazing deep learning final year projects ideas for final year students Final Year Projects for CSE to training and develop their deep learning experience and talents.
ReplyDeleteIEEE Final Year projects Project Centers in India are consistently sought after. Final Year Students Projects take a shot at them to improve their aptitudes, while specialists like the enjoyment in interfering with innovation.
corporate training in chennai corporate training in chennai
corporate training companies in india
corporate training companies in india
corporate training companies in chennai corporate training companies in chennai
I have read your blog its very attractive and impressive. I like it your blog. Digital Marketing Company in Chennai
Digital Marketing Agency
SEO Company in India
SEO Services in India
Aivivu chuyên vé máy bay, tham khảo
ReplyDeleteVé máy bay đi Mỹ
vé từ mỹ về việt nam
ve may bay tư duc ve viet nam
vé máy bay từ nga về tphcm