Skip to content Skip to navigation

OpenStax CNX

You are here: Home » Content » Caller ID Decoder

Navigation

Lenses

What is a lens?

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

This content is ...

In these lenses

Recently Viewed

This feature requires Javascript to be enabled.

Tags

(What is a tag?)

These tags come from the endorsement, affiliation, and other lenses that include this content.
 

Caller ID Decoder

Module by: Ed Doering. E-mail the authorEdited By: Erik Luther, Sam Shearman

Summary: The telephone company's "Caller ID" service provides the calling party's directory information as well as the time and date of the call as an FSK (frequency shift keying) signal between the first and second rings of a telephone call. In this project, develop a complete Caller ID decoder that analyzes an audio recording of the FSK signal to extract the directory and date information for display.

Table 1
LabVIEWtop.png This module refers to LabVIEW, a software development environment that features a graphical programming language. Please see the LabVIEW QuickStart Guide module for tutorials and documentation that will help you:
• Apply LabVIEW to Audio Signal Processing
• Get started with LabVIEW
• Obtain a fully-functional evaluation edition of LabVIEW

Note:

Visit LabVIEW Setup to learn how to adjust your own LabVIEW environment to match the settings used by the LabVIEW screencast video(s) in this module. Click the "Fullscreen" button at the lower right corner of the video player if the video does not fit properly within your browser window.

Summary

The telephone company's "Caller ID" service provides the calling party's directory information as well as the time and date of the call as an FSK (frequency shift keying) signal between the first and second rings of a telephone call. In this project, develop a complete Caller ID decoder that analyzes an audio recording of the FSK signal to extract the directory and date information for display.

Objectives

  1. Describe the Caller ID standard at the signal level
  2. Express a set of Caller ID information as a series of message bytes
  3. Decode by hand a Caller ID data block bitstream
  4. Implement a complete Caller ID decoder application in LabVIEW

Deliverables

  1. Summary write-up of your results
  2. Hardcopy of all LabVIEW code that you develop (block diagrams and front panels)
  3. Any plots or diagrams requested

Note:

You can easily export LabVIEW front-panel waveform plots directly to your report. Right-click on the waveform indicator and choose "Export Simplified Image."

Setup

  1. LabVIEW 8.5 or later version
  2. Modulation Toolkit 4.0 or later version
  3. Computer soundcard
  4. Speaker

Textbook Linkages

Refer to the following textbooks for additional background on the project activities of this module; see the "References" section below for publication details:

  • Carlson, Crilly, and Rutledge -- Ch 14
  • Couch -- Ch 5
  • Haykin and Moher -- Ch 7
  • Lathi -- Ch 13
  • Proakis and Salehi (FCS) -- Ch 10
  • Stern and Mahmoud -- Ch 5
  • Wheeler -- Ch 14 (an excellent reference, provides much detail about Caller ID)

Prerequisite Modules

If you are relatively new to LabVIEW, consider taking the course LabVIEW Techniques for Audio Signal Processing which provides the foundation you need to complete this project activity, including: block diagram editing techniques, essential programming structures, subVIs, arrays, and audio.

Introduction

You are no doubt familiar with Caller ID, the telephone company service that provides the name and phone number of your incoming caller. The Caller ID service transmits the calling party's directory information (name and telephone number) as well as the date and time of the call between the first and second ring as a binary FSK (frequency shift keying) signal. Click CallerID_audio_example.mp3 to listen to a typical Caller ID FSK signal embedded between the first and second ringer pulses.

After successfully completing this project, your LabVIEW application will be able to read audio recordings such as CallerID_audio_example.mp3 and then extract the Caller ID message for display.

Figure 1 illustrates the Caller ID decoder system to be constructed in this project.

Figure 1: Caller ID decoder system to be constructed in this project
Figure 1 (bpm_cid-systemdiagram.png)

