Twilio + Deepgram Voice Agent #1328
Replies: 3 comments
-
Thanks for asking your question. Please be sure to reply with as much detail as possible so the community can assist you efficiently. |
Beta Was this translation helpful? Give feedback.
-
Hey there! It looks like you haven't connected your GitHub account to your Deepgram account. You can do this at https://community.deepgram.com - being verified through this process will allow our team to help you in a much more streamlined fashion. |
Beta Was this translation helpful? Give feedback.
-
It looks like we're missing some important information to help debug your issue. Would you mind providing us with the following details in a reply?
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am using Deepgram Agent Voice now on my Twilio App.
This is my code sample:
import asyncio
import base64
import json
import sys
import websockets
import ssl
import os
def sts_connect():
# you can run export DEEPGRAM_API_KEY="your key" in your terminal to set your API key.
api_key = os.getenv('DEEPGRAM_API_KEY')
if not api_key:
raise ValueError("DEEPGRAM_API_KEY environment variable is not set")
async def twilio_handler(twilio_ws):
audio_queue = asyncio.Queue()
streamsid_queue = asyncio.Queue()
async def router(websocket, path):
print(f"Incoming connection on path: {path}")
if path == "/twilio":
print("Starting Twilio handler")
await twilio_handler(websocket)
def main():
# use this if using ssl
# ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
# ssl_context.load_cert_chain('cert.pem', 'key.pem')
# server = websockets.serve(router, '0.0.0.0', 443, ssl=ssl_context)
if name == "main":
sys.exit(main() or 0)
Is there any way to make the AI respond faster? Right now, when I call my Twilio number with Deepgram's AI Agent, it takes around 4 to 5 seconds to reply. I’m hoping there’s a way to reduce the response time to 1 to 2 seconds or less.
I am using Fly.io to deploy my App.
Beta Was this translation helpful? Give feedback.
All reactions