Node version v0.10.32
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0"
global.WebSocket = require('ws')
// SipJS Initialization
var SIP = require('./sip-0.6.0.js');
var Uaconfig = {
traceSip: true,
register: true,
userAgentString: 'sipJS Test tool',
uri: 'ramenlabs.io',
wsServers: ['wss://ramenlabs.io:5063'],
authorizationUser: 'gogasca',
password: '********'
//hackIpInContact: true
};
var userAgent = new SIP.UA(Uaconfig);When I run it I get an error:
Thu Oct 16 2014 03:40:53 GMT+0000 (UTC) | sip.transport | WebSocket connection error: Error: unexpected server response (400)Because initial Websocket from Sip.js lacks Sec-WebSocket-Protocol: sip to indicate SIP Protocol. If i use sample web page it works perfectly with same parameters, but not from my node command line. How to force this?
In API js I do see the 'sip' extra header but contains the window.Websocket
try {
this.ws = new window.WebSocket(this.server.ws_uri, 'sip');
}
catch(e) {
this.logger.log('Error connecting to WebSocket ' + this.server.ws_uri + ': ' + e);
//return false;
}global.WebSocket = require('ws');var SIP = require('./sip-0.6.3.js');var ua = new SIP.UA({traceSip: true});TypeError: Cannot set property 'binaryType' of null at Object.Transport.connect (/home/ubuntu/onsip/SIP.js/dist/sip-0.6.3.js:7836:24) at Object.Transport (/home/ubuntu/onsip/SIP.js/dist/sip-0.6.3.js:7762:8) at Object.UA.start (/home/ubuntu/onsip/SIP.js/dist/sip-0.6.3.js:8424:12) at Object.UA (/home/ubuntu/onsip/SIP.js/dist/sip-0.6.3.js:8222:10) at repl:1:11 at REPLServer.self.eval (repl.js:110:21) at repl.js:249:20 at REPLServer.self.eval (repl.js:122:7) at Interface.<anonymous> (repl.js:239:12) at Interface.emit (events.js:95:17)
I check line 7836 and this->ws is null after new Wesockets..global.WebSocket = require('ws');
var socket = new WebSocket('wss://echo.websocket.org');
socket.on('message', console.log.bind(console));
socket.on('open', socket.send.bind(socket, 'hello world'));
hello world { masked: false,
buffer: <Buffer 68 65 6c 6c 6f 20 77 6f 72 6c 64> }
node --version && npm --version && npm ls
v0.10.32
2.1.2
/private/tmp
├── sip...@0.6.3
└─┬ w...@0.4.32
├── comm...@2.1.0
├── n...@1.0.0
├── opt...@0.0.6
└── tiny...@0.0.1
--
You received this message because you are subscribed to a topic in the Google Groups "SIP.js" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sip_js/5GyRZHvyUTI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sip_js+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
To unsubscribe from this group and all its topics, send an email to sip_js+unsubscribe@googlegroups.com.