The process begins with a call placed by the calling party. The telephone company's subscriber line interface card (SLIC) in the telephone company central office (CO) signals the customer premises equipment (CPE) -- telephone, modem, CallerID unit, etc. -- with a ringing pulse (90 VRMS, 20 Hz, 2 seconds on, 4 seconds off). The CO repeats the ringing pulse as long as the CPE is on hook, that is, the phone has not been answered. Answering the phone call places the CPE in the off hook state, and the CO connects the calling party to the CPE. The terms "on hook" and "off hook" refer to the position of the ear piece or handset in early telephone equipment. The SLIC detects the CPE hook state by the amount of DC current in the customer loop: zero current means on-hook, and non-zero current (about 10 to 20mA) indicates off-hook. The Caller ID FSK signal is transmitted between the first and second ringing pulses provided the CPE is on-hook. For this reason, the interface circuit indicated in Figure 1 must be AC-coupled to the SLIC to prevent drawing DC current.

FSK Signal

Caller ID uses the Bell 202 modem standard:

  • Binary FSK (two-level frequency shift keying)
  • Symbol rate: 1,200 symbols/second
  • Bit rate: 1 bit per symbol
  • Logic 0 ("space"): 2,200 Hz
  • Logic 1 ("mark"): 1,300 Hz

Caller ID Message Format

The complete Caller ID message is less than eight tenths of a second in duration. Listen to reduced_tempo_FSK.wav, a reduced tempo version of just the FSK signal; the signal is stretched out in time by a factor of 4, but the original frequencies are preserved.

Hopefully you could discern three distinct regions of the signal:

  1. Alternating 1's and 0's for 250 ms -- this channel seizure region "wakes up" the demodulator and gives the symbol synchronization subsystem enough time to generate pulses synchronized to the FSK signal
  2. Constant 1's for 150 ms -- this steady mark region separates the channel seizure region from the datablock; the relatively long interval of constant "mark" level ensures that the first "space" symbol of the data block can be easily detected
  3. Message bits for approximately 350 ms (the total time varies depending on the caller information) -- this data block region contains the Caller ID information

The message consists of a sequence of 10-bit frames. A start bit of value 0 begins the frame, 8 bits of information follow, and the frame concludes with a stop bit of value 1. The 8 information bits begin with the LSB (least significant bit) and end with the MSB (most significant bit). The information bits form one byte.

The data block message bytes are organized as follows:

  1. Message type, 1 byte -- 0x80 (i.e., hexadecimal 80) for Multiple Data Message Format (MDMF), or 0x04 for Single Data Message Format (SDMF). Number-only Caller ID service uses SDMF, and number-plus-name service uses MDMF. Number-plus-name service is much more common today, and is used in this project.
  2. Length of complete message, 1 byte -- This length value excludes the single-byte checksum at the end of the data block
  3. Data type, 1 byte -- 0x01 = date and time, 0x02 = phone number, 0x04 = number not present, 0x07 = name, and 0x08 = name not present
  4. Length of data, 1 byte
  5. Data bytes, variable number according to length
  6. Repeat Items 3, 4, and 5 as needed to complete the Caller ID message
  7. Checksum, 1 byte -- Add this to the modulo-256 sum of all the previous bytes in the message, including the message type and message length; a zero result indicates no errors detected

FSK Demodulator

The phase-lock loop (PLL) can easily discern the change in frequencies of an FSK signal. The LabVIEW Modulation Toolkit provides a PLL component that serves as an FSK demodulator for this project. Refer to the theory-of-operation screencast video in cid_Demodulator.vi learn how to use this PLL.

Timing Recovery

The Caller ID message symbol rate is 1,200 symbols per second. The baseband output of the FSK demodulator must be compared to a threshold and sampled at the symbol rate to recover the serial bit stream. The timing recovery system ensures that the thresholded demodulator output is sampled near the midpoint of the symbol. In this project a "local oscillator" produces a squarewave at a nominal frequency of 1,200 Hz. The local oscillator phase is synchronized to the thresholded FSK demodulator output. That is, the local oscillator phase is reset each time a transition is detected on the FSK demodulator output.

Procedure

Download required project files

Download the required project files contained in CID_Decoder_Project_Files.zip; unpack the files to the same folder in which you plan to build your LabVIEW subVIs and top-level application VIs.

