sipster
sipster copied to clipboard
Ported to Windows (almost..)
I got sipster to build "successfully" under windows
unfortunately I get this:
module.js:434
return process.dlopen(module, path._makeLong(filename));
^
Error: The specified module could not be found.
\\?\c:\_______\sipster\build\Release\sipster.node
at Error (native)
at Object.Module._extensions..node (module.js:434:18)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (c:\______\app.js:5:13)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
but I can clearly see the sipster.node file. I'm assuming the ".dll" is failing to load.
steps:
-
edit all source files
#ifndef _WIN32 #include <strings.h> #endif
-
download
https://sourceforge.net/projects/gnuwin32/files/pcre/7.0/pcre-7.0-lib.zip/download
and extract intopcre-7.0-lib
of the sipster module directory. -
download pjsip source and put into
pjsip
of the sipster module directory. -
build
libpjproject
Release-Static Win32 -
node-gyp configure
-
node-gyp build
output:
> node-gyp rebuild
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | win32 | ia32
gyp info spawn C:\Python27\python.EXE
gyp info spawn args [ 'C:\\Users\\bstriker\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'msvs',
gyp info spawn args '-G',
gyp info spawn args 'msvs_version=auto',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\bstriker\\Git\\node-pjsip\\sipster\\build\\config.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\bstriker\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\bstriker\\.node-gyp\\4.4.3\\include\\node\\common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=C:\\Users\\bstriker\\.node-gyp\\4.4.3',
gyp info spawn args '-Dnode_gyp_dir=C:\\Users\\bstriker\\AppData\\Roaming\\npm\\node_modules\\node-gyp',
gyp info spawn args '-Dnode_lib_file=node.lib',
gyp info spawn args '-Dmodule_root_dir=C:\\Users\\bstriker\\Git\\node-pjsip\\sipster',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'C:\\Users\\bstriker\\Git\\node-pjsip\\sipster\\build',
gyp info spawn args '-Goutput_dir=.' ]
gyp info spawn C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args '/clp:Verbosity=minimal',
gyp info spawn args '/nologo',
gyp info spawn args '/p:Configuration=Release;Platform=Win32' ]
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
binding.cc
SIPSTERAccount.cc
SIPSTERCall.cc
SIPSTERMedia.cc
..\src\SIPSTERCall.cc(93): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc [C:\Users\bstriker\Git\node-pjsip\sipster\build\sipster.vcxproj]
..\src\SIPSTERMedia.cc(56): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc [C:\Users\bstriker\Git\node-pjsip\sipster\build\sipster.vcxproj]
..\src\binding.cc(231): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc [C:\Users\bstriker\Git\node-pjsip\sipster\build\sipster.vcxproj]
..\src\binding.cc(264): warning C4101: 'err': unreferenced local variable [C:\Users\bstriker\Git\node-pjsip\sipster\build\sipster.vcxproj]
..\src\SIPSTERAccount.cc(449): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc [C:\Users\bstriker\Git\node-pjsip\sipster\build\sipster.vcxproj]
SIPSTERTransport.cc
..\src\SIPSTERTransport.cc(11): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc [C:\Users\bstriker\Git\node-pjsip\sipster\build\sipster.vcxproj]
win_delay_load_hook.c
Creating library C:\Users\bstriker\Git\node-pjsip\sipster\build\Release\sipster.lib and object C:\Users\bstriker\Git\node-pjsip\sipster\build\Release\sipster.exp
Generating code
Finished generating code
sipster.vcxproj -> C:\__________\sipster\build\Release\\sipster.node
gyp info ok
binding.gyp
{
'targets': [
{
'target_name': 'sipster',
'sources': [
'src/binding.cc',
'src/SIPSTERAccount.cc',
'src/SIPSTERCall.cc',
'src/SIPSTERMedia.cc',
'src/SIPSTERTransport.cc',
],
'include_dirs': [
"src",
"<!(node -e \"require('nan')\")"
],
'conditions': [
[ 'OS=="win"', {
'include_dirs': [
'pjsip/pjsip/include',
'pjsip/pjlib/include',
'pjsip/pjlib-util/include',
'pjsip/pjmedia/include',
'pjsip/pjnath/include',
'pcre-7.0-lib/include'
],
'libraries': [
"-l../pjsip/lib/libpjproject-i386-Win32-vc8-Release-Static.lib",
"-l../pcre-7.0-lib/lib/pcre.lib",
"-lWs2_32.lib"
],
}],
[ 'OS!="win"', {
'cflags_cc': [
'<!@(pkg-config --atleast-version=2.4.5 libpjproject)',
'<!@(pkg-config --cflags libpjproject)',
'-fexceptions',
'-Wno-maybe-uninitialized',
],
'libraries': [
'<!@(pkg-config --libs libpjproject)',
],
}],
[ 'OS=="mac"', {
'xcode_settings': {
'OTHER_CFLAGS': [
'-fexceptions',
'-frtti',
],
},
# begin gyp stupidity workaround =====================================
'ldflags!': [
'-framework CoreAudio',
],
'libraries!': [
'CoreServices',
'AudioUnit',
'AudioToolbox',
'Foundation',
'AppKit',
'QTKit',
'QuartzCore',
'OpenGL',
],
'libraries': [
'CoreAudio.framework',
'CoreServices.framework',
'AudioUnit.framework',
'AudioToolbox.framework',
'Foundation.framework',
'AppKit.framework',
'QTKit.framework',
'QuartzCore.framework',
'OpenGL.framework',
],
# end gyp stupidity workaround =======================================
}],
],
},
],
}
I also got this to build with the swig wrapper finally also but there's no initializer function so it fails to compile. NODE_MODULE(pjsua2, init);
to wrap in swig:
-
install swig 3.x
-
navigate to
pjsip-apps\src\swig\nodejs
inside pjsip src folder -
create new folder
node
and cd into it -
run swig command:
swig -outdir ./src -I../../../../pjlib/include -I../../../../pjlib-util/include -I../../../../pjmedia/include -I../../../../pjsip/include -I../../../../pjnath/include -w312 -c++ -javascript -v8 -DV8_VERSION=0x04510335 -o pjsua2_wrap.cpp ../pjsua2.i
-
create binding.gyp (copy from above) and modify to point the include dirs and libs
../../../../
directories up -
node-gyp configure
-
node-gyp build
Hi all, I'm working for this too. I've "successfully" port it to windows. Failed to listening the events as follow. @StrikeForceZero I think you need a pcre3.dll for dlopen.
10:08:11.555 os_core_win32. !pjlib 2.6-svn for win32 initialized 10:08:11.559 sip_endpoint.c .Creating endpoint instance... 10:08:11.560 pjlib .select() I/O Queue created (06AD3BD8) 10:08:11.563 sip_endpoint.c .Module "mod-msg-print" registered 10:08:11.565 sip_transport. .Transport manager created. 10:08:11.568 pjsua_core.c .PJSUA state changed: NULL --> CREATED 10:08:11.570 sip_endpoint.c .Module "mod-pjsua-log" registered 10:08:11.573 sip_endpoint.c .Module "mod-tsx-layer" registered 10:08:11.575 sip_endpoint.c .Module "mod-stateful-util" registered 10:08:11.578 sip_endpoint.c .Module "mod-ua" registered 10:08:11.581 sip_endpoint.c .Module "mod-100rel" registered 10:08:11.583 sip_endpoint.c .Module "mod-pjsua" registered 10:08:11.586 sip_endpoint.c .Module "mod-invite" registered 10:08:11.607 wmme_dev.c ..WMME found 7 devices: 10:08:11.607 wmme_dev.c .. dev_id 0: Wave mapper (in=2, out=2) 10:08:11.610 wmme_dev.c .. dev_id 1: Mic 1 (Virtual Audio Cable) (in=2, out=0) 10:08:11.613 wmme_dev.c .. dev_id 2: Line 1 (Virtual Audio Cable) (in=2, out=0) 10:08:11.616 wmme_dev.c .. dev_id 3: Line 2 (Virtual Audio Cable) (in=2, out=0) 10:08:11.619 wmme_dev.c .. dev_id 4: Speakers (High Definition Audio (in=0, out=2) 10:08:11.621 wmme_dev.c .. dev_id 5: Line 2 (Virtual Audio Cable) (in=0, out=2) 10:08:11.624 wmme_dev.c .. dev_id 6: Line 1 (Virtual Audio Cable) (in=0, out=2) 10:08:11.627 wmme_dev.c ..WMME initialized 10:08:11.627 pjlib ..select() I/O Queue created (06AE5524) 10:08:11.634 sip_endpoint.c .Module "mod-evsub" registered 10:08:11.635 sip_endpoint.c .Module "mod-presence" registered 10:08:11.635 sip_endpoint.c .Module "mod-mwi" registered 10:08:11.640 sip_endpoint.c .Module "mod-refer" registered 10:08:11.644 sip_endpoint.c .Module "mod-pjsua-pres" registered 10:08:11.646 sip_endpoint.c .Module "mod-pjsua-im" registered 10:08:11.647 sip_endpoint.c .Module "mod-pjsua-options" registered 10:08:11.647 pjsua_core.c .1 SIP worker threads created 10:08:11.650 pjsua_core.c .pjsua version 2.6-svn for win32-6.1/i386/msvc-19.0 initialized 10:08:11.655 pjsua_core.c .PJSUA state changed: CREATED --> INIT 10:08:11.657 pjsua_aud.c Setting null sound device.. 10:08:11.661 pjsua_aud.c .Opening null sound device.. 10:08:11.666 pjsua_core.c SIP UDP socket reachable at 10.0.6.2:5060 10:08:11.667 udp06AF4A30 SIP UDP transport started, published address is 10.0.6.2:5060 10:08:11.670 pjsua_acc.c Adding account: id=sip:192.168.0.75 10:08:11.673 pjsua_acc.c .Account sip:192.168.0.75 added with id 0 App threw an error during load TypeError: acct.on is not a function at Object.
(E:\electron-test\main.js:53:6) at Object. (E:\electron-test\main.js:88:3) at Module._compile (module.js:571:32) at Object.Module._extensions..js (module.js:580:10) at Module.load (module.js:488:32) at tryModuleLoad (module.js:447:12) at Function.Module._load (module.js:439:3) at loadApplicationPackage (C:\Users\ganquan\AppData\Roaming\npm\node_modules\electron\dist\resources\default_app.asar\main.js:283:12) at Object. (C:\Users\ganquan\AppData\Roaming\npm\node_modules\electron\dist\resources\default_app.asar\main.js:325:5) at Object. (C:\Users\ganquan\AppData\Roaming\npm\node_modules\electron\dist\resources\default_app.asar\main.js:361:3)