Asterisk-Java

org.asteriskjava.fastagi
Class AgiOperations

java.lang.Object
  extended by org.asteriskjava.fastagi.AgiOperations
Direct Known Subclasses:
BaseAgiScript

public class AgiOperations
extends java.lang.Object

AgiOperations provides some convinience methods that wrap the various AgiCommands.

Since:
0.3
Version:
$Id: AgiOperations.java 641 2007-04-23 21:50:12Z srt $
Author:
srt

Constructor Summary
AgiOperations()
          Creates a new instance that operates on the channel attached to the current thread.
AgiOperations(AgiChannel channel)
          Creates a new instance that operates on the given channel.
 
Method Summary
 void answer()
          Answers the channel.
 void controlStreamFile(java.lang.String file)
          Plays the given file allowing the user to control the streaming by using "#" for forward and "*" for rewind.
 char controlStreamFile(java.lang.String file, java.lang.String escapeDigits)
          Plays the given file allowing the user to control the streaming by using "#" for forward and "*" for rewind.
 char controlStreamFile(java.lang.String file, java.lang.String escapeDigits, int offset)
          Plays the given file allowing the user to control the streaming by using "#" for forward and "*" for rewind.
 char controlStreamFile(java.lang.String file, java.lang.String escapeDigits, int offset, java.lang.String forwardDigit, java.lang.String rewindDigit, java.lang.String pauseDigit)
          Plays the given file allowing the user to control the streaming by using forwardDigit for forward, rewindDigit for rewind and pauseDigit for pause.
 void databaseDel(java.lang.String family, java.lang.String key)
          Deletes an entry in the Asterisk database for a given family and key.
 void databaseDelTree(java.lang.String family)
          Deletes a whole family of entries in the Asterisk database.
 void databaseDelTree(java.lang.String family, java.lang.String keytree)
          Deletes all entries of a given family in the Asterisk database that have a key that starts with a given prefix.
 java.lang.String databaseGet(java.lang.String family, java.lang.String key)
          Retrieves an entry in the Asterisk database for a given family and key.
 void databasePut(java.lang.String family, java.lang.String key, java.lang.String value)
          Adds or updates an entry in the Asterisk database for a given family, key, and value.
 int exec(java.lang.String application)
          Executes the given command.
 int exec(java.lang.String application, java.lang.String options)
          Executes the given command.
