mirror of
https://github.com/balzack/databag.git
synced 2025-02-11 19:19:16 +00:00
defaulting to udp transport
This commit is contained in:
parent
3318048ce3
commit
cd801a7679
@ -69,6 +69,8 @@ func AddCall(w http.ResponseWriter, r *http.Request) {
|
||||
calleeToken := hex.EncodeToString(calleeBin);
|
||||
bridgeRelay.AddBridge(account.ID, callId, cardId, callerToken, calleeToken);
|
||||
|
||||
turn := getDefaultIce(ice);
|
||||
|
||||
// create response
|
||||
call := Call{
|
||||
Id: callId,
|
||||
@ -77,10 +79,11 @@ func AddCall(w http.ResponseWriter, r *http.Request) {
|
||||
CalleeToken: calleeToken,
|
||||
Ice: ice,
|
||||
IceService: iceService,
|
||||
IceURL: ice[len(ice)-1].URLs,
|
||||
IceUsername: ice[len(ice)-1].Username,
|
||||
IcePassword: ice[len(ice)-1].Credential,
|
||||
IceURL: turn.URLs,
|
||||
IceUsername: turn.Username,
|
||||
IcePassword: turn.Credential,
|
||||
KeepAlive: BridgeKeepAlive,
|
||||
}
|
||||
|
||||
WriteResponse(w, call);
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import (
|
||||
"net/http"
|
||||
"errors"
|
||||
"bytes"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func getIce(service bool, urls string, username string, credential string) ([]IceURL, error) {
|
||||
@ -45,3 +46,12 @@ func getIce(service bool, urls string, username string, credential string) ([]Ic
|
||||
}, nil
|
||||
}
|
||||
|
||||
func getDefaultIce(ice []IceURL) IceURL, error {
|
||||
for _, url := range ice {
|
||||
if strings.HasSuffix(url.URLs, "?transport=udp") {
|
||||
return url
|
||||
}
|
||||
}
|
||||
return ice[0];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user