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);
|
calleeToken := hex.EncodeToString(calleeBin);
|
||||||
bridgeRelay.AddBridge(account.ID, callId, cardId, callerToken, calleeToken);
|
bridgeRelay.AddBridge(account.ID, callId, cardId, callerToken, calleeToken);
|
||||||
|
|
||||||
|
turn := getDefaultIce(ice);
|
||||||
|
|
||||||
// create response
|
// create response
|
||||||
call := Call{
|
call := Call{
|
||||||
Id: callId,
|
Id: callId,
|
||||||
@ -77,10 +79,11 @@ func AddCall(w http.ResponseWriter, r *http.Request) {
|
|||||||
CalleeToken: calleeToken,
|
CalleeToken: calleeToken,
|
||||||
Ice: ice,
|
Ice: ice,
|
||||||
IceService: iceService,
|
IceService: iceService,
|
||||||
IceURL: ice[len(ice)-1].URLs,
|
IceURL: turn.URLs,
|
||||||
IceUsername: ice[len(ice)-1].Username,
|
IceUsername: turn.Username,
|
||||||
IcePassword: ice[len(ice)-1].Credential,
|
IcePassword: turn.Credential,
|
||||||
KeepAlive: BridgeKeepAlive,
|
KeepAlive: BridgeKeepAlive,
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteResponse(w, call);
|
WriteResponse(w, call);
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"errors"
|
"errors"
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
func getIce(service bool, urls string, username string, credential string) ([]IceURL, error) {
|
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
|
}, 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