protected  AgiChannel getChannel()
          Returns the channel to operate on.
 int getChannelStatus()
          Returns the status of the channel.
 java.lang.String getData(java.lang.String file)
          Plays the given file and waits for the user to enter DTMF digits until he presses '#'.
 java.lang.String getData(java.lang.String file, int timeout)
          Plays the given file and waits for the user to enter DTMF digits until he presses '#' or the timeout occurs.
 java.lang.String getData(java.lang.String file, int timeout, int maxDigits)
          Plays the given file and waits for the user to enter DTMF digits until he presses '#' or the timeout occurs or the maximum number of digits has been entered.
 java.lang.String getFullVariable(java.lang.String name)
          Returns the value of the current channel variable, unlike getVariable() this method understands complex variable names and builtin variables.
 java.lang.String getFullVariable(java.lang.String name, java.lang.String channel)
          Returns the value of the given channel variable.
 char getOption(java.lang.String file, java.lang.String escapeDigits)
          Plays the given file, and waits for the user to press one of the given digits.
 char getOption(java.lang.String file, java.lang.String escapeDigits, int timeout)
          Plays the given file, and waits for the user to press one of the given digits.
 java.lang.String getVariable(java.lang.String name)
          Returns the value of the given channel variable.
 void hangup()
          Hangs the channel up.
 void playMusicOnHold()
          Plays music on hold from the default music on hold class.
 void playMusicOnHold(java.lang.String musicOnHoldClass)
          Plays music on hold from the given music on hold class.
 void recordFile(java.lang.String file, java.lang.String format, java.lang.String escapeDigits, int timeout)
          Record to a file until a given dtmf digit in the sequence is received.
 void recordFile(java.lang.String file, java.lang.String format, java.lang.String escapeDigits, int timeout, int offset, boolean beep, int maxSilence)
          Record to a file until a given dtmf digit in the sequence is received.
 void sayAlpha(java.lang.String text)
          Says the given character string.
 char sayAlpha(java.lang.String text, java.lang.String escapeDigits)
          Says the given character string, returning early if any of the given DTMF number are received on the channel.
 void sayDateTime(long time)
          Says the given time.
 char sayDateTime(long time, java.lang.String escapeDigits)
          Says the given time and allows interruption by one of the given escape digits.
 char sayDateTime(long time, java.lang.String escapeDigits, java.lang.String format)
          Says the given time in the given format and allows interruption by one of the given escape digits.
 char sayDateTime(long time, java.lang.String escapeDigits, java.lang.String format, java.lang.String timezone)
          Says the given time in the given format and timezone and allows interruption by one of the given escape digits.
 void sayDigits(java.lang.String digits)
          Says the given digit string.
 char sayDigits(java.lang.String digits, java.lang.String escapeDigits)
          Says the given number, returning early if any of the given DTMF number are received on the channel.
 void sayNumber(java.lang.String number)
          Says the given number.
 char sayNumber(java.lang.String number, java.lang.String escapeDigits)
          Says the given number, returning early if any of the given DTMF number are received on the channel.
 void sayPhonetic(java.lang.String text)
          Says the given character string with phonetics.
 char sayPhonetic(java.lang.String text, java.lang.String escapeDigits)
          Says the given character string with phonetics, returning early if any of the given DTMF number are received on the channel.
 void sayTime(long time)
          Says the given time.
 char sayTime(long time, java.lang.String escapeDigits)
          Says the given time, returning early if any of the given DTMF number are received on the channel.
 AgiReply sendCommand(AgiCommand command)
          Sends the given command to the channel attached to the current thread.
 void setAutoHangup(int time)
          Cause the channel to automatically hangup at the given number of seconds in the future.
 void setCallerId(java.lang.String callerId)
          Sets the caller id on the current channel.
 void setContext(java.lang.String context)
          Sets the context for continuation upon exiting the application.
 void setExtension(java.lang.String extension)
          Sets the extension for continuation upon exiting the application.
 void setPriority(java.lang.String priority)
          Sets the priority or label for continuation upon exiting the application.
 void setVariable(java.lang.String name, java.lang.String value)
          Sets the value of the given channel variable to a new value.
 void stopMusicOnHold()
          Stops playing music on hold.
 void streamFile(java.lang.String file)
          Plays the given file.
 char streamFile(java.lang.String file, java.lang.String escapeDigits)
          Plays the given file and allows the user to escape by pressing one of the given digit.
 void verbose(java.lang.String message, int level)
          Sends a message to the Asterisk console via the verbose message system.
 char waitForDigit(int timeout)
          Waits up to 'timeout' milliseconds to receive a DTMF digit.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AgiOperations

public AgiOperations()
Creates a new instance that operates on the channel attached to the current thread.


AgiOperations

public AgiOperations(AgiChannel channel)
Creates a new instance that operates on the given channel.

Parameters:
channel - the channel to operate on.
Method Detail

answer

public void answer()
            throws AgiException
Answers the channel.

Throws:
AgiException

hangup

public void hangup()
            throws AgiException
Hangs the channel up.

Throws:
AgiException

setAutoHangup

public void setAutoHangup(int time)
                   throws AgiException
Cause the channel to automatically hangup at the given number of seconds in the future.

Parameters:
time - the number of seconds before this channel is automatically hung up.

0 disables the autohangup feature.

Throws:
AgiException

setCallerId

public void setCallerId(java.lang.String callerId)
                 throws AgiException
Sets the caller id on the current channel.

Parameters:
callerId - the raw caller id to set, for example "John Doe<1234>".
Throws:
AgiException

playMusicOnHold

public void playMusicOnHold()
                     throws AgiException
Plays music on hold from the default music on hold class.

Throws:
AgiException

playMusicOnHold

public void playMusicOnHold(java.lang.String musicOnHoldClass)
                     throws AgiException
Plays music on hold from the given music on hold class.

Parameters:
musicOnHoldClass - the music on hold class to play music from as configures in Asterisk's .
Throws:
AgiException

stopMusicOnHold

public void stopMusicOnHold()
                     throws AgiException
Stops playing music on hold.

Throws:
AgiException

getChannelStatus

public int getChannelStatus()
                     throws AgiException
Returns the status of the channel.

