Skip to content

Commit f9192a3

Browse files
committed
feat: Use turn.delta.chat as fallback TURN server (#7382)
1 parent 7c30aef commit f9192a3

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

src/calls.rs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -663,24 +663,35 @@ pub(crate) async fn create_fallback_ice_servers(context: &Context) -> Result<Str
663663
// because of bandwidth costs:
664664
// <https://github.com/jselbie/stunserver/issues/50>
665665

666-
// We use nine.testrun.org for a default STUN server.
667666
let hostname = "nine.testrun.org";
668-
669667
// Do not use cache because there is no TLS.
670668
let load_cache = false;
671669
let urls: Vec<String> = lookup_host_with_cache(context, hostname, STUN_PORT, "", load_cache)
672670
.await?
673671
.into_iter()
674672
.map(|addr| format!("stun:{addr}"))
675673
.collect();
676-
677-
let ice_server = IceServer {
674+
let stun_server = IceServer {
678675
urls,
679676
username: None,
680677
credential: None,
681678
};
682679

683-
let json = serde_json::to_string(&[ice_server])?;
680+
let hostname = "turn.delta.chat";
681+
// Do not use cache because there is no TLS.
682+
let load_cache = false;
683+
let urls: Vec<String> = lookup_host_with_cache(context, hostname, STUN_PORT, "", load_cache)
684+
.await?
685+
.into_iter()
686+
.map(|addr| format!("turn:{addr}"))
687+
.collect();
688+
let turn_server = IceServer {
689+
urls,
690+
username: Some("public".to_string()),
691+
credential: Some("o4tR7yG4rG2slhXqRUf9zgmHz".to_string()),
692+
};
693+
694+
let json = serde_json::to_string(&[stun_server, turn_server])?;
684695
Ok(json)
685696
}
686697

0 commit comments

Comments
 (0)