AgentsClient
Methods
addEventListener
addEventListener(event: | , callback: Function
): void
Adds a handler for the specified Cartesia.AgentsEvents or Cartesia.Events event. Use only functions as handlers; anything except a function leads to the error and scenario termination when a handler is called.
Parameters
event:
Event class (i.e., Cartesia.AgentsEvents.ACK)
callback:
Function
Handler function. A single parameter is passed - object with event information
Returns
type:
void
clearMediaBuffer
clearMediaBuffer(parameters: ): void
Clears the Cartesia WebSocket media buffer.
Parameters
parameters:
OptionalOptional. Media buffer clearing parameters
Returns
type:
void
close
close(): void
Closes the Cartesia connection (over WebSocket) or connection attempt.
Returns
type:
void
custom
custom(parameters: Object
): void
Sends custom metadata to the agent. https://docs.cartesia.ai/line/integrations/web-calls#custom-event
Parameters
parameters:
Object
Returns
type:
void
dtmf
dtmf(parameters: Object
): void
Sends DTMF (dual-tone multi-frequency) tones. https://docs.cartesia.ai/line/integrations/web-calls#dtmf-event
Parameters
parameters:
Object
Returns
type:
void
id
id(): string
Returns the AgentsClient id.
Returns
type:
string
removeEventListener
removeEventListener(event: | , callback: Function
): void
Removes a handler for the specified Cartesia.AgentsEvents or Cartesia.Events event.
Parameters
event:
Event class (i.e., Cartesia.AgentsEvents.ACK)
callback:
Function
OptionalOptional. Handler function. If not specified, all handler functions are removed
Returns
type:
void
sendMediaTo
sendMediaTo(mediaUnit: , parameters: ): void
Starts sending media from the Cartesia (via WebSocket) to the media unit. Cartesia works in real time.
Parameters
mediaUnit:
Media unit that receives media
parameters:
OptionalOptional interaction parameters
Returns
type:
void
start
start(parameters: Object
): void
Initializes the audio stream configuration. https://docs.cartesia.ai/line/integrations/web-calls#start-event
Parameters
parameters:
Object
Returns
type:
void
stopMediaTo
stopMediaTo(mediaUnit: ): void
Stops sending media from the Cartesia (via WebSocket) to the media unit.
Parameters
mediaUnit:
Media unit that stops receiving media
Returns
type:
void
webSocketId
webSocketId(): string
Returns the Cartesia WebSocket id.
Returns
type:
string