linting errors and removed unusued sip url
This commit is contained in:
committed by
Aleix Conchillo Flaqué
parent
cc5bfa8af8
commit
2c933f43d8
@@ -24,19 +24,18 @@ load_dotenv(override=True)
|
|||||||
logger.remove(0)
|
logger.remove(0)
|
||||||
logger.add(sys.stderr, level="DEBUG")
|
logger.add(sys.stderr, level="DEBUG")
|
||||||
|
|
||||||
daily_api_url = os.getenv("DAILY_API_URL", "https://api.daily.co/v1")
|
|
||||||
daily_api_key = os.getenv("DAILY_API_KEY", "")
|
daily_api_key = os.getenv("DAILY_API_KEY", "")
|
||||||
|
daily_api_url = os.getenv("DAILY_API_URL", "https://api.daily.co/v1")
|
||||||
|
|
||||||
|
|
||||||
async def main(room_url: str, token: str, callId: str, callDomain: str, sipUri: str):
|
async def main(room_url: str, token: str, callId: str, callDomain: str):
|
||||||
async with aiohttp.ClientSession() as session:
|
async with aiohttp.ClientSession() as session:
|
||||||
# diallin_settings are only needed if Daily's SIP URI is used
|
# diallin_settings are only needed if Daily's SIP URI is used
|
||||||
# If you are handling this via Twilio, Telnyx, set this to None
|
# If you are handling this via Twilio, Telnyx, set this to None
|
||||||
# and handle call-forwarding when on_dialin_ready fires.
|
# and handle call-forwarding when on_dialin_ready fires.
|
||||||
diallin_settings = DailyDialinSettings(
|
diallin_settings = DailyDialinSettings(
|
||||||
call_id=callId,
|
call_id=callId,
|
||||||
call_domain=callDomain,
|
call_domain=callDomain
|
||||||
sip_uri=sipUri
|
|
||||||
)
|
)
|
||||||
|
|
||||||
transport = DailyTransport(
|
transport = DailyTransport(
|
||||||
@@ -44,7 +43,7 @@ async def main(room_url: str, token: str, callId: str, callDomain: str, sipUri:
|
|||||||
token,
|
token,
|
||||||
"Chatbot",
|
"Chatbot",
|
||||||
DailyParams(
|
DailyParams(
|
||||||
api_url=f"{daily_api_url}",
|
api_url=f"https://{daily_api_url}",
|
||||||
api_key=daily_api_key,
|
api_key=daily_api_key,
|
||||||
dialin_settings=diallin_settings,
|
dialin_settings=diallin_settings,
|
||||||
audio_in_enabled=True,
|
audio_in_enabled=True,
|
||||||
@@ -58,8 +57,8 @@ async def main(room_url: str, token: str, callId: str, callDomain: str, sipUri:
|
|||||||
|
|
||||||
tts = ElevenLabsTTSService(
|
tts = ElevenLabsTTSService(
|
||||||
aiohttp_session=session,
|
aiohttp_session=session,
|
||||||
api_key=os.getenv("ELEVENLABS_API_KEY"),
|
api_key=os.getenv("ELEVENLABS_API_KEY", ""),
|
||||||
voice_id=os.getenv("ELEVENLABS_VOICE_ID"),
|
voice_id=os.getenv("ELEVENLABS_VOICE_ID", ""),
|
||||||
)
|
)
|
||||||
|
|
||||||
llm = OpenAILLMService(
|
llm = OpenAILLMService(
|
||||||
@@ -107,7 +106,6 @@ if __name__ == "__main__":
|
|||||||
parser.add_argument("-t", type=str, help="Token")
|
parser.add_argument("-t", type=str, help="Token")
|
||||||
parser.add_argument("-i", type=str, help="Call ID")
|
parser.add_argument("-i", type=str, help="Call ID")
|
||||||
parser.add_argument("-d", type=str, help="Call Domain")
|
parser.add_argument("-d", type=str, help="Call Domain")
|
||||||
parser.add_argument("-s", type=str, help="SIP URI")
|
|
||||||
config = parser.parse_args()
|
config = parser.parse_args()
|
||||||
|
|
||||||
asyncio.run(main(config.u, config.t, config.i, config.d, config.s))
|
asyncio.run(main(config.u, config.t, config.i, config.d))
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ def _create_daily_room(room_url, callId, callDomain=None, vendor="daily"):
|
|||||||
# Note: this is mostly for demonstration purposes (refer to 'deployment' in docs)
|
# Note: this is mostly for demonstration purposes (refer to 'deployment' in docs)
|
||||||
if vendor == "daily":
|
if vendor == "daily":
|
||||||
bot_proc = f"python3 -m bot_daily -u {room.url} -t {token} -i {
|
bot_proc = f"python3 -m bot_daily -u {room.url} -t {token} -i {
|
||||||
callId} -d {callDomain} -s {room.config.sip_endpoint}"
|
callId} -d {callDomain}"
|
||||||
else:
|
else:
|
||||||
bot_proc = f"python3 -m bot_twilio -u {room.url} -t {
|
bot_proc = f"python3 -m bot_twilio -u {room.url} -t {
|
||||||
token} -i {callId} -s {room.config.sip_endpoint}"
|
token} -i {callId} -s {room.config.sip_endpoint}"
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ twilio_account_sid = os.getenv('TWILIO_ACCOUNT_SID')
|
|||||||
twilio_auth_token = os.getenv('TWILIO_AUTH_TOKEN')
|
twilio_auth_token = os.getenv('TWILIO_AUTH_TOKEN')
|
||||||
twilioclient = Client(twilio_account_sid, twilio_auth_token)
|
twilioclient = Client(twilio_account_sid, twilio_auth_token)
|
||||||
|
|
||||||
daily_api_key = os.getenv("DAILY_API_KEY")
|
daily_api_key = os.getenv("DAILY_API_KEY", "")
|
||||||
|
|
||||||
|
|
||||||
async def main(room_url: str, token: str, callId: str, sipUri: str):
|
async def main(room_url: str, token: str, callId: str, sipUri: str):
|
||||||
@@ -58,8 +58,8 @@ async def main(room_url: str, token: str, callId: str, sipUri: str):
|
|||||||
|
|
||||||
tts = ElevenLabsTTSService(
|
tts = ElevenLabsTTSService(
|
||||||
aiohttp_session=session,
|
aiohttp_session=session,
|
||||||
api_key=os.getenv("ELEVENLABS_API_KEY"),
|
api_key=os.getenv("ELEVENLABS_API_KEY", ""),
|
||||||
voice_id=os.getenv("ELEVENLABS_VOICE_ID"),
|
voice_id=os.getenv("ELEVENLABS_VOICE_ID", ""),
|
||||||
)
|
)
|
||||||
|
|
||||||
llm = OpenAILLMService(
|
llm = OpenAILLMService(
|
||||||
@@ -108,7 +108,7 @@ async def main(room_url: str, token: str, callId: str, sipUri: str):
|
|||||||
twiml=f'<Response><Dial><Sip>{sipUri}</Sip></Dial></Response>'
|
twiml=f'<Response><Dial><Sip>{sipUri}</Sip></Dial></Response>'
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise Exception(detail=f"Failed to forward call: {str(e)}")
|
raise Exception(f"Failed to forward call: {str(e)}")
|
||||||
|
|
||||||
runner = PipelineRunner()
|
runner = PipelineRunner()
|
||||||
await runner.run(task)
|
await runner.run(task)
|
||||||
|
|||||||
Reference in New Issue
Block a user