diff --git a/vocode/streaming/action/worker.py b/vocode/streaming/action/worker.py index b256489cb..3c9fda74f 100644 --- a/vocode/streaming/action/worker.py +++ b/vocode/streaming/action/worker.py @@ -5,12 +5,12 @@ from vocode.streaming.action.abstract_factory import AbstractActionFactory from vocode.streaming.action.default_factory import DefaultActionFactory from vocode.streaming.agent.base_agent import ActionResultAgentInput, AgentInput -from vocode.streaming.models.actions import ( - ActionInput, - TwilioPhoneConversationActionInput, - VonagePhoneConversationActionInput, +from vocode.streaming.models.actions import ActionInput +from vocode.streaming.utils.state_manager import ( + AbstractConversationStateManager, + TwilioPhoneConversationStateManager, + VonagePhoneConversationStateManager, ) -from vocode.streaming.utils.state_manager import AbstractConversationStateManager from vocode.streaming.utils.worker import ( AbstractWorker, InterruptibleEvent, @@ -49,13 +49,17 @@ async def process(self, item: InterruptibleEvent[ActionInput]): action_input=action_input, action_output=action_output, vonage_uuid=( - action_input.vonage_uuid - if isinstance(action_input, VonagePhoneConversationActionInput) + self.conversation_state_manager.get_vonage_uuid() + if isinstance( + self.conversation_state_manager, VonagePhoneConversationStateManager + ) else None ), twilio_sid=( - action_input.twilio_sid - if isinstance(action_input, TwilioPhoneConversationActionInput) + self.conversation_state_manager.get_twilio_sid() + if isinstance( + self.conversation_state_manager, TwilioPhoneConversationStateManager + ) else None ), is_quiet=action.quiet, diff --git a/vocode/streaming/utils/state_manager.py b/vocode/streaming/utils/state_manager.py index b67eb1bd2..91ae34419 100644 --- a/vocode/streaming/utils/state_manager.py +++ b/vocode/streaming/utils/state_manager.py @@ -142,6 +142,9 @@ def __init__(self, conversation: "VonagePhoneConversation"): super().__init__(conversation=conversation) self._vonage_phone_conversation = conversation + def get_vonage_uuid(self): + return self._vonage_phone_conversation.vonage_uuid + def create_vonage_client(self): return VonageClient( base_url=self._vonage_phone_conversation.base_url, @@ -156,6 +159,9 @@ def __init__(self, conversation: "TwilioPhoneConversation"): def get_twilio_config(self): return self._twilio_phone_conversation.twilio_config + + def get_twilio_sid(self): + return self._twilio_phone_conversation.twilio_sid def create_twilio_client(self): return TwilioClient(