summaryrefslogtreecommitdiff
path: root/xpp/perl_modules/Dahdi/Chans.pm
diff options
context:
space:
mode:
authorTzafrir Cohen <tzafrir.cohen@xorcom.com>2008-08-12 12:59:19 +0000
committerTzafrir Cohen <tzafrir.cohen@xorcom.com>2008-08-12 12:59:19 +0000
commitc3b406cc3fd13be93d935a3ac2f5c37dbb05f8e5 (patch)
tree3c29b4cb68ed46c9d8bef57b25847f170626fd2a /xpp/perl_modules/Dahdi/Chans.pm
parent2fdffda1d2950e14be0563616377c2697a05e3e9 (diff)
Dahdi-perl: More robust parsing of channel signalling types.
Use a list of signalling types rather than a regular experssion of a "word". git-svn-id: http://svn.asterisk.org/svn/dahdi/tools/trunk@4767 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'xpp/perl_modules/Dahdi/Chans.pm')
-rw-r--r--xpp/perl_modules/Dahdi/Chans.pm35
1 files changed, 31 insertions, 4 deletions
diff --git a/xpp/perl_modules/Dahdi/Chans.pm b/xpp/perl_modules/Dahdi/Chans.pm
index 86a4da6..b7e54cc 100644
--- a/xpp/perl_modules/Dahdi/Chans.pm
+++ b/xpp/perl_modules/Dahdi/Chans.pm
@@ -62,6 +62,30 @@ Returns the type of the channel: 'FXS', 'FXO', 'EMPTY', etc.
my @alarm_types = qw(BLUE YELLOW RED LOOP RECOVERING NOTOPEN);
+# Taken from dahdi-base.c
+my @sigtypes = (
+ "FXSLS",
+ "FXSKS",
+ "FXSGS",
+ "FXOLS",
+ "FXOKS",
+ "FXOGS",
+ "E&M",
+ "E&M-E1",
+ "Clear",
+ "HDLCRAW",
+ "HDLCFCS",
+ "HDLCNET",
+ "Hardware-assisted HDLC",
+ "MTP2",
+ "Slave",
+ "CAS",
+ "DACS",
+ "DACS+RBS",
+ "SF (ToneOnly)",
+ "Unconfigured"
+ );
+
sub new($$$$$$) {
my $pack = shift or die "Wasn't called as a class method\n";
my $span = shift or die "Missing a span parameter\n";
@@ -81,7 +105,7 @@ sub new($$$$$$) {
my $info = '';
if(defined $rest) {
# remarks in parenthesis (In use), (no pcm)
- while($rest =~ s/(\([^)]+\))\s*//) {
+ while($rest =~ s/\s*(\([^)]+\))\s*//) {
$info .= " $1";
}
# Alarms
@@ -90,10 +114,13 @@ sub new($$$$$$) {
push(@alarms, $1);
}
}
- if($rest =~ s/^\s*(\w+)\s*//) {
- $signalling = $1;
+ foreach my $sig (@sigtypes) {
+ if($rest =~ s/^\Q$sig\E//) {
+ $signalling = $sig;
+ last;
+ }
}
- die "Unrecognized garbage '$rest' in $fqn\n"
+ warn "Unrecognized garbage '$rest' in $fqn\n"
if length($rest);
}
$self->{NUM} = $num;