|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.asterisk.fastagi.impl.AGIChannelImpl
public class AGIChannelImpl
Default implementation of the AGIChannel interface.
Constructor Summary | |
---|---|
AGIChannelImpl(AGIWriter agiWriter,
AGIReader agiReader)
|
|
AGIChannelImpl(SocketConnectionFacade socket)
|
Method Summary | |
---|---|
void |
answer()
Answers the channel. |
int |
exec(java.lang.String application)
Executes the given command. |
int |
exec(java.lang.String application,
java.lang.String options)
Executes the given command. |
int |
getChannelStatus()
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 |
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,
long 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,
long 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. Available since Asterisk 1.2. |
java.lang.String |
getFullVariable(java.lang.String name,
java.lang.String channel)
Returns the value of the given channel variable. Available since Asterisk 1.2. |
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 current 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 |
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. Available since Asterisk 1.2. |
char |
sayDateTime(long time,
java.lang.String escapeDigits)
Says the given time and allows interruption by one of the given escape digits. Available since Asterisk 1.2. |
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. Available since Asterisk 1.2. |
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. Available since Asterisk 1.2. |
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 a command to asterisk and returns the corresponding reply. |
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 current 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. |
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 |
---|
public AGIChannelImpl(SocketConnectionFacade socket)
public AGIChannelImpl(AGIWriter agiWriter, AGIReader agiReader)
Method Detail |
---|
public AGIReply sendCommand(AGICommand command) throws AGIException
AGIChannel
sendCommand
in interface AGIChannel
command
- the command to send.
AGIException
- if the command can't be sent to Asterisk (for
example because the channel has been hung up)public void answer() throws AGIException
AGIChannel
answer
in interface AGIChannel
AGIException
public void hangup() throws AGIException
AGIChannel
hangup
in interface AGIChannel
AGIException
public void setAutoHangup(int time) throws AGIException
AGIChannel
setAutoHangup
in interface AGIChannel
time
- the number of seconds before this channel is automatically
hung up.AGIException
public void setCallerId(java.lang.String callerId) throws AGIException
AGIChannel
setCallerId
in interface AGIChannel
callerId
- the raw caller id to set, for example "John Doe<1234>".
AGIException
public void playMusicOnHold() throws AGIException
AGIChannel
playMusicOnHold
in interface AGIChannel
AGIException
public void playMusicOnHold(java.lang.String musicOnHoldClass) throws AGIException
AGIChannel
playMusicOnHold
in interface AGIChannel
musicOnHoldClass
- the music on hold class to play music from as
configures in Asterisk's .
- Throws:
AGIException
public void stopMusicOnHold() throws AGIException
AGIChannel
stopMusicOnHold
in interface AGIChannel
AGIException
public int getChannelStatus() throws AGIException
AGIChannel
getChannelStatus
in interface AGIChannel
AGIException
public java.lang.String getData(java.lang.String file) throws AGIException
AGIChannel
getData
in interface AGIChannel
file
- the name of the file to play
AGIException
public java.lang.String getData(java.lang.String file, long timeout) throws AGIException
AGIChannel
getData
in interface AGIChannel
file
- the name of the file to playtimeout
- the timeout in milliseconds to wait for user input.AGIException
public java.lang.String getData(java.lang.String file, long timeout, int maxDigits) throws AGIException
AGIChannel
getData
in interface AGIChannel
file
- the name of the file to playtimeout
- the timeout in milliseconds to wait for user input.maxDigits
- the maximum number of digits the user is allowed to
enter
AGIException
public char getOption(java.lang.String file, java.lang.String escapeDigits) throws AGIException
AGIChannel
getOption
in interface AGIChannel
file
- the name of the file to stream, must not include extension.escapeDigits
- contains the digits that the user is expected to
press.
AGIException
public char getOption(java.lang.String file, java.lang.String escapeDigits, int timeout) throws AGIException
AGIChannel
getOption
in interface AGIChannel
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.
AGIException
public int exec(java.lang.String application) throws AGIException
AGIChannel
exec
in interface AGIChannel
application
- the name of the application to execute, for example
"Dial".
AGIException
public int exec(java.lang.String application, java.lang.String options) throws AGIException
AGIChannel
exec
in interface AGIChannel
application
- the name of the application to execute, for example
"Dial".options
- the parameters to pass to the application, for example
"SIP/123".
AGIException
public void setContext(java.lang.String context) throws AGIException
AGIChannel
setContext
in interface AGIChannel
context
- the context for continuation upon exiting the application.
AGIException
public void setExtension(java.lang.String extension) throws AGIException
AGIChannel
setExtension
in interface AGIChannel
extension
- the extension for continuation upon exiting the
application.
AGIException
public void setPriority(java.lang.String priority) throws AGIException
AGIChannel
setPriority
in interface AGIChannel
priority
- the priority or label for continuation upon exiting the
application.
AGIException
public void streamFile(java.lang.String file) throws AGIException
AGIChannel
streamFile
in interface AGIChannel
file
- name of the file to play.
AGIException
public char streamFile(java.lang.String file, java.lang.String escapeDigits) throws AGIException
AGIChannel
streamFile
in interface AGIChannel
file
- name of the file to play.escapeDigits
- a String containing the DTMF digits that allow the
user to escape.
AGIException
public void sayDigits(java.lang.String digits) throws AGIException
AGIChannel
sayDigits
in interface AGIChannel
digits
- the digit string to say.
AGIException
public char sayDigits(java.lang.String digits, java.lang.String escapeDigits) throws AGIException
AGIChannel
sayDigits
in interface AGIChannel
digits
- the digit string to say.escapeDigits
- a String containing the DTMF digits that allow the
user to escape.
AGIException
public void sayNumber(java.lang.String number) throws AGIException
AGIChannel
sayNumber
in interface AGIChannel
number
- the number to say.
AGIException
public char sayNumber(java.lang.String number, java.lang.String escapeDigits) throws AGIException
AGIChannel
sayNumber
in interface AGIChannel
number
- the number to say.escapeDigits
- a String containing the DTMF digits that allow the
user to escape.
AGIException
public void sayPhonetic(java.lang.String text) throws AGIException
AGIChannel
sayPhonetic
in interface AGIChannel
text
- the text to say.
AGIException
public char sayPhonetic(java.lang.String text, java.lang.String escapeDigits) throws AGIException
AGIChannel
sayPhonetic
in interface AGIChannel
text
- the text to say.escapeDigits
- a String containing the DTMF digits that allow the
user to escape.
AGIException
public void sayAlpha(java.lang.String text) throws AGIException
AGIChannel
sayAlpha
in interface AGIChannel
text
- the text to say.
AGIException
public char sayAlpha(java.lang.String text, java.lang.String escapeDigits) throws AGIException
AGIChannel
sayAlpha
in interface AGIChannel
text
- the text to say.escapeDigits
- a String containing the DTMF digits that allow the
user to escape.
AGIException
public void sayTime(long time) throws AGIException
AGIChannel
sayTime
in interface AGIChannel
time
- the time to say in seconds since 00:00:00 on January 1, 1970.
AGIException
public char sayTime(long time, java.lang.String escapeDigits) throws AGIException
AGIChannel
sayTime
in interface AGIChannel
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.
AGIException
public java.lang.String getVariable(java.lang.String name) throws AGIException
AGIChannel
getVariable
in interface AGIChannel
name
- the name of the variable to retrieve.
null
if not
set.
AGIException
public void setVariable(java.lang.String name, java.lang.String value) throws AGIException
AGIChannel
setVariable
in interface AGIChannel
name
- the name of the variable to retrieve.value
- the new value to set.
AGIException
public char waitForDigit(int timeout) throws AGIException
AGIChannel
waitForDigit
in interface AGIChannel
timeout
- timeout the milliseconds to wait for the channel to
receive a DTMF digit, -1 will wait forever.
AGIException
public java.lang.String getFullVariable(java.lang.String name) throws AGIException
AGIChannel
getFullVariable
in interface AGIChannel
name
- the name of the variable to retrieve.
null
if not
set.
AGIException
public java.lang.String getFullVariable(java.lang.String name, java.lang.String channel) throws AGIException
AGIChannel
getFullVariable
in interface AGIChannel
name
- the name of the variable to retrieve.channel
- the name of the channel.
null
if not
set.
AGIException
public char sayDateTime(long time, java.lang.String escapeDigits, java.lang.String format, java.lang.String timezone) throws AGIException
AGIChannel
sayDateTime
in interface AGIChannel
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 intimezone
- the timezone to use when saying the time, for example
"UTC" or "Europe/Berlin".
AGIException
public char sayDateTime(long time, java.lang.String escapeDigits, java.lang.String format) throws AGIException
AGIChannel
sayDateTime
in interface AGIChannel
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
AGIException
public char sayDateTime(long time, java.lang.String escapeDigits) throws AGIException
AGIChannel
sayDateTime
in interface AGIChannel
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.
AGIException
public void sayDateTime(long time) throws AGIException
AGIChannel
sayDateTime
in interface AGIChannel
time
- the time to say in seconds elapsed since 00:00:00 on January
1, 1970, Coordinated Universal Time (UTC)
AGIException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |