Loading... Please wait...


How do I use patlooptest to troubleshoot analog FXO modules used with Asterisk?

How do I use patlooptest to troubleshoot analog FXO modules used with Asterisk?

In DAHDI 2.5.0 and later, the wctdm24xxp device driver can be compiled (with the "DEBUG" conditional compilation directive) to include the "digitalloopback" module parameter. As its name implies, this module parameter enables an internal digital loopback for FXO modules. This can be used with patlooptest to verify the internal operation of an FXO module, not including its electrical connection to the corresponding physical port on the base card.

1.    Compile the wctdm24xxp device driver for DEBUG mode.

The following steps outline how to modify the DAHDI source code to compile the wctdm24xxp device driver for DEBUG mode.

o    Download the DAHDI source code.

Download the source code for the latest DAHDI drivers, version 2.5.0 or later. Extract and change into the source code directory using the following commands. Substitute the version of DAHDI for the X.X.X in the command lines below.

# cd /usr/local/src/
# wget http://downloads.digium.com/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz

# tar -zxvf dahdi-linux-complete-X.X.X+X.X.X.tar.gz

# cd dahdi-linux-complete-X.X.X+X.X.X/

o    Modify the source code for the "Kbuild" file for the wctdm24xxp device driver.

Modify the source code for the "Kbuild" file to define the "DEBUG" preprocessor macro when the wctdm24xxp device driver is compiled.
In the following example, the "
vim" text editor is used, but you can specify nano, emacs, gedit or any other text editor.

# vim linux/drivers/dahdi/wctdm24xxp/Kbuild

Next, search for the following line:

EXTRA_CFLAGS += -I$(src)/.. -Wno-undef

Change it to this:

EXTRA_CFLAGS += -I$(src)/.. -Wno-undef -DDEBUG

o    Build and install DAHDI drivers.

After making the above modifications and saving the source file, build and install the DAHDI drivers with the usual commands:

# make

# make install


The following steps should be performed during a maintenance window, because they will interrupt service on your Asterisk system.

2.    Enable the "digitalloopback" parameter.

The default value of "digitalloopback" is '0', meaning not enabled. Set it to '1' to enable it.

See "How do I enable a device driver module parameter?".

3.      Run patlooptest for the given analog port(s)

Use thepatlooptestutility to test this internal loopback. This is similar to the localhost loopback usingdahdi_maintfor T1/E1 cards; it does not require a physical loopback plug.

o    Compile patlooptest

# cd /tools/

# make patlooptest

o    Run patlooptest

E.g., if the analog FXO port that you want to test is configured to be DAHDI channel 1:

#./patlooptest /dev/dahdi/1 -t 300 -v

If no errors occur, you will see "Going for it..." and there will be no further output. If there are errors, you will see ""Unexpected result." Please report these to Digital Techniques Technical Support for possible causes.


Using the internal loopback is only one part of troubleshooting some types of symptoms with an analog FXO module. A failedpatlooptestwith an internal loopback may indicate that the module is defective or damaged, or that the corresponding module-header connectors on the base card are defective or damaged, or some other failure mode. However, a successfulpatlooptestwith an internal loopback does not guarantee that the module and its base card port(s) are good. The internal loopback will mask any physical problems (e.g., bent contact pins) and some electrical problems (e.g., a blown "fuse") in the module and its base card port(s).