<commit_before>package org.asteriskjava.pbx.agi;

import org.asteriskjava.fastagi.AgiChannel;
import org.asteriskjava.fastagi.AgiException;
import org.asteriskjava.fastagi.AgiHangupException;
import org.asteriskjava.pbx.AgiChannelActivityAction;
import org.asteriskjava.pbx.Channel;
import org.asteriskjava.util.Log;
import org.asteriskjava.util.LogFactory;

public class AgiChannelActivityHoldForBridge implements AgiChannelActivityAction
{
    private final Log logger = LogFactory.getLog(this.getClass());
    private AgiChannelActivityBridge bridgeActivity;

    public AgiChannelActivityHoldForBridge(AgiChannelActivityBridge bridgeActivity)
    {
        this.bridgeActivity = bridgeActivity;
    }

    @Override
    public void execute(AgiChannel channel, Channel ichannel) throws AgiException, InterruptedException
    {
        try
        {
            channel.playMusicOnHold();
            bridgeActivity.sleepWhileBridged();

            channel.hangup();
        }
        catch (AgiHangupException e)
        {
            logger.warn(e.getMessage() + " " + channel.getName());
        }

    }

    @Override
    public boolean isDisconnect()
    {
        return false;
    }

    @Override
    public void cancel(Channel channel)
    {
        // TODO Auto-generated method stub

    }
    // Logger logger = LogManager.getLogger();
}
<commit_msg>do not hangup when the activity is cancelled<commit_after>package org.asteriskjava.pbx.agi;

import org.asteriskjava.fastagi.AgiChannel;
import org.asteriskjava.fastagi.AgiException;
import org.asteriskjava.fastagi.AgiHangupException;
import org.asteriskjava.pbx.AgiChannelActivityAction;
import org.asteriskjava.pbx.Channel;
import org.asteriskjava.util.Log;
import org.asteriskjava.util.LogFactory;

public class AgiChannelActivityHoldForBridge implements AgiChannelActivityAction
{
    private final Log logger = LogFactory.getLog(this.getClass());
    private AgiChannelActivityBridge bridgeActivity;
    private boolean hangup = true;

    public AgiChannelActivityHoldForBridge(AgiChannelActivityBridge bridgeActivity)
    {
        this.bridgeActivity = bridgeActivity;
    }

    @Override
    public void execute(AgiChannel channel, Channel ichannel) throws AgiException, InterruptedException
    {
        try
        {
            channel.playMusicOnHold();
            bridgeActivity.sleepWhileBridged();

            if (hangup)
            {
                channel.hangup();
            }
        }
        catch (AgiHangupException e)
        {
            logger.warn(e.getMessage() + " " + channel.getName());
        }

    }

    @Override
    public boolean isDisconnect()
    {
        return false;
    }

    @Override
    public void cancel(Channel channel)
    {
    	hangup = false;

    }
    // Logger logger = LogManager.getLogger();
}

{'fraction_non_alphanumeric': 0.0815677966101695, 'fraction_numerical': 0.0, 'mean_word_length': 2.929264909847434, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2407152', 'n_tokens_mistral': 813, 'n_tokens_neox': 783, 'n_words': 153}