💡  Beta product

This product is a Beta product. This means that it and the information is subject for change, updates or removal.
If you test this product, please let us know your feedback, so that we can make it the best possible product for you. Please share your feedback with us here.

Message types

API → Application

These messages are sent from the API to your application.

Type (t) Description Example
hello The WebSocket session has started.
{
  "t": "hello",
  "callid": "cA2c...",
  "from": "+46701234567",
  "to": "+46766861234"
}
audio Base64 encoded audio data, see Audio Formats.
{
  "t": "audio",
  "data": "<base64>"
}
sync Sent in response to a sync request from the application. All audio sent before the request has been played.
{
  "t": "sync"
}
bye The call has ended. reason can be either done, hangup, or error.
{
  "t": "bye",
  "reason": "done",
  "message": "Call finished"
}

Application → API

These messages are sent to the API from your application.

Type (t) Description Example
sending Let the API know that we will be sending data in the given format.
{
  "t": "sending",
  "format": "pcm_24000"
}
listening Let the API know that we want to receive audio in the given format.
{
  "t": "listening",
  "format": "pcm_24000"
}
audio Base64 encoded audio data, see Audio Formats.
{
  "t": "audio",
  "data": "<base64>"
}
interrupt Immediately clear the audio buffer and ignore all subsequent audio messages until a new sending is sent.
{
  "t": "interrupt"
}
sync Request a checkpoint from the API. The API will reply once all previously sent audio has been played.
{
  "t": "sync"
}
bye End the call.
{
  "t": "bye"
}