Return values:

  • 0 Channel is down and available
  • 1 Channel is down, but reserved
  • 2 Channel is off hook
  • 3 Digits (or equivalent) have been dialed
  • 4 Line is ringing
  • 5 Remote end is ringing
  • 6 Line is up
  • 7 Line is busy

Returns:
the status of the channel.
Throws:
AgiException

getData

public java.lang.String getData(java.lang.String file)
                         throws AgiException
Plays the given file and waits for the user to enter DTMF digits until he presses '#'. The user may interrupt the streaming by starting to enter digits.

Parameters:
file - the name of the file to play
Returns:
a String containing the DTMF the user entered
Throws:
AgiException

getData

public java.lang.String getData(java.lang.String file,
                                int timeout)
                         throws AgiException
Plays the given file and waits for the user to enter DTMF digits until he presses '#' or the timeout occurs. The user may interrupt the streaming by starting to enter digits.

Parameters:
file - the name of the file to play
timeout - the timeout in milliseconds to wait for user input.

0 means standard timeout value, -1 means "ludicrous time" (essentially never times out).

Returns:
a String containing the DTMF the user entered
Throws:
AgiException

getData

public java.lang.String getData(java.lang.String file,
                                int timeout,
                                int maxDigits)
                         throws AgiException
Plays the given file and waits for the user to enter DTMF digits until he presses '#' or the timeout occurs or the maximum number of digits has been entered. The user may interrupt the streaming by starting to enter digits.

Parameters:
file - the name of the file to play
timeout - the timeout in milliseconds to wait for user input.

0 means standard timeout value, -1 means "ludicrous time" (essentially never times out).

maxDigits - the maximum number of digits the user is allowed to enter
Returns:
a String containing the DTMF the user entered
Throws:
AgiException

getOption

public char getOption(java.lang.String file,
                      java.lang.String escapeDigits)
               throws AgiException
Plays the given file, and waits for the user to press one of the given digits. If none of the esacpe digits is pressed while streaming the file it waits for the default timeout of 5 seconds still waiting for the user to press a digit.

Parameters:
file - the name of the file to stream, must not include extension.
escapeDigits - contains the digits that the user is expected to press.
Returns:
the DTMF digit pressed or 0x0 if none was pressed.
Throws:
AgiException

getOption

public char getOption(java.lang.String file,
                      java.lang.String escapeDigits,
                      int timeout)
               throws AgiException
Plays the given file, and waits for the user to press one of the given digits. If none of the esacpe digits is pressed while streaming the file it waits for the specified timeout still waiting for the user to press a digit.

Parameters:
file - the name of the file to stream, must not include extension.
escapeDigits - contains the digits that the user is expected to press.
timeout - the timeout in seconds to wait if none of the defined esacpe digits was presses while streaming.
Returns:
the DTMF digit pressed or 0x0 if none was pressed.
Throws:
AgiException

exec

public int exec(java.lang.String application)
         throws AgiException
Executes the given command.

Parameters:
application - the name of the application to execute, for example "Dial".
Returns:
the return code of the application of -2 if the application was not found.
Throws:
AgiException

exec

public int exec(java.lang.String application,
                java.lang.String options)
         throws AgiException
Executes the given command.

Parameters:
application - the name of the application to execute, for example "Dial".
options - the parameters to pass to the application, for example "SIP/123". Multiple options are separated by the pipe character ('|').
Returns:
the return code of the application of -2 if the application was not found.
Throws:
AgiException

setContext

public void setContext(java.lang.String context)
                throws AgiException
Sets the context for continuation upon exiting the application.

Parameters:
context - the context for continuation upon exiting the application.
Throws:
AgiException

setExtension

public void setExtension(java.lang.String extension)
                  throws AgiException
Sets the extension for continuation upon exiting the application.

Parameters:
extension - the extension for continuation upon exiting the application.
Throws:
AgiException

setPriority

public void setPriority(java.lang.String priority)
                 throws AgiException
Sets the priority or label for continuation upon exiting the application.

Parameters:
priority - the priority or label for continuation upon exiting the application.
Throws:
AgiException

streamFile

public void streamFile(java.lang.String file)
                throws AgiException
Plays the given file.

Parameters:
file - name of the file to play.
Throws:
AgiException

streamFile

public char streamFile(java.lang.String file,
                       java.lang.String escapeDigits)
                throws AgiException
Plays the given file and allows the user to escape by pressing one of the given digit.

