Friday, 23 November 2012

Usb Modem from Mono on the Raspberry Pi


How to Automatically Hang Up on Telesales Using .net, a Modem and Caller ID


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


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


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 on Raspbian 3.2.27+ #250 PREEMPT

Forget it. Use an int for milliseconds. The following code




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


  1. Hi Mark,

    Could your project be modded to show caller ID over a network?

    1. Maybe, but if networked caller ID is the only feature you need, you could try getting ncidd working, from

    2. Thanks 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.

  2. Yes, 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.
    But 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.

  3. NCID 0.86 (released Mar 24 2013) now has support for Raspberry Pi.

  4. No 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.

  5. IEEE 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.

    IEEE 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