Skip to main content

Show what the agent is doing

agentStateChanged tells you what the agent is doing, so your page can show it:
speaking and listening also fire as events of their own.

End the call

callEnded fires, then closed. They also fire when the agent ends the call, or the connection is lost for good. After end(), callEnded can fire twice, so make your handler safe to run more than once. Leaving or reloading the page ends the call too.

Pause and resume

pause() turns off the visitor’s microphone and stops playing the agent. The call stays connected while it’s paused. resume() turns both back on.

Mute the microphone

The agent keeps talking while the visitor is muted.

Set the agent’s volume

This changes how loud the agent plays in the page, not the visitor’s microphone. Values outside 0 to 1 are clamped.

Send keypad digits

For agents that ask the caller to press a key, such as a menu, send the digit as a phone keypad would:
sendDTMF() throws if there’s no call, or if the digit isn’t one of those.

The call’s ID

callStarted sends the call’s ID. It’s the ID in Call history, in the agent’s webhook, and in the API’s call endpoints.
To read the call’s transcript and outcome after it ends, use the agent’s webhook, or read the call from your server with a secret key (Get a call). agent.getJobDetails() works only with an older API key in the page, so with a public key or a call token it throws.

Events

Every event the SDK sends, and live transcripts.

Audio

Levels, visualizers, and capturing the call’s audio.