Parameters:
file - name of the file to play.
escapeDigits - a String containing the DTMF digits that allow the user to escape.
Returns:
the DTMF digit pressed or 0x0 if none was pressed.
Throws:
AgiException

sayDigits

public void sayDigits(java.lang.String digits)
               throws AgiException
Says the given digit string.

Parameters:
digits - the digit string to say.
Throws:
AgiException

sayDigits

public char sayDigits(java.lang.String digits,
                      java.lang.String escapeDigits)
               throws AgiException
Says the given number, returning early if any of the given DTMF number are received on the channel.

Parameters:
digits - the digit string to say.
escapeDigits - a String containing the DTMF digits that allow the user to escape.
Returns:
the DTMF digit pressed or 0x0 if none was pressed.
Throws:
AgiException

sayNumber

public void sayNumber(java.lang.String number)
               throws AgiException
Says the given number.

Parameters:
number - the number to say.
Throws:
AgiException

sayNumber

public char sayNumber(java.lang.String number,
                      java.lang.String escapeDigits)
               throws AgiException
Says the given number, returning early if any of the given DTMF number are received on the channel.

Parameters:
number - the number to say.
escapeDigits - a String containing the DTMF digits that allow the user to escape.
Returns:
the DTMF digit pressed or 0x0 if none was pressed.
Throws:
AgiException

sayPhonetic

public void sayPhonetic(java.lang.String text)
                 throws AgiException
Says the given character string with phonetics.

Parameters:
text - the text to say.
Throws:
AgiException

sayPhonetic

public char sayPhonetic(java.lang.String text,
                        java.lang.String escapeDigits)
                 throws AgiException
Says the given character string with phonetics, returning early if any of the given DTMF number are received on the channel.

Parameters:
text - the text to say.
escapeDigits - a String containing the DTMF digits that allow the user to escape.
Returns:
the DTMF digit pressed or 0x0 if none was pressed.
Throws:
AgiException

sayAlpha

public void sayAlpha(java.lang.String text)
              throws AgiException
Says the given character string.

Parameters:
text - the text to say.
Throws:
AgiException

sayAlpha

public char sayAlpha(java.lang.String text,
                     java.lang.String escapeDigits)
              throws AgiException
Says the given character string, returning early if any of the given DTMF number are received on the channel.

Parameters:
text - the text to say.
escapeDigits - a String containing the DTMF digits that allow the user to escape.
Returns:
the DTMF digit pressed or 0x0 if none was pressed.
Throws:
AgiException

sayTime

public void sayTime(long time)
             throws AgiException
Says the given time.

Parameters:
time - the time to say in seconds since 00:00:00 on January 1, 1970.
Throws:
AgiException

sayTime

public char sayTime(long time,
                    java.lang.String escapeDigits)
             throws AgiException
Says the given time, returning early if any of the given DTMF number are received on the channel.

Parameters:
time - the time to say in seconds since 00:00:00 on January 1, 1970.
escapeDigits - a String containing the DTMF digits that allow the user to escape.
Returns:
the DTMF digit pressed or 0x0 if none was pressed.
Throws:
AgiException

getVariable

public java.lang.String getVariable(java.lang.String name)
                             throws AgiException
Returns the value of the given channel variable.

Parameters:
name - the name of the variable to retrieve.
Returns:
the value of the given variable or null if not set.
Throws:
AgiException

setVariable

public void setVariable(java.lang.String name,
                        java.lang.String value)
                 throws AgiException
Sets the value of the given channel variable to a new value.

Parameters:
name - the name of the variable to retrieve.
value - the new value to set.
Throws:
AgiException

waitForDigit

public char waitForDigit(int timeout)
                  throws AgiException
Waits up to 'timeout' milliseconds to receive a DTMF digit.

Parameters:
timeout - timeout the milliseconds to wait for the channel to receive a DTMF digit, -1 will wait forever.
Returns:
the DTMF digit pressed or 0x0 if none was pressed.
Throws:
AgiException

getFullVariable

public java.lang.String getFullVariable(java.lang.String name)
                                 throws AgiException
Returns the value of the current channel variable, unlike getVariable() this method understands complex variable names and builtin variables.

You can also use this method to use custom Asterisk functions. Syntax is "func(args)".

Available since Asterisk 1.2.

Parameters:
name - the name of the variable to retrieve.
Returns:
the value of the given variable or null if not set.
Throws:
AgiException
Since:
0.2

