| Caller-ID Interceptor
This C-language program initializes and monitors a serial port
for the arrival of a Caller-ID data stream, returning a formatted data string in printable
format when a call arrives.
This code was developed and tested under RedHat Linux 6.1.
The serial port control segments were derived from the Linux Serial-Programming-HOWTO document.
Description
Caller-ID information is transmitted by the telephone
company between the first and second rings of an incoming call.
Information is sent using Bell202 (FSK) modulation and formatted as
asynchronous (start/stop) data at 1200 bits per second. If a suitable
demodulator is connected to the telephone line, the data stream can
be read directly by a standard serial port.
This program initializes the PC serial port and waits for a valid Caller-ID data transmission.
When a phone call arrives, the data is assembled in printable form and returned.
A typical return string is shown below.
Example Caller-ID Data Stream in Printable Form
The original data is a stream of octets with no formatting.
Information is packaged as a series of octets within a frame beginning with 0x80
and a length octet and ending with an 8-bit checksum.
The frame can carry a number of fields, each headed by ID and length octets.
The date and time field (ID=01) is always present. In the example below,
the caller name (ID=07) and number (ID=03) are also present.
Non-printable values are expressed in hexadecimal within carets (e.g. <86>),
while printables are shown directly (e.g. the quotation mark is ASCII 34 (decimal)).
In this format, the data fields are human readable and easily parsed
by a higher level Perl script.
|
A higher level routine may call this program and further process the information.
What Exactly Are The Data Fields?
A compact description of the caller ID format may be found at:
http://www.ti.com/sc/docs/psheets/abstract/apps/bpra056.htm
|