Include backend URL to when starting dialout request.

This commit is contained in:
Joachim Bauch 2023-10-31 08:34:23 +01:00
parent c72c821687
commit 2a40c89585
No known key found for this signature in database
GPG key ID: 77C1D22D53E15F02
3 changed files with 13 additions and 3 deletions

View file

@ -793,7 +793,8 @@ func (m *InternalClientMessage) CheckValid() error {
}
type InternalServerDialoutRequest struct {
RoomId string `json:"roomid"`
RoomId string `json:"roomid"`
Backend string `json:"backend"`
Request *BackendRoomDialoutRequest `json:"request"`
}

View file

@ -698,6 +698,7 @@ func (b *BackendServer) startDialout(roomid string, backend *Backend, request *B
Type: "dialout",
Dialout: &InternalServerDialoutRequest{
RoomId: roomid,
Backend: backend.Url(),
Request: request.Dialout,
},
},

View file

@ -79,11 +79,13 @@ func CreateBackendServerForTestFromConfig(t *testing.T, config *goconf.ConfigFil
if err != nil {
t.Fatal(err)
}
config.AddOption("backend", "allowed", u.Host)
backendId := "backend1"
config.AddOption("backend", "backends", backendId)
config.AddOption(backendId, "url", server.URL)
if u.Scheme == "http" {
config.AddOption("backend", "allowhttp", "true")
}
config.AddOption("backend", "secret", string(testBackendSecret))
config.AddOption(backendId, "secret", string(testBackendSecret))
config.AddOption("sessions", "hashkey", "12345678901234567890123456789012")
config.AddOption("sessions", "blockkey", "09876543210987654321098765432109")
config.AddOption("clients", "internalsecret", string(testInternalSecret))
@ -1886,6 +1888,9 @@ func TestBackendServer_DialoutAccepted(t *testing.T) {
if msg.Internal.Dialout.RoomId != roomId {
t.Errorf("expected room id %s, got %+v", roomId, msg)
}
if url := server.URL + "/"; msg.Internal.Dialout.Backend != url {
t.Errorf("expected backend %s, got %+v", url, msg)
}
response := &ClientMessage{
Id: msg.Id,
@ -1990,6 +1995,9 @@ func TestBackendServer_DialoutRejected(t *testing.T) {
if msg.Internal.Dialout.RoomId != roomId {
t.Errorf("expected room id %s, got %+v", roomId, msg)
}
if url := server.URL + "/"; msg.Internal.Dialout.Backend != url {
t.Errorf("expected backend %s, got %+v", url, msg)
}
response := &ClientMessage{
Id: msg.Id,