From f46df849da266ecf921871efb6a21108f8da8c32 Mon Sep 17 00:00:00 2001 From: Tzafrir Cohen Date: Thu, 16 Jun 2011 09:35:32 +0000 Subject: [PATCH] dahdi_genconf: apply termtype to Digium HA8 BRI Make the pri_termtype setting in genconf_parameters apply to any BRI/PRI carddeclared as "soft NT". ATM, this is only the Xorcom E1/T1 device and the Digium HA8 (BRI) module of the TDM card. Signed-off-by: Tzafrir Cohen Acked-by: Shaun Ruffell git-svn-id: http://svn.astersk.org/svn/dahdi/tools/trunk@9979 17933a7a-c749-41c5-a318-cba88f637d49 --- xpp/dahdi_genconf | 2 +- xpp/perl_modules/Dahdi/Span.pm | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/xpp/dahdi_genconf b/xpp/dahdi_genconf index 49b9325..ac0acf9 100755 --- a/xpp/dahdi_genconf +++ b/xpp/dahdi_genconf @@ -38,7 +38,7 @@ sub spans_prep($@) { my $gconfig = shift || die; my @spans = @_; foreach my $span (@spans) { - if($span->is_pri) { + if($span->is_pri || $span->is_bri) { $span->pri_set_fromconfig($gconfig); } } diff --git a/xpp/perl_modules/Dahdi/Span.pm b/xpp/perl_modules/Dahdi/Span.pm index 5e13f04..367ca08 100644 --- a/xpp/perl_modules/Dahdi/Span.pm +++ b/xpp/perl_modules/Dahdi/Span.pm @@ -151,6 +151,11 @@ my @pri_strings = ( 'WP(E1|T1)/.* "wanpipe', # Sangoma E1/T1 ); +my @soft_term_type_strings = ( + 'Xorcom XPD.*: (E1|T1)', # Astribank PRI + '(WCBRI)', # has selectable NT/TE modes via dahdi_cfg +); + our $DAHDI_BRI_NET = 'bri_net'; our $DAHDI_BRI_CPE = 'bri_cpe'; @@ -196,6 +201,7 @@ sub new($$) { $self->{TYPE} = "BRI_$termtype"; $self->{DCHAN_IDX} = 2; $self->{BCHAN_LIST} = [ 0, 1 ]; + $self->init_proto('BRI'); last; } } @@ -217,6 +223,13 @@ sub new($$) { last; } } + $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; @@ -305,7 +318,11 @@ sub set_termtype($$) { my $span = shift || die; my $termtype = shift || die; $span->{TERMTYPE} = $termtype; - $span->{SIGNALLING} = ($termtype eq 'NT') ? $DAHDI_PRI_NET : $DAHDI_PRI_CPE ; + if ($span->is_pri) { + $span->{SIGNALLING} = ($termtype eq 'NT') ? $DAHDI_PRI_NET : $DAHDI_PRI_CPE ; + } elsif ($span->is_bri) { + $span->{SIGNALLING} = ($termtype eq 'NT') ? $DAHDI_BRI_NET : $DAHDI_BRI_CPE ; + } $span->{TYPE} = $span->proto . "_$termtype"; } @@ -313,6 +330,7 @@ sub pri_set_fromconfig($$) { my $span = shift || die; my $genconf = shift || die; my $name = $span->name; + return unless $span->is_soft_term_type; # if(defined $termtype) { # die "Termtype for $name already defined as $termtype\n"; # }