sip-lab 1.14.0 → 1.16.0
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.
- package/DEV.md +2 -2
- package/package.json +4 -3
- package/prebuilds/linux-x64/node.abi102.node +0 -0
- package/prebuilds/linux-x64/node.abi108.node +0 -0
- package/prebuilds/linux-x64/node.abi88.node +0 -0
- package/prebuilds/linux-x64/node.abi93.node +0 -0
- package/prebuilds/linux-x64/sip-lab.node +0 -0
- package/samples/{t → 183_session_progress.js} +98 -160
- package/samples/rtp_and_srtp.js +466 -0
- package/samples/rtp_and_srtp.rtp_refused.js +430 -0
- package/samples/rtp_and_srtp.unbalanced_sdp_answer.js.future +189 -0
- package/samples/srtp.js +344 -0
- package/src/sip.cpp +137 -30
- package/samples/183_session_progress.js.future +0 -246
package/DEV.md
CHANGED
|
@@ -48,14 +48,14 @@ Previously we would do:
|
|
|
48
48
|
|
|
49
49
|
```
|
|
50
50
|
nvm use v16.13.1 # if we try with v17 it will fail to build for -t 15.0.0
|
|
51
|
-
npx prebuildify --strip -t 15.0.0 -t 16.0.0 -t 17.0.0 -t 18.0.0
|
|
51
|
+
npx prebuildify --strip -t 15.0.0 -t 16.0.0 -t 17.0.0 -t 18.0.0 19.0.0 20.0.0 21.0.0
|
|
52
52
|
```
|
|
53
53
|
However the above will build the addon to run on the current OS.
|
|
54
54
|
|
|
55
55
|
Instead we will force the build on debian11 (using docker). So do this instead:
|
|
56
56
|
```
|
|
57
57
|
nvm use v16.13.1
|
|
58
|
-
npx prebuildify-cross -i mayamatakeshi/sip-lab-debian11:latest -t 15.0.0 -t 16.0.0 -t 17.0.0 -t 18.0.0 --strip
|
|
58
|
+
npx prebuildify-cross -i mayamatakeshi/sip-lab-debian11:latest -t 15.0.0 -t 16.0.0 -t 17.0.0 -t 18.0.0 -t 19.0.0 -t 20.0.0 -t 21.0.0 --strip
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
#### Running tests
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sip-lab",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.16.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"engines": {
|
|
@@ -30,9 +30,10 @@
|
|
|
30
30
|
"sip-matching": "^1.5.2"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"prebuildify": "^
|
|
33
|
+
"prebuildify": "^6.0.0",
|
|
34
34
|
"prebuildify-cross": "github:MayamaTakeshi/prebuildify-cross#use_existing_images",
|
|
35
|
-
"sdp-matching": "^1.3.2"
|
|
35
|
+
"sdp-matching": "^1.3.2",
|
|
36
|
+
"sipjs-lab": "^1.3.10"
|
|
36
37
|
},
|
|
37
38
|
"files": [
|
|
38
39
|
"index.js",
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -26,13 +26,13 @@ async function test() {
|
|
|
26
26
|
|
|
27
27
|
console.log(sip.start((data) => { console.log(data)} ))
|
|
28
28
|
|
|
29
|
-
t1 = sip.transport.create({address: "127.0.0.1",
|
|
30
|
-
t2 = sip.transport.create({address: "127.0.0.1",
|
|
29
|
+
t1 = sip.transport.create({address: "127.0.0.1", type: 'udp'})
|
|
30
|
+
t2 = sip.transport.create({address: "127.0.0.1", type: 'udp'})
|
|
31
31
|
|
|
32
32
|
console.log("t1", t1)
|
|
33
33
|
console.log("t2", t2)
|
|
34
34
|
|
|
35
|
-
oc = sip.call.create(t1.id, {from_uri: 'sip:alice@test.com', to_uri: `sip:bob@${t2.address}:${t2.port}`, media:
|
|
35
|
+
oc = sip.call.create(t1.id, {from_uri: 'sip:alice@test.com', to_uri: `sip:bob@${t2.address}:${t2.port}`, media: 'audio,audio'})
|
|
36
36
|
|
|
37
37
|
await z.wait([
|
|
38
38
|
{
|
|
@@ -46,7 +46,7 @@ async function test() {
|
|
|
46
46
|
sip_call_id: z.store.sip_call_id,
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
sip.call.respond(ic.id, {code:
|
|
49
|
+
sip.call.respond(ic.id, {code: 183, reason: 'Session Progress', media: 'audio,audio'})
|
|
50
50
|
|
|
51
51
|
await z.wait([
|
|
52
52
|
{
|
|
@@ -54,8 +54,8 @@ async function test() {
|
|
|
54
54
|
call_id: oc.id,
|
|
55
55
|
method: 'INVITE',
|
|
56
56
|
msg: sip_msg({
|
|
57
|
-
$rs: '
|
|
58
|
-
$rr: '
|
|
57
|
+
$rs: '183',
|
|
58
|
+
$rr: 'Session Progress',
|
|
59
59
|
'$(hdrcnt(VIA))': 1,
|
|
60
60
|
$fU: 'alice',
|
|
61
61
|
$fd: 'test.com',
|
|
@@ -71,13 +71,11 @@ async function test() {
|
|
|
71
71
|
media: [
|
|
72
72
|
{
|
|
73
73
|
type: 'audio',
|
|
74
|
-
local: {},
|
|
75
74
|
},
|
|
76
75
|
{
|
|
77
76
|
type: 'audio',
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
],
|
|
77
|
+
},
|
|
78
|
+
],
|
|
81
79
|
},
|
|
82
80
|
{
|
|
83
81
|
event: 'media_update',
|
|
@@ -86,12 +84,10 @@ async function test() {
|
|
|
86
84
|
media: [
|
|
87
85
|
{
|
|
88
86
|
type: 'audio',
|
|
89
|
-
local: {},
|
|
90
87
|
},
|
|
91
88
|
{
|
|
92
89
|
type: 'audio',
|
|
93
|
-
|
|
94
|
-
}
|
|
90
|
+
},
|
|
95
91
|
],
|
|
96
92
|
},
|
|
97
93
|
], 1000)
|
|
@@ -107,6 +103,13 @@ async function test() {
|
|
|
107
103
|
mode: 0,
|
|
108
104
|
media_id: 0
|
|
109
105
|
},
|
|
106
|
+
{
|
|
107
|
+
event: 'dtmf',
|
|
108
|
+
call_id: ic.id,
|
|
109
|
+
digits: '1234',
|
|
110
|
+
mode: 0,
|
|
111
|
+
media_id: 1
|
|
112
|
+
},
|
|
110
113
|
{
|
|
111
114
|
event: 'dtmf',
|
|
112
115
|
call_id: oc.id,
|
|
@@ -114,19 +117,18 @@ async function test() {
|
|
|
114
117
|
mode: 1,
|
|
115
118
|
media_id: 0
|
|
116
119
|
},
|
|
120
|
+
{
|
|
121
|
+
event: 'dtmf',
|
|
122
|
+
call_id: oc.id,
|
|
123
|
+
digits: '4321',
|
|
124
|
+
mode: 1,
|
|
125
|
+
media_id: 1
|
|
126
|
+
},
|
|
117
127
|
], 2000)
|
|
118
128
|
|
|
119
|
-
|
|
120
|
-
sip.call.reinvite(oc.id, {media: "audio,audio"})
|
|
121
|
-
|
|
122
|
-
await z.wait([
|
|
123
|
-
{
|
|
124
|
-
event: 'reinvite',
|
|
125
|
-
call_id: ic.id,
|
|
126
|
-
},
|
|
127
|
-
], 1000)
|
|
129
|
+
await z.sleep(1000)
|
|
128
130
|
|
|
129
|
-
sip.call.respond(ic.id, {code: 200, reason: 'OK', media:
|
|
131
|
+
sip.call.respond(ic.id, {code: 200, reason: 'OK', media: 'audio,audio'})
|
|
130
132
|
|
|
131
133
|
await z.wait([
|
|
132
134
|
{
|
|
@@ -135,80 +137,65 @@ async function test() {
|
|
|
135
137
|
method: 'INVITE',
|
|
136
138
|
msg: sip_msg({
|
|
137
139
|
$rs: '200',
|
|
140
|
+
$rr: 'OK',
|
|
141
|
+
'$(hdrcnt(VIA))': 1,
|
|
142
|
+
$fU: 'alice',
|
|
143
|
+
$fd: 'test.com',
|
|
144
|
+
$tU: 'bob',
|
|
145
|
+
'$hdr(content-type)': 'application/sdp',
|
|
146
|
+
$rb: '!{_}a=sendrecv',
|
|
138
147
|
}),
|
|
139
148
|
},
|
|
149
|
+
], 1000)
|
|
150
|
+
|
|
151
|
+
sip.call.send_dtmf(oc.id, {digits: '1234', mode: 0})
|
|
152
|
+
sip.call.send_dtmf(ic.id, {digits: '4321', mode: 1})
|
|
153
|
+
|
|
154
|
+
await z.wait([
|
|
140
155
|
{
|
|
141
156
|
event: 'media_update',
|
|
142
|
-
call_id:
|
|
157
|
+
call_id: oc.id,
|
|
143
158
|
status: 'ok',
|
|
144
159
|
media: [
|
|
145
160
|
{
|
|
146
161
|
type: 'audio',
|
|
147
|
-
local: {
|
|
148
|
-
mode: 'sendrecv'
|
|
149
|
-
},
|
|
150
|
-
remote: {
|
|
151
|
-
mode: 'sendrecv'
|
|
152
|
-
},
|
|
153
|
-
fmt: [
|
|
154
|
-
'0 PCMU/8000',
|
|
155
|
-
'120 telephone-event/8000'
|
|
156
|
-
]
|
|
157
162
|
},
|
|
158
163
|
{
|
|
159
164
|
type: 'audio',
|
|
160
|
-
|
|
161
|
-
mode: 'sendrecv'
|
|
162
|
-
},
|
|
163
|
-
remote: {
|
|
164
|
-
mode: 'sendrecv'
|
|
165
|
-
},
|
|
166
|
-
fmt: [
|
|
167
|
-
'0 PCMU/8000',
|
|
168
|
-
'120 telephone-event/8000'
|
|
169
|
-
]
|
|
170
|
-
}
|
|
165
|
+
},
|
|
171
166
|
]
|
|
172
167
|
},
|
|
173
168
|
{
|
|
174
|
-
event: '
|
|
169
|
+
event: 'dtmf',
|
|
170
|
+
call_id: ic.id,
|
|
171
|
+
digits: '1234',
|
|
172
|
+
mode: 0,
|
|
173
|
+
media_id: 0
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
event: 'dtmf',
|
|
177
|
+
call_id: ic.id,
|
|
178
|
+
digits: '1234',
|
|
179
|
+
mode: 0,
|
|
180
|
+
media_id: 1
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
event: 'dtmf',
|
|
175
184
|
call_id: oc.id,
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
type: 'audio',
|
|
180
|
-
local: {
|
|
181
|
-
mode: 'sendrecv'
|
|
182
|
-
},
|
|
183
|
-
remote: {
|
|
184
|
-
mode: 'sendrecv'
|
|
185
|
-
},
|
|
186
|
-
fmt: [
|
|
187
|
-
'0 PCMU/8000',
|
|
188
|
-
'120 telephone-event/8000'
|
|
189
|
-
]
|
|
190
|
-
},
|
|
191
|
-
{
|
|
192
|
-
type: 'audio',
|
|
193
|
-
local: {
|
|
194
|
-
mode: 'sendrecv'
|
|
195
|
-
},
|
|
196
|
-
remote: {
|
|
197
|
-
mode: 'sendrecv'
|
|
198
|
-
},
|
|
199
|
-
fmt: [
|
|
200
|
-
'0 PCMU/8000',
|
|
201
|
-
'120 telephone-event/8000'
|
|
202
|
-
]
|
|
203
|
-
}
|
|
204
|
-
]
|
|
185
|
+
digits: '4321',
|
|
186
|
+
mode: 1,
|
|
187
|
+
media_id: 0
|
|
205
188
|
},
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
189
|
+
{
|
|
190
|
+
event: 'dtmf',
|
|
191
|
+
call_id: oc.id,
|
|
192
|
+
digits: '4321',
|
|
193
|
+
mode: 1,
|
|
194
|
+
media_id: 1
|
|
195
|
+
},
|
|
196
|
+
], 2000)
|
|
209
197
|
|
|
210
|
-
|
|
211
|
-
sip.call.reinvite(oc.id, {media: "audio"})
|
|
198
|
+
sip.call.reinvite(oc.id, {media: 'audio,audio'})
|
|
212
199
|
|
|
213
200
|
await z.wait([
|
|
214
201
|
{
|
|
@@ -217,7 +204,7 @@ async function test() {
|
|
|
217
204
|
},
|
|
218
205
|
], 1000)
|
|
219
206
|
|
|
220
|
-
sip.call.respond(ic.id, {code: 200, reason: 'OK', media:
|
|
207
|
+
sip.call.respond(ic.id, {code: 200, reason: 'OK', media: 'audio,audio'})
|
|
221
208
|
|
|
222
209
|
await z.wait([
|
|
223
210
|
{
|
|
@@ -235,20 +222,9 @@ async function test() {
|
|
|
235
222
|
media: [
|
|
236
223
|
{
|
|
237
224
|
type: 'audio',
|
|
238
|
-
local: {
|
|
239
|
-
mode: 'sendrecv'
|
|
240
|
-
},
|
|
241
|
-
remote: {
|
|
242
|
-
mode: 'sendrecv'
|
|
243
|
-
},
|
|
244
|
-
fmt: [
|
|
245
|
-
'0 PCMU/8000',
|
|
246
|
-
'120 telephone-event/8000'
|
|
247
|
-
]
|
|
248
225
|
},
|
|
249
226
|
{
|
|
250
227
|
type: 'audio',
|
|
251
|
-
port: 0,
|
|
252
228
|
},
|
|
253
229
|
]
|
|
254
230
|
},
|
|
@@ -259,20 +235,9 @@ async function test() {
|
|
|
259
235
|
media: [
|
|
260
236
|
{
|
|
261
237
|
type: 'audio',
|
|
262
|
-
local: {
|
|
263
|
-
mode: 'sendrecv'
|
|
264
|
-
},
|
|
265
|
-
remote: {
|
|
266
|
-
mode: 'sendrecv'
|
|
267
|
-
},
|
|
268
|
-
fmt: [
|
|
269
|
-
'0 PCMU/8000',
|
|
270
|
-
'120 telephone-event/8000'
|
|
271
|
-
]
|
|
272
238
|
},
|
|
273
239
|
{
|
|
274
240
|
type: 'audio',
|
|
275
|
-
port: 0,
|
|
276
241
|
},
|
|
277
242
|
]
|
|
278
243
|
},
|
|
@@ -289,6 +254,13 @@ async function test() {
|
|
|
289
254
|
mode: 0,
|
|
290
255
|
media_id: 0
|
|
291
256
|
},
|
|
257
|
+
{
|
|
258
|
+
event: 'dtmf',
|
|
259
|
+
call_id: ic.id,
|
|
260
|
+
digits: '1234',
|
|
261
|
+
mode: 0,
|
|
262
|
+
media_id: 1
|
|
263
|
+
},
|
|
292
264
|
{
|
|
293
265
|
event: 'dtmf',
|
|
294
266
|
call_id: oc.id,
|
|
@@ -296,24 +268,30 @@ async function test() {
|
|
|
296
268
|
mode: 1,
|
|
297
269
|
media_id: 0
|
|
298
270
|
},
|
|
299
|
-
|
|
271
|
+
{
|
|
272
|
+
event: 'dtmf',
|
|
273
|
+
call_id: oc.id,
|
|
274
|
+
digits: '4321',
|
|
275
|
+
mode: 1,
|
|
276
|
+
media_id: 1
|
|
277
|
+
},
|
|
278
|
+
], 2000)
|
|
300
279
|
|
|
301
|
-
|
|
302
|
-
sip.call.reinvite(oc.id, {media: "audio,audio"})
|
|
280
|
+
sip.call.reinvite(ic.id, {media: 'audio,audio'})
|
|
303
281
|
|
|
304
282
|
await z.wait([
|
|
305
283
|
{
|
|
306
284
|
event: 'reinvite',
|
|
307
|
-
call_id:
|
|
285
|
+
call_id: oc.id,
|
|
308
286
|
},
|
|
309
287
|
], 1000)
|
|
310
288
|
|
|
311
|
-
sip.call.respond(
|
|
289
|
+
sip.call.respond(oc.id, {code: 200, reason: 'OK', media: 'audio,audio'})
|
|
312
290
|
|
|
313
291
|
await z.wait([
|
|
314
292
|
{
|
|
315
293
|
event: 'response',
|
|
316
|
-
call_id:
|
|
294
|
+
call_id: ic.id,
|
|
317
295
|
method: 'INVITE',
|
|
318
296
|
msg: sip_msg({
|
|
319
297
|
$rs: '200',
|
|
@@ -321,68 +299,28 @@ async function test() {
|
|
|
321
299
|
},
|
|
322
300
|
{
|
|
323
301
|
event: 'media_update',
|
|
324
|
-
call_id:
|
|
302
|
+
call_id: oc.id,
|
|
325
303
|
status: 'ok',
|
|
326
304
|
media: [
|
|
327
305
|
{
|
|
328
306
|
type: 'audio',
|
|
329
|
-
local: {
|
|
330
|
-
mode: 'sendrecv'
|
|
331
|
-
},
|
|
332
|
-
remote: {
|
|
333
|
-
mode: 'sendrecv'
|
|
334
|
-
},
|
|
335
|
-
fmt: [
|
|
336
|
-
'0 PCMU/8000',
|
|
337
|
-
'120 telephone-event/8000'
|
|
338
|
-
]
|
|
339
307
|
},
|
|
340
308
|
{
|
|
341
309
|
type: 'audio',
|
|
342
|
-
|
|
343
|
-
mode: 'sendrecv'
|
|
344
|
-
},
|
|
345
|
-
remote: {
|
|
346
|
-
mode: 'sendrecv'
|
|
347
|
-
},
|
|
348
|
-
fmt: [
|
|
349
|
-
'0 PCMU/8000',
|
|
350
|
-
'120 telephone-event/8000'
|
|
351
|
-
]
|
|
352
|
-
}
|
|
310
|
+
},
|
|
353
311
|
]
|
|
354
312
|
},
|
|
355
313
|
{
|
|
356
314
|
event: 'media_update',
|
|
357
|
-
call_id:
|
|
315
|
+
call_id: ic.id,
|
|
358
316
|
status: 'ok',
|
|
359
317
|
media: [
|
|
360
318
|
{
|
|
361
319
|
type: 'audio',
|
|
362
|
-
local: {
|
|
363
|
-
mode: 'sendrecv'
|
|
364
|
-
},
|
|
365
|
-
remote: {
|
|
366
|
-
mode: 'sendrecv'
|
|
367
|
-
},
|
|
368
|
-
fmt: [
|
|
369
|
-
'0 PCMU/8000',
|
|
370
|
-
'120 telephone-event/8000'
|
|
371
|
-
]
|
|
372
320
|
},
|
|
373
321
|
{
|
|
374
322
|
type: 'audio',
|
|
375
|
-
|
|
376
|
-
mode: 'sendrecv'
|
|
377
|
-
},
|
|
378
|
-
remote: {
|
|
379
|
-
mode: 'sendrecv'
|
|
380
|
-
},
|
|
381
|
-
fmt: [
|
|
382
|
-
'0 PCMU/8000',
|
|
383
|
-
'120 telephone-event/8000'
|
|
384
|
-
]
|
|
385
|
-
}
|
|
323
|
+
},
|
|
386
324
|
]
|
|
387
325
|
},
|
|
388
326
|
], 1000)
|
|
@@ -398,13 +336,6 @@ async function test() {
|
|
|
398
336
|
mode: 0,
|
|
399
337
|
media_id: 0
|
|
400
338
|
},
|
|
401
|
-
{
|
|
402
|
-
event: 'dtmf',
|
|
403
|
-
call_id: oc.id,
|
|
404
|
-
digits: '4321',
|
|
405
|
-
mode: 1,
|
|
406
|
-
media_id: 0
|
|
407
|
-
},
|
|
408
339
|
{
|
|
409
340
|
event: 'dtmf',
|
|
410
341
|
call_id: ic.id,
|
|
@@ -412,6 +343,13 @@ async function test() {
|
|
|
412
343
|
mode: 0,
|
|
413
344
|
media_id: 1
|
|
414
345
|
},
|
|
346
|
+
{
|
|
347
|
+
event: 'dtmf',
|
|
348
|
+
call_id: oc.id,
|
|
349
|
+
digits: '4321',
|
|
350
|
+
mode: 1,
|
|
351
|
+
media_id: 0
|
|
352
|
+
},
|
|
415
353
|
{
|
|
416
354
|
event: 'dtmf',
|
|
417
355
|
call_id: oc.id,
|