sync: migrate ai-operator to Gitea (2026-08-10)

This commit is contained in:
konturai-ops
2026-08-10 15:26:52 +00:00
commit 53652b95ad
173 changed files with 16676 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
package asteriskws
import (
"errors"
"net/url"
"strings"
)
func BuildMediaWebSocketURL(baseURL, connectionID string) (string, string, error) {
if strings.TrimSpace(connectionID) == "" {
return "", "", errors.New("media websocket connection id is empty")
}
base := strings.TrimRight(baseURL, "/")
parsed, err := url.Parse(base + "/" + url.PathEscape(connectionID))
if err != nil {
return "", "", err
}
if parsed.Scheme != "ws" && parsed.Scheme != "wss" {
return "", "", errors.New("media websocket URL must use ws or wss")
}
return parsed.String(), parsed.String(), nil
}