Debian DAHDI

From sailpbx
Revision as of 12:29, 17 February 2014 by Adminwiki (talk | contribs) (Generate)
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.

Tailor/fix

For some reason, the install puts DAHDI into a strange group ("dialout") in the udev rules.

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

Edit the file and change it to GROUP="asterisk"

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 you wish. At, or around line 230 in /usr/share/perl5/Dahdi/Span.pm you will find the following 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

dahdi_cfg
/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 file