getFullVariable

public java.lang.String getFullVariable(java.lang.String name,
                                        java.lang.String channel)
                                 throws AgiException
Returns the value of the given channel variable.

Available since Asterisk 1.2.

Parameters:
name - the name of the variable to retrieve.
channel - the name of the channel.
Returns:
the value of the given variable or null if not set.
Throws:
AgiException
Since:
0.2

sayDateTime

public void sayDateTime(long time)
                 throws AgiException
Says the given time.

Available since Asterisk 1.2.

Parameters:
time - the time to say in seconds elapsed since 00:00:00 on January 1, 1970, Coordinated Universal Time (UTC)
Throws:
AgiException
Since:
0.2

sayDateTime

public char sayDateTime(long time,
                        java.lang.String escapeDigits)
                 throws AgiException
Says the given time and allows interruption by one of the given escape digits.

Available since Asterisk 1.2.

Parameters:
time - the time to say in seconds elapsed since 00:00:00 on January 1, 1970, Coordinated Universal Time (UTC)
escapeDigits - the digits that allow the user to interrupt this command or null for none.
Returns:
the DTMF digit pressed or 0x0 if none was pressed.
Throws:
AgiException
Since:
0.2

sayDateTime

public char sayDateTime(long time,
                        java.lang.String escapeDigits,
                        java.lang.String format)
                 throws AgiException
Says the given time in the given format and allows interruption by one of the given escape digits.

Available since Asterisk 1.2.

Parameters:
time - the time to say in seconds elapsed since 00:00:00 on January 1, 1970, Coordinated Universal Time (UTC)
escapeDigits - the digits that allow the user to interrupt this command or null for none.
format - the format the time should be said in
Returns:
the DTMF digit pressed or 0x0 if none was pressed.
Throws:
AgiException
Since:
0.2

sayDateTime

public char sayDateTime(long time,
                        java.lang.String escapeDigits,
                        java.lang.String format,
                        java.lang.String timezone)
                 throws AgiException
Says the given time in the given format and timezone and allows interruption by one of the given escape digits.

Available since Asterisk 1.2.

Parameters:
time - the time to say in seconds elapsed since 00:00:00 on January 1, 1970, Coordinated Universal Time (UTC)
escapeDigits - the digits that allow the user to interrupt this command or null for none.
format - the format the time should be said in
timezone - the timezone to use when saying the time, for example "UTC" or "Europe/Berlin".
Returns:
the DTMF digit pressed or 0x0 if none was pressed.
Throws:
AgiException
Since:
0.2

databaseGet

public java.lang.String databaseGet(java.lang.String family,
                                    java.lang.String key)
                             throws AgiException
Retrieves an entry in the Asterisk database for a given family and key.

Parameters:
family - the family of the entry to retrieve.
key - the key of the entry to retrieve.
Returns:
the value of the given family and key or null if there is no such value.
Throws:
AgiException
Since:
0.3

databasePut

public void databasePut(java.lang.String family,
                        java.lang.String key,
                        java.lang.String value)
                 throws AgiException
Adds or updates an entry in the Asterisk database for a given family, key, and value.

Parameters:
family - the family of the entry to add or update.
key - the key of the entry to add or update.
value - the new value of the entry.
Throws:
AgiException
Since:
0.3

databaseDel

public void databaseDel(java.lang.String family,
                        java.lang.String key)
                 throws AgiException
Deletes an entry in the Asterisk database for a given family and key.

Parameters:
family - the family of the entry to delete.
key - the key of the entry to delete.
Throws:
AgiException
Since:
0.3

databaseDelTree

public void databaseDelTree(java.lang.String family)
                     throws AgiException
Deletes a whole family of entries in the Asterisk database.

Parameters:
family - the family to delete.
Throws:
AgiException
Since:
0.3

databaseDelTree

public void databaseDelTree(java.lang.String family,
                            java.lang.String keytree)
                     throws AgiException
Deletes all entries of a given family in the Asterisk database that have a key that starts with a given prefix.

Parameters:
family - the family of the entries to delete.
keytree - the prefix of the keys of the entries to delete.
Throws:
AgiException
Since:
0.3

verbose

public void verbose(java.lang.String message,
                    int level)
             throws AgiException
Sends a message to the Asterisk console via the verbose message system.

Parameters:
message - the message to send.
level - the verbosity level to use. Must be in [1..4].
Throws:
AgiException
Since:
0.3

