<commit_before>/*
 *  Copyright 2004-2006 <NAME>
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 */
package org.asteriskjava.live;

import java.io.IOException;
import java.util.Collection;
import java.util.Map;

import org.asteriskjava.manager.Originate;
import org.asteriskjava.manager.TimeoutException;

/**
 * The AsteriskManager is built on top of the ManagerConnection and is an
 * attempt to simplify interaction with Asterisk by abstracting the interface.<br>
 * You will certainly have less freedom using AsteriskManager but it will make
 * life easier for easy things (like originating a call or getting a list of
 * open channels).<br>
 * AsteriskManager is still in an early state of development. So, when using
 * AsteriskManager be aware that it might change in the future.
 * 
 * @author srt
 * @version $Id$
 */
public interface AsteriskManager
{
    /**
     * Generates an outgoing call.
     * 
     * @param originate conatins the details of the call to originate
     * @return a Call object representing the originated call
     * @throws TimeoutException if the originated call is not answered in time
     * @throws IOException if the action cannot be sent to the asterisk server
     * @deprecated
     */
    Call originateCall(Originate originate) throws ManagerCommunicationException;

    AsteriskChannel originateToExtension(String channel, String context, String exten, int priority, long timeout) 
        throws ManagerCommunicationException;

    AsteriskChannel originateToExtension(String channel, String context, String exten, int priority, long timeout, Map<String, String> variables) 
        throws ManagerCommunicationException;

    AsteriskChannel originateToApplication(String channel, String application, String data, long timeout) 
        throws ManagerCommunicationException;

    AsteriskChannel originateToApplication(String channel, String application, String data, long timeout, Map<String, String> variables) 
    throws ManagerCommunicationException;

    /**<commit_msg>Added javadoc for originate methods<commit_after>/*
 *  Copyright 2004-2006 <NAME>
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 */
package org.asteriskjava.live;

import java.io.IOException;
import java.util.Collection;
import java.util.Map;

import org.asteriskjava.manager.Originate;
import org.asteriskjava.manager.TimeoutException;

/**
 * The AsteriskManager is built on top of the ManagerConnection and is an
 * attempt to simplify interaction with Asterisk by abstracting the interface.<br>
 * You will certainly have less freedom using AsteriskManager but it will make
 * life easier for easy things (like originating a call or getting a list of
 * open channels).<br>
 * AsteriskManager is still in an early state of development. So, when using
 * AsteriskManager be aware that it might change in the future.
 * 
 * @author srt
 * @version $Id$
 */
public interface AsteriskManager
{
    /**
     * Generates an outgoing call.
     * 
     * @param originate conatins the details of the call to originate
     * @return a Call object representing the originated call
     * @throws TimeoutException if the originated call is not answered in time
     * @throws IOException if the action cannot be sent to the asterisk server
     * @deprecated
     */
    Call originateCall(Originate originate) throws ManagerCommunicationException;

    /**
     * Generates an outgoing channel to a dialplan entry (extension, context, priority).
     * 
     * @param channel channel name to call, for example "SIP/1310.
     * @param context context to connect to
     * @param exten extension to connect to
     * @param priority priority to connect to
     * @param timeout how long to wait for the channel to be answered before its considered to have failed (in ms)
     * @return the generated channel
     * @throws ManagerCommunicationException if the originate action cannot be sent to Asterisk
     */
    AsteriskChannel originateToExtension(String channel, String context, String exten, int priority, long timeout) 
        throws ManagerCommunicationException;

    /**
     * Generates an outgoing channel to a dialplan entry (extension, context, priority)
     * and sets an optional map of channel variables.
     * 
     * @param channel channel name to call, for example "SIP/1310.
     * @param context context to connect to
     * @param exten extension to connect to
     * @param priority priority to connect to
     * @param timeout how long to wait for the channel to be answered before its considered to have failed (in ms)
     * @param variables channel variables to set, may be <code>null</code>.
     * @return the generated channel
     * @throws ManagerCommunicationException if the originate action cannot be sent to Asterisk
     */
    AsteriskChannel originateToExtension(String channel, String context, String exten, int priority, long timeout, Map<String, String> variables) 
        throws ManagerCommunicationException;

    /**
     * Generates an outgoing channel to an application.
     * 
     * @param channel channel name to call, for example "SIP/1310.
     * @param application application to connect to, for example "MeetMe"
     * @param data data to pass to the application, for example "1000|d", may be <code>null</code>.
     * @param timeout how long to wait for the channel to be answered before its considered to have failed (in ms)
     * @return the generated channel
     * @throws ManagerCommunicationException if the originate action cannot be sent to Asterisk
     */
    AsteriskChannel originateToApplication(String channel, String application, String data, long timeout) 
        throws ManagerCommunicationException;

    /**
     * Generates an outgoing channel to an application and sets an optional
     * map of channel variables.
     * 
     * @param channel channel name to call, for example "SIP/1310.
     * @param application application to connect to, for example "MeetMe"
     * @param data data to pass to the application, for example "1000|d", may be <code>null</code>.
     * @param timeout how long to wait for the channel to be answered before its considered to have failed (in ms)
     * @param variables channel variables to set, may be <code>null</code>.
     * @return the generated channel
     * @throws ManagerCommunicationException if the originate action cannot be sent to Asterisk
     */
    AsteriskChannel originateToApplication(String channel, String application, String data, long timeout, Map<String, String> variables) 
        throws ManagerCommunicationException;

    /**
{'fraction_non_alphanumeric': 0.06256544502617802, 'fraction_numerical': 0.0062827225130890054, 'mean_word_length': 3.633717404487568, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5104272', 'n_tokens_mistral': 1960, 'n_tokens_neox': 1842, 'n_words': 894}