Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EADDRNOTAVAIL when trying to connecto to Twilio #1

Closed
psukys opened this issue Apr 3, 2018 · 6 comments
Closed

EADDRNOTAVAIL when trying to connecto to Twilio #1

psukys opened this issue Apr 3, 2018 · 6 comments
Assignees

Comments

@psukys
Copy link

psukys commented Apr 3, 2018

Hey, appreciate that @cwysong85 built the foundations on UDP communication for SIP.js!

Unfortunately, I do not know how to correctly (?) attempt to connect to Twilio's SIP service with this library. What I've tried was using the example examples/uas.js

--- uas.js	2018-04-03 15:18:56.187973602 +0200
+++ index.js	2018-04-03 15:19:07.136946594 +0200
@@ -1,6 +1,6 @@
 const SIPUDP = require('sipjs-udp')
 
-let host = '127.0.0.1', port = '5060';
+let host = 'manosip.sip.us1.twilio.com', port = '5060';
 
 class UasMediaHandler {
     constructor() {}
@@ -16,7 +16,7 @@
 const server = new SIPUDP.UA({
     // provide a valid URI here
     // The host and port are used to start the server
-    uri: 'uas@' + host + ':' + port,
+    uri: '101@' + host + ':' + port,
 
     // auto start...
     autostart: true,

To set-up Twilio's SIP endpoint, I've used this guide. I've verified through Zoiper (Android client) that it's possible to use the functionality.

The error that I get is:

Tue Apr 03 2018 15:26:18 GMT+0200 (CEST) | sip.ua | configuration parameters after validation:
Tue Apr 03 2018 15:26:18 GMT+0200 (CEST) | sip.ua | · viaHost: "manosip.sip.us1.twilio.com"
Tue Apr 03 2018 15:26:18 GMT+0200 (CEST) | sip.ua | · viaPort: 5060
Tue Apr 03 2018 15:26:18 GMT+0200 (CEST) | sip.ua | · uri: sip:101@manosip.sip.us1.twilio.com:5060
Tue Apr 03 2018 15:26:18 GMT+0200 (CEST) | sip.ua | · wsServers: [{"scheme":"WSS","sip_uri":"<sip:edge.sip.onsip.com;transport=ws;lr>","status":0,"weight":0,"ws_uri":"wss://edge.sip.onsip.com"}]
Tue Apr 03 2018 15:26:18 GMT+0200 (CEST) | sip.ua | · password: NOT SHOWN
Tue Apr 03 2018 15:26:18 GMT+0200 (CEST) | sip.ua | · registerExpires: 600
Tue Apr 03 2018 15:26:18 GMT+0200 (CEST) | sip.ua | · register: false
Tue Apr 03 2018 15:26:18 GMT+0200 (CEST) | sip.ua | · registrarServer: sip:manosip.sip.us1.twilio.com:5060
Tue Apr 03 2018 15:26:18 GMT+0200 (CEST) | sip.ua | · wsServerMaxReconnection: 3
Tue Apr 03 2018 15:26:18 GMT+0200 (CEST) | sip.ua | · wsServerReconnectionTimeout: 4
Tue Apr 03 2018 15:26:18 GMT+0200 (CEST) | sip.ua | · connectionRecoveryMinInterval: 2
Tue Apr 03 2018 15:26:18 GMT+0200 (CEST) | sip.ua | · connectionRecoveryMaxInterval: 30
Tue Apr 03 2018 15:26:18 GMT+0200 (CEST) | sip.ua | · usePreloadedRoute: false
Tue Apr 03 2018 15:26:18 GMT+0200 (CEST) | sip.ua | · userAgentString: "SIP.js/0.0.3"
Tue Apr 03 2018 15:26:18 GMT+0200 (CEST) | sip.ua | · iceCheckingTimeout: 5000
Tue Apr 03 2018 15:26:18 GMT+0200 (CEST) | sip.ua | · noAnswerTimeout: 60000
Tue Apr 03 2018 15:26:18 GMT+0200 (CEST) | sip.ua | · stunServers: ["stun:stun.l.google.com:19302"]
Tue Apr 03 2018 15:26:18 GMT+0200 (CEST) | sip.ua | · turnServers: []
Tue Apr 03 2018 15:26:18 GMT+0200 (CEST) | sip.ua | · traceSip: true
Tue Apr 03 2018 15:26:18 GMT+0200 (CEST) | sip.ua | · hackViaTcp: true
Tue Apr 03 2018 15:26:18 GMT+0200 (CEST) | sip.ua | · hackIpInContact: false
Tue Apr 03 2018 15:26:18 GMT+0200 (CEST) | sip.ua | · hackWssInTransport: false
Tue Apr 03 2018 15:26:18 GMT+0200 (CEST) | sip.ua | · autostart: true
Tue Apr 03 2018 15:26:18 GMT+0200 (CEST) | sip.ua | · doUAS: true
Tue Apr 03 2018 15:26:18 GMT+0200 (CEST) | sip.ua | · cluster: false
Tue Apr 03 2018 15:26:18 GMT+0200 (CEST) | sip.ua | · rel100: "none"
Tue Apr 03 2018 15:26:18 GMT+0200 (CEST) | sip.ua | · replaces: "none"
Tue Apr 03 2018 15:26:18 GMT+0200 (CEST) | sip.ua | · mediaHandlerFactory: function defaultFactory(session, options) {
  return new MediaHandler(session, options);
}
Tue Apr 03 2018 15:26:18 GMT+0200 (CEST) | sip.ua | · authenticationFactory: undefined
Tue Apr 03 2018 15:26:18 GMT+0200 (CEST) | sip.ua | · instanceId: "d5f76c73-d39a-47f0-a0f1-e58de051241e"
Tue Apr 03 2018 15:26:18 GMT+0200 (CEST) | sip.ua | · sipjsId: "a7als"
Tue Apr 03 2018 15:26:18 GMT+0200 (CEST) | sip.ua | · hostportParams: "manosip.sip.us1.twilio.com:5060"
Tue Apr 03 2018 15:26:18 GMT+0200 (CEST) | sip.ua | · authorizationUser: "101"
Tue Apr 03 2018 15:26:18 GMT+0200 (CEST) | sip.ua | · media: undefined
Tue Apr 03 2018 15:26:18 GMT+0200 (CEST) | sip.ua | user requested startup...
events.js:165
      throw er; // Unhandled 'error' event
      ^

Error: bind EADDRNOTAVAIL 54.172.60.1:5060
    at GetAddrInfoReqWrap._handle.lookup [as callback] (dgram.js:266:18)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:70:10)
Emitted 'error' event at:
    at GetAddrInfoReqWrap._handle.lookup [as callback] (dgram.js:267:14)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:70:10)

I've as well checked Twilio console, it does not report on any attempts to connect to it.

@cwysong85
Copy link
Owner

Since you are trying to register to Twilio, try these settings for the SIP UA:

const server = new SIPUDP.UA({
    // provide a valid URI here
    // The host and port are used to start the server
    uri: 'uas@' + host + ':' + port,

    // auto start...
    autostart: true,

    // register to Twilio 
    register: true,

    // trace sip or not
    traceSip: true,
    hackViaTcp: true,

    // diaabke UAS support
    doUAS: false,

    // Custom media handler - Enabled for custom media handling
    // dev notes: I've only implemented this library using a custom media handler.
    // I'm unsure how the built in media handler works with the UDP transport.
    // mediaHandlerFactory: new UasMediaHandler()
})

I changed register to “true” and doUAS to “false”.

@cwysong85
Copy link
Owner

cwysong85 commented Apr 4, 2018

@psukys Looks like there needs to be more work done when using the "register" function. This library was hacked to support more of a UAS than a UA with UDP transport. I'll be looking into the code and modifying it to support registering as a UA and using UDP as the transport.

@cwysong85 cwysong85 self-assigned this Apr 4, 2018
@cwysong85
Copy link
Owner

Closing this issue since I haven't received any other feedback for this issue.

@forjuan
Copy link

forjuan commented Apr 8, 2019

Is there any way to be a sip proxy and support websocket register to udp register?

@cwysong85
Copy link
Owner

cwysong85 commented Apr 8, 2019

@forjuan This project is geared towards being a client/server model more than a proxy. If I were you, I'd look at Kamailio and install the WebSocket module. That should give you everything you need in a proxy with WebSocket registration and UDP/TCP support right out of the gate.

Kamailio Install Guide for Debian: http://kamailio.org/docs/tutorials/devel/kamailio-install-guide-deb/
WebSocket module: https://www.kamailio.org/docs/modules/5.1.x/modules/websocket.html

@forjuan
Copy link

forjuan commented Apr 9, 2019

@cwysong85 I want a project builded with node rather than c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants