sip-lab 1.12.23 → 1.12.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +0 -3
  2. package/index.js +1 -1
  3. package/install.sh +0 -7
  4. package/package.json +17 -7
  5. package/prebuilds/linux-x64/node.abi102.node +0 -0
  6. package/prebuilds/linux-x64/node.abi108.node +0 -0
  7. package/prebuilds/linux-x64/node.abi88.node +0 -0
  8. package/prebuilds/linux-x64/node.abi93.node +0 -0
  9. package/DEV.md +0 -35
  10. package/binding.gyp +0 -110
  11. package/devjournal +0 -449
  12. package/include/siplab_constants.h +0 -6
  13. package/runtests +0 -15
  14. package/src/Makefile +0 -42
  15. package/src/addon.cpp +0 -1094
  16. package/src/event_templates.cpp +0 -62
  17. package/src/event_templates.hpp +0 -29
  18. package/src/idmanager.cpp +0 -76
  19. package/src/idmanager.hpp +0 -26
  20. package/src/log.cpp +0 -18
  21. package/src/log.hpp +0 -15
  22. package/src/packetdumper.cpp +0 -234
  23. package/src/packetdumper.hpp +0 -67
  24. package/src/pjmedia/Makefile +0 -39
  25. package/src/pjmedia/devjournal +0 -26
  26. package/src/pjmedia/include/chainlink/README +0 -3
  27. package/src/pjmedia/include/chainlink/chainlink.h +0 -11
  28. package/src/pjmedia/include/chainlink/chainlink_dtmfdet.h +0 -56
  29. package/src/pjmedia/include/chainlink/chainlink_fax.h +0 -25
  30. package/src/pjmedia/include/chainlink/chainlink_tonegen.h +0 -178
  31. package/src/pjmedia/include/chainlink/chainlink_wav_port.h +0 -231
  32. package/src/pjmedia/include/chainlink/chainlink_wire_port.h +0 -50
  33. package/src/pjmedia/include/pjmedia/README +0 -3
  34. package/src/pjmedia/include/pjmedia/dtmfdet.h +0 -74
  35. package/src/pjmedia/src/chainlink/chainlink_dtmfdet.c +0 -125
  36. package/src/pjmedia/src/chainlink/chainlink_fax.c +0 -280
  37. package/src/pjmedia/src/chainlink/chainlink_tonegen.c +0 -901
  38. package/src/pjmedia/src/chainlink/chainlink_wav_player.c +0 -688
  39. package/src/pjmedia/src/chainlink/chainlink_wav_writer.c +0 -442
  40. package/src/pjmedia/src/chainlink/chainlink_wire_port.c +0 -93
  41. package/src/pjmedia/src/pjmedia/dtmfdet.c +0 -129
  42. package/src/pjmedia/src/pjmedia/simpleua_dtmfdet.c +0 -753
  43. package/src/pjmedia/src/pjmedia/tonegen_dtmfdet.c +0 -263
  44. package/src/sip.cpp +0 -5975
  45. package/src/sip.hpp +0 -107
package/README.md CHANGED
@@ -60,9 +60,6 @@ It was originally developed with node v.10 and tested with v.12 and v16.13.1 and
60
60
 
61
61
  (it is known to not work with node v.8)
62
62
 
63
- It currently doesn't work with Debian 11 (see #29).
64
-
65
-
66
63
 
67
64
  ### About the code
68
65
 
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- const addon = require('./build/Release/addon.node');
1
+ const addon = require('node-gyp-build')(__dirname);
2
2
 
3
3
  var events = require('events');
4
4
  var eventEmitter = new events.EventEmitter();
package/install.sh CHANGED
@@ -68,10 +68,3 @@ EOF
68
68
  make dep && make clean && make
69
69
  fi
70
70
 
71
-
72
-
73
- cd $START_DIR
74
-
75
- node-gyp configure
76
-
77
- node-gyp build
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "sip-lab",
3
- "version": "1.12.23",
3
+ "version": "1.12.25",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "engines": {
7
7
  "node": ">=10.22"
8
8
  },
9
9
  "scripts": {
10
- "install": "./install.sh",
10
+ "install": "node-gyp-build",
11
11
  "test": "./runtests"
12
12
  },
13
13
  "repository": {
@@ -20,9 +20,19 @@
20
20
  "homepage": "https://github.com/MayamaTakeshi/sip-lab",
21
21
  "dependencies": {
22
22
  "@mayama/zeq": "^4.1.14",
23
- "data-matching": "^1.24.0",
24
- "node-addon-api": "^1.7.2",
25
- "node-gyp": "^8.4.1",
26
- "sip-matching": "^1.3.31"
27
- }
23
+ "node-addon-api": "^5.0.0",
24
+ "node-gyp": "^9.1.0",
25
+ "node-gyp-build": "^4.5.0",
26
+ "sip-matching": "^1.3.32"
27
+ },
28
+ "devDependencies": {
29
+ "prebuildify": "^5.0.1"
30
+ },
31
+ "files": [
32
+ "index.js",
33
+ "bindings.gyp",
34
+ "install.sh",
35
+ "samples",
36
+ "prebuilds"
37
+ ]
28
38
  }