recordFile

public void recordFile(java.lang.String file,
                       java.lang.String format,
                       java.lang.String escapeDigits,
                       int timeout)
                throws AgiException
Record to a file until a given dtmf digit in the sequence is received.

Parameters:
file - the name of the file to stream, must not include extension.
format - the format of the file to be recorded, for example "wav".
escapeDigits - contains the digits that allow the user to end recording.
timeout - the maximum record time in milliseconds, or -1 for no timeout.
Throws:
AgiException
Since:
0.3

recordFile

public void recordFile(java.lang.String file,
                       java.lang.String format,
                       java.lang.String escapeDigits,
                       int timeout,
                       int offset,
                       boolean beep,
                       int maxSilence)
                throws AgiException
Record to a file until a given dtmf digit in the sequence is received.

Parameters:
file - the name of the file to stream, must not include extension.
format - the format of the file to be recorded, for example "wav".
escapeDigits - contains the digits that allow the user to end recording.
timeout - the maximum record time in milliseconds, or -1 for no timeout.
offset - the offset samples to skip.
beep - true if a beep should be played before recording.
maxSilence - The amount of silence (in seconds) to allow before returning despite the lack of dtmf digits or reaching timeout.
Throws:
AgiException
Since:
0.3

controlStreamFile

public void controlStreamFile(java.lang.String file)
                       throws AgiException
Plays the given file allowing the user to control the streaming by using "#" for forward and "*" for rewind.

Parameters:
file - the name of the file to stream, must not include extension.
Throws:
AgiException
Since:
0.3

controlStreamFile

public char controlStreamFile(java.lang.String file,
                              java.lang.String escapeDigits)
                       throws AgiException
Plays the given file allowing the user to control the streaming by using "#" for forward and "*" for rewind. Pressing one of the escape digits stops streaming.

Parameters:
file - the name of the file to stream, must not include extension.
escapeDigits - contains the digits that allow the user to interrupt this command.
Returns:
the DTMF digit pressed or 0x0 if none was pressed.
Throws:
AgiException
Since:
0.3

controlStreamFile

public char controlStreamFile(java.lang.String file,
                              java.lang.String escapeDigits,
                              int offset)
                       throws AgiException
Plays the given file allowing the user to control the streaming by using "#" for forward and "*" for rewind. Pressing one of the escape digits stops streaming. The file is played starting at the indicated offset.

Parameters:
file - the name of the file to stream, must not include extension.
escapeDigits - contains the digits that allow the user to interrupt this command. May be null if you don't want the user to interrupt.
offset - the offset samples to skip before streaming.
Returns:
the DTMF digit pressed or 0x0 if none was pressed.
Throws:
AgiException
Since:
0.3

controlStreamFile

public char controlStreamFile(java.lang.String file,
                              java.lang.String escapeDigits,
                              int offset,
                              java.lang.String forwardDigit,
                              java.lang.String rewindDigit,
                              java.lang.String pauseDigit)
                       throws AgiException
Plays the given file allowing the user to control the streaming by using forwardDigit for forward, rewindDigit for rewind and pauseDigit for pause. Pressing one of the escape digits stops streaming. The file is played starting at the indicated offset, use 0 to start at the beginning.

Parameters:
file - the name of the file to stream, must not include extension.
escapeDigits - contains the digits that allow the user to interrupt this command. May be null if you don't want the user to interrupt.
offset - the offset samples to skip before streaming, use 0 to start at the beginning.
forwardDigit - the digit for fast forward.
rewindDigit - the digit for rewind.
pauseDigit - the digit for pause and unpause.
Returns:
the DTMF digit pressed or 0x0 if none was pressed.
Throws:
AgiException
Since:
0.3

sendCommand

public AgiReply sendCommand(AgiCommand command)
                     throws AgiException
Sends the given command to the channel attached to the current thread.

Parameters:
command - the command to send to Asterisk
Returns:
the reply received from Asterisk
Throws:
AgiException - if the command could not be processed properly

getChannel

protected AgiChannel getChannel()
Returns the channel to operate on.

Returns:
the channel to operate on.
Throws:
java.lang.IllegalStateException - if no AgiChannel is bound to the current channel and no channel has been passed to the constructor.

Asterisk-Java

Copyright © 2004-2007 Stefan Reuter. All Rights Reserved.