caller id.
© 1998 Jamie Zawinski <jwz@jwz.org>




I guarentee you that whatever you came here
searching for... this isn't it.

I haven't used this code in many years.
I'm sure it's totally useless now.




Here are a couple of marginal hacks I've been using for a while now. (If you're not running Unix, you might as well stop reading now.)

My original goal was to have my computer be my answering machine: I want it to do all the usual answering machine things: answer the phone; play a greeting; record a message. That's all. I didn't have any burning desire to have a beep-based menu system, or auto-fax-detection, or any of that crap.

And I wanted it to take those messages and dump them into my mail inbox as some kind of audio attachment, with the messages being tagged with the date, and the caller-ID info as the sender.

So I went out and bought a ZyXEL 288S modem, which is a pretty cool modem that, in addition to being a normal modem, has extension commands that do caller-ID, and that let you record and play back digital audio over the phone line.

Then I found this package on the net called `` mgetty/vgetty'', which purported to do the answering machine thing with ZyXEL modems, among others.

Well, three months later, I still hadn't gotten it to work, and had reached the decision that vgetty was just a categorical piece of shit, unsalvagable. The fact that others claimed to have gotten it working on their systems did nothing to change my mind about this, because I had read the code, and that backed up my opinion better than anything. In addition to not working on my system, it was inscrutable, so my attempts to repair it were futile.

So I gave up on the answering machine idea, and settled for simply having my computer pop up a window showing the caller-ID info every time the phone rang. That wasn't too hard to get working (well, it was, and it gave me even more reasons to hate Perl, as if I didn't have enough already) but I did manage to get it working reliably.

At the time, the phone system in my area sent the calling phone number, but not the subscriber name, so I also hacked it to cross-reference the phone number with BBDB (my address book) and tell me the name of the caller too.

That was all well and good. But then I realized that I still had the problem that, if someone called when I was asleep, it would wake me up. Now most people solve this problem by not having a phone in the bedroom. But my place doesn't really have any interior walls, so there's nowhere I can put the phone where I can hear it from the places I want to hear it, but not hear it from the places I don't.

(Some other people solve this problem by turning off the ringer at night, and turning it back on during the day, but I never remember to do one or the other or both.)

But now that I had my computer noticing the phone ringing, the solution was easy! Turn off the ringer on the phone, and let the computer do the ringing. Because then it can look at the time of day to decide how loudly to ring: I have it set up so that if: it's between 2am and noon; and the screen saver is active, it rings really quietly. Hack hack!

cid-modem This is the program that runs in the background, listening to the serial port. It instructs the modem to report rings and caller-ID info, but to never actually answer the phone.
ring.sh This is the thing that rings the phone, and checks to see if the screen saver is running to decide on the volume. The playing of the sound file (and setting of the volume) is SGI-specific, but it shouldn't be hard to port. Let me know if you do.

So then I got a laptop. And the laptop has a Ricochet radio modem, which means it's fully on the net whenever I'm using it (Ricochet is great, I highly recommend it). So the next hack ought to be obvious: when I'm out sitting in a park somewhere, I ought to be informed when someone has called me at home, and who they are!

This presents a couple of interesting problems:

So it's impossible for the laptop to open a net connection to the home machine, because the firewall won't let its packets through; and it's impossible for the home machine to open a connection to the laptop, because it doesn't know what its IP address is.

So my solution was to meet in the middle: when the phone rings, my home machine pushes the call info to a third machine out on the external Internet (the machine that hosts www.jwz.org, as it happens.) Then, a daemon on the laptop periodically polls that third machine to see if any new call info has shown up; and if so, pops up a window showing it to me.

It's kludgy, but it works!

cid-remote the home machine runs ``cid-remote -push &'', which watches /usr/local/etc/cid-log for new caller-ID info, and then pushes it to a third machine; the laptop runs ``cid-remote -pull &'', which watches that third machine for new data (by polling it every ten minutes or so), and pops up a window (with xmessage) when something shows up.

Let me know if you find any of this useful, or do other clever things with caller-ID. I don't particularly expect anyone else to use this stuff as-is, but it's something I wrote for me because I felt a need, and I've found that most of the things I've written that others use started out that way too, so, who knows...


[ up ]