From 41c6ad281dfcf8229e6a815eeaa638d3a76a0a17 Mon Sep 17 00:00:00 2001 From: Sergiu Toma Date: Fri, 16 Sep 2022 11:08:02 +0300 Subject: [PATCH 1/2] Delete the whole call(with id) when we call closeCall --- app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.js b/app.js index 2295ce5..b625313 100644 --- a/app.js +++ b/app.js @@ -110,7 +110,7 @@ const closeCall = (callId) => { videoCalls[callId]?.consumerTransport.close(); videoCalls[callId]?.producerTransport.close(); videoCalls[callId].router.close(); - delete videoCalls[callId].router; + delete videoCalls[callId]; } } -- 2.37.1 From 7b6f78725b8326349c3f41aca386c5977f181cea Mon Sep 17 00:00:00 2001 From: Sergiu Toma Date: Fri, 16 Sep 2022 18:49:56 +0300 Subject: [PATCH 2/2] LINXD-2209: Call closeCall from producerclose and transportclose on consumer handlers; Update README.md --- .env | 2 +- README.md | 6 ++++++ app.js | 16 ++++++---------- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/.env b/.env index 6d8b7b8..551a6ac 100644 --- a/.env +++ b/.env @@ -1,3 +1,3 @@ -PORT=3000 +PORT=3001 IP=0.0.0.0 # Listening IPv4 or IPv6. ANNOUNCED_IP=185.8.154.190 # Announced IPv4 or IPv6 (useful when running mediasoup behind NAT with private IP). diff --git a/README.md b/README.md index 0f6cd98..8ca0eb7 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,11 @@ # Video server +### Generating certificates + +##### To generate SSL certificates you must: +1. Go to `/server/ssl` +2. Execute `openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout key.pem -out cert.pem` + ### Development diff --git a/app.js b/app.js index b625313..8b9e407 100644 --- a/app.js +++ b/app.js @@ -209,22 +209,18 @@ peers.on('connection', async socket => { paused: true, }) + // https://mediasoup.org/documentation/v3/mediasoup/api/#consumer-on-transportclose videoCalls[callId].consumer.on('transportclose', () => { const callId = socketDetails[socket.id]; - console.log('transport close from consumer', callId) - - // https://mediasoup.org/documentation/v3/mediasoup/api/#router-close - videoCalls[callId].producer.close() - videoCalls[callId].consumer.close() - delete videoCalls[callId].router + console.log('transport close from consumer', callId); + closeCall(); }) + // https://mediasoup.org/documentation/v3/mediasoup/api/#consumer-on-producerclose videoCalls[callId].consumer.on('producerclose', () => { const callId = socketDetails[socket.id]; - console.log('producer of consumer closed', callId) - - // https://mediasoup.org/documentation/v3/mediasoup/api/#router-close - closeCall() + console.log('producer of consumer closed', callId); + closeCall(); }) // from the consumer extract the following params -- 2.37.1