Twilio serializer to return None

This commit is contained in:
Mark Backman
2025-04-22 12:50:11 -04:00
parent 7360866c97
commit 873d84aa09

View File

@@ -106,6 +106,7 @@ class TwilioFrameSerializer(FrameSerializer):
"""
if self._params.auto_hang_up and isinstance(frame, (EndFrame)):
asyncio.create_task(self._hang_up_call())
return None
elif isinstance(frame, StartInterruptionFrame):
answer = {"event": "clear", "streamSid": self._stream_sid}
return json.dumps(answer)
@@ -127,6 +128,9 @@ class TwilioFrameSerializer(FrameSerializer):
elif isinstance(frame, (TransportMessageFrame, TransportMessageUrgentFrame)):
return json.dumps(frame.message)
# Return None for unhandled frames
return None
async def _hang_up_call(self):
"""Hang up the Twilio call using the REST API."""
try: