vocodedev / vocode-core

🤖 Build voice-based LLM agents. Modular + open source.
https://vocode.dev
MIT License
2.88k stars 489 forks source link

Decouple telephony from StreamingConversation #654

Closed ajar98 closed 6 days ago

ajar98 commented 3 months ago

We’d like support other “streaming” conversations on the phone - basically anything that can accept streaming audio chunks and send out streaming audio chunks concurrently should supportable on a phone call

[0] https://github.com/vocodedev/vocode-core/issues/650

rodrigoGA commented 2 months ago

hello @ajar98

I’ve been evaluating the project, and in relation to this, I believe it would be interesting to implement it through a factory, allowing this factory to be overridden during the call creation.

In the context of SIP with Twilio, it’s common to receive information in the headers of a transferred call. The headers sent with the "X-" prefix are forwarded with the "SipHeader_" prefix and can be extracted from the body. Having access to the body that initializes the call when creating the agent can be very useful for adjusting the call behavior, such as changing the prompts or the voice that will handle the call.

Implementing this feature would provide greater flexibility. Instead of:

call_config = TwilioCallConfig(config.... )
conversation_id = create_conversation_id()
await self.config_manager.save_config(conversation_id, call_config)

We could consider changing it to something like:

self.call_config_factory = TwilioCallConfigFactory()
....

call_config = self.call_config_factory.create_config(config..., extra_params=twilio_body)
conversation_id = call_config.conversation_id
await self.config_manager.save_config(conversation_id, call_config)

Overriding the factory during the initialization of the flow would give the system the necessary versatility to adapt the call behavior based on the parameters received. This simple change allows for greater system flexibility. For example, it could use different languages depending on the caller, or the agent could behave differently based on the transcription or specific needs if the call was transferred from another location.

github-actions[bot] commented 2 weeks ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] commented 6 days ago

This issue has been automatically closed due to inactivity. Thank you for your contributions.