The .zip archive contains the following files:

  • cid_ParseMessage.vi -- Accepts a text string containing the Caller ID data block bytes, and parses the string to extract the Caller ID data fields, i.e., date, time, number, and name; also returns information about the data block itself, namely, message type (SDMF or MDMF), message length, checksum value, and result of checksum calculation. All of the values are returned in a single cluster.
  • cid_Display.ctl -- Custom front-panel control to display Caller ID data block information contained in the cluster generated by cid_ParseMessage.vi. Follow these steps to place the control on the front panel: Display the front panel, right-click and choose "Select a Control...", and then choose cid_Display.ctl.
  • CallerID-N.wav -- Two audio recordings of Caller ID signal embedded between the first and second ringer pulses. The recordings include three ringer pulses, are approximately 17 seconds in duration, and are sampled at 44.1 kHz.
  • CallerID-N_19.2kHz.wav -- The same audio recordings downsampled to 19.2 kHz to produce 16 samples per symbol, the default value for many of the LabVIEW Modulation Toolkit subVIs. Either audio file can be used for this project, although the downsampled versions shorten run times of the Caller ID decoder application.
  • cid_Recorder.vi -- LabVIEW VI to monitor the soundcard input for ringer activity; when detected, record for a fixed time interval and save to a .wav file. Useful to collect several Caller ID signals automatically. Requires a suitable interface circuit between the telephone wall jack and the computer sound card.

Study the Caller ID signal audio recordings

Open the CallerID-1.wav audio recording in Audacity or an equivalent sound editor to view and listen to the signal. Use the zoom features to study the fine detail of the FSK signal, especially at the transitions between frequencies.

Repeat for the other .wav audio files included in the download distribution.

Are you able to discern any obvious differences among the various audio recordings?

SubVI construction

Possible approaches to analyze the signal generated by the telephone central office include: (1) process each sample as it arrives and generate the decoded message "on the fly," or (2) record the entire signal and then make repeated passes over the recording as needed to extract the message. Real-time implementation requires the former approach, while the latter "off-line" approach is easier to implement as a sequence of subVI calls, and is therefore the method of choice for this project.

Build the subVIs listed below. You may already have some of these available from previous projects.

Demonstrate that each of these subVIs works properly before continuing to the next part. The order in which you build the subVIs does not matter, however, the order presented roughly corresponds to the general processing flow that begins with the audio recording and ends with a collection of bytes.

Isolate and demodulate the FSK signal

Build a top-level VI that isolates and demodulates the FSK portion of the complete Caller ID audio signal. util_GetAudio to load the .wav audio file, and then pass this signal to cid_Demodulator.vi. Connect front-panel controls to the four parameter inputs of cid_Demodulator.vi. Create a mixed-signal waveform chart to display the four signals associated with cid_Demodulator.vi, namely: FSK signal (the original audio signal applied to the demodulator input), baseband signal (the demodulated output), phase error magnitude, and PLL locked.

The Figure 2 screencast video describes how to set up a LabVIEW "Mixed Signal Graph" to plot the waveform data type and Boolean 1-D array on a common timescale, much like an oscilloscope display with multiple analog and digital signals.

Figure 2: [video] Set up a "Mixed Signal Graph" to display both "analog" and "digital" signals on a common timescale
Figure 2 (bpm_cid-mixedsignalgraph.htm)

Set the demodulator VCO carrier frequency to the average value of the mark and space frequencies of the FSK signal.

Experiment with the remaining demodulator parameters VCO gain (start with values in the range 0.05 to 0.20), phase error LPF cutoff frequency, and comparator threshold for PLL lock to satisfy the following goals:

  • Baseband signal in FSK region "looks good", i.e., reasonably quick rise time without high-frequency ringing or other non-ideal artifacts
  • PLL locked is active (T) only during the FSK signal and is inactive during silence and ringer pulses.

Report your four demodulator parameter values and plot the mixed signal graph that demonstrates the ability of your system to identify the time region over which the FSK signal is active.

Sample the baseband signal

Use regen_Sampler.vi to extract the FSK signal region from the baseband signal produced by cid_Demodulator.vi. Note that regen_Sampler.vi is used like a "gating" circuit here: the PLL locked signal is active over the entire time that the FSK signal is detected, therefore regen_Sampler.vi picks out every value from the original audio recording over which PLL locked is active.

