diff options
author | Tzafrir Cohen <tzafrir.cohen@xorcom.com> | 2009-05-19 16:46:06 +0000 |
---|---|---|
committer | Tzafrir Cohen <tzafrir.cohen@xorcom.com> | 2009-05-19 16:46:06 +0000 |
commit | ed38d8829eb28229ae6cb0e881f1374d55302221 (patch) | |
tree | d830fb98493f4fae8b839c441ec1d68861471ee2 /xpp/perl_modules/Dahdi/Config/Gen/System.pm | |
parent | 096417e3731173f0a70625d413b4d68a449adec1 (diff) |
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
Diffstat (limited to 'xpp/perl_modules/Dahdi/Config/Gen/System.pm')
-rw-r--r-- | xpp/perl_modules/Dahdi/Config/Gen/System.pm | 43 |
1 files changed, 33 insertions, 10 deletions
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)); } |