Getting error in connecting to WebSocket

210 views
Skip to first unread message

gita....@gventure.net

unread,
Aug 1, 2018, 9:12:12 AM8/1/18
to SIP.js
Hi,
I am using nodejs to impletement sipjs. When i want to register User then i am getting error like given below. I have check my my freeswitch connection all configuration complete as you given in sipjs manual. Pleas help me to solve this issues.

Wed Aug 01 2018 18:32:00 GMT+0530 (IST) | sip.ua | user requested startup...
Wed Aug 01 2018 18:32:00 GMT+0530 (IST) | sip.transport | connecting to WebSocket ws://192.168.1.34:5066
Wed Aug 01 2018 18:32:00 GMT+0530 (IST) | sip.transport | error connecting to WebSocket ws://192.168.1.34:5066: TypeError: t is not a constructor
/node_modules/sip.js/dist/sip.min.js:38
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.SIP=t():e.SIP=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(s){if(i[s])return i[s].exports;var r=i[s]={i:s,l:!1,exports:{}};return e[s].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var i={};return t.m=e,t.c=i,t.d=function(e,i,s){t.o(e,i)||Object.defineProperty(e,i,{configurable:!1,enumerable:!0,get:s})},t.n=function(e){var i=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(i,"a",i),i},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=1)}([function(e,t){var i;i=function(){return this}();try{i=i||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(i=window)}e.exports=i},function(e,t,i){"use strict";e.exports=i(2)(i(34))},function(e,t,i){"use

TypeError: Cannot set property 'binaryType' of null
at i.connect (/node_modules/sip.js/dist/sip.min.js:38:189496)
at new i (/node_modules/sip.js/dist/sip.min.js:38:187581)
at o.start (/node_modules/sip.js/dist/sip.min.js:38:114349)
at new o (/node_modules/sip.js/dist/sip.min.js:38:111720)

Thank You!

Eric Green

unread,
Aug 1, 2018, 9:15:07 AM8/1/18
to SIP.js
Are you running the latest version of SIP.js? Please include full logs.

You may need a custom Transport and SDH to work within Node.js. While SIP.js will work in that environment, it is not something we support out of the box.

gita....@gventure.net

unread,
Aug 1, 2018, 10:31:36 AM8/1/18
to SIP.js
Currently i am running sipjs 0.11.2

full Error log :

Wed Aug 01 2018 18:32:00 GMT+0530 (IST) | sip.ua | configuration parameters after validation:
Wed Aug 01 2018 18:32:00 GMT+0530 (IST) | sip.ua | · viaHost: "6o6f5f5g1hhc.invalid"
Wed Aug 01 2018 18:32:00 GMT+0530 (IST) | sip.ua | · uri: sip:10...@192.168.88.25
Wed Aug 01 2018 18:32:00 GMT+0530 (IST) | sip.ua | · wsServers: [{"ws_uri":"ws://192.168.88.25:5066","sip_uri":"<sip:192.168.88.25:5066;transport=ws;lr>","weight":0,"status":0,"scheme":"WS"}]
Wed Aug 01 2018 18:32:00 GMT+0530 (IST) | sip.ua | · custom: {}
Wed Aug 01 2018 18:32:00 GMT+0530 (IST) | sip.ua | · displayName: ""
Wed Aug 01 2018 18:32:00 GMT+0530 (IST) | sip.ua | · password: NOT SHOWN
Wed Aug 01 2018 18:32:00 GMT+0530 (IST) | sip.ua | · registerExpires: 600
Wed Aug 01 2018 18:32:00 GMT+0530 (IST) | sip.ua | · register: true
Wed Aug 01 2018 18:32:00 GMT+0530 (IST) | sip.ua | · registrarServer: sip:192.168.88.25
Wed Aug 01 2018 18:32:00 GMT+0530 (IST) | sip.ua | · wsServerMaxReconnection: 3
Wed Aug 01 2018 18:32:00 GMT+0530 (IST) | sip.ua | · wsServerReconnectionTimeout: 4
Wed Aug 01 2018 18:32:00 GMT+0530 (IST) | sip.ua | · connectionRecoveryMinInterval: 2
Wed Aug 01 2018 18:32:00 GMT+0530 (IST) | sip.ua | · connectionRecoveryMaxInterval: 30
Wed Aug 01 2018 18:32:00 GMT+0530 (IST) | sip.ua | · keepAliveInterval: 0
Wed Aug 01 2018 18:32:00 GMT+0530 (IST) | sip.ua | · extraSupported: []
Wed Aug 01 2018 18:32:00 GMT+0530 (IST) | sip.ua | · usePreloadedRoute: false
Wed Aug 01 2018 18:32:00 GMT+0530 (IST) | sip.ua | · userAgentString: "sipJS Test tool"
Wed Aug 01 2018 18:32:00 GMT+0530 (IST) | sip.ua | · noAnswerTimeout: 60000
Wed Aug 01 2018 18:32:00 GMT+0530 (IST) | sip.ua | · traceSip: true
Wed Aug 01 2018 18:32:00 GMT+0530 (IST) | sip.ua | · hackViaTcp: false
Wed Aug 01 2018 18:32:00 GMT+0530 (IST) | sip.ua | · hackIpInContact: false
Wed Aug 01 2018 18:32:00 GMT+0530 (IST) | sip.ua | · hackWssInTransport: false
Wed Aug 01 2018 18:32:00 GMT+0530 (IST) | sip.ua | · hackAllowUnregisteredOptionTags: false
Wed Aug 01 2018 18:32:00 GMT+0530 (IST) | sip.ua | · sessionDescriptionHandlerFactoryOptions: {"constraints":{},"peerConnectionOptions":{}}
Wed Aug 01 2018 18:32:00 GMT+0530 (IST) | sip.ua | · contactName: "4so50q0b"
Wed Aug 01 2018 18:32:00 GMT+0530 (IST) | sip.ua | · contactTransport: "ws"
Wed Aug 01 2018 18:32:00 GMT+0530 (IST) | sip.ua | · forceRport: false
Wed Aug 01 2018 18:32:00 GMT+0530 (IST) | sip.ua | · autostart: true
Wed Aug 01 2018 18:32:00 GMT+0530 (IST) | sip.ua | · autostop: true
Wed Aug 01 2018 18:32:00 GMT+0530 (IST) | sip.ua | · rel100: "none"
Wed Aug 01 2018 18:32:00 GMT+0530 (IST) | sip.ua | · replaces: "none"
Wed Aug 01 2018 18:32:00 GMT+0530 (IST) | sip.ua | · sessionDescriptionHandlerFactory: function(e,t){return new i(e,t)}
Wed Aug 01 2018 18:32:00 GMT+0530 (IST) | sip.ua | · authenticationFactory: undefined
Wed Aug 01 2018 18:32:00 GMT+0530 (IST) | sip.ua | · allowLegacyNotifications: false
Wed Aug 01 2018 18:32:00 GMT+0530 (IST) | sip.ua | · allowOutOfDialogRefers: false
Wed Aug 01 2018 18:32:00 GMT+0530 (IST) | sip.ua | · authorizationUser: "1000"
Wed Aug 01 2018 18:32:00 GMT+0530 (IST) | sip.ua | · instanceId: "c9833aa4-e767-4f19-8019-2a1ef177921b"
Wed Aug 01 2018 18:32:00 GMT+0530 (IST) | sip.ua | · sipjsId: "8e71p"
Wed Aug 01 2018 18:32:00 GMT+0530 (IST) | sip.ua | · hostportParams: "192.168.88.25"
Wed Aug 01 2018 18:32:00 GMT+0530 (IST) | sip.ua | user requested startup...
Wed Aug 01 2018 18:32:00 GMT+0530 (IST) | sip.transport | connecting to WebSocket ws://192.168.88.25:5066
Wed Aug 01 2018 18:32:00 GMT+0530 (IST) | sip.transport | error connecting to WebSocket ws://192.168.88.25:5066: TypeError: t is not a constructor
/var/www/html/gita/nexibell/php/nodejs/trunk/node_modules/sip.js/dist/sip.min.js:38
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.SIP=t():e.SIP=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(s){if(i[s])return i[s].exports;var r=i[s]={i:s,l:!1,exports:{}};return e[s].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var i={};return t.m=e,t.c=i,t.d=function(e,i,s){t.o(e,i)||Object.defineProperty(e,i,{configurable:!1,enumerable:!0,get:s})},t.n=function(e){var i=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(i,"a",i),i},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=1)}([function(e,t){var i;i=function(){return this}();try{i=i||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(i=window)}e.exports=i},function(e,t,i){"use strict";e.exports=i(2)(i(34))},function(e,t,i){"use

TypeError: Cannot set property 'binaryType' of null
at i.connect (/node_modules/sip.js/dist/sip.min.js:38:189496)
at new i (/node_modules/sip.js/dist/sip.min.js:38:187581)
at o.start (/node_modules/sip.js/dist/sip.min.js:38:114349)
at new o (/node_modules/sip.js/dist/sip.min.js:38:111720)

at Module._compile (internal/modules/cjs/loader.js:678:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:689:10)
at Module.load (internal/modules/cjs/loader.js:589:32)
at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
at Function.Module._load (internal/modules/cjs/loader.js:520:3)

Eric Green

unread,
Aug 1, 2018, 10:54:59 AM8/1/18
to SIP.js
Node does not have native web sockets built in. You will need to create your own Transport.

gita....@gventure.net

unread,
Aug 2, 2018, 2:30:54 AM8/2/18
to SIP.js
i have created own transport like

var config = {
uri: '10...@192.168.88.25',
ws_servers: 'ws://192.168.88.25:5066',
authorizationUser: '1000',
password: '1234',
register:true,
transportOptions: {
traceSip: true,
wsServers: "ws://192.168.88.25:5066"
}
};

var ua = new SIP.UA(config);

Jim Greenberg

unread,
Aug 2, 2018, 10:14:59 AM8/2/18
to SIP.js
Creating your own transport is unfortunately going to be slightly more involved-
Much like creating your own session description handler, creating your own transport means making a new class to handle the transport part of SIP.js.
The interface is all outlined on the website https://sipjs.com/api/0.11.0/transport/ , and you can look at the default (websocket) transport to see how it might look. You will be able to pass it any configuration options you need via the transportOptions on the UA config.

I hope this helped.
-Jim
Reply all
Reply to author
Forward
0 new messages