meowlib/client/helpers/call.go
ycc e674a0cb33
Some checks failed
continuous-integration/drone/push Build is failing
peers separate
2024-05-28 16:47:04 +02:00

56 lines
1.8 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_uid string, replyToUid string, filelist []string) ([]byte, string, error) {
peer := client.GetConfig().GetIdentity().Peers.GetFromUid(peer_uid)
// 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() {
}