@@ -0,0 +1,1852 @@
+package org.asteriskjava.pbx.agi;%0A%0Aimport java.util.concurrent.CountDownLatch;%0Aimport java.util.concurrent.TimeUnit;%0A%0Aimport org.asteriskjava.fastagi.AgiChannel;%0Aimport org.asteriskjava.fastagi.AgiException;%0Aimport org.asteriskjava.fastagi.AgiHangupException;%0Aimport org.asteriskjava.pbx.AgiChannelActivityAction;%0Aimport org.asteriskjava.pbx.Channel;%0Aimport org.asteriskjava.util.Log;%0Aimport org.asteriskjava.util.LogFactory;%0A%0A/**%0A * Waits in silence for 10 seconds, then hangs up. This is useful where channels%0A * are waiting for some external action to redirect/bridge them.%0A * %0A * @author rsutton%0A */%0Apublic class AgiChannelActivityTransientHoldSilence implements AgiChannelActivityAction%0A%7B%0A    private final Log logger = LogFactory.getLog(this.getClass());%0A%0A    CountDownLatch latch = new CountDownLatch(1);%0A    volatile boolean callReachedAgi = false;%0A    long timer = System.currentTimeMillis();%0A%0A    @Override%0A    public void execute(AgiChannel channel, Channel ichannel) throws AgiException, InterruptedException%0A    %7B%0A        try%0A        %7B%0A            callReachedAgi = true;%0A            channel.answer();%0A            long secondsOnHold = Math.abs(System.currentTimeMillis() - timer) / 1000;%0A            if (secondsOnHold %3E 8)%0A            %7B%0A                logger.info(ichannel + %22 is still on hold after %22 + secondsOnHold + %22 seconds, Hanging up%22);%0A                channel.hangup();%0A            %7D%0A            else%0A            %7B%0A                latch.await(10, TimeUnit.SECONDS);%0A            %7D%0A        %7D%0A        catch (AgiHangupException e)%0A        %7B%0A            logger.warn(e);%0A        %7D%0A%0A    %7D%0A%0A    @Override%0A    public boolean isDisconnect()%0A    %7B%0A        return false;%0A    %7D%0A%0A    @Override%0A    public void cancel()%0A    %7B%0A        latch.countDown();%0A%0A    %7D%0A%0A    public boolean hasCallReachedAgi()%0A    %7B%0A        return callReachedAgi;%0A    %7D%0A%7D%0A

add short term silent wait activity