Twilio: send only one hangup command
This commit is contained in:
@@ -13,6 +13,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
the Telnyx call when an `EndFrame` or `CancelFrame` is received. It is
|
the Telnyx call when an `EndFrame` or `CancelFrame` is received. It is
|
||||||
enabled by default and is configurable via the `auto_hang_up` `InputParam`.
|
enabled by default and is configurable via the `auto_hang_up` `InputParam`.
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed an issue where `TwilioFrameSerializer` would send two hang up commands:
|
||||||
|
one for the `EndFrame` and one for the `CancelFrame`.
|
||||||
|
|
||||||
## [0.0.64] - 2025-04-22
|
## [0.0.64] - 2025-04-22
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ class TwilioFrameSerializer(FrameSerializer):
|
|||||||
self._sample_rate = 0 # Pipeline input rate
|
self._sample_rate = 0 # Pipeline input rate
|
||||||
|
|
||||||
self._resampler = create_default_resampler()
|
self._resampler = create_default_resampler()
|
||||||
|
self._hangup_attempted = False
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def type(self) -> FrameSerializerType:
|
def type(self) -> FrameSerializerType:
|
||||||
@@ -120,7 +121,12 @@ class TwilioFrameSerializer(FrameSerializer):
|
|||||||
Returns:
|
Returns:
|
||||||
Serialized data as string or bytes, or None if the frame isn't handled.
|
Serialized data as string or bytes, or None if the frame isn't handled.
|
||||||
"""
|
"""
|
||||||
if self._params.auto_hang_up and isinstance(frame, (EndFrame, CancelFrame)):
|
if (
|
||||||
|
self._params.auto_hang_up
|
||||||
|
and not self._hangup_attempted
|
||||||
|
and isinstance(frame, (EndFrame, CancelFrame))
|
||||||
|
):
|
||||||
|
self._hangup_attempted = True
|
||||||
await self._hang_up_call()
|
await self._hang_up_call()
|
||||||
return None
|
return None
|
||||||
elif isinstance(frame, StartInterruptionFrame):
|
elif isinstance(frame, StartInterruptionFrame):
|
||||||
|
|||||||
Reference in New Issue
Block a user