Skip to content

Commit

Permalink
Don't close session on transfer call (#717)
Browse files Browse the repository at this point in the history
  • Loading branch information
vocode-petern authored Oct 9, 2024
1 parent c3c41f2 commit fb8e079
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions vocode/streaming/action/transfer_call.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit fb8e079

Please sign in to comment.