|USB Caller Line Identification decoder|
You may ask yourself how your fixed telephone is able to show the number of the person who's calling you.
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 this caller information available online so I built an FSK decoder and hooked it up to a USB port of a router running OpenWrt firmware using a USB serial adapter. The FSK decoder is built around a PLL XR-2211 modem chip. Its output is connected to the USB serial adapter through an optocoupler. The USB serial adapter was stripped from its case and connectors and now sits on the main board together with the FSK decoder and the optocoupler.
To control the USB serial adapter the OpenWrt firmware needs the generic usbserial module and the appropriate module for the specific USB serial adapter, in this case the ch341 module. After plugging in the USB cable this module creates the /dev/ttyUSB0 device.
This shell script reads the data from /dev/ttyUSB0, detects valid CLID messages and passes them through netcat to "webserver" where spam is filtered out and the available address books are queried. Together with the timestamp this information is logged and published on the internet and sent to an I2C character display.