sip-lab 1.15.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/package.json +3 -2
- package/prebuilds/linux-x64/sip-lab.node +0 -0
- package/samples/{183_session_progress.js.future → 183_session_progress.js} +156 -7
- 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 +14 -16
- package/src/sip.cpp +53 -22
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": {
|
|
@@ -32,7 +32,8 @@
|
|
|
32
32
|
"devDependencies": {
|
|
33
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
|
|
@@ -32,7 +32,7 @@ async function test() {
|
|
|
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}
|
|
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: 183, reason: 'Session Progress'})
|
|
49
|
+
sip.call.respond(ic.id, {code: 183, reason: 'Session Progress', media: 'audio,audio'})
|
|
50
50
|
|
|
51
51
|
await z.wait([
|
|
52
52
|
{
|
|
@@ -72,6 +72,9 @@ async function test() {
|
|
|
72
72
|
{
|
|
73
73
|
type: 'audio',
|
|
74
74
|
},
|
|
75
|
+
{
|
|
76
|
+
type: 'audio',
|
|
77
|
+
},
|
|
75
78
|
],
|
|
76
79
|
},
|
|
77
80
|
{
|
|
@@ -82,6 +85,9 @@ async function test() {
|
|
|
82
85
|
{
|
|
83
86
|
type: 'audio',
|
|
84
87
|
},
|
|
88
|
+
{
|
|
89
|
+
type: 'audio',
|
|
90
|
+
},
|
|
85
91
|
],
|
|
86
92
|
},
|
|
87
93
|
], 1000)
|
|
@@ -97,6 +103,13 @@ async function test() {
|
|
|
97
103
|
mode: 0,
|
|
98
104
|
media_id: 0
|
|
99
105
|
},
|
|
106
|
+
{
|
|
107
|
+
event: 'dtmf',
|
|
108
|
+
call_id: ic.id,
|
|
109
|
+
digits: '1234',
|
|
110
|
+
mode: 0,
|
|
111
|
+
media_id: 1
|
|
112
|
+
},
|
|
100
113
|
{
|
|
101
114
|
event: 'dtmf',
|
|
102
115
|
call_id: oc.id,
|
|
@@ -104,11 +117,18 @@ async function test() {
|
|
|
104
117
|
mode: 1,
|
|
105
118
|
media_id: 0
|
|
106
119
|
},
|
|
120
|
+
{
|
|
121
|
+
event: 'dtmf',
|
|
122
|
+
call_id: oc.id,
|
|
123
|
+
digits: '4321',
|
|
124
|
+
mode: 1,
|
|
125
|
+
media_id: 1
|
|
126
|
+
},
|
|
107
127
|
], 2000)
|
|
108
128
|
|
|
109
129
|
await z.sleep(1000)
|
|
110
130
|
|
|
111
|
-
sip.call.respond(ic.id, {code: 200, reason: 'OK'})
|
|
131
|
+
sip.call.respond(ic.id, {code: 200, reason: 'OK', media: 'audio,audio'})
|
|
112
132
|
|
|
113
133
|
await z.wait([
|
|
114
134
|
{
|
|
@@ -116,8 +136,8 @@ async function test() {
|
|
|
116
136
|
call_id: oc.id,
|
|
117
137
|
method: 'INVITE',
|
|
118
138
|
msg: sip_msg({
|
|
119
|
-
$rs: '
|
|
120
|
-
$rr: '
|
|
139
|
+
$rs: '200',
|
|
140
|
+
$rr: 'OK',
|
|
121
141
|
'$(hdrcnt(VIA))': 1,
|
|
122
142
|
$fU: 'alice',
|
|
123
143
|
$fd: 'test.com',
|
|
@@ -132,6 +152,19 @@ async function test() {
|
|
|
132
152
|
sip.call.send_dtmf(ic.id, {digits: '4321', mode: 1})
|
|
133
153
|
|
|
134
154
|
await z.wait([
|
|
155
|
+
{
|
|
156
|
+
event: 'media_update',
|
|
157
|
+
call_id: oc.id,
|
|
158
|
+
status: 'ok',
|
|
159
|
+
media: [
|
|
160
|
+
{
|
|
161
|
+
type: 'audio',
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
type: 'audio',
|
|
165
|
+
},
|
|
166
|
+
]
|
|
167
|
+
},
|
|
135
168
|
{
|
|
136
169
|
event: 'dtmf',
|
|
137
170
|
call_id: ic.id,
|
|
@@ -139,6 +172,13 @@ async function test() {
|
|
|
139
172
|
mode: 0,
|
|
140
173
|
media_id: 0
|
|
141
174
|
},
|
|
175
|
+
{
|
|
176
|
+
event: 'dtmf',
|
|
177
|
+
call_id: ic.id,
|
|
178
|
+
digits: '1234',
|
|
179
|
+
mode: 0,
|
|
180
|
+
media_id: 1
|
|
181
|
+
},
|
|
142
182
|
{
|
|
143
183
|
event: 'dtmf',
|
|
144
184
|
call_id: oc.id,
|
|
@@ -146,9 +186,16 @@ async function test() {
|
|
|
146
186
|
mode: 1,
|
|
147
187
|
media_id: 0
|
|
148
188
|
},
|
|
189
|
+
{
|
|
190
|
+
event: 'dtmf',
|
|
191
|
+
call_id: oc.id,
|
|
192
|
+
digits: '4321',
|
|
193
|
+
mode: 1,
|
|
194
|
+
media_id: 1
|
|
195
|
+
},
|
|
149
196
|
], 2000)
|
|
150
197
|
|
|
151
|
-
sip.call.reinvite(oc.id)
|
|
198
|
+
sip.call.reinvite(oc.id, {media: 'audio,audio'})
|
|
152
199
|
|
|
153
200
|
await z.wait([
|
|
154
201
|
{
|
|
@@ -157,7 +204,7 @@ async function test() {
|
|
|
157
204
|
},
|
|
158
205
|
], 1000)
|
|
159
206
|
|
|
160
|
-
sip.call.respond(ic.id, {code: 200, reason: 'OK'})
|
|
207
|
+
sip.call.respond(ic.id, {code: 200, reason: 'OK', media: 'audio,audio'})
|
|
161
208
|
|
|
162
209
|
await z.wait([
|
|
163
210
|
{
|
|
@@ -176,6 +223,9 @@ async function test() {
|
|
|
176
223
|
{
|
|
177
224
|
type: 'audio',
|
|
178
225
|
},
|
|
226
|
+
{
|
|
227
|
+
type: 'audio',
|
|
228
|
+
},
|
|
179
229
|
]
|
|
180
230
|
},
|
|
181
231
|
{
|
|
@@ -186,6 +236,91 @@ async function test() {
|
|
|
186
236
|
{
|
|
187
237
|
type: 'audio',
|
|
188
238
|
},
|
|
239
|
+
{
|
|
240
|
+
type: 'audio',
|
|
241
|
+
},
|
|
242
|
+
]
|
|
243
|
+
},
|
|
244
|
+
], 1000)
|
|
245
|
+
|
|
246
|
+
sip.call.send_dtmf(oc.id, {digits: '1234', mode: 0})
|
|
247
|
+
sip.call.send_dtmf(ic.id, {digits: '4321', mode: 1})
|
|
248
|
+
|
|
249
|
+
await z.wait([
|
|
250
|
+
{
|
|
251
|
+
event: 'dtmf',
|
|
252
|
+
call_id: ic.id,
|
|
253
|
+
digits: '1234',
|
|
254
|
+
mode: 0,
|
|
255
|
+
media_id: 0
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
event: 'dtmf',
|
|
259
|
+
call_id: ic.id,
|
|
260
|
+
digits: '1234',
|
|
261
|
+
mode: 0,
|
|
262
|
+
media_id: 1
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
event: 'dtmf',
|
|
266
|
+
call_id: oc.id,
|
|
267
|
+
digits: '4321',
|
|
268
|
+
mode: 1,
|
|
269
|
+
media_id: 0
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
event: 'dtmf',
|
|
273
|
+
call_id: oc.id,
|
|
274
|
+
digits: '4321',
|
|
275
|
+
mode: 1,
|
|
276
|
+
media_id: 1
|
|
277
|
+
},
|
|
278
|
+
], 2000)
|
|
279
|
+
|
|
280
|
+
sip.call.reinvite(ic.id, {media: 'audio,audio'})
|
|
281
|
+
|
|
282
|
+
await z.wait([
|
|
283
|
+
{
|
|
284
|
+
event: 'reinvite',
|
|
285
|
+
call_id: oc.id,
|
|
286
|
+
},
|
|
287
|
+
], 1000)
|
|
288
|
+
|
|
289
|
+
sip.call.respond(oc.id, {code: 200, reason: 'OK', media: 'audio,audio'})
|
|
290
|
+
|
|
291
|
+
await z.wait([
|
|
292
|
+
{
|
|
293
|
+
event: 'response',
|
|
294
|
+
call_id: ic.id,
|
|
295
|
+
method: 'INVITE',
|
|
296
|
+
msg: sip_msg({
|
|
297
|
+
$rs: '200',
|
|
298
|
+
}),
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
event: 'media_update',
|
|
302
|
+
call_id: oc.id,
|
|
303
|
+
status: 'ok',
|
|
304
|
+
media: [
|
|
305
|
+
{
|
|
306
|
+
type: 'audio',
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
type: 'audio',
|
|
310
|
+
},
|
|
311
|
+
]
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
event: 'media_update',
|
|
315
|
+
call_id: ic.id,
|
|
316
|
+
status: 'ok',
|
|
317
|
+
media: [
|
|
318
|
+
{
|
|
319
|
+
type: 'audio',
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
type: 'audio',
|
|
323
|
+
},
|
|
189
324
|
]
|
|
190
325
|
},
|
|
191
326
|
], 1000)
|
|
@@ -201,6 +336,13 @@ async function test() {
|
|
|
201
336
|
mode: 0,
|
|
202
337
|
media_id: 0
|
|
203
338
|
},
|
|
339
|
+
{
|
|
340
|
+
event: 'dtmf',
|
|
341
|
+
call_id: ic.id,
|
|
342
|
+
digits: '1234',
|
|
343
|
+
mode: 0,
|
|
344
|
+
media_id: 1
|
|
345
|
+
},
|
|
204
346
|
{
|
|
205
347
|
event: 'dtmf',
|
|
206
348
|
call_id: oc.id,
|
|
@@ -208,6 +350,13 @@ async function test() {
|
|
|
208
350
|
mode: 1,
|
|
209
351
|
media_id: 0
|
|
210
352
|
},
|
|
353
|
+
{
|
|
354
|
+
event: 'dtmf',
|
|
355
|
+
call_id: oc.id,
|
|
356
|
+
digits: '4321',
|
|
357
|
+
mode: 1,
|
|
358
|
+
media_id: 1
|
|
359
|
+
},
|
|
211
360
|
], 2000)
|
|
212
361
|
|
|
213
362
|
sip.call.terminate(oc.id)
|