package/DEV.md DELETED
@@ -1,35 +0,0 @@
1
- ### For devs
2
-
3
- We build and statically link to libs pjproject, spandsp, bgc729 and rapidjson.
4
-
5
- Basic tasks for development:
6
-
7
- #### To build
8
- ```
9
- npm install
10
- ```
11
-
12
- #### To clean up (for a clean rebuild)
13
- ```
14
- npx node-gyp clean
15
- ```
16
-
17
- #### To update pjproject, spandsp, bcg729 or rapidjson
18
- Just delete the corresponding library subfolder in subfolder 3drParty.
19
-
20
-
21
- Then temporarily change install.sh to not checkout a specific version (or checkout a desired commit)
22
-
23
- Then run
24
- ```
25
- npm install
26
- ```
27
-
28
- Then perform code changes and tests. When you are satisfied with them, update install.sh with the new commit id.
29
-
30
-
31
- #### Running tests
32
- ```
33
- npm test
34
- ```
35
-
package/binding.gyp DELETED
@@ -1,110 +0,0 @@
1
- {
2
- 'targets': [
3
- {
4
- 'target_name': 'addon',
5
- 'sources': [
6
- 'src/log.cpp',
7
- 'src/event_templates.cpp',
8
- 'src/idmanager.cpp',
9
- 'src/packetdumper.cpp',
10
- 'src/sip.cpp',
11
- 'src/addon.cpp',
12
- 'src/pjmedia/src/chainlink/chainlink_dtmfdet.c',
13
- 'src/pjmedia/src/chainlink/chainlink_tonegen.c',
14
- 'src/pjmedia/src/chainlink/chainlink_wav_player.c',
15
- 'src/pjmedia/src/chainlink/chainlink_wav_writer.c',
16
- 'src/pjmedia/src/chainlink/chainlink_wire_port.c',
17
- 'src/pjmedia/src/chainlink/chainlink_fax.c',
18
- ],
19
- 'include_dirs': [
20
- "3rdParty/pjproject/pjsip/include",
21
- "3rdParty/pjproject/pjlib/include",
22
- "3rdParty/pjproject/pjlib-util/include",
23
- "3rdParty/pjproject/pjnath/include",
24
- "3rdParty/pjproject/pjmedia/include",
25
- "include",
26
- "src",
27
- "src/pjmedia/include",
28
- "src/pjmedia/include/pjmedia",
29
- "src/pjmedia/include/chainlink",
30
- "3rdParty/rapidjson/include",
31
- "3rdParty/spandsp/src",
32
- "<!@(node -p \"require('node-addon-api').include\")",
33
- ],
34
- "dependencies": [
35
- "<!@(node -p \"require('node-addon-api').gyp\")"
36
- ],
37
- 'conditions': [
38
- [ 'OS!="win"', {
39
- 'cflags_cc': [
40
- '-g',
41
- '-fexceptions',
42
- '-Wno-maybe-uninitialized',
43
- '-fPIC',
44
- ],
45
- 'ldflags_cc': [
46
- '-all-static',
47
- ]
48
- }
49
- ]
50
- ],
51
- 'link_settings': {
52
- 'libraries': [
53
- '-L ../3rdParty/pjproject/pjnath/lib',
54
- '-L ../3rdParty/pjproject/pjlib/lib',
55
- '-L ../3rdParty/pjproject/pjlib-util/lib',
56
- '-L ../3rdParty/pjproject/third_party/lib',
57
- '-L ../3rdParty/pjproject/pjmedia/lib',
58
- '-L ../3rdParty/pjproject/pjsip/lib',
59
- '-L ../3rdParty/pjproject/third_party/lib',
60
- '-l pjnath-x86_64-unknown-linux-gnu',
61
- '-l ilbccodec-x86_64-unknown-linux-gnu',
62
- '-l srtp-x86_64-unknown-linux-gnu',
63
- '-l webrtc-x86_64-unknown-linux-gnu',
64
- '-l yuv-x86_64-unknown-linux-gnu',
65
- '-l speex-x86_64-unknown-linux-gnu',
66
- '-l gsmcodec-x86_64-unknown-linux-gnu',
67
- '-l g7221codec-x86_64-unknown-linux-gnu',
68
- '-l resample-x86_64-unknown-linux-gnu',
69
- '-l pjmedia-audiodev-x86_64-unknown-linux-gnu',
70
- '-l pjmedia-codec-x86_64-unknown-linux-gnu',
71
- '-l pjmedia-videodev-x86_64-unknown-linux-gnu',
72
- '-l pjmedia-x86_64-unknown-linux-gnu',
73
- '-l pjsdp-x86_64-unknown-linux-gnu',
74
- '-l pjsip-x86_64-unknown-linux-gnu',
75
- '-l pjsua2-x86_64-unknown-linux-gnu',
76
- '-l pjsip-ua-x86_64-unknown-linux-gnu',
77
- '-l pjsip-simple-x86_64-unknown-linux-gnu',
78
- '-l pjsua-x86_64-unknown-linux-gnu',
79
- '-l pj-x86_64-unknown-linux-gnu',
80
- '-l pjlib-util-x86_64-unknown-linux-gnu',
81
- '../3rdParty/spandsp/src/.libs/libspandsp.a',
82
- '../3rdParty/bcg729/src/libbcg729.a',
83
- '-lstdc++',
84
- '-lopus',
85
- '-lssl',
86
- '-lcrypto',
87
- '-luuid',
88
- '-lm',
89
- '-ldl',
90
- '-ltiff',
91
- '-lpcap',
92
- '-lrt',
93
- '-lpthread',
94
- '-lasound',
95
- '-lSDL2',
96
- '-lavdevice',
97
- '-lavformat',
98
- '-lavcodec',
99
- '-lswscale',
100
- '-lavutil',
101
- '-lv4l2',
102
- '-lopencore-amrnb',
103
- '-lopencore-amrwb',
104
- '-lvo-amrwbenc',
105
- '-lspeex',
106
- ],
107
- },
108
- },
109
- ]
110
- }
package/devjournal DELETED
@@ -1,449 +0,0 @@
1
- ------------------------------------------------------------
2
- 2019/05/25 takeshi:
3
- Development and test using node v10.15.3
4
-
5
- ------------------------------------------------------------
6
- 2019/06/08 takeshi:
7
-
8
- We needed to use pjproject built from source to permit to debug it as pjw_call_respond gets stuck.
9
-
10
-
11
- To be able to generate addon.node SO file we needed to build pjsip with -pPIC by doing:
12
-
13
- cd pjproject-2.7.2
14
- cat > user.mak <<EOF
15
- export CFLAGS += -fPIC -g
16
- export LDFLAGS +=
17
- EOF
18
-
19
- ./configure
20
- make dep && make clean && make
21
-
22
-
23
-
24
- After preparing binding.gyp to use pjproject built from source, build of addon was successful:
25
-
26
- takeshi@takeshi-desktop:node-sip$ node-gyp configure
27
- gyp info it worked if it ends with ok
28
- gyp info using node-gyp@3.8.0
29
- gyp info using node@10.15.3 | linux | x64
30
- gyp info spawn /usr/bin/python2
31
- gyp info spawn args [ '/home/takeshi/.nvm/versions/node/v10.15.3/lib/node_modules/node-gyp/gyp/gyp_main.py',
32
- gyp info spawn args 'binding.gyp',
33
- gyp info spawn args '-f',
34
- gyp info spawn args 'make',
35
- gyp info spawn args '-I',
36
- gyp info spawn args '/home/takeshi/src/git/themonks/node-sip/build/config.gypi',
37
- gyp info spawn args '-I',
38
- gyp info spawn args '/home/takeshi/.nvm/versions/node/v10.15.3/lib/node_modules/node-gyp/addon.gypi',
39
- gyp info spawn args '-I',
40
- gyp info spawn args '/home/takeshi/.node-gyp/10.15.3/include/node/common.gypi',
41
- gyp info spawn args '-Dlibrary=shared_library',
42
- gyp info spawn args '-Dvisibility=default',
43
- gyp info spawn args '-Dnode_root_dir=/home/takeshi/.node-gyp/10.15.3',
44
- gyp info spawn args '-Dnode_gyp_dir=/home/takeshi/.nvm/versions/node/v10.15.3/lib/node_modules/node-gyp',
45
- gyp info spawn args '-Dnode_lib_file=/home/takeshi/.node-gyp/10.15.3/<(target_arch)/node.lib',
46
- gyp info spawn args '-Dmodule_root_dir=/home/takeshi/src/git/themonks/node-sip',
47
- gyp info spawn args '-Dnode_engine=v8',
48
- gyp info spawn args '--depth=.',
49
- gyp info spawn args '--no-parallel',
50
- gyp info spawn args '--generator-output',
51
- gyp info spawn args 'build',
52
- gyp info spawn args '-Goutput_dir=.' ]
53
- ngyp info ok
54
- takeshi@takeshi-desktop:node-sip$ node-gyp build
55
- gyp info it worked if it ends with ok
56
- gyp info using node-gyp@3.8.0
57
- gyp info using node@10.15.3 | linux | x64
58
- gyp info spawn make
59
- gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
60
- make: Entering directory '/home/takeshi/src/git/themonks/node-sip/build'
61
- SOLINK_MODULE(target) Release/obj.target/addon.node
62
- COPY Release/addon.node
63
- make: Leaving directory '/home/takeshi/src/git/themonks/node-sip/build'
64
- gyp info ok
65
-
66
-
67
- Howevever, when trying to use it we got:
68
-
69
- takeshi@takeshi-desktop:node-sip$ node test.js
70
- internal/modules/cjs/loader.js:730
71
- return process.dlopen(module, path.toNamespacedPath(filename));
72
- ^
73
-
74
- Error: /home/takeshi/src/git/themonks/node-sip/build/Release/addon.node: undefined symbol: srtp_crypto_policy_set_aes_cm_256_hmac_sha1_80
75
- at Object.Module._extensions..node (internal/modules/cjs/loader.js:730:18)
76
- at Module.load (internal/modules/cjs/loader.js:600:32)
77
- at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
78
- at Function.Module._load (internal/modules/cjs/loader.js:531:3)
79
- at Module.require (internal/modules/cjs/loader.js:637:17)
80
- at require (internal/modules/cjs/helpers.js:22:18)
81
- at Object.<anonymous> (/home/takeshi/src/git/themonks/node-sip/index.js:1:77)
82
- at Module._compile (internal/modules/cjs/loader.js:701:30)
83
- at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
84
- at Module.load (internal/modules/cjs/loader.js:600:32)
85
-
86
-
87
- This was solved by checking the pjproject from apt dependencies:
88
-
89
- takeshi@takeshi-desktop:node-sip$ pkg-config --libs libpjproject
90
- -lpjsua2 -lstdc++ -lpjsua -lpjsip-ua -lpjsip-simple -lpjsip -lpjmedia-codec -lpjmedia -lpjmedia-videodev -lpjmedia-audiodev -lpjmedia -lpjnath -lpjlib-util -lsrtp2 -lpj -lopus -lssl -lcrypto -luuid -lm -lrt -lpthread -lasound -lSDL2 -lavdevice -lavformat -lavcodec -lswscale -lavutil -lv4l2 -lopencore-amrnb -lopencore-amrwb -lvo-amrwbenc
91
-
92
- and adding them to the binding.gyp link_settings.libraries.
93
-
94
-
95
- It also complained about a function from libspeex which was not mentioned in the the pkg-config output. So we addded it.
96
-
97
-
98
- Then, it failed with:
99
-
100
- takeshi@takeshi-desktop:node-sip$ node test.js
101
- pjw_init thread_id=1319614176
102
-
103
- 22:39:16.787 os_core_unix.c !pjlib 2.7.2 for POSIX initialized
104
- node: symbol lookup error: /home/takeshi/src/git/themonks/node-sip/build/Release/addon.node: undefined symbol: pj_cis_buf_init
105
-
106
-
107
- We found this in libpjlib-util:
108
-
109
- takeshi@takeshi-desktop:node-sip$ nm pjproject-2.7.2/pjlib-util/lib/libpjlib-util-x86_64-unknown-linux-gnu.a |grep pj_cis
110
- U pj_cis_add_str
111
- U pj_cis_buf_init
112
- U pj_cis_init
113
- 0000000000000170 T pj_cis_add_alpha
114
- 00000000000001f0 T pj_cis_add_cis
115
- 00000000000001a0 T pj_cis_add_num
116
- 0000000000000100 T pj_cis_add_range
117
- 00000000000001b0 T pj_cis_add_str
118
- 0000000000000000 T pj_cis_buf_init
119
- 0000000000000230 T pj_cis_del_range
120
- 0000000000000270 T pj_cis_del_str
121
- 0000000000000090 T pj_cis_dup
122
- 0000000000000040 T pj_cis_init
123
- 00000000000002b0 T pj_cis_invert
124
- takeshi@takeshi-desktop:node-sip$ nm pjproject-2.7.2/pjlib-util/lib/libpjlib-util-x86_64-unknown-linux-gnu.a |grep pj_cis_buf_init
125
- U pj_cis_buf_init
126
- 0000000000000000 T pj_cis_buf_init
127
-
128
-
129
- We solved the above by putting -lpjlib-util-x86_64-unknown-linux-gnu as the last library in the list of pjprojects libs.
130
-
131
- ------------------------------------------------------------
132
- 2019/06/08 takeshi:
133
-
134
- Problem of having pjw_call_respond stuck was narrowed down to:
135
- pjsip/src/pjsip-ua/sip_inv.c
136
- in function
137
- pjsip_inv_answer
138
-
139
- The code stops at this line:
140
- pjsip_dlg_inc_lock(inv->dlg);
141
-
142
- We tried to use latest pjproject 2.8 but the same problem happens.
143
-
144
- UPDATE:
145
- this is happening because pjsip get stuck in call to pjsip_mutex_lock.
146
- It seems the cause is because we are using a separate thread (boost/thread) to do periodic poll of events
147
- So we changed to make js to periodically do the poll and after that pjw_call_respond worked as expected.
148
-
149
-
150
-
151
- Obs: while investigating this issue, we found this:
152
-
153
- #####
154
- Deadlocks
155
- A deadlock is a situation wherein two or more competing actions are waiting for the other to finish, and thus neither ever does.
156
-
157
- The internal PJSIP synchronization should be free from deadlock problem. However, deadlock may still arise when PJSIP has to interract with application's mutex.
158
-
159
- To avoid deadlock introduced by application's mutex, the following rule MUST be obeyed at all times:
160
-
161
- Mutexes MUST always be acquired with the same order, and the order is:
162
- acquire PJSIP mutex first, then
163
- acquire application mutex.
164
- ###
165
-
166
- https://www.pjsip.org/locking.htm
167
-
168
- However, to confirm this is not related to the problem we replaced this:
169
-
170
- #define PJW_LOCK() pthread_mutex_lock(&g_mutex)
171
- #define PJW_UNLOCK() pthread_mutex_unlock(&g_mutex)
172
-
173
- with this:
174
-
175
- #define PJW_LOCK() printf("");
176
- #define PJW_UNLOCK() printf("");
177
-
178
- and the problem persisted.
179
-
180
- ------------------------------------------------------------
181
- 2019/06/08 takeshi:
182
- Due to:
183
- https://trac.pjsip.org/repos/changeset/5942
184
- we reverted from pjproject-2.8 to pjproject-2.7.2
185
-
186
-
187
- ------------------------------------------------------------
188
- 2019/06/08 takeshi:
189
-
190
- Failure to compile due change in definition of struct pjmedia_port_info:
191
-
192
- takeshi@takeshi-desktop:node-sip$ node-gyp build
193
- gyp info it worked if it ends with ok
194
- gyp info using node-gyp@3.8.0
195
- gyp info using node@10.15.3 | linux | x64
196
- gyp info spawn make
197
- gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
198
- make: Entering directory '/home/takeshi/src/git/themonks/node-sip/build'
199
- CC(target) Release/obj.target/addon/src/pjmedia/src/pjmedia/dtmfdet.o
200
- ../src/pjmedia/src/pjmedia/dtmfdet.c: In function ‘pjmedia_dtmfdet_create’:
201
- ../src/pjmedia/src/pjmedia/dtmfdet.c:90:29: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
202
- dtmfdet->base.put_frame = &dtmfdet_put_frame;
203
- ^
204
- ../src/pjmedia/src/pjmedia/dtmfdet.c: In function ‘dtmfdet_put_frame’:
205
- ../src/pjmedia/src/pjmedia/dtmfdet.c:115:19: error: ‘pjmedia_port_info {aka struct pjmedia_port_info}’ has no member named ‘samples_per_frame’
206
- dport->base.info.samples_per_frame);
207
- ^
208
- addon.target.mk:133: recipe for target 'Release/obj.target/addon/src/pjmedia/src/pjmedia/dtmfdet.o' failed
209
- make: *** [Release/obj.target/addon/src/pjmedia/src/pjmedia/dtmfdet.o] Error 1
210
- make: Leaving directory '/home/takeshi/src/git/themonks/node-sip/build'
211
- gyp ERR! build error
212
- gyp ERR! stack Error: `make` failed with exit code: 2
213
- gyp ERR! stack at ChildProcess.onExit (/home/takeshi/.nvm/versions/node/v10.15.3/lib/node_modules/node-gyp/lib/build.js:262:23)
214
- gyp ERR! stack at ChildProcess.emit (events.js:189:13)
215
- gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
216
- gyp ERR! System Linux 4.15.0-43-generic
217
- gyp ERR! command "/home/takeshi/.nvm/versions/node/v10.15.3/bin/node" "/home/takeshi/.nvm/versions/node/v10.15.3/bin/node-gyp" "build"
218
- gyp ERR! cwd /home/takeshi/src/git/themonks/node-sip
219
- gyp ERR! node -v v10.15.3
220
- gyp ERR! node-gyp -v v3.8.0
221
- gyp ERR! not ok
222
-
223
- UPDATE: actually dtmfdet.c is not necessary as it was just a plain pjmedia sample. Same for simpleua_dtmfdet.c.
224
- So these were removed from binding.gyp target sources list.
225
-
226
- ------------------------------------------------------------
227
- 2020/08/02 takeshi:
228
-
229
- Installation using 'npm install' tested on Ubuntu 18.04.
230
- ------------------------------------------------------------
231
- 2020/08/08 takeshi:
232
-
233
- When trying to build on Debian 10 I got:
234
-
235
- $ npm install
236
- npm WARN lifecycle sip-lab@1.0.0~install: cannot run in wd sip-lab@1.0.0 ./install.sh (wd=/usr/local/src/git/github_MayamaTakeshi/sip-lab)
237
- audited 124 packages in 2.618s
238
- found 0 vulnerabilities
239
-
240
- But the process exit without error:
241
- $ echo $?
242
- 0
243
-
244
- which is bad because the addon was left unbuilt.
245
-
246
- I had to use:
247
- npm install --unsafe-perm
248
- otherwise, it doesn't run the install.sh script
249
-
250
- Then build went further but now I got:
251
-
252
- CXX(target) Release/obj.target/addon/src/addon.o
253
- ../src/addon.cpp: In function 'Napi::Object init(Napi::Env, Napi::Object)':
254
- ../src/addon.cpp:1361:60: error: no matching function for call to 'Napi::Function::New(Napi::Env&, <unresolved overloaded function type>)'
255
- exports.Set("shutdown", Napi::Function::New(env, shutdown));
256
- ^
257
- In file included from /usr/local/src/git/github_MayamaTakeshi/sip-lab/node_modules/node-addon-api/napi.h:2051,
258
- from ../src/addon.cpp:3:
259
- /usr/local/src/git/github_MayamaTakeshi/sip-lab/node_modules/node-addon-api/napi-inl.h:1678:17: note: candidate: 'template<class Callable> static Napi::Function Napi::Function::New(napi_env, Callable, con
260
- st char*, void*)'
261
- inline Function Function::New(napi_env env,
262
- ^~~~~~~~
263
- /usr/local/src/git/github_MayamaTakeshi/sip-lab/node_modules/node-addon-api/napi-inl.h:1678:17: note: template argument deduction/substitution failed:
264
- ../src/addon.cpp:1361:60: note: couldn't deduce template parameter 'Callable'
265
- exports.Set("shutdown", Napi::Function::New(env, shutdown));
266
- ^
267
-
268
- Suspecting the name shutdown was conflicting with something else, I renamed the function as
269
- shutdown_
270
- and after that, build went further.
271
-
272
- But then I got:
273
-
274
- /usr/bin/ld: cannot find -lsrtp
275
- collect2: error: ld returned 1 exit status
276
- make: *** [addon.target.mk:226: Release/obj.target/addon.node] Error 1
277
- make: Leaving directory '/usr/local/src/git/github_MayamaTakeshi/sip-lab/build'
278
-
279
- This seems to be because in Debian 10, srtp library changed from libsrtp to libsrtp2.
280
- But, actually, we should not use OS libs and instead we should the ThirdParty ones.
281
- And in the binding.gyp we were actually using this unnecessary line:
282
-
283
- '-lsrtp',
284
-
285
- But we already got this one:
286
-
287
- '-L ../pjproject/third_party/lib',
288
-
289
-
290
- So, I removed '-lsrtp' and built was successful but then when running the sample I got:
291
-
292
-
293
- $ node samples/simple.js
294
- internal/modules/cjs/loader.js:730
295
- return process.dlopen(module, path.toNamespacedPath(filename));
296
- ^
297
-
298
- Error: /usr/local/src/git/github_MayamaTakeshi/sip-lab/build/Release/addon.node: undefined symbol: crypto_policy_set_aes_cm_256_hmac_sha1_80
299
- at Object.Module._extensions..node (internal/modules/cjs/loader.js:730:18)
300
- at Module.load (internal/modules/cjs/loader.js:600:32)
301
- at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
302
- at Function.Module._load (internal/modules/cjs/loader.js:531:3)
303
- at Module.require (internal/modules/cjs/loader.js:637:17)
304
- at require (internal/modules/cjs/helpers.js:22:18)
305
- at Object.<anonymous> (/usr/local/src/git/github_MayamaTakeshi/sip-lab/index.js:1:77)
306
- at Module._compile (internal/modules/cjs/loader.js:701:30)
307
- at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
308
- at Module.load (internal/modules/cjs/loader.js:600:32)
309
-
310
-
311
- So I disable SRTP by setting:
312
-
313
- #define PJMEDIA_HAS_SRTP 0
314
-
315
- in config_site.h
316
-
317
-
318
- However, when trying to run
319
- node samples/simple.js
320
- we are frequently (almost all the time) getting this:
321
-
322
- $ node samples/simple.js
323
- pjw_init thread_id=583253000
324
-
325
- 21:12:20.187 os_core_unix.c !pjlib 2.5.5-svn for POSIX initialized
326
- undefined
327
- t1 { id: 0, ip: '127.0.0.1', port: 5090 }
328
- t2 { id: 1, ip: '127.0.0.1', port: 5092 }
329
- inv=22c3c118 tdata=3779318
330
-
331
- on_state_changed
332
-
333
- status=583254296
334
-
335
- 21:12:20.260 !: Success
336
- wait (line /usr/local/src/git/github_MayamaTakeshi/sip-lab/samples/simple.js:24) started. Waiting for expected_events:
337
- [
338
- partial_match({
339
- event: 'incoming_call',
340
- call_id: collect['call_id']()
341
- }),
342
- partial_match({
343
- event: 'response',
344
- call_id: 0,
345
- method: 'INVITE',
346
- msg: sip_msg({
347
- $rs: '100',
348
- $rr: 'Trying',
349
- $(hdrcnt(via)): 1,
350
- $hdr(call-id): collect['sip_call_id'](),
351
- $fU: 'a',
352
- $fd: 't',
353
- $tU: 'b',
354
- $hdr(l): '0'
355
- })
356
- })
357
- ]
358
- Segmentation fault
359
-
360
-
361
-
362
- Checking with gdb:
363
- Thread 1 "node" received signal SIGSEGV, Segmentation fault.
364
- __strlen_sse2 () at ../sysdeps/x86_64/multiarch/../strlen.S:120
365
- 120 ../sysdeps/x86_64/multiarch/../strlen.S: No such file or directory.
366
- (gdb) bt
367
- #0 0x00007ffff7b40206 in __strlen_sse2 () at ../sysdeps/x86_64/multiarch/../strlen.S:120
368
- #1 0x00007ffff7af99ef in _IO_vfprintf_internal (s=0x7fffffff6af0, format=0x7ffff52533ec "on_rx_request %.*s\n\n", ap=0x7fffffff91b0) at vfprintf.c:1638
369
- #2 0x00007ffff7afa866 in buffered_vfprintf (s=s@entry=0x7ffff7c64760 <_IO_2_1_stdout_>, format=format@entry=0x7ffff52533ec "on_rx_request %.*s\n\n", args=args@entry=0x7fffffff91b0) at vfprintf.c:2322
370
- #3 0x00007ffff7af7eb2 in _IO_vfprintf_internal (s=0x7ffff7c64760 <_IO_2_1_stdout_>, format=0x7ffff52533ec "on_rx_request %.*s\n\n", ap=ap@entry=0x7fffffff91b0) at vfprintf.c:1296
371
- #4 0x00007ffff7b00606 in __printf (format=<optimized out>) at printf.c:33
372
- #5 0x00007ffff51ccbe6 in _addon_log(int, char const*, ...) () at /usr/local/src/git/github_MayamaTakeshi/sip-lab/build/Release/addon.node
373
- #6 0x00007ffff51d81a9 in on_rx_request(pjsip_rx_data*) () at /usr/local/src/git/github_MayamaTakeshi/sip-lab/build/Release/addon.node
374
- #7 0x00007ffff520b94b in pjsip_endpt_process_rx_data (p_handled=0x7fffffffa75c, p=0x7fffffffa780, rdata=0x266f488, endpt=0x261e7a8) at ../src/pjsip/sip_endpoint.c:887
375
- #8 0x00007ffff520b94b in pjsip_endpt_process_rx_data (endpt=0x261e7a8, rdata=0x266f488, p=<optimized out>, p_handled=0x7fffffffa75c) at ../src/pjsip/sip_endpoint.c:824
376
- #9 0x00007ffff520bb56 in endpt_on_rx_msg (endpt=0x261e7a8, status=<optimized out>, rdata=0x266f488) at ../src/pjsip/sip_endpoint.c:1037
377
- #10 0x00007ffff52117a6 in pjsip_tpmgr_receive_packet (mgr=<optimized out>, rdata=rdata@entry=0x266f488) at ../src/pjsip/sip_transport.c:1938
378
- #11 0x00007ffff5213a4f in udp_on_read_complete (key=0x26257e8, op_key=<optimized out>, bytes_read=<optimized out>) at ../src/pjsip/sip_transport_udp.c:170
379
- #12 0x00007ffff5236e28 in ioqueue_dispatch_read_event (h=0x26257e8, ioqueue=0x2629600) at ../src/pj/ioqueue_common_abs.c:605
380
- #13 0x00007ffff5236e28 in ioqueue_dispatch_read_event (ioqueue=0x2629600, h=0x26257e8) at ../src/pj/ioqueue_common_abs.c:433
381
- #14 0x00007ffff52386cf in pj_ioqueue_poll (ioqueue=0x2629600, timeout=timeout@entry=0x7fffffffb190) at ../src/pj/ioqueue_select.c:981
382
- #15 0x00007ffff520b70a in pjsip_endpt_handle_events2 (endpt=0x261e7a8, max_timeout=0x7fffffffb1d0, p_count=0x0) at ../src/pjsip/sip_endpoint.c:742
383
- #16 0x00007ffff51cf824 in handle_events() () at /usr/local/src/git/github_MayamaTakeshi/sip-lab/build/Release/addon.node
384
- #17 0x00007ffff51d00a4 in __pjw_poll(char*) () at /usr/local/src/git/github_MayamaTakeshi/sip-lab/build/Release/addon.node
385
- #18 0x00007ffff51dab71 in do_poll(Napi::CallbackInfo const&) () at /usr/local/src/git/github_MayamaTakeshi/sip-lab/build/Release/addon.node
386
- #19 0x00007ffff51e4923 in Napi::details::CallbackData<Napi::Value (*)(Napi::CallbackInfo const&), Napi::Value>::Wrapper(napi_env__*, napi_callback_info__*) ()
387
- at /usr/local/src/git/github_MayamaTakeshi/sip-lab/build/Release/addon.node
388
- #20 0x00000000008e85b5 in (anonymous namespace)::v8impl::FunctionCallbackWrapper::Invoke(v8::FunctionCallbackInfo<v8::Value> const&) ()
389
- #21 0x0000000000b62a3f in v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObj
390
- ect>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) ()
391
- #22 0x0000000000b635a9 in v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate*) ()
392
- #23 0x0000309d62fdbe1d in ()
393
-
394
-
395
- So it is a bug in our code.
396
-
397
-
398
- But building it with these changes in on ubuntu 18.04.4 doesn't cause this crash which means in Debian 10 a condition that increases the chances of crash was introduced.
399
- Anyway, we will commit these changes and solve the crash later.
400
-
401
- ------------------------------------------------------------
402
- 2020/08/09 takeshi:
403
-
404
- We had to disable SRTP pjsip support (config_site.h) because of this:
405
-
406
- $ node samples/simple.js
407
- internal/modules/cjs/loader.js:730
408
- return process.dlopen(module, path.toNamespacedPath(filename));
409
- ^
410
-
411
- Error: /mnt/backup/takeshi_tmp/sip-lab/build/Release/addon.node: undefined symbol: crypto_policy_set_aes_cm_256_hmac_sha1_80
412
- at Object.Module._extensions..node (internal/modules/cjs/loader.js:730:18)
413
- at Module.load (internal/modules/cjs/loader.js:600:32)
414
- at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
415
- at Function.Module._load (internal/modules/cjs/loader.js:531:3)
416
- at Module.require (internal/modules/cjs/loader.js:637:17)
417
- at require (internal/modules/cjs/helpers.js:22:18)
418
- at Object.<anonymous> (/mnt/backup/takeshi_tmp/sip-lab/index.js:1:77)
419
- at Module._compile (internal/modules/cjs/loader.js:701:30)
420
- at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
421
- at Module.load (internal/modules/cjs/loader.js:600:32)
422
-
423
- ------------------------------------------------------------
424
- 2020/08/12 takeshi:
425
-
426
- We did adjustments to support late negotiation.
427
- For this we split original callback on_rx_offer in new callbacks on_rx_offer and on_rx_reinvite.
428
- This worked with initial INVITE late negotiation.
429
- However, it crashed with RE-INVITE late negotiation.
430
- The problem is that on_rx_reinvite is getting an offer without media (due RE-INVITE without SDP).
431
- Instead, I think we should go back to use original on_rx_offer because it seems this is called only when we get media offer and so we would avoid this problem.
432
-
433
-
434
- ------------------------------------------------------------
435
- 2022/08/12 takeshi:
436
-
437
- When rebuilding the addon, this should be enough (it should be fast):
438
- ```
439
- npm install --unsafe-perm
440
- ```
441
- ------------------------------------------------------------
442
- 2022/09/11 takeshi:
443
-
444
- To try to solve #21, we upraded pjproject to commit 797088ed133c98492519b7d042b75735f6f9388c.
445
- However, after doing it we verified sending CANCEL doesn't cause the other side to send '497 Request Terminated' by itself anymore (see samples/sip_cancel.js)
446
-
447
-
448
-
449
-