DAHDI and Asterisk PCI Card Setup: Comprehensive Guide

This document provides a step-by-step guide to set up an Asterisk server with a DAHDI-compatible PCI card. It covers the entire process from installing the PCI board to configuring drivers, firmware, and necessary software components, as well as troubleshooting tips.


1. Hardware Installation

2. Operating System Installation

3. Kernel Preparation

Verify Kernel Version

The recommended kernel is 5.4.x. Confirm it by running:

uname -r

Downgrade Kernel (if necessary)

  1. Install the 5.4.x kernel:
    sudo apt-get install linux-image-5.4.0-xx-generic linux-headers-5.4.0-xx-generic
  2. Reboot into the older kernel by selecting it in the GRUB menu.
  3. Confirm the kernel version after reboot:
    uname -r

4. Prepare for DAHDI Installation

Dependencies

Install necessary packages for building DAHDI:

sudo apt-get install -y build-essential gcc g++ make libncurses5-dev libtool autoconf automake pkg-config m4 linux-headers-$(uname -r)

Create System-wide Source Directory

  1. Navigate to the system source directory:
    cd /usr/src
  2. Download the latest DAHDI tarball:
    sudo wget http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz
  3. Extract the tarball:
    sudo tar -xvzf dahdi-linux-complete-current.tar.gz

5. Install DAHDI

Build DAHDI Linux Modules

  1. Navigate to the DAHDI Linux directory:
    cd /usr/src/dahdi-linux-complete-<version>/linux
  2. Build the kernel modules:
    sudo make
    sudo make install
  3. Load the DAHDI kernel module:
    sudo modprobe dahdi

Install DAHDI Tools

  1. Navigate to the tools directory:
    cd /usr/src/dahdi-linux-complete-<version>/tools
  2. Build and install tools:
    sudo autoreconf -i
    sudo ./configure
    sudo make
    sudo make install
    sudo make config
  3. Verify the installation:
    sudo dahdi_cfg -vv

6. Install Wanpipe Drivers

  1. Download the latest Wanpipe drivers:
    sudo wget https://ftp.sangoma.com/linux/current_wanpipe/wanpipe-<latest>.tgz
  2. Extract the drivers:
    sudo tar -xvzf wanpipe-<latest>.tgz
  3. Navigate to the extracted directory:
    cd wanpipe-<latest>
  4. Build and install the drivers:
    sudo ./Setup install

    Follow the prompts to configure WANPIPE for DAHDI.

7. Configuration and Testing

Verify Hardware Detection

Run the following to confirm hardware is detected:

sudo dahdi_hardware

Generate DAHDI Configuration

Generate the configuration files:

sudo dahdi_genconf

Start DAHDI

Start the DAHDI service:

sudo /etc/init.d/dahdi start

Test Configuration

Check the DAHDI configuration:

sudo dahdi_cfg -vv

8. Troubleshooting Tips

  1. Missing Kernel Headers: Ensure headers for the current kernel are installed.
    sudo apt-get install linux-headers-$(uname -r)
  2. Module Loading Issues: Check for module-related errors:
    dmesg | grep dahdi
  3. Rebuild Modules: Clean and rebuild DAHDI modules if issues persist:
    cd /usr/src/dahdi-linux-complete-<version>/