Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Neto committed Dec 10, 2024
1 parent 777c4eb commit d80911c
Showing 1 changed file with 2 additions and 43 deletions.
45 changes: 2 additions & 43 deletions plugin/Meet/api.js.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,50 +171,9 @@ interfaceConfigOverwrite: {

let myUserID;

api.executeCommand('displayName', 'Loading...'); // Set temporary display name

api.addListener('videoConferenceJoined', (event) => {
api.addListener('participantJoined', (participan) => {
// Log the event details for debugging
console.log('videoConferenceJoined: Event triggered:', event);

// Extract necessary details
const roomName = event.roomName;
const userId = event.id; // Local participant's ID
const displayName = event.displayName; // Current display name

// Log extracted details
console.log(`videoConferenceJoined: Local user joined room: ${roomName}`);
console.log(`videoConferenceJoined: Local participant ID: ${userId}`);
console.log(`videoConferenceJoined: Current display name: ${displayName}`);

// Check if the display name looks like a phone number
const phonePattern = /^[0-9()\-\s]+$/;
if (phonePattern.test(displayName)) {
console.log('videoConferenceJoined: Display name looks like a phone number, updating it.');

// Remove all non-numeric characters
const numbers = displayName.replace(/\D/g, '');

// Format the phone number to ** ****-**XX
let newName = '';
if (numbers.length >= 4) {
newName = `** ****-**${numbers.slice(-2)}`;
} else {
newName = '**'; // Fallback for short numbers
}

// Log the new display name
console.log(`videoConferenceJoined: Updated display name: ${newName}`);

// Update the display name
api.executeCommand('displayName', newName);
} else {
console.log('videoConferenceJoined: Display name does not look like a phone number, keeping original.');

// Log and retain the original display name
console.log(`videoConferenceJoined: Retaining display name: ${displayName}`);
api.executeCommand('displayName', displayName);
}
console.log('participantJoined: Event triggered:', participan);
});


Expand Down

0 comments on commit d80911c

Please sign in to comment.