From fb8e0796b2cedda58bce4fe485b7bf714b02386d Mon Sep 17 00:00:00 2001 From: vocode-petern Date: Wed, 9 Oct 2024 09:45:49 -0700 Subject: [PATCH] Don't close session on transfer call (#717) --- vocode/streaming/action/transfer_call.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/vocode/streaming/action/transfer_call.py b/vocode/streaming/action/transfer_call.py index 397dd7a4ef..2fe270024e 100644 --- a/vocode/streaming/action/transfer_call.py +++ b/vocode/streaming/action/transfer_call.py @@ -104,13 +104,14 @@ async def transfer_call(self, twilio_call_sid: str, to_phone: str): payload = {"Twiml": twiml_data} - async with AsyncRequestor().get_session() as session: - async with session.post(url, data=payload, auth=twilio_client.auth) as response: - if response.status != 200: - logger.error(f"Failed to transfer call: {response.status} {response.reason}") - raise Exception("failed to update call") - else: - return await response.json() + async with AsyncRequestor().get_session().post( + url, data=payload, auth=twilio_client.auth + ) as response: + if response.status != 200: + logger.error(f"Failed to transfer call: {response.status} {response.reason}") + raise Exception("failed to update call") + else: + return await response.json() async def run( self, action_input: ActionInput[TransferCallParameters]