@babblevoice/babble-drachtio-callmanager 2.0.2 → 2.0.3
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/.eslintrc.js +67 -0
- package/index.js +3 -4
- package/lib/call.js +5 -25
- package/lib/callmanager.js +3 -3
- package/lib/sdp.js +78 -46
- package/package.json +7 -3
- package/test/interface/call.js +130 -130
- package/test/interface/callmanager.js +12 -12
- package/test/interface/callsdp.js +6 -6
- package/test/interface/early.js +72 -73
- package/test/interface/events.js +10 -10
- package/test/interface/hold.js +15 -15
- package/test/interface/latecall.js +8 -8
- package/test/interface/sdp.js +321 -47
- package/test/interface/xfer.js +47 -56
- package/test/interface/serverconnect.js +0 -79
|
@@ -17,9 +17,9 @@ describe( "callmanager", function() {
|
|
|
17
17
|
clearcallmanager()
|
|
18
18
|
} )
|
|
19
19
|
|
|
20
|
-
it(
|
|
20
|
+
it( "create new callmanager object and present a simple call", async function() {
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
const req = new srf.req()
|
|
23
23
|
req.setparsedheader( "call-id", "1234" )
|
|
24
24
|
req.setparsedheader( "from", {
|
|
25
25
|
"params": {
|
|
@@ -29,7 +29,7 @@ describe( "callmanager", function() {
|
|
|
29
29
|
|
|
30
30
|
let usecalled = false
|
|
31
31
|
let invitecb = false
|
|
32
|
-
|
|
32
|
+
const options = {
|
|
33
33
|
"srf": {
|
|
34
34
|
"use": ( method, asynccb ) => {
|
|
35
35
|
invitecb = asynccb
|
|
@@ -38,12 +38,12 @@ describe( "callmanager", function() {
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
const c = await callmanager.callmanager( options )
|
|
42
42
|
|
|
43
43
|
expect( usecalled ).to.be.true
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
const res = {}
|
|
46
|
+
const next = () => {}
|
|
47
47
|
/* present our pretend call */
|
|
48
48
|
await invitecb( req, res, next )
|
|
49
49
|
|
|
@@ -55,21 +55,21 @@ describe( "callmanager", function() {
|
|
|
55
55
|
} )
|
|
56
56
|
} )
|
|
57
57
|
|
|
58
|
-
it(
|
|
58
|
+
it( "create new callmanager object test for listening rtp server", async function() {
|
|
59
59
|
|
|
60
60
|
this.timeout( 300 )
|
|
61
61
|
this.slow( 200 )
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
const options = {
|
|
64
64
|
"srf": { "use": ( method, asynccb ) => {} }
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
const rtpserver = await callmanager.projectrtp.proxy.listen()
|
|
68
|
+
const c = await callmanager.callmanager( options )
|
|
69
69
|
|
|
70
70
|
let closing = false
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
const connection = net.createConnection( 9002, "127.0.0.1" )
|
|
73
73
|
.on( "error", () => {
|
|
74
74
|
expect( closing ).to.be.true
|
|
75
75
|
} )
|
|
@@ -81,7 +81,7 @@ describe( "callmanager", function() {
|
|
|
81
81
|
rtpserver.destroy()
|
|
82
82
|
} )
|
|
83
83
|
|
|
84
|
-
it(
|
|
84
|
+
it( "check hangup codes on main interface", async function() {
|
|
85
85
|
expect( callmanager ).to.have.property( "hangupcodes" ).that.is.a( "object" )
|
|
86
86
|
expect( callmanager.hangupcodes ).to.have.property( "PAYMENT_REQUIRED" ).that.is.a( "object" )
|
|
87
87
|
expect( callmanager.hangupcodes ).to.have.property( "FORBIDDEN" ).that.is.a( "object" )
|
|
@@ -4,21 +4,21 @@ const srf = require( "../mock/srf.js" )
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
describe( "call sdp generation", function() {
|
|
7
|
-
it(
|
|
7
|
+
it( "uas.newuac - check sdp", async function() {
|
|
8
8
|
|
|
9
9
|
/* We are presented with sdp contained in the mock srf file */
|
|
10
|
-
|
|
10
|
+
const srfscenario = new srf.srfscenario()
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
const localsdp = []
|
|
13
13
|
srfscenario.oncreateUAS( ( req, res, options ) => {
|
|
14
14
|
localsdp.push( options.localSdp )
|
|
15
15
|
return new srf.dialog()
|
|
16
16
|
} )
|
|
17
17
|
|
|
18
18
|
let callnumber = 0
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
const callcount = 6
|
|
20
|
+
const codecsselected = []
|
|
21
|
+
const c = await new Promise( ( done ) => {
|
|
22
22
|
srfscenario.oncall( async ( call ) => {
|
|
23
23
|
await call.answer()
|
|
24
24
|
|
package/test/interface/early.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
const { v4: uuidv4 } = require( "uuid" )
|
|
4
4
|
const expect = require( "chai" ).expect
|
|
5
5
|
const callmanager = require( "../../index.js" )
|
|
6
|
-
const call = require( "../../lib/call.js" )
|
|
7
6
|
const srf = require( "../mock/srf.js" )
|
|
8
7
|
|
|
9
8
|
const projectrtpmessage = require( "@babblevoice/projectrtp/lib/message.js" )
|
|
@@ -22,7 +21,7 @@ describe( "call early", function() {
|
|
|
22
21
|
} )
|
|
23
22
|
|
|
24
23
|
|
|
25
|
-
it(
|
|
24
|
+
it( "Create call and send 183 - early basic", async () => {
|
|
26
25
|
|
|
27
26
|
/*
|
|
28
27
|
Phone BV Gateway
|
|
@@ -37,10 +36,10 @@ describe( "call early", function() {
|
|
|
37
36
|
*/
|
|
38
37
|
|
|
39
38
|
/* Setup the mock RTP server */
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
const srfscenario = new srf.srfscenario()
|
|
40
|
+
const rtpserver = await callmanager.projectrtp.proxy.listen()
|
|
42
41
|
|
|
43
|
-
|
|
42
|
+
const connection = net.createConnection( 9002, "127.0.0.1" )
|
|
44
43
|
.on( "error", ( e ) => {
|
|
45
44
|
console.error( e )
|
|
46
45
|
} )
|
|
@@ -51,8 +50,8 @@ describe( "call early", function() {
|
|
|
51
50
|
} )
|
|
52
51
|
|
|
53
52
|
let mixing
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
const messagestate = projectrtpmessage.newstate()
|
|
54
|
+
const channelmessages = []
|
|
56
55
|
let opencount = 0
|
|
57
56
|
|
|
58
57
|
connection.on( "data", ( data ) => {
|
|
@@ -66,11 +65,11 @@ describe( "call early", function() {
|
|
|
66
65
|
projectrtpmessage.createmessage(
|
|
67
66
|
{"local":{"port":10008,"dtls":
|
|
68
67
|
{"fingerprint":"Some fingerprint","enabled":false},
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
68
|
+
"address":"192.168.0.141"},
|
|
69
|
+
"id": msg.id,
|
|
70
|
+
"uuid": uuidv4(),
|
|
71
|
+
"action":"open",
|
|
72
|
+
"status":{"channel":{"available":4995,"current":5},"workercount":12,"instance":"ca0ef6a9-9174-444d-bdeb-4c9eb54d4566"}
|
|
74
73
|
} ) ), 2 )
|
|
75
74
|
} else {
|
|
76
75
|
setTimeout( () =>
|
|
@@ -78,17 +77,17 @@ describe( "call early", function() {
|
|
|
78
77
|
projectrtpmessage.createmessage(
|
|
79
78
|
{"local":{"port": 10010,"dtls":
|
|
80
79
|
{"fingerprint":"Some fingerprint","enabled":false},
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
80
|
+
"address":"192.168.0.141"},
|
|
81
|
+
"id": msg.id,
|
|
82
|
+
"uuid": uuidv4(),
|
|
83
|
+
"action":"open",
|
|
84
|
+
"status":{"channel":{"available":4995,"current":5},"workercount":12,"instance":"ca0ef6a9-9174-444d-bdeb-4c9eb54d4566"}
|
|
86
85
|
} ) ), 2 )
|
|
87
86
|
}
|
|
88
87
|
opencount++
|
|
89
88
|
} else if ( "close" === msg.channel ) {
|
|
90
89
|
connection.write( projectrtpmessage.createmessage( {"id": msg.id,"uuid":msg.uuid,"action":"close","reason":"requested","stats":{"in":{"mos":4.5,"count":586,"dropped":0,"skip":0},"out":{"count":303,"skip":0},"tick":{"meanus":124,"maxus":508,"count":597}}, "status":{"channel":{"available":4995,"current":5},"workercount":12,"instance":"ca0ef6a9-9174-444d-bdeb-4c9eb54d4566"}
|
|
91
|
-
|
|
90
|
+
} ) )
|
|
92
91
|
} else if ( "mix" === msg.channel ) {
|
|
93
92
|
mixing = true
|
|
94
93
|
}
|
|
@@ -99,7 +98,7 @@ describe( "call early", function() {
|
|
|
99
98
|
} )
|
|
100
99
|
|
|
101
100
|
/* ensure we are connected */
|
|
102
|
-
await new Promise( (
|
|
101
|
+
await new Promise( ( resolve ) => setTimeout( () => resolve(), 100 ) )
|
|
103
102
|
|
|
104
103
|
srfscenario.oncreateUAC( async ( contact, options, callbacks ) => {
|
|
105
104
|
|
|
@@ -119,12 +118,12 @@ a=sendrecv`.replace(/(\r\n|\n|\r)/gm, "\r\n")
|
|
|
119
118
|
}
|
|
120
119
|
} )
|
|
121
120
|
|
|
122
|
-
await new Promise( (
|
|
121
|
+
await new Promise( ( resolve ) => setTimeout( () => resolve(), 100 ) )
|
|
123
122
|
throw { "status": 503 }
|
|
124
123
|
} )
|
|
125
124
|
|
|
126
125
|
/* Step 1. Phone sends INVITE */
|
|
127
|
-
|
|
126
|
+
const call = await new Promise( ( resolve ) => {
|
|
128
127
|
srfscenario.oncall( async ( call ) => { resolve( call ) } )
|
|
129
128
|
srfscenario.inbound()
|
|
130
129
|
} )
|
|
@@ -138,7 +137,7 @@ a=sendrecv`.replace(/(\r\n|\n|\r)/gm, "\r\n")
|
|
|
138
137
|
|
|
139
138
|
|
|
140
139
|
/* Step 2. New INVITE to the remote Gateway */
|
|
141
|
-
|
|
140
|
+
const newcall = await call.newuac( { "contact": "callto" } )
|
|
142
141
|
|
|
143
142
|
await call._onhangup( "wire" )
|
|
144
143
|
|
|
@@ -164,7 +163,7 @@ a=sendrecv`.replace(/(\r\n|\n|\r)/gm, "\r\n")
|
|
|
164
163
|
rtpserver.destroy()
|
|
165
164
|
} )
|
|
166
165
|
|
|
167
|
-
it(
|
|
166
|
+
it( "Create call and send 183 - early - SAVPF", async () => {
|
|
168
167
|
|
|
169
168
|
/*
|
|
170
169
|
Phone (SAVPF) BV Gateway
|
|
@@ -175,10 +174,10 @@ a=sendrecv`.replace(/(\r\n|\n|\r)/gm, "\r\n")
|
|
|
175
174
|
*/
|
|
176
175
|
|
|
177
176
|
/* Setup the mock RTP server */
|
|
178
|
-
|
|
179
|
-
|
|
177
|
+
const srfscenario = new srf.srfscenario( { savpf: true } )
|
|
178
|
+
const rtpserver = await callmanager.projectrtp.proxy.listen()
|
|
180
179
|
|
|
181
|
-
|
|
180
|
+
const connection = net.createConnection( 9002, "127.0.0.1" )
|
|
182
181
|
.on( "error", ( e ) => {
|
|
183
182
|
console.error( e )
|
|
184
183
|
} )
|
|
@@ -189,8 +188,8 @@ a=sendrecv`.replace(/(\r\n|\n|\r)/gm, "\r\n")
|
|
|
189
188
|
} )
|
|
190
189
|
|
|
191
190
|
let mixing
|
|
192
|
-
|
|
193
|
-
|
|
191
|
+
const messagestate = projectrtpmessage.newstate()
|
|
192
|
+
const channelmessages = []
|
|
194
193
|
let opencount = 0
|
|
195
194
|
|
|
196
195
|
connection.on( "data", ( data ) => {
|
|
@@ -204,11 +203,11 @@ a=sendrecv`.replace(/(\r\n|\n|\r)/gm, "\r\n")
|
|
|
204
203
|
projectrtpmessage.createmessage(
|
|
205
204
|
{"local":{"port":10008,"dtls":
|
|
206
205
|
{"fingerprint":"Some fingerprint","enabled":false},
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
206
|
+
"address":"192.168.0.141"},
|
|
207
|
+
"id": msg.id,
|
|
208
|
+
"uuid": uuidv4(),
|
|
209
|
+
"action":"open",
|
|
210
|
+
"status":{"channel":{"available":4995,"current":5},"workercount":12,"instance":"ca0ef6a9-9174-444d-bdeb-4c9eb54d4566"}
|
|
212
211
|
} ) ), 2 )
|
|
213
212
|
} else {
|
|
214
213
|
setTimeout( () =>
|
|
@@ -216,11 +215,11 @@ a=sendrecv`.replace(/(\r\n|\n|\r)/gm, "\r\n")
|
|
|
216
215
|
projectrtpmessage.createmessage(
|
|
217
216
|
{"local":{"port": 10010,"dtls":
|
|
218
217
|
{"fingerprint":"Some fingerprint","enabled":false},
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
218
|
+
"address":"192.168.0.141"},
|
|
219
|
+
"id": msg.id,
|
|
220
|
+
"uuid": uuidv4(),
|
|
221
|
+
"action":"open",
|
|
222
|
+
"status":{"channel":{"available":4995,"current":5},"workercount":12,"instance":"ca0ef6a9-9174-444d-bdeb-4c9eb54d4566"}
|
|
224
223
|
} ) ), 2 )
|
|
225
224
|
}
|
|
226
225
|
opencount++
|
|
@@ -236,7 +235,7 @@ a=sendrecv`.replace(/(\r\n|\n|\r)/gm, "\r\n")
|
|
|
236
235
|
} )
|
|
237
236
|
|
|
238
237
|
/* ensure we are connected */
|
|
239
|
-
await new Promise( (
|
|
238
|
+
await new Promise( ( resolve ) => setTimeout( () => resolve(), 100 ) )
|
|
240
239
|
|
|
241
240
|
srfscenario.oncreateUAC( async ( contact, options, callbacks ) => {
|
|
242
241
|
|
|
@@ -256,20 +255,20 @@ a=sendrecv`.replace(/(\r\n|\n|\r)/gm, "\r\n")
|
|
|
256
255
|
}
|
|
257
256
|
} )
|
|
258
257
|
|
|
259
|
-
await new Promise( (
|
|
258
|
+
await new Promise( ( resolve ) => setTimeout( () => resolve(), 100 ) )
|
|
260
259
|
throw { "status": 503 }
|
|
261
260
|
} )
|
|
262
261
|
|
|
263
262
|
/* Step 1. Phone sends INVITE */
|
|
264
|
-
|
|
263
|
+
const call = await new Promise( ( resolve ) => {
|
|
265
264
|
srfscenario.oncall( async ( call ) => { resolve( call ) } )
|
|
266
265
|
|
|
267
|
-
|
|
266
|
+
const req = new srf.req( { savpf: true } )
|
|
268
267
|
req.setparsedheader( "contact", [ {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
268
|
+
name: undefined,
|
|
269
|
+
uri: "sip:u3s2etdo@pc3lfsq1oh86.invalid;transport=ws;ob",
|
|
270
|
+
params: {}
|
|
271
|
+
}
|
|
273
272
|
] )
|
|
274
273
|
|
|
275
274
|
srfscenario.inbound( req )
|
|
@@ -284,7 +283,7 @@ a=sendrecv`.replace(/(\r\n|\n|\r)/gm, "\r\n")
|
|
|
284
283
|
|
|
285
284
|
|
|
286
285
|
/* Step 2. New INVITE to the remote Gateway */
|
|
287
|
-
|
|
286
|
+
const newcall = await call.newuac( { "contact": "callto" } )
|
|
288
287
|
|
|
289
288
|
await call._onhangup( "wire" )
|
|
290
289
|
|
|
@@ -310,7 +309,7 @@ a=sendrecv`.replace(/(\r\n|\n|\r)/gm, "\r\n")
|
|
|
310
309
|
} )
|
|
311
310
|
|
|
312
311
|
|
|
313
|
-
it(
|
|
312
|
+
it( "Create call and send 183 - early - SAVPF and 200 ok", async () => {
|
|
314
313
|
|
|
315
314
|
/**
|
|
316
315
|
* Markdown - mermaid
|
|
@@ -328,10 +327,10 @@ a=sendrecv`.replace(/(\r\n|\n|\r)/gm, "\r\n")
|
|
|
328
327
|
*/
|
|
329
328
|
|
|
330
329
|
/* Setup the mock RTP server */
|
|
331
|
-
|
|
332
|
-
|
|
330
|
+
const srfscenario = new srf.srfscenario( { savpf: true } )
|
|
331
|
+
const rtpserver = await callmanager.projectrtp.proxy.listen()
|
|
333
332
|
|
|
334
|
-
|
|
333
|
+
const connection = net.createConnection( 9002, "127.0.0.1" )
|
|
335
334
|
.on( "error", ( e ) => {
|
|
336
335
|
console.error( e )
|
|
337
336
|
} )
|
|
@@ -342,8 +341,8 @@ a=sendrecv`.replace(/(\r\n|\n|\r)/gm, "\r\n")
|
|
|
342
341
|
} )
|
|
343
342
|
|
|
344
343
|
let mixing
|
|
345
|
-
|
|
346
|
-
|
|
344
|
+
const messagestate = projectrtpmessage.newstate()
|
|
345
|
+
const channelmessages = []
|
|
347
346
|
let opencount = 0
|
|
348
347
|
|
|
349
348
|
connection.on( "data", ( data ) => {
|
|
@@ -357,11 +356,11 @@ a=sendrecv`.replace(/(\r\n|\n|\r)/gm, "\r\n")
|
|
|
357
356
|
projectrtpmessage.createmessage(
|
|
358
357
|
{"local":{"port":10008,"dtls":
|
|
359
358
|
{"fingerprint":"Some fingerprint","enabled":false},
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
359
|
+
"address":"192.168.0.141"},
|
|
360
|
+
"id": msg.id,
|
|
361
|
+
"uuid": uuidv4(),
|
|
362
|
+
"action":"open",
|
|
363
|
+
"status":{"channel":{"available":4995,"current":5},"workercount":12,"instance":"ca0ef6a9-9174-444d-bdeb-4c9eb54d4566"}
|
|
365
364
|
} ) ), 2 )
|
|
366
365
|
} else {
|
|
367
366
|
setTimeout( () =>
|
|
@@ -369,11 +368,11 @@ a=sendrecv`.replace(/(\r\n|\n|\r)/gm, "\r\n")
|
|
|
369
368
|
projectrtpmessage.createmessage(
|
|
370
369
|
{"local":{"port": 10010,"dtls":
|
|
371
370
|
{"fingerprint":"Some fingerprint","enabled":false},
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
371
|
+
"address":"192.168.0.141"},
|
|
372
|
+
"id": msg.id,
|
|
373
|
+
"uuid": uuidv4(),
|
|
374
|
+
"action":"open",
|
|
375
|
+
"status":{"channel":{"available":4995,"current":5},"workercount":12,"instance":"ca0ef6a9-9174-444d-bdeb-4c9eb54d4566"}
|
|
377
376
|
} ) ), 2 )
|
|
378
377
|
}
|
|
379
378
|
opencount++
|
|
@@ -389,14 +388,14 @@ a=sendrecv`.replace(/(\r\n|\n|\r)/gm, "\r\n")
|
|
|
389
388
|
} )
|
|
390
389
|
|
|
391
390
|
/* ensure we are connected */
|
|
392
|
-
await new Promise( (
|
|
391
|
+
await new Promise( ( resolve ) => setTimeout( () => resolve(), 100 ) )
|
|
393
392
|
|
|
394
|
-
|
|
393
|
+
const req = new srf.req( { savpf: true } )
|
|
395
394
|
req.setparsedheader( "contact", [ {
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
395
|
+
name: undefined,
|
|
396
|
+
uri: "sip:u3s2etdo@pc3lfsq1oh86.invalid;transport=ws;ob",
|
|
397
|
+
params: {}
|
|
398
|
+
}
|
|
400
399
|
] )
|
|
401
400
|
|
|
402
401
|
srfscenario.oncreateUAC( async ( contact, options, callbacks ) => {
|
|
@@ -417,12 +416,12 @@ a=sendrecv`.replace(/(\r\n|\n|\r)/gm, "\r\n")
|
|
|
417
416
|
}
|
|
418
417
|
} )
|
|
419
418
|
|
|
420
|
-
await new Promise( (
|
|
419
|
+
await new Promise( ( resolve ) => setTimeout( () => resolve(), 100 ) )
|
|
421
420
|
return new srf.dialog( req )
|
|
422
421
|
} )
|
|
423
422
|
|
|
424
423
|
/* Step 1. Phone sends INVITE */
|
|
425
|
-
|
|
424
|
+
const call = await new Promise( ( resolve ) => {
|
|
426
425
|
srfscenario.oncall( async ( call ) => { resolve( call ) } )
|
|
427
426
|
srfscenario.inbound( req )
|
|
428
427
|
} )
|
|
@@ -436,9 +435,9 @@ a=sendrecv`.replace(/(\r\n|\n|\r)/gm, "\r\n")
|
|
|
436
435
|
|
|
437
436
|
|
|
438
437
|
/* Step 2. New INVITE to the remote Gateway */
|
|
439
|
-
|
|
438
|
+
const newcall = await call.newuac( { "contact": "callto" } )
|
|
440
439
|
|
|
441
|
-
await new Promise( (
|
|
440
|
+
await new Promise( ( resolve ) => setTimeout( () => resolve(), 500 ) )
|
|
442
441
|
await call._onhangup( "wire" )
|
|
443
442
|
|
|
444
443
|
expect( newcall.state.early ).to.be.true
|
package/test/interface/events.js
CHANGED
|
@@ -5,10 +5,10 @@ const srf = require( "../mock/srf.js" )
|
|
|
5
5
|
|
|
6
6
|
describe( "events", function() {
|
|
7
7
|
|
|
8
|
-
it(
|
|
9
|
-
|
|
8
|
+
it( "send fake events and wait", async function() {
|
|
9
|
+
const srfscenario = new srf.srfscenario()
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
const call = await new Promise( ( resolve ) => {
|
|
12
12
|
srfscenario.oncall( async ( call ) => { resolve( call ) } )
|
|
13
13
|
srfscenario.inbound()
|
|
14
14
|
} )
|
|
@@ -30,10 +30,10 @@ describe( "events", function() {
|
|
|
30
30
|
|
|
31
31
|
} )
|
|
32
32
|
|
|
33
|
-
it(
|
|
34
|
-
|
|
33
|
+
it( "send fake events with clear", async function() {
|
|
34
|
+
const srfscenario = new srf.srfscenario()
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
const call = await new Promise( ( resolve ) => {
|
|
37
37
|
srfscenario.oncall( async ( call ) => { resolve( call ) } )
|
|
38
38
|
srfscenario.inbound()
|
|
39
39
|
} )
|
|
@@ -62,17 +62,17 @@ describe( "events", function() {
|
|
|
62
62
|
|
|
63
63
|
} )
|
|
64
64
|
|
|
65
|
-
it(
|
|
66
|
-
|
|
65
|
+
it( "timeout", async function() {
|
|
66
|
+
const srfscenario = new srf.srfscenario()
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
const call = await new Promise( ( resolve ) => {
|
|
69
69
|
srfscenario.oncall( async ( call ) => { resolve( call ) } )
|
|
70
70
|
srfscenario.inbound()
|
|
71
71
|
} )
|
|
72
72
|
|
|
73
73
|
await call.answer()
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
const events = await call.waitfortelevents( /[0-9A-D\*#]/, 10 )
|
|
76
76
|
expect( events ).to.be.undefined
|
|
77
77
|
|
|
78
78
|
call.hangup()
|
package/test/interface/hold.js
CHANGED
|
@@ -19,10 +19,10 @@ describe( "hold", function() {
|
|
|
19
19
|
clearcallmanager()
|
|
20
20
|
} )
|
|
21
21
|
|
|
22
|
-
it(
|
|
23
|
-
|
|
22
|
+
it( "place call on hold - inactive", async function() {
|
|
23
|
+
const srfscenario = new srf.srfscenario()
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
const call = await new Promise( ( resolve ) => {
|
|
26
26
|
srfscenario.oncall( async ( call ) => { resolve( call ) } )
|
|
27
27
|
srfscenario.inbound()
|
|
28
28
|
} )
|
|
@@ -34,8 +34,8 @@ describe( "hold", function() {
|
|
|
34
34
|
|
|
35
35
|
await call.answer()
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
const req = new srf.req( new srf.options() )
|
|
38
|
+
const res = new srf.res()
|
|
39
39
|
|
|
40
40
|
let sipcodesent, msgsent
|
|
41
41
|
res.onsend( ( sipcode, msg ) => {
|
|
@@ -65,10 +65,10 @@ a=inactive`.replace(/(\r\n|\n|\r)/gm, "\r\n")
|
|
|
65
65
|
expect( msgsent.body ).to.include( "a=inactive" )
|
|
66
66
|
} )
|
|
67
67
|
|
|
68
|
-
it(
|
|
69
|
-
|
|
68
|
+
it( "place call off hold - inactive", async function() {
|
|
69
|
+
const srfscenario = new srf.srfscenario()
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
const call = await new Promise( ( resolve ) => {
|
|
72
72
|
srfscenario.oncall( async ( call ) => { resolve( call ) } )
|
|
73
73
|
srfscenario.inbound()
|
|
74
74
|
} )
|
|
@@ -80,8 +80,8 @@ a=inactive`.replace(/(\r\n|\n|\r)/gm, "\r\n")
|
|
|
80
80
|
|
|
81
81
|
await call.answer()
|
|
82
82
|
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
const req = new srf.req( new srf.options() )
|
|
84
|
+
const res = new srf.res()
|
|
85
85
|
|
|
86
86
|
req.msg.body = `v=0
|
|
87
87
|
o=- 1608235282228 0 IN IP4 127.0.0.1
|
|
@@ -126,10 +126,10 @@ a=sendrecv`.replace(/(\r\n|\n|\r)/gm, "\r\n")
|
|
|
126
126
|
} )
|
|
127
127
|
|
|
128
128
|
|
|
129
|
-
it(
|
|
130
|
-
|
|
129
|
+
it( "place call on hold - 0.0.0.0", async function() {
|
|
130
|
+
const srfscenario = new srf.srfscenario()
|
|
131
131
|
|
|
132
|
-
|
|
132
|
+
const call = await new Promise( ( resolve ) => {
|
|
133
133
|
srfscenario.oncall( async ( call ) => { resolve( call ) } )
|
|
134
134
|
srfscenario.inbound()
|
|
135
135
|
} )
|
|
@@ -141,8 +141,8 @@ a=sendrecv`.replace(/(\r\n|\n|\r)/gm, "\r\n")
|
|
|
141
141
|
|
|
142
142
|
await call.answer()
|
|
143
143
|
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
const req = new srf.req( new srf.options() )
|
|
145
|
+
const res = new srf.res()
|
|
146
146
|
|
|
147
147
|
let sipcodesent, msgsent
|
|
148
148
|
res.onsend( ( sipcode, msg ) => {
|
|
@@ -24,11 +24,11 @@ describe( "uas.newuac - late", function() {
|
|
|
24
24
|
clearcallmanager()
|
|
25
25
|
} )
|
|
26
26
|
|
|
27
|
-
it(
|
|
27
|
+
it( "uas.newuac - create late uac", async function() {
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
const srfscenario = new srf.srfscenario()
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
const call = await new Promise( ( resolve ) => {
|
|
32
32
|
srfscenario.oncall( async ( call ) => { resolve( call ) } )
|
|
33
33
|
srfscenario.inbound()
|
|
34
34
|
} )
|
|
@@ -39,7 +39,7 @@ describe( "uas.newuac - late", function() {
|
|
|
39
39
|
"storebyentity": 0
|
|
40
40
|
} )
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
const child = await call.newuac( { "contact": "1000@dummy", "late": true } )
|
|
43
43
|
|
|
44
44
|
expect( await callstore.stats() ).to.deep.include( {
|
|
45
45
|
"storebycallid": 2,
|
|
@@ -92,10 +92,10 @@ describe( "uas.newuac - late", function() {
|
|
|
92
92
|
|
|
93
93
|
} )
|
|
94
94
|
|
|
95
|
-
it(
|
|
96
|
-
|
|
95
|
+
it( "uas.newuac - create late uac parent already answered", async function() {
|
|
96
|
+
const srfscenario = new srf.srfscenario()
|
|
97
97
|
|
|
98
|
-
|
|
98
|
+
const call = await new Promise( ( resolve ) => {
|
|
99
99
|
srfscenario.oncall( async ( call ) => { resolve( call ) } )
|
|
100
100
|
srfscenario.inbound()
|
|
101
101
|
} )
|
|
@@ -108,7 +108,7 @@ describe( "uas.newuac - late", function() {
|
|
|
108
108
|
|
|
109
109
|
await call.answer()
|
|
110
110
|
|
|
111
|
-
|
|
111
|
+
const child = await call.newuac( { "contact": "1000@dummy", "late": true } )
|
|
112
112
|
|
|
113
113
|
expect( await callstore.stats() ).to.deep.include( {
|
|
114
114
|
"storebycallid": 2,
|