Skip to content

Commit

Permalink
Include backend URL to when starting dialout request.
Browse files Browse the repository at this point in the history
  • Loading branch information
fancycode committed Oct 31, 2023
1 parent c72c821 commit 2a40c89
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
3 changes: 2 additions & 1 deletion api_signaling.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
Expand Down
1 change: 1 addition & 0 deletions backend_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
},
Expand Down
12 changes: 10 additions & 2 deletions backend_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 2a40c89

Please sign in to comment.