Add changelog and improve docstring for parse_telephony_websocket
- Added changelog entry for bug fix - Enhanced docstring with Args and Raises sections Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
1
changelog/3629.fixed.md
Normal file
1
changelog/3629.fixed.md
Normal file
@@ -0,0 +1 @@
|
||||
- Fixed `StopAsyncIteration` exceptions in `parse_telephony_websocket()` when WebSocket connections close before sending expected messages.
|
||||
@@ -96,6 +96,9 @@ def _detect_transport_type_from_message(message_data: dict) -> str:
|
||||
async def parse_telephony_websocket(websocket: WebSocket):
|
||||
"""Parse telephony WebSocket messages and return transport type and call data.
|
||||
|
||||
Args:
|
||||
websocket: FastAPI WebSocket connection from telephony provider.
|
||||
|
||||
Returns:
|
||||
tuple: (transport_type: str, call_data: dict)
|
||||
|
||||
@@ -136,6 +139,9 @@ async def parse_telephony_websocket(websocket: WebSocket):
|
||||
"to": str,
|
||||
}
|
||||
|
||||
Raises:
|
||||
ValueError: If WebSocket closes before sending any messages.
|
||||
|
||||
Example usage::
|
||||
|
||||
transport_type, call_data = await parse_telephony_websocket(websocket)
|
||||
|
||||
Reference in New Issue
Block a user