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