meowlib/client/helpers/call.go
ycc c284b15788
Some checks failed
continuous-integration/drone/push Build is failing
some video retated fixes
2024-05-27 18:38:38 +02:00

56 lines
1.7 KiB
Go

package helpers
import (
"forge.redroom.link/yves/meowlib"
"forge.redroom.link/yves/meowlib/client"
)
func BuildCallRequestMessage(users []string, expiry uint64, srvuid string) ([]byte, string, error) {
// Server: get the invitation server
server, err := client.GetConfig().GetIdentity().MessageServers.LoadServer(srvuid)
if err != nil {
return nil, "BuildCallRequestMessage: LoadServer", err
}
toSrvMsg, err := server.BuildVideoRoomRequestMessage(users, expiry)
if err != nil {
return nil, "BuildCallRequestMessage: BuildVideoRoomRequestMessage", err
}
msg, err := server.ProcessOutboundMessage(toSrvMsg)
if err != nil {
return nil, "BuildCallRequestMessage: ProcessOutboundMessage", err
}
return msg, "", nil
}
func ReadCallRequestResponseMessage(data []byte, srvuid string) (*meowlib.VideoData, string, error) {
server, err := client.GetConfig().GetIdentity().MessageServers.LoadServer(srvuid)
if err != nil {
return nil, "ReadCallRequestResponseMessage: LoadServer", err
}
// Server inbound processing : get the invitation server
serverMsg, err := server.ProcessInboundServerResponse(data)
if err != nil {
return nil, "ReadCallRequestResponseMessage: ProcessInboundServerResponse", err
}
return serverMsg.VideoData, "", nil
}
func BuildCallMessage(videodata *meowlib.VideoData, srvuid string, peer_idx int, replyToUid string, filelist []string) ([]byte, string, error) {
peer := client.GetConfig().GetIdentity().Peers[peer_idx]
// Creating User message
usermessage, err := peer.BuildSimpleUserMessage(nil)
if err != nil {
return nil, "BuildCallMessage : BuildSimpleUserMessage", err
}
usermessage.Status.AnswerToUuid = replyToUid
return messageBuildPostprocess(usermessage, srvuid, peer)
}
func BuildCancelCallMessage() {
}