public void startSweep()
    {
        PeerMonitor.logger.debug("Starting channel mark and sweep"); //$NON-NLS-1$

        // Mark every channel as 'clearing'
        synchronized (PeerMonitor.class)
        {
            for (final Peer peer : this.peerList)
            {
                peer.startSweep();
            }
        }

        /**
         * Request Asterisk to send us a status update for every channel.
         */
        final StatusAction sa = new StatusAction();
        try
        {
            AsteriskPBX pbx = (AsteriskPBX) PBXFactory.getActivePBX();
            pbx.sendAction(sa, 5000);
        }
        catch (final Exception e)
        {
            PeerMonitor.logger.error(e, e);
        }

    }
public void startSweep ( ) { PeerMonitor . logger . debug ( "Starting channel mark and sweep" ) ; synchronized ( PeerMonitor . class ) { for ( final Peer peer : this . peerList ) { peer . startSweep ( ) ; } } final StatusAction sa = new StatusAction ( ) ; try { AsteriskPBX pbx = ( AsteriskPBX ) PBXFactory . getActivePBX ( ) ; pbx . sendAction ( sa , 5000 ) ; } catch ( final Exception e ) { PeerMonitor . logger . error ( e , e ) ; } }
Check every channel to make certain they are still active. We do this in
case we missed a hangup event along the way somewhere. This allows us to
cleanup any old channels. We start by clearing the mark on all channels
and then generates a Asterisk status message for every active channel. At
the end of the process any channels which haven't been marked are then
discarded.