[zaptel-commits] tzafrir: branch 1.2 r4475 - /branches/1.2/xpp/utils/zconf/Zaptel/Chans.pm
SVN commits to the Zaptel project
zaptel-commits at lists.digium.com
Tue Aug 12 08:05:48 CDT 2008
Author: tzafrir
Date: Tue Aug 12 08:05:47 2008
New Revision: 4475
URL: http://svn.digium.com/view/zaptel?view=rev&rev=4475
Log:
Zaptel-perl: more robust parsing of channel signalling types.
Parse them from a list rather thna fusing a regex of a "word".
Modified:
branches/1.2/xpp/utils/zconf/Zaptel/Chans.pm
Modified: branches/1.2/xpp/utils/zconf/Zaptel/Chans.pm
URL: http://svn.digium.com/view/zaptel/branches/1.2/xpp/utils/zconf/Zaptel/Chans.pm?view=diff&rev=4475&r1=4474&r2=4475
==============================================================================
--- branches/1.2/xpp/utils/zconf/Zaptel/Chans.pm (original)
+++ branches/1.2/xpp/utils/zconf/Zaptel/Chans.pm Tue Aug 12 08:05:47 2008
@@ -61,6 +61,29 @@
=cut
my @alarm_types = qw(BLUE YELLOW RED LOOP RECOVERING NOTOPEN);
+
+# Taken from zaptel-base.c
+my @sigtypes = (
+ "FXSLS",
+ "FXSKS",
+ "FXSGS",
+ "FXOLS",
+ "FXOKS",
+ "FXOGS",
+ "E&M",
+ "E&M-E1",
+ "Clear",
+ "HDLCRAW",
+ "HDLCFCS",
+ "HDLCNET",
+ "Hardware-assisted HDLC",
+ "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 +104,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 +113,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 zaptel-commits
mailing list