fixes: super init inhereted class to set event hanlders in the construct
This commit is contained in:
@@ -156,12 +156,15 @@ class GenesysAudioHookSerializer(FrameSerializer):
|
|||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
params: Optional[InputParams] = None,
|
params: Optional[InputParams] = None,
|
||||||
|
**kwargs,
|
||||||
):
|
):
|
||||||
"""Initialize the GenesysAudioHookSerializer.
|
"""Initialize the GenesysAudioHookSerializer.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
params: Configuration parameters.
|
params: Configuration parameters.
|
||||||
|
**kwargs: Additional arguments passed to BaseObject (e.g., name).
|
||||||
"""
|
"""
|
||||||
|
super().__init__(**kwargs)
|
||||||
self._params = params or GenesysAudioHookSerializer.InputParams()
|
self._params = params or GenesysAudioHookSerializer.InputParams()
|
||||||
|
|
||||||
self._genesys_sample_rate = self._params.genesys_sample_rate
|
self._genesys_sample_rate = self._params.genesys_sample_rate
|
||||||
@@ -599,8 +602,13 @@ class GenesysAudioHookSerializer(FrameSerializer):
|
|||||||
return json.dumps(self.create_barge_in_event())
|
return json.dumps(self.create_barge_in_event())
|
||||||
|
|
||||||
elif isinstance(frame, (OutputTransportMessageFrame, OutputTransportMessageUrgentFrame)):
|
elif isinstance(frame, (OutputTransportMessageFrame, OutputTransportMessageUrgentFrame)):
|
||||||
# Pass through custom JSON messages
|
# Only pass through AudioHook protocol messages (those with "version" field)
|
||||||
return json.dumps(frame.message)
|
# Filter out RTVI and other non-AudioHook messages
|
||||||
|
if isinstance(frame.message, dict) and "version" in frame.message:
|
||||||
|
return json.dumps(frame.message)
|
||||||
|
else:
|
||||||
|
# Not an AudioHook message, ignore
|
||||||
|
return None
|
||||||
|
|
||||||
# Ignore other frames - we don't need to process them here
|
# Ignore other frames - we don't need to process them here
|
||||||
return None
|
return None
|
||||||
|
|||||||
Reference in New Issue
Block a user