desc
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { logger } from '../logger/logger.js';
|
||||
import * as protocol from '../protocol/messages.js';
|
||||
import { logSessionActive, logSessionInitiator, logSessionEnded } from '../db/db.js';
|
||||
import { config } from '../config/config.js';
|
||||
|
||||
/**
|
||||
* Hub is the central coordinator for all active call sessions and client sockets.
|
||||
@@ -303,8 +304,26 @@ export class Hub {
|
||||
remote_ip: connectionIP
|
||||
});
|
||||
|
||||
// Confirm successful authentication to the client
|
||||
client.send(protocol.newAuthenticated(client.userID));
|
||||
// Prepare ICE servers configuration dynamically
|
||||
const iceServers = [
|
||||
{ urls: 'stun:stun.l.google.com:19302' },
|
||||
{ urls: 'stun:stun1.l.google.com:19302' }
|
||||
];
|
||||
if (config.turnUrl) {
|
||||
iceServers.push({
|
||||
urls: `${config.turnUrl}?transport=udp`,
|
||||
username: config.turnUsername,
|
||||
credential: config.turnCredential
|
||||
});
|
||||
iceServers.push({
|
||||
urls: `${config.turnUrl}?transport=tcp`,
|
||||
username: config.turnUsername,
|
||||
credential: config.turnCredential
|
||||
});
|
||||
}
|
||||
|
||||
// Confirm successful authentication to the client with the dynamic ICE servers configuration
|
||||
client.send(protocol.newAuthenticated(client.userID, iceServers));
|
||||
|
||||
// Trigger WebRTC active session joined if both are connected
|
||||
if (sess.driverConn && sess.passengerConn) {
|
||||
|
||||
Reference in New Issue
Block a user