AudioCodes Voice Stream Channel | Rasa Documentation

Build your first agent in just a few minutes with Rasa Copilot.

New in 3.12

From Rasa Pro 3.12, you can stream conversation audio directly from AudioCodes to your Rasa Assistant.

This channel is a voice-stream channel connector to AudioCodes where the conversation audio is streamed directly to Rasa. Rasa also offers a voice-ready channel connector with AudioCodes, read about it on AudioCodes VoiceAI Connect

Configure Rasa Assistant

Use the built-in channel audiocodes_stream to configure your Rasa Assistant. Create or edit the credentials.yml file at the root of your assistant directory to add audiocodes_stream channel. Here's an example:

# websocket_url: wss://<your-domain>/webhooks/audiocodes_stream/websocket
audiocodes_stream:
  server_url: "<your-domain>"
  asr:
    name: deepgram
  tts:
    name: cartesia

# Optional configurations
  token: "<authentication-token>"

This channel expects WebSocket requests on the URL described above as "websocket_url". The channel configuration accepts the following properties:

You can run the assistant using the command rasa run. You'll need a URL accessible by AudioCodes for your Rasa assistant. For development, you can use tools like ngrok or Cloudflare Tunnel

You can also run it with a development inspector using rasa run --inspect. To see all available parameters for this command, use rasa run -h.

Bot URLs for development

Visit this section to learn how to generate the required bot URL when testing the channel on your local machine.

Configuration on AudioCodes

This channel connector uses AudioCodes Voice Streaming API. Create a bot connection for Streaming Mode bots on AudioCodes, please refer to AudioCodes Documentation for detailed instructions.

  1. On the Bot Connections page, click on Add new voice bot connection.
  2. Select AudioCodes Bot API
  3. Set an appropriate name for the Bot Connection. For "Bot connection API type", select "Streaming Mode".
  4. Set the "Bot URL". Depending on the hostname and TLS configuration, the URL would be wss://<your-domain>/webhooks/audiocodes_stream/websocket
  5. Set an authentication token, ensure that Rasa channel configuration has the same authentication token.

You can validate your Rasa Channel configuration with the button "Validate bot connection configuration". Ensure that the Rasa Server is running, AudioCodes will open a websocket on the Bot URL and send a "connection.validate" message.

  1. On the next page, select Enable voice streaming. For 'Language' field, leave the default setting as it has no impact on Rasa Assistant.

Click Create to create the bot connection. You can now define a Routing to connect the Bot Connection to a phone number.

Enable playFinished events

This channel connector requires playFinished events for certain features like silence handling and hanging up the call with action_hangup to work.

To enable these events, edit the bot connection that was created in the previous section. Go to the Advanced Tab and paste the following in,

{
  "sendEventsToBot":["playFinished"]
}

Call Metadata

Metadata about the call can be accessed by the slot session_started_metadata in the beginning of the call. Following fields are available:

Field Name Description Source
call_id The unique call identifier from Audiocodes vaigConversationId parameter as sent by Audiocodes
user_phone The phone number of the user caller parameter
user_name The caller's display name callerDisplayName parameter sent by Audiocodes
user_host The caller's host callerHost parameter sent by Audiocodes
bot_phone The phone number of the bot callee parameter
bot_host The bot's host calleeHost parameter sent by Audiocodes

A custom action_session_start can be used to store this information to a slot.