diff --git a/changelog/0000.fixed.md b/changelog/0000.fixed.md new file mode 100644 index 000000000..39fabc029 --- /dev/null +++ b/changelog/0000.fixed.md @@ -0,0 +1,7 @@ +- Fixed Genesys AudioHook serializer to always include the `parameters` field in + protocol messages. The AudioHook protocol requires every message to carry a + `parameters` object (even if empty), but `_create_message` omitted it when no + parameters were provided. This caused clients that validate message structure + (including the Genesys reference implementation) to reject `pong` and + parameter-less `closed` responses, breaking server sequence tracking and + preventing `outputVariables` from reaching the Architect flow. diff --git a/src/pipecat/serializers/genesys.py b/src/pipecat/serializers/genesys.py index 2cc3c32db..4e0c11504 100644 --- a/src/pipecat/serializers/genesys.py +++ b/src/pipecat/serializers/genesys.py @@ -336,8 +336,7 @@ class GenesysAudioHookSerializer(FrameSerializer): if include_position: msg["position"] = self._format_position(self._position) - if parameters: - msg["parameters"] = parameters + msg["parameters"] = parameters if parameters is not None else {} return msg diff --git a/tests/genesys/test_genesys_serializer.py b/tests/genesys/test_genesys_serializer.py index 03132d7cb..1f63ae94e 100644 --- a/tests/genesys/test_genesys_serializer.py +++ b/tests/genesys/test_genesys_serializer.py @@ -76,6 +76,7 @@ class TestGenesysAudioHookSerializer: assert msg["type"] == "pong" assert msg["id"] == serializer.session_id + assert msg["parameters"] == {} def test_create_closed_response(self): """Test creating a closed response message.""" @@ -86,7 +87,7 @@ class TestGenesysAudioHookSerializer: assert msg["type"] == "closed" assert serializer.is_open is False - assert "parameters" not in msg # No parameters when no output_variables + assert msg["parameters"] == {} # Empty parameters when no output_variables def test_create_closed_response_with_output_variables(self): """Test creating a closed response with custom output variables."""