hello jitsi community …
that is my first topic in here
A few days ago I developed prosody plugins about single access
but sometimes identity return a nil value
how can i return a real identity for all occupant in the room
hope I can find my answer here
thanks in advance
my code is :
function filter_access(event)
module:log('info', 'filter_access function is loaded');
module:log('info', 'event it is %s',tostring(event));
local origin, room, stanza = event.origin, event.room, event.stanza;
local occupant_auth_token = origin.auth_token;
if occupant_auth_token == nil then return end
update_presence_identity(
stanza,
origin.jitsi_meet_context_user
);
local data, err = jwt.decode(occupant_auth_token);
module:log('info', 'data it is %s',data);
if data == nil or
data.context == nil or
data.context.user == nil or
data.context.user.id == nil
then return end
if data.singleAccess == nil or not data.singleAccess then return end
local occupant_uuid = data.context.user.id
for _, user in room:each_occupant() do
-- filter focus as we keep it as hidden participant
if string.sub(user.nick,-string.len("/focus"))~="/focus" then
local get_session_info = async.runner( function(user)
local session = user.sessions[user.jid];
-- local wait, done = async.waiter();
local identity_tag = session:get_child('identity');
if identity_tag then
-- done();
-- end
-- wait();
local user_tag = identity_tag:get_child('user');
local id_tag = user_tag:get_child('id');
local user_uuid = id_tag:get_text();
module:log('info', 'user_uuid it is %s',user_uuid);
if user_uuid == occupant_uuid then
module:log('info', 'Duplicate access for user_uuid (%s)', user_uuid);
origin.send(st.error_reply(event.stanza, "cancel", "duplicate-access", "duplicate access"));
room:set_affiliation(true, event.occupant.bare_jid, 'member');
room:set_affiliation(true, event.occupant.bare_jid, 'outcast');
origin.send(st.error_reply(event.stanza, "cancel", "service-unavailable"));
return
end
-- end
end
end)
get_session_info:run(user);
end
end
end