public final class DesktopTelephonySupport extends java.lang.Object implements Telephony
Telephony resource to be used in desktop/like
environments.
This implementation of a Telephony resource can be used, if there is
no telephony support or if the SpokenInput and
SynthesizedOutput implementations are able to produced communicate
directly with the user.
| Constructor and Description |
|---|
DesktopTelephonySupport(javax.sound.sampled.AudioFormat format)
Constructs a new object.
|
| Modifier and Type | Method and Description |
|---|---|
void |
activate()
Activates this resource, when it is retrieved from the pool.
|
void |
addListener(TelephonyListener callListener)
Adds the given listener to the list of known listeners.
|
void |
close()
Closes and releases the acquired resources.
|
void |
connect(ConnectionInformation client)
Establishes a connection from the given
ConnectionInformation to
this object. |
void |
disconnect(ConnectionInformation client)
Closes a previously established connection.
|
javax.sound.sampled.AudioFormat |
getRecordingAudioFormat()
Retrieves the audio format that should be used for file recording.
|
java.lang.String |
getType()
Retrieves a unique identifier for this external resource.
|
void |
hangup()
Hangs up the current call.
|
boolean |
isActive()
Checks if this instance can actively be used to play back output or
record input.
|
boolean |
isBusy()
Checks if this device is busy.
|
void |
open()
Initializes and and acquires the needed resources.
|
void |
passivate()
Passivates this resource, when it is returned to the pool.
|
void |
play(SynthesizedOutput output,
CallControlProperties props)
Plays a stream from the given output device.
|
void |
record(SpokenInput input,
CallControlProperties props)
Starts recording to the given input device.
|
void |
removeListener(TelephonyListener callListener)
Removes the given listener from the list of known listeners.
|
void |
startRecording(SpokenInput input,
java.io.OutputStream stream,
CallControlProperties props)
Starts recording to the given output stream.
|
void |
stopPlay()
Stops a previously started play.
|
void |
stopRecording()
Stops a previously started recording, e.g. after a recognition process
has been stopped.
|
void |
transfer(java.lang.String dest)
Transfers the current call.
|
public DesktopTelephonySupport(javax.sound.sampled.AudioFormat format)
format - the audio format to use for recordingpublic void activate()
activate in interface ExternalResourcepublic void close()
close in interface ExternalResourcepublic java.lang.String getType()
getType in interface ExternalResourcepublic void open()
throws NoresourceError
open in interface ExternalResourceNoresourceError - The resource could not be opened.public void passivate()
The external resource is requested to return all resources that were assigned while it was active.
passivate in interface ExternalResourcepublic void connect(ConnectionInformation client) throws java.io.IOException
ConnectionInformation to
this object.connect in interface RemoteConnectableclient - data container with connection relevant data.java.io.IOException - error establishing the connection.public void disconnect(ConnectionInformation client)
disconnect in interface RemoteConnectableclient - data container with connection relevant data.public void play(SynthesizedOutput output, CallControlProperties props) throws java.io.IOException, NoresourceError
SystemOutput.queueSpeakable(org.jvoicexml.SpeakableText, String, org.jvoicexml.DocumentServer)
to prepare streaming from the synthesizer. Implementations may use this,
method, e.g., to propagate OutputStreams to the
SystemOutput implementation.
The play method is expected to run asynchronously.
play in interface Telephonyoutput - the output device delivering the output.props - parameters to use for playing.java.io.IOException - Error accessing the given URI.NoresourceError - Error accessing the terminalpublic void stopPlay()
throws NoresourceError
stopPlay in interface TelephonyNoresourceError - Error accessing the terminalpublic void record(SpokenInput input, CallControlProperties props) throws java.io.IOException, NoresourceError
InputDevice.startRecognition(org.jvoicexml.interpreter.datamodel.DataModel, org.jvoicexml.SpeechRecognizerProperties, org.jvoicexml.DtmfRecognizerProperties)
to prepare streaming to the recognizer. Implementations may use this,
method, e.g., to propagate InputStreams to the
SpokenInput implementation.record in interface Telephonyinput - input device to use for recording.props - parameters to use for the recording.java.io.IOException - Error accessing the given URI.NoresourceError - Error accessing the terminalpublic javax.sound.sampled.AudioFormat getRecordingAudioFormat()
getRecordingAudioFormat in interface Telephonypublic void startRecording(SpokenInput input, java.io.OutputStream stream, CallControlProperties props) throws java.io.IOException, NoresourceError
startRecording in interface Telephonyinput - input device that can be used in parallel to recognize the
input.stream - the stream where to send the recorded audio to.props - parameters to use for the recording.java.io.IOException - Error accessing the given URI.NoresourceError - Error accessing the terminalpublic void stopRecording()
throws NoresourceError
stopRecording in interface TelephonyNoresourceError - Error accessing the terminalpublic void transfer(java.lang.String dest)
throws NoresourceError
transfer in interface Telephonydest - Platform specific destination addressNoresourceError - Error transferring the call.public void hangup()
public void addListener(TelephonyListener callListener)
addListener in interface TelephonycallListener - TelephonyListenerpublic void removeListener(TelephonyListener callListener)
removeListener in interface TelephonycallListener - TelephonyListenerpublic boolean isBusy()
A device can be busy only if it is activated. Closed or passivated
devices must return false.
isBusy in interface ExternalResourcetrue if the device is busy.