DialogServiceConnector Class

Definition

  • java.lang.Object
    • AutoCloseable
      • com.microsoft.cognitiveservices.speech.dialog.DialogServiceConnector

Class that defines a DialogServiceConnector. Note: close() must be called in order to release underlying resources held by the object.

public class DialogServiceConnector

Constructors

DialogServiceConnector(DialogServiceConfig config)

Builds a DialogServiceConnector with audio from default microphone input

DialogServiceConnector(DialogServiceConfig config, AudioConfig audioConfig)

Builds a DialogServiceConnector

Fields

activityReceived

Defines event handler for the activity received event.

canceled

Defines event handler for the canceled event.

recognized

Defines event handler for the recognized event.

recognizing

Defines event handler for the recognizing event.

sessionStarted

Defines event handler for the session start event.

sessionStopped

Defines event handler for the session stop event.

speechEndDetected

Defines event handler for the speech end detection event.

speechStartDetected

Defines event handler for the speech start detection event.

turnStatusReceived

Defines event handler for the turn status received event.

Methods

close()

Dispose of associated resources. Note: close() must be called in order to release underlying resources held by the object.

connectAsync()

Connects with the service.

disconnectAsync()

Disconnects from the service.

getAuthorizationToken()

Gets the authorization token used to communicate with the service.

getProperties()

The collection of properties and their values defined for this DialogServiceConnector.

listenOnceAsync()

Starts a listening session that will terminate after the first utterance.

sendActivityAsync(final String activity)

Sends an activity to the backing dialog.

setAuthorizationToken(String token)

Sets the authorization token used to communicate with the service. Note: The caller needs to ensure that the authorization token is valid. Before the authorization token expires, the caller needs to refresh it by calling this setter with a new valid token. Otherwise, the recognizer will encounter errors during recognition.

setSpeechActivityTemplate(final String activityTemplate)

Sets the JSON template that will be provided to the speech service for the next conversation. The service will attempt to merge this template into all activities sent to the dialog backend, whether originated by the client with SendActivityAsync or generated by the service, as is the case with speech-to-text results.

startKeywordRecognitionAsync(final KeywordRecognitionModel model)

Initiates keyword recognition.

stopKeywordRecognitionAsync()

Stop keyword recognition.

stopListeningAsync()

Requests that an active listening operation immediately finish, interrupting any ongoing speaking, and provide a result reflecting whatever audio data has been captured so far.

Applies to