Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix action worker twilio sid capture #619

Merged
merged 2 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions vocode/streaming/action/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 6 additions & 0 deletions vocode/streaming/utils/state_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -157,6 +160,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(
base_url=self._twilio_phone_conversation.base_url,
Expand Down
Loading