mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-06-07 07:55:16 +02:00
feat: add coturn for remote deployments (#84)
* feat: add coturn for remote deployment * Simplify remote setup * fix logic in UI
This commit is contained in:
parent
2e37c89310
commit
17409998d2
9 changed files with 326 additions and 144 deletions
|
|
@ -20,7 +20,7 @@ RUN pip install --user --no-cache-dir -r requirements.txt && \
|
|||
|
||||
# Copy and install pipecat from local submodule
|
||||
COPY pipecat /tmp/pipecat
|
||||
RUN pip install --user --no-cache-dir '/tmp/pipecat[cartesia,deepgram,openai,elevenlabs,groq,google,azure,soundfile,silero,webrtc]' && \
|
||||
RUN pip install --user --no-cache-dir '/tmp/pipecat[cartesia,deepgram,openai,elevenlabs,groq,google,azure,soundfile,silero,webrtc,local-smart-turn-v3]' && \
|
||||
# Clean up pip cache and temporary pipecat directory
|
||||
rm -rf /root/.cache/pip /tmp/pipecat
|
||||
|
||||
|
|
|
|||
|
|
@ -10,9 +10,11 @@ Uses the SmallWebRTC API contract:
|
|||
"""
|
||||
|
||||
import asyncio
|
||||
import os
|
||||
from datetime import UTC, datetime
|
||||
from typing import Dict
|
||||
from typing import Dict, List
|
||||
|
||||
from aiortc import RTCIceServer
|
||||
from aiortc.sdp import candidate_from_sdp
|
||||
from fastapi import APIRouter, Depends, WebSocket, WebSocketDisconnect
|
||||
from loguru import logger
|
||||
|
|
@ -28,8 +30,34 @@ from pipecat.utils.context import set_current_run_id
|
|||
|
||||
router = APIRouter(prefix="/ws")
|
||||
|
||||
|
||||
def get_ice_servers() -> List[RTCIceServer]:
|
||||
"""Build ICE servers configuration including TURN if configured."""
|
||||
servers: List[RTCIceServer] = [RTCIceServer(urls="stun:stun.l.google.com:19302")]
|
||||
|
||||
# Add TURN server if configured
|
||||
turn_host = os.getenv("TURN_HOST")
|
||||
turn_username = os.getenv("TURN_USERNAME")
|
||||
turn_password = os.getenv("TURN_PASSWORD")
|
||||
|
||||
if turn_host and turn_username and turn_password:
|
||||
servers.append(
|
||||
RTCIceServer(
|
||||
urls=[
|
||||
f"turn:{turn_host}:3478",
|
||||
f"turn:{turn_host}:3478?transport=tcp",
|
||||
],
|
||||
username=turn_username,
|
||||
credential=turn_password,
|
||||
)
|
||||
)
|
||||
logger.info(f"TURN server configured: {turn_host}:3478")
|
||||
|
||||
return servers
|
||||
|
||||
|
||||
# ICE servers configuration
|
||||
ice_servers = ["stun:stun.l.google.com:19302"]
|
||||
ice_servers = get_ice_servers()
|
||||
|
||||
|
||||
class SignalingManager:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue