From a3d3e3136c6bf801b279d97aa430fc7560d1c261 Mon Sep 17 00:00:00 2001 From: Filipi Fuchter Date: Fri, 28 Nov 2025 15:40:59 -0300 Subject: [PATCH] Configuring the ice servers. --- .../agents/pipecat/pipecat-agent.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/examples/aws-agentcore/agents/pipecat/pipecat-agent.py b/examples/aws-agentcore/agents/pipecat/pipecat-agent.py index 2a7490353..d92a7e5f8 100644 --- a/examples/aws-agentcore/agents/pipecat/pipecat-agent.py +++ b/examples/aws-agentcore/agents/pipecat/pipecat-agent.py @@ -25,7 +25,7 @@ from pipecat.services.deepgram.stt import DeepgramSTTService from pipecat.services.openai.llm import OpenAILLMService from pipecat.transports.base_transport import BaseTransport, TransportParams from pipecat.transports.daily.transport import DailyParams -from pipecat.transports.smallwebrtc.connection import SmallWebRTCConnection +from pipecat.transports.smallwebrtc.connection import IceServer, SmallWebRTCConnection from pipecat.transports.smallwebrtc.request_handler import ( SmallWebRTCRequest, ) @@ -130,9 +130,20 @@ async def agentcore_bot(payload, context): """Bot entry point for running on Amazon Bedrock AgentCore Runtime.""" request = SmallWebRTCRequest.from_dict(payload) - # TODO: need to implement this - # ice_servers=self._ice_servers - pipecat_connection = SmallWebRTCConnection() + ice_servers = [ + IceServer( + urls=[ + "turn:turn.cloudflare.com:3478?transport=tcp", + "turn:turn.cloudflare.com:80?transport=tcp", + "turns:turn.cloudflare.com:5349?transport=tcp", + "turns:turn.cloudflare.com:443?transport=tcp", + ], + username=os.getenv("TURN_USERNAME"), + credential=os.getenv("TURN_CREDENTIAL"), + ) + ] + + pipecat_connection = SmallWebRTCConnection(ice_servers=ice_servers) await pipecat_connection.initialize(sdp=request.sdp, type=request.type) # Prepare runner arguments with the callback to run your bot