Иной подход к звонкам
This commit is contained in:
@@ -30,11 +30,7 @@ export const config = {
|
||||
minPasswordLength: 8,
|
||||
/** Maximum registrations allowed from the same IP (permanent, DB-level) */
|
||||
maxRegistrationsPerIp: Number(process.env.MAX_REGISTRATIONS_PER_IP) || 2,
|
||||
/** TURN server URL for WebRTC calls (e.g. turn:your-domain.com:3478) */
|
||||
turnUrl: process.env.TURN_URL || '',
|
||||
/** Shared secret for TURN server (coturn static-auth-secret) */
|
||||
turnSecret: process.env.TURN_SECRET || '',
|
||||
/** STUN server URLs */
|
||||
stunUrls: (process.env.STUN_URLS || 'stun:stun.l.google.com:19302,stun:stun1.l.google.com:19302')
|
||||
stunUrls: (process.env.STUN_URLS || 'stun:stun.yandex.ru:3478,stun:stun.sipnet.net:3478,stun:stun.l.google.com:19302,stun:stun.voip.aebc.com:3478,stun:stun.stunprotocol.org:3478')
|
||||
.split(',').map(s => s.trim()).filter(Boolean),
|
||||
};
|
||||
|
||||
@@ -124,23 +124,6 @@ app.get('/api/ice-servers', authenticateToken, (_req: AuthRequest, res) => {
|
||||
iceServers.push({ urls: config.stunUrls });
|
||||
}
|
||||
|
||||
// TURN сервер с временными credentials (coturn --use-auth-secret)
|
||||
if (config.turnUrl && config.turnSecret) {
|
||||
const ttl = 24 * 3600; // 24 часа
|
||||
const timestamp = Math.floor(Date.now() / 1000) + ttl;
|
||||
const username = `${timestamp}:vortex`;
|
||||
const credential = crypto
|
||||
.createHmac('sha1', config.turnSecret)
|
||||
.update(username)
|
||||
.digest('base64');
|
||||
|
||||
iceServers.push({
|
||||
urls: config.turnUrl,
|
||||
username,
|
||||
credential,
|
||||
});
|
||||
}
|
||||
|
||||
res.json({ iceServers });
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user