You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

mod_jitsi_session.lua 1.3KB

123456789101112131415161718192021222324252627282930313233
  1. -- Jitsi session information
  2. -- Copyright (C) 2021-present 8x8, Inc.
  3. module:set_global();
  4. local formdecode = require "util.http".formdecode;
  5. local region_header_name = module:get_option_string('region_header_name', 'x_proxy_region');
  6. -- Extract the following parameters from the URL and set them in the session:
  7. -- * previd: for session resumption
  8. function init_session(event)
  9. local session, request = event.session, event.request;
  10. local query = request.url.query;
  11. if query ~= nil then
  12. local params = formdecode(query);
  13. -- previd is used together with https://modules.prosody.im/mod_smacks.html
  14. -- the param is used to find resumed session and re-use anonymous(random) user id
  15. session.previd = query and params.previd or nil;
  16. -- customusername can be used with combination with "pre-jitsi-authentication" event to pre-set a known jid to a session
  17. session.customusername = query and params.customusername or nil;
  18. -- The room name and optional prefix from the web query
  19. session.jitsi_web_query_room = params.room;
  20. session.jitsi_web_query_prefix = params.prefix or "";
  21. end
  22. session.user_region = request.headers[region_header_name];
  23. end
  24. module:hook_global("bosh-session", init_session, 1);
  25. module:hook_global("websocket-session", init_session, 1);