From ed38d8829eb28229ae6cb0e881f1374d55302221 Mon Sep 17 00:00:00 2001 From: Tzafrir Cohen Date: Tue, 19 May 2009 16:46:06 +0000 Subject: dahdi-perl: make dahdi_genconf default to hardhdlc dahdi_genconf's 'bri_hardhdlc' parameter changes. Should generally work with no need for manual configuration unless you use a bristuffed driver (zaphfc, qozap). See notes in genconf_parameters. git-svn-id: http://svn.asterisk.org/svn/dahdi/tools/trunk@6647 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- xpp/perl_modules/Dahdi/Config/Gen/System.pm | 43 ++++++++++++++++++++------- xpp/perl_modules/Dahdi/Config/Gen/Xpporder.pm | 1 + xpp/perl_modules/Dahdi/Config/Params.pm | 2 +- 3 files changed, 35 insertions(+), 11 deletions(-) (limited to 'xpp/perl_modules/Dahdi/Config') diff --git a/xpp/perl_modules/Dahdi/Config/Gen/System.pm b/xpp/perl_modules/Dahdi/Config/Gen/System.pm index 6ec705f..3f9217b 100644 --- a/xpp/perl_modules/Dahdi/Config/Gen/System.pm +++ b/xpp/perl_modules/Dahdi/Config/Gen/System.pm @@ -48,11 +48,6 @@ sub gen_digital($$) { $span_crc4 = ''; $framing = 'cas'; } - my $dchan_type = 'dchan'; - if ($span->is_bri() && is_true($gconfig->{'bri_hardhdlc'})) { - $dchan_type = 'hardhdlc'; - } - $timing = ($termtype eq 'NT') ? 0 : $bri_te_last_timing++; printf "span=%d,%d,%d,%s,%s%s%s\n", $num, @@ -63,14 +58,42 @@ sub gen_digital($$) { $span_crc4, $span_yellow; printf "# termtype: %s\n", lc($termtype); - if ($gconfig->{'pri_connection_type'} eq 'PRI') { + my $dchan_type; + if ($span->is_bri()) { + my $use_bristuff = 0; + my $cfg_hardhdlc = $gconfig->{'bri_hardhdlc'}; + my $xpd = $span->xpd(); + if(!defined($cfg_hardhdlc) || $cfg_hardhdlc =~ /AUTO/i) { + # Autodetect + if(defined($xpd)) { + # Bristuff? + if(defined($xpd->dchan_hardhdlc) && !is_true($xpd->dchan_hardhdlc)) { + $use_bristuff = 1; + } + } + } elsif(!is_true($cfg_hardhdlc)) { + $use_bristuff = 1; + } + if($use_bristuff) { + $dchan_type = 'dchan'; + } else { + $dchan_type = 'hardhdlc'; + } printf "bchan=%s\n", Dahdi::Config::Gen::bchan_range($span); my $dchan = $span->dchan(); printf "$dchan_type=%d\n", $dchan->num(); - } elsif ($gconfig->{'pri_connection_type'} eq 'R2' ) { - my $idle_bits = $gconfig->{'r2_idle_bits'}; - printf "cas=%s:$idle_bits\n", Dahdi::Config::Gen::bchan_range($span); - printf "dchan=%d\n", $span->dchan()->num(); + } elsif($span->is_pri()) { + if ($gconfig->{'pri_connection_type'} eq 'PRI') { + printf "bchan=%s\n", Dahdi::Config::Gen::bchan_range($span); + my $dchan = $span->dchan(); + printf "dchan=%d\n", $dchan->num(); + } elsif ($gconfig->{'pri_connection_type'} eq 'R2' ) { + my $idle_bits = $gconfig->{'r2_idle_bits'}; + printf "cas=%s:$idle_bits\n", Dahdi::Config::Gen::bchan_range($span); + printf "dchan=%d\n", $span->dchan()->num(); + } + } else { + die "Digital span $num is not BRI, nor PRI?"; } print_echo_can($gconfig, Dahdi::Config::Gen::bchan_range($span)); } diff --git a/xpp/perl_modules/Dahdi/Config/Gen/Xpporder.pm b/xpp/perl_modules/Dahdi/Config/Gen/Xpporder.pm index 208fcfa..a98f912 100644 --- a/xpp/perl_modules/Dahdi/Config/Gen/Xpporder.pm +++ b/xpp/perl_modules/Dahdi/Config/Gen/Xpporder.pm @@ -2,6 +2,7 @@ package Dahdi::Config::Gen::Xpporder; use strict; use Dahdi::Config::Gen qw(is_true); +use Dahdi::Xpp; sub new($$$) { my $pack = shift || die; diff --git a/xpp/perl_modules/Dahdi/Config/Params.pm b/xpp/perl_modules/Dahdi/Config/Params.pm index 2ff2a0e..816b5c1 100644 --- a/xpp/perl_modules/Dahdi/Config/Params.pm +++ b/xpp/perl_modules/Dahdi/Config/Params.pm @@ -106,7 +106,7 @@ sub item($$) { brint_overlap => 'no', bri_sig_style => 'bri_ptmp', echo_can => 'mg2', - bri_hardhdlc => 'no', + bri_hardhdlc => 'auto', pri_connection_type => 'PRI', r2_idle_bits => '1101', 'pri_termtype' => [ 'SPAN/* TE' ], -- cgit v1.2.3