Add the bit sync system to your VI using a zero-crossing comparator, util_EdgeDetector.vi (two instances), regen_BitClock.vi set to 1,200 Hz, and another instance of regen_Sampler.vi. Use the zero-crossing comparator to convert the FSK signal to a Boolean 1-D array. This signal is not a bitstream yet, but rather serves to identify the beginning of bit intervals. Use one edge detector to produce indicator pulses for each zero crossing of the baseband signal (both rising edges and falling edges). These indicator pulses serve as the synchronization for the bit clock oscillator, which produces a square wave synchronized to the baseband signal. The square wave transitions low-to-high at the beginning of the symbol interval and transitions high-to-low at the midpoint of the signal interval. Use an edge detector to produce indicator pulses at the midpoint of the symbol interval which control when the sampler should take samples from the isolated FSK signal.

Create another mixed signal waveform graph to display the isolated FSK signal, the thresholded version of this signal, the indicator pulses that synchronize the bit clock, the bit clock output, and "actual sampling instants" produced by the sampler.

Study your results to ensure that the demodulated baseband signal is sampled properly.

The Figure 3 screencast video shows how you can conserve front-panel real estate by placing two waveform graphs inside a tabbed control.

Figure 3: [video] Conserve front-panel real estate with a tabbed control
Figure 3 (bpm_cid-tabbed.htm)

Decode the message bitstream

Use a zero-crossing comparator (specifically of the "less than zero" type) to convert the sampled baseband signal to a bitstream. Process this bitstream with cid_DetectStartBit.vi to extract only the data block portion of the bitstream.

Use util_BitstreamToText.vi to convert the bitstream to a sequence of 8-bit values ("string" data type), and then use cid_ParseMessage to convert the text string into an information cluster to be displayed with the custom front-panel control CID Display.

Include front panel indicators for the framing error and text out outputs from util_BitstreamToText.vi. The string indicator can be easily switched from ASCII display to hexadecimal display, as needed: right-click on the front panel indicator and choose either "Normal Display" or "Hex Display."

The framing error indicator should be dark for the entire data block region; some "left over" bits are likely after the data block ends due to the delay until the FSK demodulator's PLL locked output returns to F, and the resulting framing errors may be safely ignored.

Evaluate the completed system

Choose one of the Caller ID signal recordings, and run your VI to decode the FSK signal. When all goes well, the CID Display indicator will show "OK" for both the parsing process and the checksum calculation.

Confirm that the data block values are correctly extracted by manually decoding the hex values in the text string front panel indicator. More specifically, copy the hex values to a piece of paper, and work through the interpretation of each byte. For example, the first byte of the data block is 0x80, which indicates the Caller ID message is of the MDMF (Multiple Data Message Format) type. The next byte is an 8-bit unsigned integer that indicates message length; convert the hexadecimal value to decimal and report this value. Continue in this way to demonstrate that you understand the significance of each byte in the data block.

Try your Caller ID decoder on other signal recordings. Report the CID Display indicator values for each audio signal recording.

References

  1. Carlson, A. Bruce, Paul B. Crilly, and Janet C. Rutledge, "Communication Systems," 4th ed., McGraw-Hill, 2002. ISBN-13: 978-0-07-011127-1
  2. Couch, Leon W. II, "Digital and Analog Communication Systems," 7th ed., Pearson Prentice Hall, 2007. ISBN-10: 0-13-142492-0
  3. Haykin, Simon, and Michael Moher, "Introduction to Analog and Digital Communication Systems," 2nd ed., Wiley, 2007. ISBN-13: 978-0-471-43222-7
  4. Lathi, Bhagwandas P., "Modern Digital and Analog Communication Systems," 3rd ed., Oxford University Press, 1998. ISBN-10: 0-19-511009-9
  5. Proakis, John G., and Masoud Salehi, "Fundamentals of Communication Systems," Pearson Prentice Hall, 2005. ISBN-10: 0-13-147135-X
  6. Stern, Harold P.E., and Samy A. Mahmoud, "Communication Systems," Pearson Prentice Hall, 2004. ISBN-10: 0-13-040268-0
  7. Wheeler, Tom, "Electronic Communications for Technicians," 2nd ed., Pearson Prentice Hall, 2006. ISBN-10: 0-13-113049-8

Content actions

Download module as:

PDF | EPUB (?)

What is an EPUB file?

EPUB is an electronic book format that can be read on a variety of mobile devices.

Downloading to a reading device

For detailed instructions on how to download this content's EPUB to your specific device, click the "(?)" link.

| More downloads ...

Add module to:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks