[dahdi-commits] tzafrir: tools/trunk r4767 - /tools/trunk/xpp/perl_modules/Dahdi/Chans.pm
SVN commits to the DAHDI project
dahdi-commits at lists.digium.com
Tue Aug 12 07:59:20 CDT 2008
Author: tzafrir
Date: Tue Aug 12 07:59:19 2008
New Revision: 4767
URL: http://svn.digium.com/view/dahdi?view=rev&rev=4767
Log:
Dahdi-perl: More robust parsing of channel signalling types.
Use a list of signalling types rather than a regular experssion of a
"word".
Modified:
tools/trunk/xpp/perl_modules/Dahdi/Chans.pm
Modified: tools/trunk/xpp/perl_modules/Dahdi/Chans.pm
URL: http://svn.digium.com/view/dahdi/tools/trunk/xpp/perl_modules/Dahdi/Chans.pm?view=diff&rev=4767&r1=4766&r2=4767
==============================================================================
--- tools/trunk/xpp/perl_modules/Dahdi/Chans.pm (original)
+++ tools/trunk/xpp/perl_modules/Dahdi/Chans.pm Tue Aug 12 07:59:19 2008
@@ -61,6 +61,30 @@
=cut
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";
@@ -81,7 +105,7 @@
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 @@
push(@alarms, $1);
}
}
- if($rest =~ s/^\s*(\w+)\s*//) {
- $signalling = $1;
- }
- die "Unrecognized garbage '$rest' in $fqn\n"
+ foreach my $sig (@sigtypes) {
+ if($rest =~ s/^\Q$sig\E//) {
+ $signalling = $sig;
+ last;
+ }
+ }
+ warn "Unrecognized garbage '$rest' in $fqn\n"
if length($rest);
}
$self->{NUM} = $num;
More information about the dahdi-commits
mailing list