Debian DAHDI

From sailpbx
Revision as of 12:49, 17 February 2014 by Adminwiki (talk | contribs) (Tailor/fix)
Jump to: navigation, search

back to SARK Main Page

Install

There isn't a great deal of documentation on how to install Digium's DAHDI component onto Debian but it isn't hard so here's a little howto.

The correct "Debian way" to install driver modules uses the module assistant. What it will do is drag the source code from the libraries, compile it and then build an installable deb on-the-fly. It should work on any Debian Wheezy image.

This assumes you have already installed SAIL using the guide HERE (this means that all of the correct Asterisk stuff will already be installed).

apt-get install dahdi-source
m-a a-i dahdi

This will chug along for a while. When it finishes, you will have a little further work to do. For some reason, the install puts DAHDI into a group called "dialout" in the udev rules. It needs to be in group asterisk for our purposes.

cat /lib/udev/rules.d/60-dahdi-linux.rules
SUBSYSTEM=="dahdi",  GROUP="dialout", MODE="0660"

Change it to GROUP="asterisk" and reboot

sed -i 's/GROUP="dialout"/GROUP="asterisk"/' /lib/udev/rules.d/60-dahdi-linux.rules
reboot

Tailor/fix

There is a bug in one of the DAHDI Perl routines which will cause problems if you don't fix it. There is a published patch from Digium but you'll need to fix it manually because the patch won't verify on Debian (Span.PM is in a different place in EL5/6). Here is the Digium patch

 diff --git a/xpp/perl_modules/Dahdi/Span.pm b/xpp/perl_modules/Dahdi/Span.pm
index cf38c80..ea08961 100644
--- a/xpp/perl_modules/Dahdi/Span.pm
+++ b/xpp/perl_modules/Dahdi/Span.pm
@@ -230,6 +230,11 @@ sub new($$) {
 			last;
 		}
 	}
+        if (($self->is_soft_term_type == 0) and ($self->termtype eq "UNKNOWN")) {
+                
+        }
+
+	
+
 	($self->{NAME}, $self->{DESCRIPTION}) = (split(/\s+/, $head, 4))[2, 3];
 	$self->{IS_DAHDI_SYNC_MASTER} =
 		($self->{DESCRIPTION} =~ /\(MASTER\)/) ? 1 : 0;
-- 
1.7.6.2

Fortunately, it's not very big and only concerns a single module so you can just patch it manually if it isn't already applied. At, or around line 230 in /usr/share/perl5/Dahdi/Span.pm you will find the following (unpatched) code

                        last;
                }
        }
        ($self->{NAME}, $self->{DESCRIPTION}) = (split(/\s+/, $head, 4))[2, 3];
        $self->{IS_DAHDI_SYNC_MASTER} =
                ($self->{DESCRIPTION} =~ /\(MASTER\)/) ? 1 : 0;

Change it to this (comments optional).

                        last;
                }
        }
#
# Digium Patch 
#
        if (($self->is_soft_term_type == 0) and ($self->termtype eq "UNKNOWN")) { 
           $self->{IS_SOFT_TERM_TYPE} = 1;
        }
#
# Digium Patch End
#
        ($self->{NAME}, $self->{DESCRIPTION}) = (split(/\s+/, $head, 4))[2, 3];
        $self->{IS_DAHDI_SYNC_MASTER} =
               ($self->{DESCRIPTION} =~ /\(MASTER\)/) ? 1 : 0;

Generate

Unpack and copy the /etc/dahdi samples into /etc/dahdi

gunzip /usr/share/doc/dahdi/examples/genconf_parameters.gz
gunzip /usr/share/doc/dahdi/examples/system.conf.sample.gz
cp /usr/share/doc/dahdi/examples/system.conf.sample /etc/dahdi/system.conf
cp /usr/share/doc/dahdi/examples/genconf_parameters /etc/dahdi/ 

You can now start dahdi

/etc/init.d/dahdi start

Now you can run genconf

dahdi_genconf 
dahdi_genconf modules

At this point, you will need to examine the generated /etc/dahdi/system.conf and remove any empty lines in it. Here's ours

# Autogenerated by /usr/sbin/dahdi_genconf on Mon Feb 17 12:34:10 2014
# If you edit this file and execute /usr/sbin/dahdi_genconf again,
# your manual changes will be LOST.
# Dahdi Configuration File
#
# This file is parsed by the Dahdi Configurator, dahdi_cfg
#
# Global data

loadzone        = us
defaultzone     = us