diff options
author | tzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2008-08-12 13:11:52 +0000 |
---|---|---|
committer | tzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2008-08-12 13:11:52 +0000 |
commit | 56b0b9b5e9a2ebf43181a2cdc7daee1a47b5cee2 (patch) | |
tree | 773a57d989d6e52d0a34ef2c50a38fc6c9af20f7 /kernel/xpp | |
parent | 399e9527c164aea4ee0dffa88f7b2c0639ce2b4e (diff) |
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
git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.4@4476 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'kernel/xpp')
-rw-r--r-- | kernel/xpp/utils/zconf/Zaptel/Chans.pm | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/kernel/xpp/utils/zconf/Zaptel/Chans.pm b/kernel/xpp/utils/zconf/Zaptel/Chans.pm index aa552a2..38e8a4b 100644 --- a/kernel/xpp/utils/zconf/Zaptel/Chans.pm +++ b/kernel/xpp/utils/zconf/Zaptel/Chans.pm @@ -62,6 +62,29 @@ Returns the type of the channel: 'FXS', 'FXO', 'EMPTY', etc. 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"; my $span = shift or die "Missing a span parameter\n"; @@ -81,7 +104,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 +113,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; |