summaryrefslogtreecommitdiff
path: root/xpp/utils/zconf/Zaptel
diff options
context:
space:
mode:
Diffstat (limited to 'xpp/utils/zconf/Zaptel')
-rw-r--r--xpp/utils/zconf/Zaptel/Chans.pm15
-rw-r--r--xpp/utils/zconf/Zaptel/Config/Defaults.pm29
-rw-r--r--xpp/utils/zconf/Zaptel/Hardware.pm8
-rw-r--r--xpp/utils/zconf/Zaptel/Hardware/PCI.pm1
-rw-r--r--xpp/utils/zconf/Zaptel/Span.pm34
5 files changed, 84 insertions, 3 deletions
diff --git a/xpp/utils/zconf/Zaptel/Chans.pm b/xpp/utils/zconf/Zaptel/Chans.pm
index eef922f..f50d212 100644
--- a/xpp/utils/zconf/Zaptel/Chans.pm
+++ b/xpp/utils/zconf/Zaptel/Chans.pm
@@ -39,6 +39,21 @@ sub new($$$$$$) {
my $type;
if($fqn =~ m|\bXPP_(\w+)/.*$|) {
$type = $1; # One of our AB
+ } elsif ($fqn =~ m{\b(TE[24]|WCT1|Tor2|TorISA|WP[TE]1|cwain[12])/.*}) {
+ # TE[24]: Digium wct4xxp
+ # WCT1: Digium single span card drivers?
+ # Tor2: Tor PCI cards
+ # TorISA: ISA ones (still used?)
+ # WP[TE]1: Sangoma. TODO: this one tells us if it is TE or NT.
+ # cwain: Junghanns E1 card.
+ $type = "PRI";
+ } elsif ($fqn =~ m{\b(ZTHFC%d*|ztqoz\d*)/.*}) {
+ # ZTHFC: HFC-s single-port card (zaphfc/vzaphfc)
+ # ztqoz: qozap (Junghanns) multi-port HFC card
+ $type = "BRI";
+ } elsif ($fqn =~ m{\bztgsm/.*}) {
+ # Junghanns GSM card
+ $type = "GSM";
} elsif(defined $signalling) {
$type = 'FXS' if $signalling =~ /^FXS/;
$type = 'FXO' if $signalling =~ /^FXO/;
diff --git a/xpp/utils/zconf/Zaptel/Config/Defaults.pm b/xpp/utils/zconf/Zaptel/Config/Defaults.pm
new file mode 100644
index 0000000..90b49ab
--- /dev/null
+++ b/xpp/utils/zconf/Zaptel/Config/Defaults.pm
@@ -0,0 +1,29 @@
+package Zaptel::Config::Defaults;
+#
+# Written by Oron Peled <oron@actcom.co.il>
+# Copyright (C) 2007, Xorcom
+# This program is free software; you can redistribute and/or
+# modify it under the same terms as Perl itself.
+#
+# $Id$
+#
+use strict;
+
+# Use the shell to source a file and expand a given list
+# of variables.
+sub do_source($@) {
+ my $file = shift;
+ my @vars = @_;
+ my @output = `env -i sh -ec '. $file; export @vars; env'`;
+ die "$0: Sourcing '$file' exited with $?" if $?;
+ my %vars;
+
+ foreach my $line (@output) {
+ chomp $line;
+ my ($k, $v) = split(/=/, $line, 2);
+ $vars{$k} = $v if grep /^$k$/, @vars;
+ }
+ return %vars;
+}
+
+1;
diff --git a/xpp/utils/zconf/Zaptel/Hardware.pm b/xpp/utils/zconf/Zaptel/Hardware.pm
index 321292a..39305fb 100644
--- a/xpp/utils/zconf/Zaptel/Hardware.pm
+++ b/xpp/utils/zconf/Zaptel/Hardware.pm
@@ -34,7 +34,11 @@ sub devices($) {
return @zaptel_devices;
}
-Zaptel::Hardware::USB->scan_devices;
-Zaptel::Hardware::PCI->scan_devices;
+sub scan_hardware($) {
+ my $pack = shift || die;
+
+ Zaptel::Hardware::USB->scan_devices;
+ Zaptel::Hardware::PCI->scan_devices;
+}
1;
diff --git a/xpp/utils/zconf/Zaptel/Hardware/PCI.pm b/xpp/utils/zconf/Zaptel/Hardware/PCI.pm
index c6731dc..48fa810 100644
--- a/xpp/utils/zconf/Zaptel/Hardware/PCI.pm
+++ b/xpp/utils/zconf/Zaptel/Hardware/PCI.pm
@@ -11,6 +11,7 @@ use strict;
use Zaptel::Hardware;
my @idlist = qw(
+ 0B0B:0206
1397:16B8
1397:08B4
1057:5608
diff --git a/xpp/utils/zconf/Zaptel/Span.pm b/xpp/utils/zconf/Zaptel/Span.pm
index 8496910..47a5a56 100644
--- a/xpp/utils/zconf/Zaptel/Span.pm
+++ b/xpp/utils/zconf/Zaptel/Span.pm
@@ -46,28 +46,51 @@ my @bri_strings = (
'HFC-S PCI A ISDN.* \[(NT|TE)\] '
);
+my @pri_strings = (
+ 'PRI_(NT|TE)'
+ );
+
our $ZAPBRI_NET = 'bri_net';
our $ZAPBRI_CPE = 'bri_cpe';
+our $ZAPPRI_NET = 'pri_net';
+our $ZAPPRI_CPE = 'pri_cpe';
+
sub new($$) {
my $pack = shift or die "Wasn't called as a class method\n";
my $num = shift or die "Missing a span number parameter\n";
my $self = { NUM => $num };
bless $self, $pack;
+ $self->{TYPE} = "UNKNOWN";
open(F, "$proc_base/$num") or die "Failed to open '$proc_base/$num\n";
my $head = <F>;
chomp $head;
foreach my $cardtype (@bri_strings) {
if($head =~ m/$cardtype/) {
+ $self->{IS_DIGITAL} = 1;
$self->{IS_BRI} = 1;
$self->{TERMTYPE} = $1;
+ $self->{TYPE} = "BRI_$1";
$self->{DCHAN_IDX} = 2;
$self->{BCHAN_LIST} = [ 0, 1 ];
last;
}
}
+ foreach my $cardtype (@pri_strings) {
+ if($head =~ m/$cardtype/) {
+ $self->{IS_DIGITAL} = 1;
+ $self->{IS_PRI} = 1;
+ $self->{TERMTYPE} = $1;
+ $self->{TYPE} = "PRI_$1";
+ {
+ $self->{DCHAN_IDX} = 15; # Depends on E1/T1/J1
+ $self->{BCHAN_LIST} = [ 0 .. 14, 16 .. 30 ];
+ }
+ last;
+ }
+ }
die "$0: Unkown TERMTYPE [NT/TE]\n"
- if $self->is_bri and !defined $self->{TERMTYPE};
+ if $self->is_digital and !defined $self->{TERMTYPE};
($self->{NAME}, $self->{DESCRIPTION}) = (split(/\s+/, $head, 4))[2, 3];
$self->{IS_ZAPTEL_SYNC_MASTER} =
($self->{DESCRIPTION} =~ /\(MASTER\)/) ? 1 : 0;
@@ -99,6 +122,15 @@ sub new($$) {
$self->{SIGNALLING} = 'gsm';
}
}
+ if($self->is_pri()) {
+ $self->{DCHAN} = ($self->chans())[$self->{DCHAN_IDX}];
+ $self->{BCHANS} = [ ($self->chans())[@{$self->{BCHAN_LIST}}] ];
+ $self->{CODING} = 'hdb3';
+ $self->{YELLOW} = undef;
+ $self->{FRAMING} = 'ccs';
+ $self->{SIGNALLING} = ($self->{TERMTYPE} eq 'NT') ? $ZAPPRI_NET : $ZAPPRI_CPE ;
+ $self->{SWITCHTYPE} = 'euroisdn';
+ }
return $self;
}