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
Set the agent’s volume
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.
agent.getJobDetails() works only with an older API key in the page, so with a public key or a call token it throws.
Related
Events
Every event the SDK sends, and live transcripts.
Audio
Levels, visualizers, and capturing the call’s audio.