+ }
+ return;
+ }
+
+ } elsif ($sort eq 'K') {
+ # remember the last channel we arrived on
+ $parent->PC92C_dxchan($self->{call}) unless $self->{call} eq $parent->call;
+
+ my @ent = _decode_pc92_call($_[4]);
+
+ if (@ent) {
+ my $add;
+
+ ($parent, $add) = $self->pc92_handle_first_slot(\@ent, $parent, $t);
+ return unless $parent; # dupe
+
+ push @radd, $add if $add;
+ $parent->reset_obs;
+ dbg("ROUTE: reset obscount on $parent->{call} now " . $parent->obscount) if isdbg('obscount');
+ }
+ } elsif ($sort eq 'A' || $sort eq 'D' || $sort eq 'C') {
+
+ # remember the last channel we arrived on
+ $parent->PC92C_dxchan($self->{call}) unless $self->{call} eq $parent->call;
+
+ # this is the main route section
+ # here is where all the routes are created and destroyed
+
+ # cope with missing duplicate node calls in the first slot for A or D
+ my $me = $_[4] || '';
+ if (($sort eq 'A' || $sort eq 'D')) {
+ $me ||= _encode_pc92_call($parent) unless $me ;
+ } else {
+ unless ($me) {
+ dbg("PCPROT: this type of PC92 *must* have a node call in the first slot, ignored") if is_dbg('chanerr');
+ return;
+ }
+ }
+
+ my @ent = map {my @a = _decode_pc92_call($_); @a ? \@a : ()} grep {$_ && /^[0-7]/} $me, @_[5 .. $#_];
+
+ if (@ent) {
+
+ # look at the first one which will always be a node of some sort
+ # except in the case of 'A' or 'D' in which the $pcall is used
+ # otherwise use the node call and update any information
+ # that needs to be done.
+ my $add;
+
+ ($parent, $add) = $self->pc92_handle_first_slot($ent[0], $parent, $t);
+ return unless $parent; # dupe
+
+ shift @ent;
+ push @radd, $add if $add;
+ }
+
+ # do a pass through removing any references to either locally connected nodes or mycall
+ my @nent;
+ for (@ent) {
+ next unless $_ && @$_;
+ if ($_->[0] eq $main::mycall || DXChannel::get($_->[0])) {
+ dbg("PCPROT: $_->[0] refers to locally connected node, ignored") if isdbg('chanerr');
+ next;
+ }
+ push @nent, $_;
+ }
+
+ if ($sort eq 'A') {
+ for (@nent) {
+ push @radd, _add_thingy($parent, $_);
+ }
+ } elsif ($sort eq 'D') {
+ for (@nent) {
+ push @rdel, _del_thingy($parent, $_);
+ }
+ } elsif ($sort eq 'C') {
+ my (@nodes, @users);
+
+ # we reset obscounts on config records as well as K records
+ $parent->reset_obs;
+ dbg("ROUTE: reset obscount on $parent->{call} now " . $parent->obscount) if isdbg('obscount');
+
+ #
+ foreach my $r (@nent) {
+ # my ($call, $is_node, $is_extnode, $here, $version, $build) = _decode_pc92_call($_);
+ if ($r->[0]) {
+ if ($r->[1]) {
+ push @nodes, $r->[0];
+ } else {
+ push @users, $r->[0];
+ }
+ } else {
+ dbg("PCPROT: pc92 call entry '$_' not decoded, ignored") if isdbg('chanerr');