kirm / sip.js

Session Initiation Protocol for node.js
MIT License
427 stars 171 forks source link

Uncatchable "Error: listen EADDRINUSE: address already in use" error #147

Open Apollon77 opened 4 years ago

Apollon77 commented 4 years ago

Hey, we see users having issue when this library is used but the port is already used. This error in uncatchable because there is no error event handler added to the servicer instance created. Can this be changed somehow?

see https://sentry.iobroker.net/share/issue/5d67edf1bb314e2ab58c6a1e40ee3317/

Error: listen EADDRINUSE: address already in use :::41617
  File "net.js", line 1313, col 16, in Server.setupListenHandle [as _listen2]
  File "net.js", line 1361, col 12, in listenInCluster
  File "net.js", line 1447, col 7, in Server.listen
  File "/opt/iobroker/node_modules/sip/sip.js", line 643, col 14, in null.<anonymous>
    server.listen(options.tls_port || 5061, options.address);
  File "/opt/iobroker/node_modules/sip/sip.js", line 613, col 16, in makeStreamTransport
    var server = createServer(function(stream) {
  File "/opt/iobroker/node_modules/sip/sip.js", line 636, col 10, in makeTlsTransport
    return makeStreamTransport(
  File "/opt/iobroker/node_modules/sip/sip.js", line 819, col 21, in makeTransport
    protocols.TLS = makeTlsTransport(options, callbackAndLog);
  File "/opt/iobroker/node_modules/sip/sip.js", line 1325, col 19, in Object.exports.create
    var transport = makeTransport(options, function(m,remote) {
  File "/opt/iobroker/node_modules/iobroker.ring/node_modules/ring-client-api/lib/api/sip-call.js", line 56, col 30, in new SipCall
    this.sipClient = sip.create({
  File "/opt/iobroker/node_modules/iobroker.ring/node_modules/ring-client-api/lib/api/sip-session.js", line 43, col 38, in SipSession.createSipCall
    const call = (this.sipCall = new sip_call_1.SipCall(sipOptions, this.rtpOptions, this.tlsPort));