diff options
Diffstat (limited to 'xpp/utils/xpp_sync')
-rwxr-xr-x | xpp/utils/xpp_sync | 71 |
1 files changed, 22 insertions, 49 deletions
diff --git a/xpp/utils/xpp_sync b/xpp/utils/xpp_sync index 3647fba..80b61c7 100755 --- a/xpp/utils/xpp_sync +++ b/xpp/utils/xpp_sync @@ -38,9 +38,8 @@ sub get_sorted_xpds() { push(@good_xpds, $xpd); } } - - my @pri_nt_xpds = grep { $_->type eq 'PRI_NT'; } @good_xpds; - my @pri_te_xpds = grep { $_->type eq 'PRI_TE'; } @good_xpds; + my @pri_nt_xpds = grep { $_->type =~ /(E1|T1|J1)_NT/; } @good_xpds; + my @pri_te_xpds = grep { $_->type =~ /(E1|T1|J1)_TE/; } @good_xpds; my @bri_nt_xpds = grep { $_->type eq 'BRI_NT'; } @good_xpds; my @bri_te_xpds = grep { $_->type eq 'BRI_TE'; } @good_xpds; my @fxo_xpds = grep { $_->type eq 'FXO'; } @good_xpds; @@ -74,10 +73,6 @@ sub do_select(@) { print STDERR "Failed to set $busnum: $!\n"; } } - if(!$found) { - print STDERR "Fall back to HOST sync\n"; - die "Failed to set HOST sync\n" unless Zaptel::Xpp::sync('HOST'); - } } sub do_set($) { @@ -97,33 +92,12 @@ my @sync_xpds = unique_xbus(get_sorted_xpds()); sub show_sync() { foreach my $xpd (@sync_xpds) { my $xbus = $xpd->xbus; - my @xpds = $xbus->xpds; - my @types = map { $_->type } @xpds; + my $xpdstr = '[ ' . $xbus->pretty_xpds . ' ]'; + my $label = '[' . $xbus->label() . ']'; + my $connector = '(' . $xbus->connector . ')'; my $mark = ($curr_sync =~ /\d+/ and $xbus->num == $curr_sync)?"+":""; - my $xpdstr = ''; - my @xpd_types = map { $_->type } sort { $a->num <=> $b->num } @xpds; - my $last_type = ''; - my $mult = 0; - foreach my $curr (@xpd_types) { - if(!$last_type || ($curr eq $last_type)) { - $mult++; - } else { - if($mult == 1) { - $xpdstr .= "$last_type "; - } elsif($mult) { - $xpdstr .= "$last_type*$mult "; - } - $mult = 1; - } - $last_type = $curr; - } - if($mult == 1) { - $xpdstr .= "$last_type "; - } elsif($mult) { - $xpdstr .= "$last_type*$mult "; - } my $padding = ' ' x (40 - length $xpdstr); - printf " %1s %s [ %s]%s (%s)\n", $mark, $xbus->name, $xpdstr, $padding, $xbus->connector; + printf " %1s %s %-25s %-14s %s\n", $mark, $xbus->name, $connector, $label, $xpdstr; } } @@ -134,12 +108,12 @@ sub check_fxo_host_sync() { my @bad_xbus = map { $_->xbus } unique_xbus(@host_synced_fxos); our $lines = join("\n\t", map { $_->name } @bad_xbus); print STDERR <<"END"; -========================================= -WARNING: FXO with HOST SYNC cause bad PCM +================================================== +WARNING: FXO which is not the syncer cause bad PCM Affected Astribanks are: ------------------------------------------ +-------------------------------------------------- $lines -========================================= +================================================== END } } @@ -177,7 +151,7 @@ other Astribank devices. When run without parameters, xpp_sync will display a list of Astribanks (xbuses) that are connected and registered as Zaptel spans. The current -xpp sync master will be marked (if it is not HOST). +xpp sync master will be marked. If you this an Astribank is connected and yet it does not appear on the output of xpp_sync, it may be unregistered. Try running zt_registration . @@ -188,11 +162,7 @@ output of xpp_sync, it may be unregistered. Try running zt_registration . =item auto -Automatically selects the best Astribank for syncing (with HOST fallback). - -=item host - -Set HOST synchronization (XPP timers). +Automatically selects the best Astribank for syncing. =item nn @@ -202,14 +172,17 @@ Set XBUS number nn as sync source. =head2 Example output: - Current sync: 02 + Setting SYNC + Current sync: 01 Best Available Syncers: - + XBUS-02 [ FXS*3 FXO ] (usb-0000:00:1d.7-3) - XBUS-04 [ FXS*4 ] (usb-0000:00:1d.7-1) - XBUS-03 [ FXS*4 ] (usb-0000:00:1d.7-2) - XBUS-01 [ FXS*4 ] (usb-0000:00:1d.7-4) - XBUS-00 [ FXS*4 ] (usb-0000:00:1d.7-5) - XBUS-05 [ FXS*4 ] (usb-0000:00:1d.7-6) + + XBUS-01 (usb-0000:00:10.4-3) [usb:12345678] [ PRI_TE PRI_NT PRI_TE PRI_NT ] + XBUS-00 (usb-0000:00:10.4-2) [usb:QA-01] [ FXS FXO ] + ================================================== + WARNING: FXO which is not the syncer cause bad PCM + Affected Astribanks are: + -------------------------------------------------- + XBUS-00 + ================================================== In this example we see that the recommended xpp sync master is XBUS-02 - it is the first on the list. It is also the actual syncer, as we can see |