sip-lab 1.12.39 → 1.13.1
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 +19 -3
- package/README.md +8 -4
- package/binding.gyp +97 -86
- package/build_deps.sh +3 -2
- package/index.js +14 -7
- package/package.json +7 -2
- 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/samples/16_audio_streams.js +179 -0
- package/samples/delayed_media.js +117 -81
- package/samples/g729.js +50 -28
- package/samples/mrcp_and_audio.js +445 -0
- package/samples/mrcp_and_audio.simplified_media.js +273 -0
- package/samples/mrcp_and_audio.switching_order.js +273 -0
- package/samples/options.js +82 -0
- package/samples/refer.js +247 -0
- package/samples/refuse_telephone_event.js +166 -0
- package/samples/register_no_expires.js +82 -0
- package/samples/register_subscribe.js +36 -4
- package/samples/reinvite_and_dtmf.js +236 -161
- package/samples/reinvite_audio_audio.js +320 -0
- package/samples/reinvite_with_hold_unhold.js +412 -0
- package/samples/send_and_receive_fax.js +4 -8
- package/samples/simple.js +5 -9
- package/samples/sip_cancel.js +4 -6
- package/samples/tcp_and_extra_headers.js +98 -45
- package/samples/two_audio_media.js +497 -0
- package/src/addon.cpp +488 -268
- package/src/event_templates.cpp +84 -35
- package/src/event_templates.hpp +22 -12
- package/src/idmanager.cpp +58 -57
- package/src/idmanager.hpp +10 -10
- package/src/log.cpp +9 -11
- package/src/log.hpp +4 -4
- package/src/sip.cpp +6841 -5040
- package/src/sip.hpp +26 -34
- package/src/packetdumper.cpp +0 -234
- package/src/packetdumper.hpp +0 -67
|
@@ -5,6 +5,8 @@ var m = require('data-matching')
|
|
|
5
5
|
var sip_msg = require('sip-matching')
|
|
6
6
|
|
|
7
7
|
async function test() {
|
|
8
|
+
//sip.set_log_level(9)
|
|
9
|
+
|
|
8
10
|
//sip.set_log_level(6)
|
|
9
11
|
sip.dtmf_aggregation_on(500)
|
|
10
12
|
|
|
@@ -53,20 +55,6 @@ async function test() {
|
|
|
53
55
|
sip.call.respond(ic.id, {code: 200, reason: 'OK'})
|
|
54
56
|
|
|
55
57
|
await z.wait([
|
|
56
|
-
{
|
|
57
|
-
event: 'media_status',
|
|
58
|
-
call_id: oc.id,
|
|
59
|
-
status: 'setup_ok',
|
|
60
|
-
local_mode: 'sendrecv',
|
|
61
|
-
remote_mode: 'sendrecv',
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
event: 'media_status',
|
|
65
|
-
call_id: ic.id,
|
|
66
|
-
status: 'setup_ok',
|
|
67
|
-
local_mode: 'sendrecv',
|
|
68
|
-
remote_mode: 'sendrecv',
|
|
69
|
-
},
|
|
70
58
|
{
|
|
71
59
|
event: 'response',
|
|
72
60
|
call_id: oc.id,
|
|
@@ -82,158 +70,43 @@ async function test() {
|
|
|
82
70
|
$rb: '!{_}a=sendrecv',
|
|
83
71
|
}),
|
|
84
72
|
},
|
|
85
|
-
], 1000)
|
|
86
|
-
|
|
87
|
-
sip.call.send_dtmf(oc.id, {digits: '1234', mode: 0})
|
|
88
|
-
sip.call.send_dtmf(ic.id, {digits: '4321', mode: 1})
|
|
89
|
-
|
|
90
|
-
await z.wait([
|
|
91
|
-
{
|
|
92
|
-
event: 'dtmf',
|
|
93
|
-
call_id: ic.id,
|
|
94
|
-
digits: '1234',
|
|
95
|
-
mode: 0,
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
event: 'dtmf',
|
|
99
|
-
call_id: oc.id,
|
|
100
|
-
digits: '4321',
|
|
101
|
-
mode: 1,
|
|
102
|
-
},
|
|
103
|
-
], 2000)
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
sip.call.reinvite(oc.id, {hold: true})
|
|
107
|
-
|
|
108
|
-
await z.wait([
|
|
109
|
-
{
|
|
110
|
-
event: 'response',
|
|
111
|
-
call_id: oc.id,
|
|
112
|
-
method: 'INVITE',
|
|
113
|
-
msg: sip_msg({
|
|
114
|
-
$rs: '200',
|
|
115
|
-
$rr: 'OK',
|
|
116
|
-
$rb: '!{_}a=recvonly',
|
|
117
|
-
}),
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
event: 'media_status',
|
|
121
|
-
call_id: oc.id,
|
|
122
|
-
status: 'setup_ok',
|
|
123
|
-
local_mode: 'sendonly',
|
|
124
|
-
remote_mode: 'recvonly',
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
event: 'media_status',
|
|
128
|
-
call_id: ic.id,
|
|
129
|
-
status: 'setup_ok',
|
|
130
|
-
local_mode: 'recvonly',
|
|
131
|
-
remote_mode: 'sendonly',
|
|
132
|
-
},
|
|
133
|
-
], 500)
|
|
134
|
-
|
|
135
|
-
sip.call.send_dtmf(oc.id, {digits: '1234', mode: 0})
|
|
136
|
-
sip.call.send_dtmf(ic.id, {digits: '4321', mode: 1}) // this will not generate event 'dtmf' as the call is on hold
|
|
137
|
-
|
|
138
|
-
await z.wait([
|
|
139
|
-
{
|
|
140
|
-
event: 'dtmf',
|
|
141
|
-
call_id: ic.id,
|
|
142
|
-
digits: '1234',
|
|
143
|
-
mode: 0,
|
|
144
|
-
},
|
|
145
|
-
], 2000)
|
|
146
|
-
|
|
147
|
-
sip.call.reinvite(ic.id, {hold: false})
|
|
148
|
-
|
|
149
|
-
await z.wait([
|
|
150
|
-
{
|
|
151
|
-
event: 'response',
|
|
152
|
-
call_id: ic.id,
|
|
153
|
-
method: 'INVITE',
|
|
154
|
-
msg: sip_msg({
|
|
155
|
-
$rs: '200',
|
|
156
|
-
$rr: 'OK',
|
|
157
|
-
$rb: '!{_}a=sendonly',
|
|
158
|
-
}),
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
event: 'media_status',
|
|
162
|
-
call_id: oc.id,
|
|
163
|
-
status: 'setup_ok',
|
|
164
|
-
local_mode: 'sendonly',
|
|
165
|
-
remote_mode: 'recvonly',
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
event: 'media_status',
|
|
169
|
-
call_id: ic.id,
|
|
170
|
-
status: 'setup_ok',
|
|
171
|
-
local_mode: 'recvonly',
|
|
172
|
-
remote_mode: 'sendonly',
|
|
173
|
-
},
|
|
174
|
-
], 500)
|
|
175
|
-
|
|
176
|
-
sip.call.send_dtmf(oc.id, {digits: '1234', mode: 0})
|
|
177
|
-
sip.call.send_dtmf(ic.id, {digits: '4321', mode: 1}) // this will not generate event 'dtmf' as the call is on hold
|
|
178
|
-
|
|
179
|
-
await z.wait([
|
|
180
|
-
{
|
|
181
|
-
event: 'dtmf',
|
|
182
|
-
call_id: ic.id,
|
|
183
|
-
digits: '1234',
|
|
184
|
-
mode: 0,
|
|
185
|
-
},
|
|
186
|
-
], 2000)
|
|
187
|
-
|
|
188
|
-
sip.call.send_request(oc.id, {method: 'INFO'})
|
|
189
|
-
|
|
190
|
-
await z.wait([
|
|
191
|
-
{
|
|
192
|
-
event: 'request',
|
|
193
|
-
call_id: ic.id,
|
|
194
|
-
msg: sip_msg({
|
|
195
|
-
$rm: 'INFO',
|
|
196
|
-
}),
|
|
197
|
-
},
|
|
198
|
-
{
|
|
199
|
-
event: 'response',
|
|
200
|
-
call_id: oc.id,
|
|
201
|
-
method: 'INFO',
|
|
202
|
-
msg: sip_msg({
|
|
203
|
-
$rs: '200',
|
|
204
|
-
$rr: 'OK',
|
|
205
|
-
}),
|
|
206
|
-
},
|
|
207
|
-
], 500)
|
|
208
|
-
|
|
209
|
-
sip.call.reinvite(oc.id, {hold: false})
|
|
210
|
-
|
|
211
|
-
await z.wait([
|
|
212
|
-
{
|
|
213
|
-
event: 'response',
|
|
214
|
-
call_id: oc.id,
|
|
215
|
-
method: 'INVITE',
|
|
216
|
-
msg: sip_msg({
|
|
217
|
-
$rs: '200',
|
|
218
|
-
$rr: 'OK',
|
|
219
|
-
$rb: '!{_}a=sendrecv',
|
|
220
|
-
}),
|
|
221
|
-
},
|
|
222
73
|
{
|
|
223
|
-
event: '
|
|
74
|
+
event: 'media_update',
|
|
224
75
|
call_id: oc.id,
|
|
225
|
-
status: '
|
|
226
|
-
|
|
227
|
-
|
|
76
|
+
status: 'ok',
|
|
77
|
+
media: [
|
|
78
|
+
{
|
|
79
|
+
type: 'audio',
|
|
80
|
+
local: {
|
|
81
|
+
port: 10000,
|
|
82
|
+
mode: 'sendrecv'
|
|
83
|
+
},
|
|
84
|
+
remote: {
|
|
85
|
+
port: 10002,
|
|
86
|
+
mode: 'sendrecv'
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
],
|
|
228
90
|
},
|
|
229
91
|
{
|
|
230
|
-
event: '
|
|
92
|
+
event: 'media_update',
|
|
231
93
|
call_id: ic.id,
|
|
232
|
-
status: '
|
|
233
|
-
|
|
234
|
-
|
|
94
|
+
status: 'ok',
|
|
95
|
+
media: [
|
|
96
|
+
{
|
|
97
|
+
type: 'audio',
|
|
98
|
+
local: {
|
|
99
|
+
port: 10002,
|
|
100
|
+
mode: 'sendrecv'
|
|
101
|
+
},
|
|
102
|
+
remote: {
|
|
103
|
+
port: 10000,
|
|
104
|
+
mode: 'sendrecv'
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
],
|
|
235
108
|
},
|
|
236
|
-
],
|
|
109
|
+
], 1000)
|
|
237
110
|
|
|
238
111
|
sip.call.send_dtmf(oc.id, {digits: '1234', mode: 0})
|
|
239
112
|
sip.call.send_dtmf(ic.id, {digits: '4321', mode: 1})
|
|
@@ -244,14 +117,216 @@ async function test() {
|
|
|
244
117
|
call_id: ic.id,
|
|
245
118
|
digits: '1234',
|
|
246
119
|
mode: 0,
|
|
120
|
+
media_id: 0
|
|
247
121
|
},
|
|
248
122
|
{
|
|
249
123
|
event: 'dtmf',
|
|
250
124
|
call_id: oc.id,
|
|
251
125
|
digits: '4321',
|
|
252
126
|
mode: 1,
|
|
127
|
+
media_id: 0
|
|
253
128
|
},
|
|
254
|
-
],
|
|
129
|
+
], 1500)
|
|
130
|
+
|
|
131
|
+
for(i=0 ;i< 3; i++) {
|
|
132
|
+
//await z.sleep(100)
|
|
133
|
+
sip.call.reinvite(oc.id)
|
|
134
|
+
|
|
135
|
+
await z.wait([
|
|
136
|
+
{
|
|
137
|
+
event: 'reinvite',
|
|
138
|
+
call_id: ic.id,
|
|
139
|
+
},
|
|
140
|
+
], 500)
|
|
141
|
+
|
|
142
|
+
sip.call.respond(ic.id, {code: 200, reason: 'OK'})
|
|
143
|
+
|
|
144
|
+
await z.wait([
|
|
145
|
+
{
|
|
146
|
+
event: 'response',
|
|
147
|
+
call_id: oc.id,
|
|
148
|
+
method: 'INVITE',
|
|
149
|
+
msg: sip_msg({
|
|
150
|
+
$rs: '100',
|
|
151
|
+
}),
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
event: 'response',
|
|
155
|
+
call_id: oc.id,
|
|
156
|
+
method: 'INVITE',
|
|
157
|
+
msg: sip_msg({
|
|
158
|
+
$rs: '200',
|
|
159
|
+
$rr: 'OK',
|
|
160
|
+
$rb: '!{_}a=sendrecv',
|
|
161
|
+
}),
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
event: 'media_update',
|
|
165
|
+
call_id: oc.id,
|
|
166
|
+
status: 'ok',
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
event: 'media_update',
|
|
170
|
+
call_id: ic.id,
|
|
171
|
+
status: 'ok',
|
|
172
|
+
},
|
|
173
|
+
], 500)
|
|
174
|
+
|
|
175
|
+
//await z.sleep(100)
|
|
176
|
+
sip.call.reinvite(ic.id)
|
|
177
|
+
|
|
178
|
+
await z.wait([
|
|
179
|
+
{
|
|
180
|
+
event: 'reinvite',
|
|
181
|
+
call_id: oc.id,
|
|
182
|
+
},
|
|
183
|
+
], 500)
|
|
184
|
+
|
|
185
|
+
sip.call.respond(oc.id, {code: 200, reason: 'OK'})
|
|
186
|
+
|
|
187
|
+
await z.wait([
|
|
188
|
+
{
|
|
189
|
+
event: 'response',
|
|
190
|
+
call_id: ic.id,
|
|
191
|
+
method: 'INVITE',
|
|
192
|
+
msg: sip_msg({
|
|
193
|
+
$rs: '100',
|
|
194
|
+
}),
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
event: 'response',
|
|
198
|
+
call_id: ic.id,
|
|
199
|
+
method: 'INVITE',
|
|
200
|
+
msg: sip_msg({
|
|
201
|
+
$rs: '200',
|
|
202
|
+
$rr: 'OK',
|
|
203
|
+
}),
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
event: 'media_update',
|
|
207
|
+
call_id: oc.id,
|
|
208
|
+
status: 'ok',
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
event: 'media_update',
|
|
212
|
+
call_id: ic.id,
|
|
213
|
+
status: 'ok',
|
|
214
|
+
},
|
|
215
|
+
], 500)
|
|
216
|
+
|
|
217
|
+
//await z.sleep(100)
|
|
218
|
+
sip.call.send_request(oc.id, {method: 'INFO'})
|
|
219
|
+
|
|
220
|
+
await z.wait([
|
|
221
|
+
{
|
|
222
|
+
event: 'request',
|
|
223
|
+
call_id: ic.id,
|
|
224
|
+
msg: sip_msg({
|
|
225
|
+
$rm: 'INFO',
|
|
226
|
+
}),
|
|
227
|
+
},
|
|
228
|
+
], 500)
|
|
229
|
+
|
|
230
|
+
sip.call.respond(ic.id, {code: 100, reason: 'Trying'})
|
|
231
|
+
|
|
232
|
+
await z.wait([
|
|
233
|
+
{
|
|
234
|
+
event: 'response',
|
|
235
|
+
call_id: oc.id,
|
|
236
|
+
method: 'INFO',
|
|
237
|
+
msg: sip_msg({
|
|
238
|
+
$rs: '100',
|
|
239
|
+
$rr: 'Trying',
|
|
240
|
+
}),
|
|
241
|
+
},
|
|
242
|
+
], 500)
|
|
243
|
+
|
|
244
|
+
sip.call.respond(ic.id, {code: 200, reason: 'OK'})
|
|
245
|
+
|
|
246
|
+
await z.wait([
|
|
247
|
+
{
|
|
248
|
+
event: 'response',
|
|
249
|
+
call_id: oc.id,
|
|
250
|
+
method: 'INFO',
|
|
251
|
+
msg: sip_msg({
|
|
252
|
+
$rs: '200',
|
|
253
|
+
$rr: 'OK',
|
|
254
|
+
}),
|
|
255
|
+
},
|
|
256
|
+
], 500)
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
//await z.sleep(100)
|
|
260
|
+
sip.call.send_request(oc.id, {method: 'INFO'})
|
|
261
|
+
|
|
262
|
+
await z.wait([
|
|
263
|
+
{
|
|
264
|
+
event: 'request',
|
|
265
|
+
call_id: ic.id,
|
|
266
|
+
msg: sip_msg({
|
|
267
|
+
$rm: 'INFO',
|
|
268
|
+
}),
|
|
269
|
+
},
|
|
270
|
+
], 500)
|
|
271
|
+
|
|
272
|
+
sip.call.respond(ic.id, {code: 100, reason: 'Trying'})
|
|
273
|
+
|
|
274
|
+
await z.wait([
|
|
275
|
+
{
|
|
276
|
+
event: 'response',
|
|
277
|
+
call_id: oc.id,
|
|
278
|
+
method: 'INFO',
|
|
279
|
+
msg: sip_msg({
|
|
280
|
+
$rs: '100',
|
|
281
|
+
$rr: 'Trying',
|
|
282
|
+
}),
|
|
283
|
+
},
|
|
284
|
+
], 500)
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
sip.call.respond(ic.id, {code: 200, reason: 'OK'})
|
|
288
|
+
|
|
289
|
+
await z.wait([
|
|
290
|
+
{
|
|
291
|
+
event: 'response',
|
|
292
|
+
call_id: oc.id,
|
|
293
|
+
method: 'INFO',
|
|
294
|
+
msg: sip_msg({
|
|
295
|
+
$rs: '200',
|
|
296
|
+
$rr: 'OK',
|
|
297
|
+
}),
|
|
298
|
+
},
|
|
299
|
+
], 500)
|
|
300
|
+
|
|
301
|
+
//await z.sleep(100)
|
|
302
|
+
sip.call.send_request(ic.id, {method: 'INFO'})
|
|
303
|
+
|
|
304
|
+
await z.wait([
|
|
305
|
+
{
|
|
306
|
+
event: 'request',
|
|
307
|
+
call_id: oc.id,
|
|
308
|
+
msg: sip_msg({
|
|
309
|
+
$rm: 'INFO',
|
|
310
|
+
}),
|
|
311
|
+
},
|
|
312
|
+
], 500)
|
|
313
|
+
|
|
314
|
+
sip.call.respond(oc.id, {code: 200, reason: 'OK'})
|
|
315
|
+
|
|
316
|
+
await z.wait([
|
|
317
|
+
{
|
|
318
|
+
event: 'response',
|
|
319
|
+
call_id: ic.id,
|
|
320
|
+
method: 'INFO',
|
|
321
|
+
msg: sip_msg({
|
|
322
|
+
$rs: '200',
|
|
323
|
+
$rr: 'OK',
|
|
324
|
+
}),
|
|
325
|
+
},
|
|
326
|
+
], 500)
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
//await z.sleep(100)
|
|
255
330
|
|
|
256
331
|
sip.call.terminate(oc.id)
|
|
257
332
|
|