USB CLID decoder in box

You may ask yourself how your fixed telephone is able to show the number of the person who's calling you. After all, the connection is 100% analog. Well, the exchange sends this so called Caller Line Identification (CLID) in a 1200 baud message using two tones, 1300 Hz (logic 1) and 2100 Hz (logic 0), just after the first ring tone. More details can be found in this document from the EXAR website.

I thought it was useful to have my received (and missed) calls available online so I built an FSK decoder and hooked it up to a USB port of a router running OpenWrt firmware using a microcontroller. The FSK decoder is built around a PLL XR-2211 modem chip. Its output is connected to the microcontroller through an optocoupler. Both sit on the main board together with the FSK decoder.

Thanks to the V-USB project an ATtiny45 microcontroller emulates a USB keyboard. When the software UART receives a valid CLID message, it "presses a key" which causes an interrupt on the host.

This shell script on the host then retrieves the content of the CLID message throught a USB control message compiled for the command line interface running on that host. The shell script passes the data through netcat to a different router running OpenWrt firmware where spam is filtered out and the available address books are queried. Together with the timestamp this information is logged and published online and sent to an I2C character display.

All documentation of this project like the ATtiny45 firmware, the Eagle schematics and layouts and assembly pictures can be found here.

CLID USB circuit