File size: 606 Bytes
5a48885 5bebc6e 5a48885 5bebc6e 5a48885 5bebc6e 5a48885 5bebc6e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
import logging
import os
from twilio.rest import Client
import streamlit as st
logger = logging.getLogger(__name__)
@st.cache_data
def get_ice_servers():
try:
account_sid = os.environ['TWILIO_ACCOUNT_SID']
auth_token = os.environ['TWILIO_AUTH_TOKEN']
except KeyError:
logger.warning(
"Twilio credentials are not set. Fallback to a free STUN server from Google." # noqa: E501
)
return [{"urls": ["stun:stun.l.google.com:19302"]}]
client = Client(account_sid, auth_token)
token = client.tokens.create()
return token.ice_servers
|