Debian DAHDI

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

back to SARK Main Page

Background

There isn't a great deal of documentation on how to install Digium's DAHDI component onto Debian.

The "Debian way" to install driver components uses a tool call m-a a-i. What it will do is drag the source code from the libraries, compile it an then build an installable deb on-the-fly. Here's how you use it. 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

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

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

        $self->{IS_SOFT_TERM_TYPE} = 0;
        foreach my $cardtype (@soft_term_type_strings) {
                if($head =~ m/$cardtype/) {
                        $self->{IS_SOFT_TERM_TYPE} = 1;
                        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

        $self->{IS_SOFT_TERM_TYPE} = 0;
        foreach my $cardtype (@soft_term_type_strings) {
                if($head =~ m/$cardtype/) {
                        $self->{IS_SOFT_TERM_TYPE} = 1;
                        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;