Spaces:
Running
Running
File size: 582 Bytes
c5a4e4e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
import os, logging
from twilio.rest import Client
import streamlit as st
logger = logging.getLogger(__name__)
@st.cache_data
def get_ice_servers():
try:
sid = os.environ["TWILIO_ACCOUNT_SID"]
token = os.environ["TWILIO_AUTH_TOKEN"]
except KeyError:
logger.warning("Twilio credentials not set; falling back to public STUN only.")
return [{"urls": ["stun:stun.l.google.com:19302"]}]
client = Client(sid, token)
# This will return both STUN and TURN servers from Twilio
token = client.tokens.create()
return token.ice_servers
|