Skip to content

Commit

Permalink
[IMPROVE] Attach jitsi link to message object for Livechat (#22690)
Browse files Browse the repository at this point in the history
* [Improve] Attach jitsi link to message object for Livechat

(cherry picked from commit c888961da3313de06eaeb0700b7ce0b6371ef469)

* Update WebRTCClass.js
  • Loading branch information
murtaza98 committed Nov 16, 2021
1 parent 5505c11 commit 782da1e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions app/videobridge/server/methods/jitsiSetTimeout.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ import { metrics } from '../../../metrics/server';
import * as CONSTANTS from '../../constants';
import { canSendMessage } from '../../../authorization/server';
import { SystemLogger } from '../../../../server/lib/logger/system';
import { settings } from '../../../settings';

// TODO: Access Token missing. This is just a partial solution, it doesn't handle access token generation logic as present in this file - client/views/room/contextualBar/Call/Jitsi/CallJitsWithData.js
const resolveJitsiCallUrl = (room) => {
const rname = settings.get('Jitsi_URL_Room_Hash') ? settings.get('uniqueID') + room._id : encodeURIComponent(room.t === 'd' ? room.usernames.join(' x ') : room.name);
return `${ settings.get('Jitsi_SSL') ? 'https://' : 'http://' }${ settings.get('Jitsi_Domain') }/${ settings.get('Jitsi_URL_Room_Prefix') }${ rname }${ settings.get('Jitsi_URL_Room_Suffix') }`;
};

Meteor.methods({
'jitsi:updateTimeout': (rid, joiningNow = true) => {
Expand Down Expand Up @@ -43,6 +50,10 @@ Meteor.methods({
actionLinks: [
{ icon: 'icon-videocam', label: TAPi18n.__('Click_to_join'), i18nLabel: 'Click_to_join', method_id: 'joinJitsiCall', params: '' },
],
customFields: {
...room.customFields && { ...room.customFields },
...room.t === 'l' && { jitsiCallUrl: resolveJitsiCallUrl(room) }, // Note: this is just a temporary solution for the jitsi calls to work in Livechat. In future we wish to create specific events for specific to livechat calls (eg: start, accept, decline, end, etc) and this url info will be passed via there
},
});
message.msg = TAPi18n.__('Started_a_video_call');
callbacks.run('afterSaveMessage', message, { ...room, jitsiTimeout: currentTime + CONSTANTS.TIMEOUT });
Expand Down
2 changes: 1 addition & 1 deletion app/webrtc/client/WebRTCClass.js
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,7 @@ const WebRTC = new class {
} else {
enabled = settings.get('Omnichannel_call_provider') === 'WebRTC';
}
enabled &&= settings.get('WebRTC_Enabled');
enabled = enabled && settings.get('WebRTC_Enabled');
if (enabled === false) {
return;
}
Expand Down

0 comments on commit 782da1e

Please sign in to comment.