CallerID Interface System

Background and Overview:
A while back we got DSL service that includes TV, and one of its neat features that it integrates CallerID functionality. When we get a call a little window pops up in the corner of the TV screen displaying the name and number of the incoming call. I thought the feature was neat, but not so useful since I don't watch much television. One day I read that some modems can display CallerID information and it occurred to me that I could create a system to popup CallerID information on my computer. There are a couple companies that offer similar products, but I'm a cheapskate, and buying something is never as fun as building it yourself anyway.
The hardware consists of a modem attached to a serial port on my home Intranet server, which is in turn connected to my other systems via an Ethernet network. Software on the server monitors the modem's output for CallerID information and uses the data to update a web page and send a message to our PCs where it pops up on the screen.

The Hardware Interface:
The choice of modem is an important one since not all modems support CallerID functionality. I'm using an old Zoom V.34 Faxmodem (VFX28.8) I found after trying several models that didn't work. Many models will not display CallerID information by default, and others will claim to work but will sit like a brick as calls come in. The only way to know for sure is to find a whole bunch of old modems (remember that the speed doesn't matter) and sit down and fiddle with them all, but that's the fun part, isn't it?
The commands for my modem are:
at#CID?  - Display current mode, 0=Disable, 1=Formatted Output, 2=Raw Output
at#CID=1  - Set the CallerID mode (in this case to 1 for Formatted Output.)

The Software:
The server software initializes the modem and then watches for text coming from the modem. Here are the details of the interface for my modem, your mileage might vary. Basically there are four different possibilities that we need to catch. The word RING is also displayed, but they are of no value in this application. The four possibilities and what they look like follow, note that the time and date are always displayed. If the phone number is not available 0 is displayed, if the name isn't available a code is displayed indicating that the name is either unavailable or blocked.
The first case is that the name and number are available.
DATE = 0807
TIME = 1719
NMBR = 1234567890
The second case is that the number is available, but the name is not for some reason. 0801 indicates that a code will follow, 4F is hex for O which means that the name field isn't available. Also notice that the fourth field is labeled MESG instead of NAME. (Thanks to Matthew Hallacy for help decoding this.)
DATE = 0814
TIME = 1958
NMBR = 1234567890
MESG = 08014F
The third possibility is that the number is available, but the caller has requested that their name be blocked or withheld. We can tell that it's blocked by the message code 0801 again, but this time the code is 50 which is hex for P. I haven't gotten many of these, so I'm not sure if the number is always sent.
DATE = 0808
TIME = 1751
NMBR = 1234567890
MESG = 080150
The last case is that nothing is available, the number field is zero and we get a not-available code.
DATE = 0809
TIME = 1535
MESG = 08014F
When the server gets the fourth field (NAME or MESG) it sends the record in a delimited form to my clients via UDP packets. The client IP addresses are just hard-coded into the application, but since it's written as a Perl script it's easy to change. The server also adds the record to the top of a web page if you just want to keep a log of who's called. Since CallerID information is sent from the phone switch during the pause between the first and second rings and the web page is updated an instant later it might even be possible to check the web page and see who's calling while the phone is still ringing.
The client software listens to the specified UDP port, undelimits the data and display it. The Windows/Tk version displays a little popup window like the one at the top of this page, the Macintosh client just appends the record to the end of a list in the program window.

Client and server code plus other bits are provided in the following files. Both contain the same files, the ZIP file is simply provided for the OS-challenged. It's all free, just remember where it came from. :-)
All of my code was written in Perl, which is a large part of why the whole project took only a couple evenings. My server is based on FreeBSD, some modifications may be needed for other systems, but that's your job not mine... so stop emailing me about a Windows version.
Note that the Windows/Tk version requires the Tk user interface module for Perl, which can be found at the CPAN web site.

Ideas, Options, and Enhancements:


Legal Mumbo-Jumbo:
Feel free to download, use, distribute, and modify code found on this page to suit your needs. I provide no support for any of this though, so your on your own. This software has been tested, but I am not responsible for anything that occurs to your computer. Use at your own risk, yada, yada, yada.

Last Updated 1/26/2002 - anthony -