summaryrefslogtreecommitdiff
path: root/kernel/xpp/utils/zconf/Zaptel/Config/Gen/Zaptel.pm
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/xpp/utils/zconf/Zaptel/Config/Gen/Zaptel.pm')
-rw-r--r--kernel/xpp/utils/zconf/Zaptel/Config/Gen/Zaptel.pm47
1 files changed, 36 insertions, 11 deletions
diff --git a/kernel/xpp/utils/zconf/Zaptel/Config/Gen/Zaptel.pm b/kernel/xpp/utils/zconf/Zaptel/Config/Gen/Zaptel.pm
index 2c30c33..892442f 100644
--- a/kernel/xpp/utils/zconf/Zaptel/Config/Gen/Zaptel.pm
+++ b/kernel/xpp/utils/zconf/Zaptel/Config/Gen/Zaptel.pm
@@ -39,11 +39,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,
@@ -54,14 +49,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", Zaptel::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", Zaptel::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", Zaptel::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", Zaptel::Config::Gen::bchan_range($span);
+ printf "dchan=%d\n", $span->dchan()->num();
+ }
+ } else {
+ die "Digital span $num is not BRI, nor PRI?";
}
}
@@ -100,7 +123,9 @@ sub generate($$$) {
print "Generating $file\n" if $genopts->{verbose};
open(F, ">$file") || die "$0: Failed to open $file: $!\n";
my $old = select F;
- printf "# Autogenerated by %s on %s -- do not hand edit\n", $0, scalar(localtime);
+ printf "# Autogenerated by $0 on %s\n", scalar(localtime);
+ print "# If you edit this file and execute $0 again,\n";
+ print "# your manual changes will be LOST.\n";
print <<"HEAD";
# Zaptel Configuration File
#