Debian DAHDI

From sailpbx
Revision as of 13:10, 17 February 2014 by Adminwiki (talk | contribs)
Jump to: navigation, search

back to SARK v4.0.0 contents

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.

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/ 

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 Debian). 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

DAHDI should already be started (after the reboot above) but if it isn't, you can start it now.

/etc/init.d/dahdi start

Now you can run genconf

dahdi_genconf 
dahdi_genconf modules
/etc/init.d/dahdi restart

You may find that the restart fails. This seems to be because genconf sometimes puts blank lines into dahdi_channels.conf which DAHDI doesn't like. Remove them and start dahdi normally.

Last of all, if you are running SARK, we need to set the perms so that SARK(Apache) can get at the generated files

chown -R asterisk:asterisk /etc/dahdi
chown -R asterisk:asterisk /etc/asterisk
chmod -R 664 /etc/dahdi
chown -R 664 /etc/asterisk

If you are just running regular Asterisk or perhaps another workbench tool then you will need to configure /etc/dahdi/system, /etc/asterisk/dahdi_channels.conf and /etc/asterisk/chan_dahdi.conf to your taste.