[zaptel-commits] tzafrir: branch 1.4 r4476 - in /branches/1.4: ./ kernel/xpp/utils/zconf/Zaptel/

SVN commits to the Zaptel project zaptel-commits at lists.digium.com
Tue Aug 12 08:11:53 CDT 2008


Author: tzafrir
Date: Tue Aug 12 08:11:52 2008
New Revision: 4476

URL: http://svn.digium.com/view/zaptel?view=rev&rev=4476
Log:
Zaptel-perl: more robust parsing of channel signalling types.

Parse them from a list rather thna fusing a regex of a "word".

Merged revisions 4475 via svnmerge from 
http://svn.digium.com/svn/zaptel/branches/1.2

Modified:
    branches/1.4/   (props changed)
    branches/1.4/kernel/xpp/utils/zconf/Zaptel/Chans.pm

Propchange: branches/1.4/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Modified: branches/1.4/kernel/xpp/utils/zconf/Zaptel/Chans.pm
URL: http://svn.digium.com/view/zaptel/branches/1.4/kernel/xpp/utils/zconf/Zaptel/Chans.pm?view=diff&rev=4476&r1=4475&r2=4476
==============================================================================
--- branches/1.4/kernel/xpp/utils/zconf/Zaptel/Chans.pm (original)
+++ branches/1.4/kernel/xpp/utils/zconf/Zaptel/Chans.pm Tue Aug 12 08:11:52 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