fix telephony app

This commit is contained in:
Ajay Raj 2023-03-28 10:53:40 -07:00
commit 7cdf57c8d8
2 changed files with 9 additions and 12 deletions

View file

@ -24,7 +24,7 @@ logger.setLevel(logging.DEBUG)
config_manager = RedisConfigManager() config_manager = RedisConfigManager()
BASE_URL = "59b8e140372d.ngrok.app" BASE_URL = "<YOUR BASE URL>"
telephony_server = TelephonyServer( telephony_server = TelephonyServer(
base_url=BASE_URL, base_url=BASE_URL,
@ -37,10 +37,6 @@ telephony_server = TelephonyServer(
prompt_preamble="Have a pleasant conversation about life", prompt_preamble="Have a pleasant conversation about life",
generate_responses=True, generate_responses=True,
), ),
twilio_config=TwilioConfig(
account_sid=getenv("TWILIO_ACCOUNT_SID"),
auth_token=getenv("TWILIO_AUTH_TOKEN"),
),
) )
], ],
logger=logger, logger=logger,
@ -50,18 +46,14 @@ app.include_router(telephony_server.get_router())
outbound_call = OutboundCall( outbound_call = OutboundCall(
base_url=BASE_URL, base_url=BASE_URL,
to_phone="+14088926228", to_phone="+11234567890",
from_phone="+14086600744", from_phone="+11234567890",
config_manager=config_manager, config_manager=config_manager,
agent_config=ChatGPTAgentConfig( agent_config=ChatGPTAgentConfig(
initial_message=BaseMessage(text="What up"), initial_message=BaseMessage(text="What up"),
prompt_preamble="Have a pleasant conversation about life", prompt_preamble="Have a pleasant conversation about life",
generate_responses=True, generate_responses=True,
), ),
twilio_config=TwilioConfig(
account_sid=getenv("TWILIO_ACCOUNT_SID"),
auth_token=getenv("TWILIO_AUTH_TOKEN"),
),
logger=logger, logger=logger,
) )

View file

@ -2,6 +2,7 @@ import logging
from typing import Optional from typing import Optional
from fastapi import APIRouter, Form, Response from fastapi import APIRouter, Form, Response
from pydantic import BaseModel from pydantic import BaseModel
from vocode import getenv
from vocode.streaming.agent.base_agent import BaseAgent from vocode.streaming.agent.base_agent import BaseAgent
from vocode.streaming.models.agent import AgentConfig from vocode.streaming.models.agent import AgentConfig
from vocode.streaming.models.synthesizer import ( from vocode.streaming.models.synthesizer import (
@ -111,7 +112,11 @@ class TelephonyServer:
sampling_rate=DEFAULT_SAMPLING_RATE, sampling_rate=DEFAULT_SAMPLING_RATE,
audio_encoding=DEFAULT_AUDIO_ENCODING, 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, twilio_sid=twilio_sid,
) )