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

Gets the authorization token used to communicate with the service.

canceled

The event canceled signals that an error occurred during recognition.

internalData
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.

speechActivityTemplate

Gets the template for the activity generated by service from speech. Properties from the template will be stamped on the generated activity. It can be empty

telemetryEnabled

This method returns the current state of the telemetry setting.

turnStatusReceived

The event turnStatusReceived signals that a turn status message has been received. These messages are associated with both an interaction and a conversation. They are used to notify the client in the event of an interaction failure with the dialog backend, e.g. in the event of a network issue, timeout, crash, or other problem.

Inherited Properties

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.

Methods

close(() => void, (error: string) => void)

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

connect(() => void, (error: string) => void)

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(() => void, (error: string) => void)

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.

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

Starts recognition and stops after the first utterance is recognized.

sendActivityAsync(string, () => void, (error: string) => void)

Inherited Methods

enableTelemetry(boolean)

This method globally enables or disables telemetry.

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

Gets the authorization token used to communicate with the service.

string authorizationToken

Property Value

string

Authorization token.

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

internalData

object internalData

Property Value

object

properties

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

PropertyCollection properties

Property Value

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

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

speechActivityTemplate

Gets the template for the activity generated by service from speech. Properties from the template will be stamped on the generated activity. It can be empty

string speechActivityTemplate

Property Value

string

telemetryEnabled

This method returns the current state of the telemetry setting.

static boolean telemetryEnabled

Property Value

boolean

true if the telemetry is enabled, false otherwise.

turnStatusReceived

The event turnStatusReceived signals that a turn status message has been received. These messages are associated with both an interaction and a conversation. They are used to notify the client in the event of an interaction failure with the dialog backend, e.g. in the event of a network issue, timeout, crash, or other problem.

public turnStatusReceived: (sender: DialogServiceConnector, event: TurnStatusReceivedEventArgs) => void

Property Value

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

Inherited Property Details

sessionStarted

Defines event handler for session started events.

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

Property Value

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

Inherited From Recognizer.sessionStarted

sessionStopped

Defines event handler for session stopped events.

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

Property Value

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

Inherited From Recognizer.sessionStopped

speechEndDetected

Defines event handler for speech stopped events.

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

Property Value

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

Inherited From Recognizer.speechEndDetected

speechStartDetected

Defines event handler for speech started events.

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

Property Value

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

Inherited From Recognizer.speechStartDetected

Method Details

close(() => void, (error: string) => void)

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

function close(cb?: () => void, err?: (error: string) => void)

Parameters

cb

() => void

err

(error: string) => void

connect(() => void, (error: string) => void)

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(cb?: () => void, err?: (error: string) => void)

Parameters

cb

() => void

err

(error: string) => void

disconnect(() => void, (error: string) => void)

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(cb?: () => void, err?: (error: string) => void)

Parameters

cb

() => void

err

(error: string) => void

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, () => void, (error: string) => void)

function sendActivityAsync(activity: string, cb?: () => void, errCb?: (error: string) => void)

Parameters

activity

string

cb

() => void

errCb

(error: string) => void

Inherited Method Details

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.

Inherited From Recognizer.enableTelemetry