FIX: prosody jibri queue handle iq properly
This commit is contained in:
parent
24c75b7332
commit
51fd10278b
|
@ -180,37 +180,42 @@ local function sendEvent(type,room_address,participant,edetails)
|
||||||
}, cb);
|
}, cb);
|
||||||
end
|
end
|
||||||
|
|
||||||
-- receives messages from client currently connected to the room
|
-- receives iq from client currently connected to the room
|
||||||
-- clients indicates their own dominant speaker events
|
function on_iq(event)
|
||||||
function on_message(event)
|
|
||||||
-- Check the type of the incoming stanza to avoid loops:
|
-- Check the type of the incoming stanza to avoid loops:
|
||||||
if event.stanza.attr.type == "error" then
|
if event.stanza.attr.type == "error" then
|
||||||
return; -- We do not want to reply to these, so leave.
|
return; -- We do not want to reply to these, so leave.
|
||||||
end
|
end
|
||||||
|
if event.stanza.attr.to == module:get_host() then
|
||||||
|
if event.stanza.attr.type == "set" then
|
||||||
|
log("info", "Jibri Queue Messsage Event found: %s ",inspect(event.stanza));
|
||||||
|
|
||||||
local jibriQueue
|
local jibriQueue
|
||||||
= jibriQueue.stanza:get_child('jibriqueue', 'http://jitsi.org/jitmeet');
|
= event.stanza:get_child('jibriqueue', 'http://jitsi.org/protocol/jibri-queue');
|
||||||
if jibriQueue then
|
if jibriQueue then
|
||||||
local roomAddress = jibriQueue.attr.room;
|
log("info", "Jibri Queue: %s ",inspect(jibriQueue));
|
||||||
local room = get_room_from_jid(room_jid_match_rewrite(roomAddress));
|
local roomAddress = jibriQueue.attr.room;
|
||||||
|
local room = get_room_from_jid(room_jid_match_rewrite(roomAddress));
|
||||||
|
|
||||||
if not room then
|
if not room then
|
||||||
log("warn", "No room found %s", roomAddress);
|
log("warn", "No room found %s", roomAddress);
|
||||||
return false;
|
return false;
|
||||||
|
end
|
||||||
|
|
||||||
|
local from = event.stanza.attr.from;
|
||||||
|
|
||||||
|
local occupant = room:get_occupant_by_real_jid(from);
|
||||||
|
if not occupant then
|
||||||
|
log("warn", "No occupant %s found for %s", from, roomAddress);
|
||||||
|
return false;
|
||||||
|
end
|
||||||
|
-- now handle new jibri queue message
|
||||||
|
local edetails = {
|
||||||
|
["foo"] = "bar"
|
||||||
|
}
|
||||||
|
sendEvent('JoinQueue',room.jid,occupant.jid,edetails)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local from = event.stanza.attr.from;
|
|
||||||
|
|
||||||
local occupant = room:get_occupant_by_real_jid(from);
|
|
||||||
if not occupant then
|
|
||||||
log("warn", "No occupant %s found for %s", from, roomAddress);
|
|
||||||
return false;
|
|
||||||
end
|
|
||||||
-- now handle new jibri queue message
|
|
||||||
local edetails = {
|
|
||||||
["foo"] = "bar"
|
|
||||||
}
|
|
||||||
sendEvent('Message',roomAddress,from,edetails)
|
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
@ -232,7 +237,7 @@ function occupant_joined(event)
|
||||||
sendEvent('Join',room.jid,occupant.jid,edetails)
|
sendEvent('Join',room.jid,occupant.jid,edetails)
|
||||||
end
|
end
|
||||||
|
|
||||||
module:hook("message/host", on_message);
|
module:hook("iq/host", on_iq);
|
||||||
|
|
||||||
-- executed on every host added internally in prosody, including components
|
-- executed on every host added internally in prosody, including components
|
||||||
function process_host(host)
|
function process_host(host)
|
||||||
|
|
Loading…
Reference in New Issue