Files
mattermost/model/webrtc.go
Simon Eisenmann 868bd76f40 PLT-7809: Add support for Kopano Webmeetings WebRTC server (#7590)
* Add support for Kopano Webmeetings WebRTC server

Add an option to select which WebRTC server to use and add support to
use Kopano Webmeetings as backend instead of Janus. If the new
configuration is not set, WebRTC assumes Janus is used as backend.

* Fixup: remove redundant case. default to janus

* Fixup: use GatewayAdminUrl as direct prefix to admin URL entry point

* Fixup: consumeAndClose
2017-10-16 16:11:03 +01:00

69 lines
1.4 KiB
Go

// Copyright (c) 2017 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
package model
import (
"encoding/json"
"io"
)
type WebrtcInfoResponse struct {
Token string `json:"token"`
GatewayUrl string `json:"gateway_url"`
GatewayType string `json:"gateway_type"`
StunUri string `json:"stun_uri,omitempty"`
TurnUri string `json:"turn_uri,omitempty"`
TurnPassword string `json:"turn_password,omitempty"`
TurnUsername string `json:"turn_username,omitempty"`
}
type JanusGatewayResponse struct {
Status string `json:"janus"`
}
type KopanoWebmeetingsResponse struct {
Value string `json:"value"`
}
func JanusGatewayResponseFromJson(data io.Reader) *JanusGatewayResponse {
decoder := json.NewDecoder(data)
var o JanusGatewayResponse
err := decoder.Decode(&o)
if err == nil {
return &o
} else {
return nil
}
}
func (o *WebrtcInfoResponse) ToJson() string {
b, err := json.Marshal(o)
if err != nil {
return ""
} else {
return string(b)
}
}
func WebrtcInfoResponseFromJson(data io.Reader) *WebrtcInfoResponse {
decoder := json.NewDecoder(data)
var o WebrtcInfoResponse
err := decoder.Decode(&o)
if err == nil {
return &o
} else {
return nil
}
}
func KopanoWebmeetingsResponseFromJson(data io.Reader) *KopanoWebmeetingsResponse {
decoder := json.NewDecoder(data)
var o KopanoWebmeetingsResponse
err := decoder.Decode(&o)
if err == nil {
return &o
}
return nil
}