From 7cdf57c8d86257f551a4e4c17e47783d530d5227 Mon Sep 17 00:00:00 2001 From: Ajay Raj Date: Tue, 28 Mar 2023 10:53:40 -0700 Subject: [PATCH] fix telephony app --- examples/telephony_app.py | 14 +++----------- vocode/streaming/telephony/server/base.py | 7 ++++++- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/examples/telephony_app.py b/examples/telephony_app.py index 86e81c2..1af1b39 100644 --- a/examples/telephony_app.py +++ b/examples/telephony_app.py @@ -24,7 +24,7 @@ logger.setLevel(logging.DEBUG) config_manager = RedisConfigManager() -BASE_URL = "59b8e140372d.ngrok.app" +BASE_URL = "" telephony_server = TelephonyServer( base_url=BASE_URL, @@ -37,10 +37,6 @@ telephony_server = TelephonyServer( prompt_preamble="Have a pleasant conversation about life", generate_responses=True, ), - twilio_config=TwilioConfig( - account_sid=getenv("TWILIO_ACCOUNT_SID"), - auth_token=getenv("TWILIO_AUTH_TOKEN"), - ), ) ], logger=logger, @@ -50,18 +46,14 @@ app.include_router(telephony_server.get_router()) outbound_call = OutboundCall( base_url=BASE_URL, - to_phone="+14088926228", - from_phone="+14086600744", + to_phone="+11234567890", + from_phone="+11234567890", config_manager=config_manager, agent_config=ChatGPTAgentConfig( initial_message=BaseMessage(text="What up"), prompt_preamble="Have a pleasant conversation about life", generate_responses=True, ), - twilio_config=TwilioConfig( - account_sid=getenv("TWILIO_ACCOUNT_SID"), - auth_token=getenv("TWILIO_AUTH_TOKEN"), - ), logger=logger, ) diff --git a/vocode/streaming/telephony/server/base.py b/vocode/streaming/telephony/server/base.py index 8be5688..c1b55a1 100644 --- a/vocode/streaming/telephony/server/base.py +++ b/vocode/streaming/telephony/server/base.py @@ -2,6 +2,7 @@ import logging from typing import Optional from fastapi import APIRouter, Form, Response from pydantic import BaseModel +from vocode import getenv from vocode.streaming.agent.base_agent import BaseAgent from vocode.streaming.models.agent import AgentConfig from vocode.streaming.models.synthesizer import ( @@ -111,7 +112,11 @@ class TelephonyServer: sampling_rate=DEFAULT_SAMPLING_RATE, audio_encoding=DEFAULT_AUDIO_ENCODING, ), - twilio_config=twilio_config, + twilio_config=twilio_config + or TwilioConfig( + account_sid=getenv("TWILIO_ACCOUNT_SID"), + auth_token=getenv("TWILIO_AUTH_TOKEN"), + ), twilio_sid=twilio_sid, )