For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
DocumentationAPI ReferenceClient LibrariesChangelog
DocumentationAPI ReferenceClient LibrariesChangelog
  • Introduction
    • Introduction
  • Getting Started
    • Quickstart
    • Models
    • Authentication
    • HTTP Streaming
  • Text to Speech
    • How to TTS
    • LLM to TTS
    • Voice Models & Languages
  • Voice Cloning
    • Types of Cloning
    • Voice Clone via UI
    • How to Voice Clone
    • Delete Cloned Voice
    • Professional Voice Cloning
  • Integrations
    • LiveKit
    • Plivo
    • Vonage
  • Product
    • Projects
  • Best Practices
    • Voice Cloning Best Practices
    • PVC Best Practices
    • TTS Best Practices
LogoLogo
Voice AgentsModels
Voice AgentsModels
On this page
  • Prerequisites
  • Setup Steps
  • 1. Configure Environment Variables
  • 2. Set Up Ngrok
  • 3. Install Dependencies
  • 4. Run the FastAPI Application
  • 5. Run the Phonetic Call Client
  • 6. Testing the Call
  • 7. Accessing the Public URL
  • Notes
  • Troubleshooting
Integrations

Telephony: Vonage

||View as Markdown|
Was this page helpful?
Previous

Telephony: Plivo

Next

Projects

Built with

This guide demonstrates how to use the Smallest AI API with telephony call functionality. It sets up a local FastAPI server to stream audio data and uses ngrok to expose the server to the public for testing.

You can access the code for this example on GitHub here .

Prerequisites

Before you begin, ensure you have the following:

  • Python 3.8+ installed
  • ngrok for tunneling local servers to the internet. You can download ngrok from here.
  • Vonage account to handle calls and text-to-speech.

Setup Steps

1. Configure Environment Variables

Start by creating a .env file in your project directory with the necessary API keys. This configuration is essential for interacting with Smallest.ai and Vonage.

$SMALLEST_API_KEY=...
$VONAGE_APPLICATION_ID=...

Additionally, ensure that the private key is added to secrets/private.key.

2. Set Up Ngrok

Ngrok is used to expose your local FastAPI server to the public internet. Follow these steps:

  1. Install ngrok (if not already installed).
  2. Expose your FastAPI server for Vonage by running:
  • For Vonage:
$ngrok http 8000
  1. Once ngrok is running, it will generate a public URL (e.g., https://abcd-1234-5678.ngrok.io).

3. Install Dependencies

To run the example code, you’ll need to install the required dependencies. Run the following command:

$pip install -r requirements.txt

4. Run the FastAPI Application

Now, you can start the FastAPI server, which will handle the streaming of audio.

Run the Vonage server:

$python vonage_example/vonage_app.py

5. Run the Phonetic Call Client

Now that the FastAPI server is up and running, it’s time to make a phonetic call. This client connects to the server, and you can test the audio stream with the desired telephony platform.

Update the phone numbers and ngrok URL in the script, then run:

$python vonage_example/vonage_make_call.py

6. Testing the Call

  • Once the client script is executed, a call will be placed to the provided number with phonetic audio.
  • Vonage will handle the audio and make the call based on the provided parameters.

7. Accessing the Public URL

If you’ve successfully run ngrok, your application will be accessible via a public URL provided by ngrok, such as https://abcd-1234-5678.ngrok.io.

This public URL will allow external services like Vonage to interact with your server.


Notes

  • Public URL Requirement: If you already have a public URL (e.g., from deploying the app), you don’t need to use ngrok.
  • API Keys: Ensure your .env file contains all required keys for Vonage to ensure successful API calls.
  • Phone Numbers: Update the client scripts with valid phone numbers to receive the call.
  • Testing: Use ngrok for easy testing in a local environment before deploying the application.

Troubleshooting

If you face any issues during setup or while making calls, ensure the following:

  • Correct API keys: Double-check the credentials in your .env file.
  • Ngrok URL: Ensure that ngrok is running and the correct URL is used in the scripts.
  • Dependencies: Ensure all dependencies are installed correctly via pip install -r requirements.txt.

If issues persist, you can reach out to the Smallest AI support team or raise an issue on the GitHub repository.


This setup provides seamless testing of phonetic calls using the Smallest AI API and Vonage for real-time voice interaction.