Debian DAHDI

From sailpbx
Revision as of 11:51, 23 April 2016 by Adminwiki (talk | contribs) (Install)
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, probably because it is so easy and obvious if you are a Deb devotee. Anyhow, for the rest of us, here's a little howto.

The correct "Debian way" to install driver modules uses Debian's module assistant. What it will do is drag the source code from the libraries, compile it, package it into a deb and install it, all on-the-fly. (if you are curious, you can find the deb which it builds in /usr/src/ after the module assistant has finished its machinations). 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). If you don't intend to install SAIL, then install Asterisk and asterisk-dahdi in the normal manner (using aptitude or apt-get). Run the module assistant as follows;

apt-get install dahdi-source

Wait for it to finish downloading and run the module assistant

m-a a-i dahdi

This will chug along for a while. When it finishes, DAHDI will be installed but you have a little further work to do.

===Debian 7 (Wheezy)

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 or Asterisk won't be able to load chan_dahdi.

These commands will change it to GROUP="asterisk" and restart udev

cp /lib/udev/rules.d/60-dahdi-linux.rules /etc/udev/rules.d
sed -i 's/GROUP="dialout"/GROUP="asterisk"/' /etc/udev/rules.d/60-dahdi-linux.rules
/etc/init.d/udev reload

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 (the target module 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 232 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

NOTE for BRI cards

If you are using Cologne BRI cards (from Digium, OpenVox etc) DAHDI BRI drivers won't load properly because the kernel will load incorrect drivers. To stop this happening you must blacklist that driver set. Open or create /etc/modprobe.d/cologne-blacklist.conf and add the following

blacklist avmfritz
blacklist hfcmulti
blacklist hfcpci
blacklist hfcsusb
blacklist mISDNinfineon
blacklist mISDNipac
blacklist mISDNisar
blacklist speedfax
blacklist w6692

Save it and reboot the box.

Card setup

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 system.conf or dahdi_channels.conf which DAHDI doesn't like. Remove them and start dahdi normally.

Also, for some reason; chan_dahdi.conf does not seem to include dahdi-channels so you may have to append the include

echo '#include dahdi-channels.conf' >> /etc/asterisk/chan_dahdi.conf

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

chown asterisk:asterisk /etc/dahdi/*
chmod 664 /etc/dahdi/*
chown asterisk:asterisk /etc/asterisk/*
chmod 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.