DialogServiceConnector class

Dialog Service Connector

Extends

Constructors

DialogServiceConnector(DialogServiceConfig, AudioConfig)

Initializes an instance of the DialogServiceConnector.

Properties

activityReceived

The event activityReceived signals that an activity has been received.

authorizationToken

Sets the authorization token used to communicate with the service.

canceled

The event canceled signals that an error occurred during recognition.

properties

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

recognized

The event recognized signals that a final recognition result is received.

recognizing

The event recognizing signals that an intermediate recognition result is received.

sessionStarted

Defines event handler for session started events.

sessionStopped

Defines event handler for session stopped events.

speechEndDetected

Defines event handler for speech stopped events.

speechStartDetected

Defines event handler for speech started events.

telemetryEnabled

This method returns the current state of the telemetry setting.

Methods

close()

closes all external resources held by an instance of this class.

connect()

Starts a connection to the service. Users can optionally call connect() to manually set up a connection in advance, before starting interactions. Note: On return, the connection might not be ready yet. Please subscribe to the Connected event to be notified when the connection is established.

disconnect()

Closes the connection the service. Users can optionally call disconnect() to manually shutdown the connection of the associated DialogServiceConnector. If disconnect() is called during a recognition, recognition will fail and cancel with an error.

enableTelemetry(boolean)

This method globally enables or disables telemetry.

listenOnceAsync((e: SpeechRecognitionResult) => void, (e: string) => void)

Starts recognition and stops after the first utterance is recognized.

sendActivityAsync(string)

Constructor Details

DialogServiceConnector(DialogServiceConfig, AudioConfig)

Initializes an instance of the DialogServiceConnector.

new DialogServiceConnector(dialogConfig: DialogServiceConfig, audioConfig?: AudioConfig)

Parameters

dialogConfig
DialogServiceConfig

Set of properties to configure this recognizer.

audioConfig
AudioConfig

An optional audio config associated with the recognizer

Property Details

activityReceived

The event activityReceived signals that an activity has been received.

public activityReceived: (sender: DialogServiceConnector, event: ActivityReceivedEventArgs) => void

Property Value

(sender: DialogServiceConnector, event: ActivityReceivedEventArgs) => void

authorizationToken

Sets the authorization token used to communicate with the service.

public authorizationToken: string

Property Value

string

canceled

The event canceled signals that an error occurred during recognition.

public canceled: (sender: DialogServiceConnector, event: SpeechRecognitionCanceledEventArgs) => void

Property Value

(sender: DialogServiceConnector, event: SpeechRecognitionCanceledEventArgs) => void

properties

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

public properties: PropertyCollection

Property Value

recognized

The event recognized signals that a final recognition result is received.

public recognized: (sender: DialogServiceConnector, event: SpeechRecognitionEventArgs) => void

Property Value

(sender: DialogServiceConnector, event: SpeechRecognitionEventArgs) => void

recognizing

The event recognizing signals that an intermediate recognition result is received.

public recognizing: (sender: DialogServiceConnector, event: SpeechRecognitionEventArgs) => void

Property Value

(sender: DialogServiceConnector, event: SpeechRecognitionEventArgs) => void

sessionStarted

Defines event handler for session started events.

public sessionStarted: (sender: Recognizer, event: SessionEventArgs) => void

Property Value

(sender: Recognizer, event: SessionEventArgs) => void

sessionStopped

Defines event handler for session stopped events.

public sessionStopped: (sender: Recognizer, event: SessionEventArgs) => void

Property Value

(sender: Recognizer, event: SessionEventArgs) => void

speechEndDetected

Defines event handler for speech stopped events.

public speechEndDetected: (sender: Recognizer, event: RecognitionEventArgs) => void

Property Value

(sender: Recognizer, event: RecognitionEventArgs) => void

speechStartDetected

Defines event handler for speech started events.

public speechStartDetected: (sender: Recognizer, event: RecognitionEventArgs) => void

Property Value

(sender: Recognizer, event: RecognitionEventArgs) => void

telemetryEnabled

This method returns the current state of the telemetry setting.

public static telemetryEnabled: boolean

Property Value

boolean

Method Details

close()

closes all external resources held by an instance of this class.

function close()

connect()

Starts a connection to the service. Users can optionally call connect() to manually set up a connection in advance, before starting interactions. Note: On return, the connection might not be ready yet. Please subscribe to the Connected event to be notified when the connection is established.

function connect()

disconnect()

Closes the connection the service. Users can optionally call disconnect() to manually shutdown the connection of the associated DialogServiceConnector. If disconnect() is called during a recognition, recognition will fail and cancel with an error.

function disconnect()

enableTelemetry(boolean)

This method globally enables or disables telemetry.

static function enableTelemetry(enabled: boolean)

Parameters

enabled
boolean

Global setting for telemetry collection. If set to true, telemetry information like microphone errors, recognition errors are collected and sent to Microsoft. If set to false, no telemetry is sent to Microsoft.

listenOnceAsync((e: SpeechRecognitionResult) => void, (e: string) => void)

Starts recognition and stops after the first utterance is recognized.

function listenOnceAsync(cb?: (e: SpeechRecognitionResult) => void, err?: (e: string) => void)

Parameters

cb
(e: SpeechRecognitionResult) => void

Callback that received the result when the reco has completed.

err
(e: string) => void

Callback invoked in case of an error.

sendActivityAsync(string)

function sendActivityAsync(activity: string)

Parameters

activity
string