This project uses Vocode to handle inbound and outbound phone calls. It includes a custom agent for spelling out text and integrates with Twilio for telephony services.
- Ngrok: For exposing the local server to the internet.
- ffmpeg: For processing audio. If you have Homebrew installed, run:
brew install ffmpeg
- redis: For managing state. If you have Homebrew installed, run:
- Docker: For containerized deployment.
# Vocode API Key
VOCODE_API_KEY=your_vocode_api_key_here
# Twilio API Keys
TWILIO_ACCOUNT_SID=your_twilio_account_sid_here
TWILIO_AUTH_TOKEN=your_twilio_auth_token_here
TWILIO_PHONE_NUMBER=your_twilio_phone_number_here
# Eleven Labs API Keys
ELEVEN_LABS_API_KEY=your_eleven_labs_api_key_here
ELEVEN_LABS_VOICE_ID=your_eleven_labs_voice_id_here
# Deepgram API Key
DEEPGRAM_API_KEY=your_deepgram_api_key_here
# OpenAI API Key
OPENAI_API_KEY=your_openai_api_key_here
# Azure Speech API Keys
AZURE_SPEECH_KEY=your_azure_speech_key_here
AZURE_SPEECH_REGION=your_azure_speech_region_here
# Courier API Token
COURIER_AUTH_TOKEN=your_courier_auth_token_here
# Ngrok Authentication Token
NGROK_AUTH_TOKEN=your_ngrok_auth_token_here
# Base URL for Ngrok or your deployed server
BASE_URL=your_base_url_here
To make your server accessible to Twilio, you need to expose it to the internet. A simple way to do this is with Ngrok. In this setup, we assume your server is running on port 3000. Run:
ngrok http 3000
Ngrok will provide you with a URL that tunnels localhost:3000. Copy this URL and update the BASE_URL in your .env file, excluding the https:// part, e.g.:
BASE_URL=asdf1234.ngrok.app
Install the required dependencies for the project. If using Python, you might need to set up a virtual environment and install packages from requirements.txt:
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
Before starting your server, you need to set up Twilio to handle incoming and outgoing calls. Follow these steps:
- Go to the Twilio website.
- Sign up for a new account if you don’t already have one. Follow the instructions to verify your email and phone number.
-
Log in to your Twilio console.
-
Navigate to the Twilio Console Dashboard.
-
Note down the following credentials from the dashboard:
- Account SID: This is a unique identifier for your Twilio account.
- Auth Token: This is used to authenticate API requests.
These credentials will be used in your
.envfile:TWILIO_ACCOUNT_SID=your_twilio_account_sid_here TWILIO_AUTH_TOKEN=your_twilio_auth_token_here
-
Go to the Phone Numbers section in the Twilio console.
-
Click on Get a Number.
-
Choose a number that suits your needs and purchase it. This number will be used to send and receive calls and SMS.
-
Add this number to your .env file:
TWILIO_PHONE_NUMBER=your_twilio_phone_number_here
-
To handle incoming calls and messages, you need to configure Twilio to point to your server’s endpoints:
-
Configure Incoming Call Handling:
-
In the Twilio console, go to the Phone Numbers section and select your Twilio number.
-
Under Voice & Fax, set the A CALL COMES IN webhook to point to your server’s URL where you handle incoming calls. For example:
docker build -t vocode-telephony-app .
docker-compose up
For any questions or issues, you can reach me at matthewpierceladdy@gmail.com.