@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
package/test/interface/call.js
CHANGED
|
@@ -31,16 +31,16 @@ describe( "call object", function() {
|
|
|
31
31
|
clearcallmanager()
|
|
32
32
|
} )
|
|
33
33
|
|
|
34
|
-
it(
|
|
34
|
+
it( "uas.newuac - create uas", async function() {
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
const srfscenario = new srf.srfscenario()
|
|
37
37
|
|
|
38
38
|
let newcallcalled = false
|
|
39
39
|
srfscenario.options.em.on( "call.new", ( /*newcall*/ ) => {
|
|
40
40
|
newcallcalled = true
|
|
41
41
|
} )
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
const call = await new Promise( ( resolve ) => {
|
|
44
44
|
srfscenario.oncall( async ( call ) => { resolve( call ) } )
|
|
45
45
|
srfscenario.inbound()
|
|
46
46
|
} )
|
|
@@ -104,11 +104,11 @@ describe( "call object", function() {
|
|
|
104
104
|
|
|
105
105
|
} )
|
|
106
106
|
|
|
107
|
-
it(
|
|
107
|
+
it( "uas.newuac - create uac", async function() {
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
const srfscenario = new srf.srfscenario()
|
|
110
110
|
|
|
111
|
-
|
|
111
|
+
const call = await new Promise( ( resolve ) => {
|
|
112
112
|
srfscenario.oncall( async ( call ) => { resolve( call ) } )
|
|
113
113
|
srfscenario.inbound()
|
|
114
114
|
} )
|
|
@@ -119,7 +119,7 @@ describe( "call object", function() {
|
|
|
119
119
|
"storebyentity": 0
|
|
120
120
|
} )
|
|
121
121
|
|
|
122
|
-
|
|
122
|
+
const child = await call.newuac( { "contact": "1000@dummy" } )
|
|
123
123
|
|
|
124
124
|
expect( await callstore.stats() ).to.deep.include( {
|
|
125
125
|
"storebycallid": 2,
|
|
@@ -177,15 +177,15 @@ describe( "call object", function() {
|
|
|
177
177
|
|
|
178
178
|
} )
|
|
179
179
|
|
|
180
|
-
it(
|
|
181
|
-
|
|
180
|
+
it( "uas.newuac - create uac by entity no registrar", async function() {
|
|
181
|
+
const srfscenario = new srf.srfscenario()
|
|
182
182
|
|
|
183
|
-
|
|
183
|
+
const call = await new Promise( ( resolve ) => {
|
|
184
184
|
srfscenario.oncall( async ( call ) => { resolve( call ) } )
|
|
185
185
|
srfscenario.inbound()
|
|
186
186
|
} )
|
|
187
187
|
|
|
188
|
-
|
|
188
|
+
const child = await call.newuac( { "entity": { "uri": "1000@dummy" } } )
|
|
189
189
|
expect( child ).to.be.false
|
|
190
190
|
|
|
191
191
|
expect( await callstore.stats() ).to.deep.include( {
|
|
@@ -205,9 +205,9 @@ describe( "call object", function() {
|
|
|
205
205
|
expect( call.state.cleaned ).to.be.true
|
|
206
206
|
} )
|
|
207
207
|
|
|
208
|
-
it(
|
|
208
|
+
it( "uas.newuac - create uac by entity with registrar", async function() {
|
|
209
209
|
|
|
210
|
-
|
|
210
|
+
const options = {
|
|
211
211
|
"registrar": {
|
|
212
212
|
"contacts": async ( entity ) => {
|
|
213
213
|
return {
|
|
@@ -221,9 +221,9 @@ describe( "call object", function() {
|
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
223
|
|
|
224
|
-
|
|
224
|
+
const srfscenario = new srf.srfscenario( options )
|
|
225
225
|
|
|
226
|
-
|
|
226
|
+
const call = await new Promise( ( resolve ) => {
|
|
227
227
|
srfscenario.oncall( async ( call ) => { resolve( call ) } )
|
|
228
228
|
srfscenario.inbound()
|
|
229
229
|
} )
|
|
@@ -237,7 +237,7 @@ describe( "call object", function() {
|
|
|
237
237
|
"type": "callerid"
|
|
238
238
|
} )
|
|
239
239
|
|
|
240
|
-
|
|
240
|
+
const child = await call.newuac( { "entity": { "uri": "1000@dummy" } } )
|
|
241
241
|
|
|
242
242
|
expect( await callstore.stats() ).to.deep.include( {
|
|
243
243
|
"storebycallid": 2,
|
|
@@ -245,7 +245,7 @@ describe( "call object", function() {
|
|
|
245
245
|
"storebyentity": 1
|
|
246
246
|
} )
|
|
247
247
|
|
|
248
|
-
|
|
248
|
+
const e = await child.entity
|
|
249
249
|
expect( e.ccc ).to.equal( 1 )
|
|
250
250
|
|
|
251
251
|
/* mock */
|
|
@@ -257,7 +257,7 @@ describe( "call object", function() {
|
|
|
257
257
|
child.update()
|
|
258
258
|
|
|
259
259
|
expect( requestoptions.method ).to.equal( "update" )
|
|
260
|
-
expect( requestoptions.headers[ "P-Preferred-Identity" ] ).to.equal(
|
|
260
|
+
expect( requestoptions.headers[ "P-Preferred-Identity" ] ).to.equal( "\"\" <sip:0123456789@someotherrealm.com>" )
|
|
261
261
|
|
|
262
262
|
await call.hangup()
|
|
263
263
|
|
|
@@ -274,9 +274,9 @@ describe( "call object", function() {
|
|
|
274
274
|
|
|
275
275
|
} )
|
|
276
276
|
|
|
277
|
-
it(
|
|
277
|
+
it( "uas.newuac - create uac by entity with max limit and registrar", async function() {
|
|
278
278
|
|
|
279
|
-
|
|
279
|
+
const options = {
|
|
280
280
|
"registrar": {
|
|
281
281
|
"contacts": async ( entity ) => {
|
|
282
282
|
return {
|
|
@@ -290,15 +290,15 @@ describe( "call object", function() {
|
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
292
|
|
|
293
|
-
|
|
293
|
+
const srfscenario = new srf.srfscenario( options )
|
|
294
294
|
|
|
295
|
-
|
|
295
|
+
const inboundcall = await new Promise( ( resolve ) => {
|
|
296
296
|
srfscenario.oncall( async ( call ) => { resolve( call ) } )
|
|
297
297
|
srfscenario.inbound()
|
|
298
298
|
} )
|
|
299
299
|
|
|
300
|
-
|
|
301
|
-
|
|
300
|
+
const child = await inboundcall.newuac( { "entity": { "uri": "1000@dummy", "max": 1 } } )
|
|
301
|
+
const child2 = await call.newuac( { "entity": { "uri": "1000@dummy", "max": 1 } } )
|
|
302
302
|
|
|
303
303
|
expect( await callstore.stats() ).to.deep.include( {
|
|
304
304
|
"storebycallid": 2,
|
|
@@ -306,7 +306,7 @@ describe( "call object", function() {
|
|
|
306
306
|
"storebyentity": 1
|
|
307
307
|
} )
|
|
308
308
|
|
|
309
|
-
|
|
309
|
+
const child3 = await call.newuac( { "entity": { "uri": "1000@dummy" } } )
|
|
310
310
|
|
|
311
311
|
expect( await callstore.stats() ).to.deep.include( {
|
|
312
312
|
"storebycallid": 3,
|
|
@@ -331,11 +331,11 @@ describe( "call object", function() {
|
|
|
331
331
|
|
|
332
332
|
} )
|
|
333
333
|
|
|
334
|
-
it(
|
|
334
|
+
it( "uas.newuac detatch from parent", async function() {
|
|
335
335
|
|
|
336
|
-
|
|
336
|
+
const srfscenario = new srf.srfscenario()
|
|
337
337
|
|
|
338
|
-
|
|
338
|
+
const call = await new Promise( ( resolve ) => {
|
|
339
339
|
srfscenario.oncall( async ( call ) => { resolve( call ) } )
|
|
340
340
|
srfscenario.inbound()
|
|
341
341
|
} )
|
|
@@ -346,7 +346,7 @@ describe( "call object", function() {
|
|
|
346
346
|
"storebyentity": 0
|
|
347
347
|
} )
|
|
348
348
|
|
|
349
|
-
|
|
349
|
+
const child = await call.newuac( { "contact": "1000@dummy" } )
|
|
350
350
|
|
|
351
351
|
expect( await callstore.stats() ).to.deep.include( {
|
|
352
352
|
"storebycallid": 2,
|
|
@@ -375,22 +375,22 @@ describe( "call object", function() {
|
|
|
375
375
|
expect( child.state.cleaned ).to.be.true
|
|
376
376
|
} )
|
|
377
377
|
|
|
378
|
-
it(
|
|
378
|
+
it( "uas.newuac - 486", async function() {
|
|
379
379
|
|
|
380
|
-
|
|
380
|
+
const srfscenario = new srf.srfscenario()
|
|
381
381
|
srfscenario.oncreateUAC( () => {
|
|
382
382
|
throw { "status": 486 }
|
|
383
383
|
} )
|
|
384
384
|
|
|
385
|
-
|
|
385
|
+
const call = await new Promise( ( resolve ) => {
|
|
386
386
|
srfscenario.oncall( async ( call ) => { resolve( call ) } )
|
|
387
387
|
srfscenario.inbound()
|
|
388
388
|
} )
|
|
389
389
|
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
390
|
+
const children = []
|
|
391
|
+
const child = await call.newuac( { "contact": "1000@dummy" }, { "early": ( c ) => {
|
|
392
|
+
children.push( c )
|
|
393
|
+
}
|
|
394
394
|
} )
|
|
395
395
|
|
|
396
396
|
expect( children.length ).to.equal( 1 )
|
|
@@ -416,20 +416,20 @@ describe( "call object", function() {
|
|
|
416
416
|
} )
|
|
417
417
|
|
|
418
418
|
|
|
419
|
-
it(
|
|
419
|
+
it( "uas.newuac - timeout", async function() {
|
|
420
420
|
|
|
421
|
-
|
|
421
|
+
const srfscenario = new srf.srfscenario()
|
|
422
422
|
srfscenario.options.srf.newuactimeout = 20 /* longer than our uactimeout */
|
|
423
423
|
|
|
424
|
-
|
|
424
|
+
const call = await new Promise( ( resolve ) => {
|
|
425
425
|
srfscenario.oncall( async ( call ) => { resolve( call ) } )
|
|
426
426
|
srfscenario.inbound()
|
|
427
427
|
} )
|
|
428
428
|
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
429
|
+
const children = []
|
|
430
|
+
const child = await call.newuac( { "contact": "1000@dummy", "uactimeout": 10 }, { "early": ( c ) => {
|
|
431
|
+
children.push( c )
|
|
432
|
+
}
|
|
433
433
|
} ) /* overide default - very short */
|
|
434
434
|
|
|
435
435
|
expect( child.destroyed ).to.be.true
|
|
@@ -458,11 +458,11 @@ describe( "call object", function() {
|
|
|
458
458
|
expect( child.state.cleaned ).to.be.true
|
|
459
459
|
} )
|
|
460
460
|
|
|
461
|
-
it(
|
|
461
|
+
it( "uas.newuac - child remote hangup", async function() {
|
|
462
462
|
|
|
463
|
-
|
|
463
|
+
const srfscenario = new srf.srfscenario()
|
|
464
464
|
|
|
465
|
-
|
|
465
|
+
const call = await new Promise( ( resolve ) => {
|
|
466
466
|
srfscenario.oncall( async ( call ) => { resolve( call ) } )
|
|
467
467
|
srfscenario.inbound()
|
|
468
468
|
} )
|
|
@@ -473,7 +473,7 @@ describe( "call object", function() {
|
|
|
473
473
|
"storebyentity": 0
|
|
474
474
|
} )
|
|
475
475
|
|
|
476
|
-
|
|
476
|
+
const child = await call.newuac( { "contact": "1000@dummy" } )
|
|
477
477
|
|
|
478
478
|
expect( await callstore.stats() ).to.deep.include( {
|
|
479
479
|
"storebycallid": 2,
|
|
@@ -513,9 +513,9 @@ describe( "call object", function() {
|
|
|
513
513
|
|
|
514
514
|
} )
|
|
515
515
|
|
|
516
|
-
it(
|
|
516
|
+
it( "uas.newuac - new call event", async function() {
|
|
517
517
|
|
|
518
|
-
|
|
518
|
+
const srfscenario = new srf.srfscenario()
|
|
519
519
|
|
|
520
520
|
let eventhappened = false
|
|
521
521
|
srfscenario.options.em.on( "call.new", ( c ) => {
|
|
@@ -533,9 +533,9 @@ describe( "call object", function() {
|
|
|
533
533
|
|
|
534
534
|
} )
|
|
535
535
|
|
|
536
|
-
it(
|
|
536
|
+
it( "uas.newuac - ringing event", async function() {
|
|
537
537
|
|
|
538
|
-
|
|
538
|
+
const srfscenario = new srf.srfscenario()
|
|
539
539
|
|
|
540
540
|
let eventhappened = false
|
|
541
541
|
srfscenario.options.em.on( "call.ringing", ( c ) => {
|
|
@@ -545,7 +545,7 @@ describe( "call object", function() {
|
|
|
545
545
|
|
|
546
546
|
} )
|
|
547
547
|
|
|
548
|
-
|
|
548
|
+
const c = await new Promise( ( resolve ) => {
|
|
549
549
|
srfscenario.oncall( async ( call ) => { resolve( call ) } )
|
|
550
550
|
srfscenario.inbound()
|
|
551
551
|
} )
|
|
@@ -557,13 +557,13 @@ describe( "call object", function() {
|
|
|
557
557
|
|
|
558
558
|
} )
|
|
559
559
|
|
|
560
|
-
it(
|
|
560
|
+
it( "uas.newuac - destroyed event", async function() {
|
|
561
561
|
|
|
562
|
-
|
|
562
|
+
const srfscenario = new srf.srfscenario()
|
|
563
563
|
|
|
564
564
|
let eventhappened = false
|
|
565
565
|
|
|
566
|
-
|
|
566
|
+
const c = await new Promise( ( resolve ) => {
|
|
567
567
|
srfscenario.oncall( async ( call ) => { resolve( call ) } )
|
|
568
568
|
srfscenario.inbound()
|
|
569
569
|
} )
|
|
@@ -577,9 +577,9 @@ describe( "call object", function() {
|
|
|
577
577
|
expect( eventhappened ).to.be.true
|
|
578
578
|
} )
|
|
579
579
|
|
|
580
|
-
it(
|
|
580
|
+
it( "uas.newuac - answered and destroyed event", async function() {
|
|
581
581
|
|
|
582
|
-
|
|
582
|
+
const srfscenario = new srf.srfscenario()
|
|
583
583
|
|
|
584
584
|
let eventhappened = false
|
|
585
585
|
srfscenario.options.em.on( "call.answered", ( c ) => {
|
|
@@ -592,7 +592,7 @@ describe( "call object", function() {
|
|
|
592
592
|
eventhappened = false
|
|
593
593
|
} )
|
|
594
594
|
|
|
595
|
-
|
|
595
|
+
const c = await new Promise( ( resolve ) => {
|
|
596
596
|
srfscenario.oncall( async ( call ) => { resolve( call ) } )
|
|
597
597
|
srfscenario.inbound()
|
|
598
598
|
} )
|
|
@@ -607,9 +607,9 @@ describe( "call object", function() {
|
|
|
607
607
|
expect( eventhappened ).to.be.false
|
|
608
608
|
} )
|
|
609
609
|
|
|
610
|
-
it(
|
|
610
|
+
it( "uas.newuac - authed event", async function() {
|
|
611
611
|
|
|
612
|
-
|
|
612
|
+
const options = {
|
|
613
613
|
"userlookup": async ( username, realm ) => {
|
|
614
614
|
return {
|
|
615
615
|
"secret": "zanzibar",
|
|
@@ -619,7 +619,7 @@ describe( "call object", function() {
|
|
|
619
619
|
}
|
|
620
620
|
}
|
|
621
621
|
|
|
622
|
-
|
|
622
|
+
const srfscenario = new srf.srfscenario( options )
|
|
623
623
|
|
|
624
624
|
let eventhappened = false
|
|
625
625
|
srfscenario.options.em.on( "call.authed", ( c ) => {
|
|
@@ -628,7 +628,7 @@ describe( "call object", function() {
|
|
|
628
628
|
eventhappened = true
|
|
629
629
|
} )
|
|
630
630
|
|
|
631
|
-
|
|
631
|
+
const c = await new Promise( ( resolve ) => {
|
|
632
632
|
srfscenario.oncall( async ( call ) => {
|
|
633
633
|
resolve( call )
|
|
634
634
|
} )
|
|
@@ -650,12 +650,12 @@ describe( "call object", function() {
|
|
|
650
650
|
|
|
651
651
|
/* We would normally look here to get nonce and opaque - howevere we are frigging it */
|
|
652
652
|
//let request = msg.headers[ "Proxy-Authenticate" ]
|
|
653
|
-
let request =
|
|
653
|
+
let request = "Digest realm=\"biloxi.com\", algorithm=MD5, qop=\"auth\", nonce=\"dcd98b7102dd2f0e8b11d0f600bfb0c093\", opaque=\"5ccc069c403ebaf9f0171e9517f40e41\", stale=false"
|
|
654
654
|
|
|
655
655
|
/* The items a uac will add */
|
|
656
|
-
request +=
|
|
657
|
-
request +=
|
|
658
|
-
request +=
|
|
656
|
+
request += ", username=\"bob\", nc=00000001,cnonce=\"0a4f113b\","
|
|
657
|
+
request += " uri=\"sip:bob@biloxi.com\","
|
|
658
|
+
request += " response=\"89eb0059246c02b2f6ee02c7961d5ea3\""
|
|
659
659
|
|
|
660
660
|
srfscenario.req.set( "Proxy-Authorization", request )
|
|
661
661
|
|
|
@@ -682,7 +682,7 @@ describe( "call object", function() {
|
|
|
682
682
|
expect( c.hangup_cause.src ).to.equal( "us" )
|
|
683
683
|
expect( c.state.destroyed ).to.equal( true )
|
|
684
684
|
expect( c.state.authed ).to.equal( true )
|
|
685
|
-
|
|
685
|
+
const e = await c.entity
|
|
686
686
|
expect( e.username ).to.equal( "bob" )
|
|
687
687
|
expect( e.realm ).to.equal( "biloxi.com" )
|
|
688
688
|
expect( e.uri ).to.equal( "bob@biloxi.com" )
|
|
@@ -690,9 +690,9 @@ describe( "call object", function() {
|
|
|
690
690
|
|
|
691
691
|
} )
|
|
692
692
|
|
|
693
|
-
it(
|
|
693
|
+
it( "uas.newuac - auth failed", async function() {
|
|
694
694
|
|
|
695
|
-
|
|
695
|
+
const options = {
|
|
696
696
|
"userlookup": async ( username, realm ) => {
|
|
697
697
|
return {
|
|
698
698
|
"secret": "zanzibar",
|
|
@@ -702,7 +702,7 @@ describe( "call object", function() {
|
|
|
702
702
|
}
|
|
703
703
|
}
|
|
704
704
|
|
|
705
|
-
|
|
705
|
+
const srfscenario = new srf.srfscenario( options )
|
|
706
706
|
|
|
707
707
|
let eventhappened = false
|
|
708
708
|
srfscenario.options.em.on( "call.authed.failed", ( c ) => {
|
|
@@ -711,7 +711,7 @@ describe( "call object", function() {
|
|
|
711
711
|
eventhappened = true
|
|
712
712
|
} )
|
|
713
713
|
|
|
714
|
-
|
|
714
|
+
const c = await new Promise( ( resolve ) => {
|
|
715
715
|
srfscenario.oncall( async ( call ) => {
|
|
716
716
|
|
|
717
717
|
let onsendcount = 0
|
|
@@ -728,9 +728,9 @@ describe( "call object", function() {
|
|
|
728
728
|
let request = msg.headers[ "Proxy-Authenticate" ]
|
|
729
729
|
|
|
730
730
|
/* The items a uac will add */
|
|
731
|
-
request +=
|
|
732
|
-
request +=
|
|
733
|
-
request +=
|
|
731
|
+
request += ", username=\"bob\", nc=00000001,cnonce=\"0a4f113b\","
|
|
732
|
+
request += " uri=\"sip:bob@biloxi.com\","
|
|
733
|
+
request += " response=\"89eb0059246c02b2f6ee02c7961d5ea\""
|
|
734
734
|
|
|
735
735
|
srfscenario.req.set( "Proxy-Authorization", request )
|
|
736
736
|
|
|
@@ -759,9 +759,9 @@ describe( "call object", function() {
|
|
|
759
759
|
expect( c.state.authed ).to.equal( false )
|
|
760
760
|
} )
|
|
761
761
|
|
|
762
|
-
it(
|
|
762
|
+
it( "uas.newuac - caller id set correctly", async function() {
|
|
763
763
|
|
|
764
|
-
|
|
764
|
+
const srfscenario = new srf.srfscenario( {} )
|
|
765
765
|
|
|
766
766
|
let createuacoptions
|
|
767
767
|
srfscenario.oncreateUAC( ( contact, options, callbacks ) => {
|
|
@@ -769,59 +769,59 @@ describe( "call object", function() {
|
|
|
769
769
|
|
|
770
770
|
} )
|
|
771
771
|
|
|
772
|
-
|
|
772
|
+
const options = {
|
|
773
773
|
"contact": "ourcontactstring",
|
|
774
774
|
"late": true
|
|
775
775
|
}
|
|
776
776
|
|
|
777
777
|
await call.newuac( options, { "early": ( c ) => c.hangup() } )
|
|
778
778
|
|
|
779
|
-
expect( createuacoptions.headers[ "Remote-Party-ID" ] ).to.equal(
|
|
779
|
+
expect( createuacoptions.headers[ "Remote-Party-ID" ] ).to.equal( "\"\" <sip:0000000000@localhost.localdomain>" )
|
|
780
780
|
expect( createuacoptions.noAck ).to.be.true
|
|
781
781
|
} )
|
|
782
782
|
|
|
783
|
-
it(
|
|
783
|
+
it( "uas.newuac - early callback is called", async function() {
|
|
784
784
|
new srf.srfscenario( {} )
|
|
785
785
|
|
|
786
|
-
|
|
786
|
+
const options = {
|
|
787
787
|
"contact": "ourcontactstring",
|
|
788
788
|
"late": true
|
|
789
789
|
}
|
|
790
790
|
|
|
791
791
|
let earlycallbackcalled = false
|
|
792
|
-
|
|
792
|
+
const c = await call.newuac( options, { "early": ( c ) => earlycallbackcalled = true } )
|
|
793
793
|
|
|
794
794
|
c.hangup()
|
|
795
795
|
|
|
796
796
|
expect( earlycallbackcalled ).to.be.true
|
|
797
797
|
} )
|
|
798
798
|
|
|
799
|
-
it(
|
|
799
|
+
it( "uas.newuac - confirmed callback is called", async function() {
|
|
800
800
|
new srf.srfscenario( {} )
|
|
801
801
|
|
|
802
|
-
|
|
802
|
+
const options = {
|
|
803
803
|
"contact": "ourcontactstring",
|
|
804
804
|
"late": true
|
|
805
805
|
}
|
|
806
806
|
|
|
807
807
|
let earlycallbackcalled = false
|
|
808
|
-
|
|
808
|
+
const c = await call.newuac( options, { "confirm": ( c ) => earlycallbackcalled = true } )
|
|
809
809
|
|
|
810
810
|
c.hangup()
|
|
811
811
|
|
|
812
812
|
expect( earlycallbackcalled ).to.be.true
|
|
813
813
|
} )
|
|
814
814
|
|
|
815
|
-
it(
|
|
815
|
+
it( "uas.newuac - simple update", async function() {
|
|
816
816
|
new srf.srfscenario( {} )
|
|
817
817
|
|
|
818
|
-
|
|
818
|
+
const options = {
|
|
819
819
|
"contact": "ourcontactstring",
|
|
820
820
|
"late": true
|
|
821
821
|
}
|
|
822
822
|
|
|
823
|
-
|
|
824
|
-
|
|
823
|
+
const earlycallbackcalled = false
|
|
824
|
+
const c = await call.newuac( options )
|
|
825
825
|
|
|
826
826
|
/* mock */
|
|
827
827
|
c._req.set( "ALLOW", "INVITE, UPDATE, OPTIONS" )
|
|
@@ -838,26 +838,26 @@ describe( "call object", function() {
|
|
|
838
838
|
|
|
839
839
|
expect( requestoptions.method ).to.equal( "update" )
|
|
840
840
|
expect( requestoptions.body ).to.be.a( "string" )
|
|
841
|
-
expect( requestoptions.headers[ "P-Preferred-Identity" ] ).to.equal(
|
|
841
|
+
expect( requestoptions.headers[ "P-Preferred-Identity" ] ).to.equal( "\"Kermit\" <sip:kermy@muppetshow.com>" )
|
|
842
842
|
|
|
843
843
|
} )
|
|
844
844
|
|
|
845
|
-
it(
|
|
845
|
+
it( "uas.newuac - simple update - but don't allow as not in allow", async function() {
|
|
846
846
|
new srf.srfscenario( {} )
|
|
847
847
|
|
|
848
|
-
|
|
848
|
+
const options = {
|
|
849
849
|
"contact": "ourcontactstring",
|
|
850
850
|
"late": true
|
|
851
851
|
}
|
|
852
852
|
|
|
853
|
-
|
|
854
|
-
|
|
853
|
+
const earlycallbackcalled = false
|
|
854
|
+
const c = await call.newuac( options )
|
|
855
855
|
|
|
856
856
|
/* mock */
|
|
857
857
|
let requestoptions = false
|
|
858
858
|
c._dialog.on( "request", ( options ) => requestoptions = options )
|
|
859
859
|
|
|
860
|
-
|
|
860
|
+
const returnedval = await c.update( { "remote": {
|
|
861
861
|
"display": "Kermit",
|
|
862
862
|
"realm": "muppetshow.com",
|
|
863
863
|
"username": "kermy"
|
|
@@ -869,15 +869,15 @@ describe( "call object", function() {
|
|
|
869
869
|
expect( requestoptions ).to.be.false
|
|
870
870
|
} )
|
|
871
871
|
|
|
872
|
-
it(
|
|
872
|
+
it( "Test listen and emit event on call object", async function() {
|
|
873
873
|
new srf.srfscenario( {} )
|
|
874
874
|
|
|
875
|
-
|
|
875
|
+
const options = {
|
|
876
876
|
"contact": "ourcontactstring",
|
|
877
877
|
"late": true
|
|
878
878
|
}
|
|
879
879
|
|
|
880
|
-
|
|
880
|
+
const c = await call.newuac( options )
|
|
881
881
|
|
|
882
882
|
let eventfired = false
|
|
883
883
|
c.on( "somerandomevent", ( ob ) => {
|
|
@@ -892,15 +892,15 @@ describe( "call object", function() {
|
|
|
892
892
|
|
|
893
893
|
} )
|
|
894
894
|
|
|
895
|
-
it(
|
|
895
|
+
it( "Test listen and emit event on and removealllisteners call object", async function() {
|
|
896
896
|
new srf.srfscenario( {} )
|
|
897
897
|
|
|
898
|
-
|
|
898
|
+
const options = {
|
|
899
899
|
"contact": "ourcontactstring",
|
|
900
900
|
"late": true
|
|
901
901
|
}
|
|
902
902
|
|
|
903
|
-
|
|
903
|
+
const c = await call.newuac( options )
|
|
904
904
|
|
|
905
905
|
let eventfired = 0
|
|
906
906
|
c.on( "somerandomevent", ( ob ) => {
|
|
@@ -918,15 +918,15 @@ describe( "call object", function() {
|
|
|
918
918
|
|
|
919
919
|
} )
|
|
920
920
|
|
|
921
|
-
it(
|
|
921
|
+
it( "Test listen and emit event on and removealllisteners (none specified) call object", async function() {
|
|
922
922
|
new srf.srfscenario( {} )
|
|
923
923
|
|
|
924
|
-
|
|
924
|
+
const options = {
|
|
925
925
|
"contact": "ourcontactstring",
|
|
926
926
|
"late": true
|
|
927
927
|
}
|
|
928
928
|
|
|
929
|
-
|
|
929
|
+
const c = await call.newuac( options )
|
|
930
930
|
|
|
931
931
|
let eventfired = 0
|
|
932
932
|
c.on( "somerandomevent", ( ob ) => {
|
|
@@ -944,19 +944,19 @@ describe( "call object", function() {
|
|
|
944
944
|
|
|
945
945
|
} )
|
|
946
946
|
|
|
947
|
-
it(
|
|
947
|
+
it( "Test listen and emit event on and off call object", async function() {
|
|
948
948
|
new srf.srfscenario( {} )
|
|
949
949
|
|
|
950
|
-
|
|
950
|
+
const options = {
|
|
951
951
|
"contact": "ourcontactstring",
|
|
952
952
|
"late": true
|
|
953
953
|
}
|
|
954
954
|
|
|
955
|
-
|
|
955
|
+
const c = await call.newuac( options )
|
|
956
956
|
|
|
957
957
|
let eventfired = 0
|
|
958
958
|
|
|
959
|
-
|
|
959
|
+
const ourcb = ( ob ) => {
|
|
960
960
|
if( "hello" === ob.vars.xinfo ) eventfired++
|
|
961
961
|
}
|
|
962
962
|
c.on( "somerandomevent", ourcb )
|
|
@@ -972,15 +972,15 @@ describe( "call object", function() {
|
|
|
972
972
|
|
|
973
973
|
} )
|
|
974
974
|
|
|
975
|
-
it(
|
|
975
|
+
it( "Test listen and emit event once call object", async function() {
|
|
976
976
|
new srf.srfscenario( {} )
|
|
977
977
|
|
|
978
|
-
|
|
978
|
+
const options = {
|
|
979
979
|
"contact": "ourcontactstring",
|
|
980
980
|
"late": true
|
|
981
981
|
}
|
|
982
982
|
|
|
983
|
-
|
|
983
|
+
const c = await call.newuac( options )
|
|
984
984
|
|
|
985
985
|
let eventfired = 0
|
|
986
986
|
c.once( "somerandomevent", ( ob ) => {
|
|
@@ -996,15 +996,15 @@ describe( "call object", function() {
|
|
|
996
996
|
|
|
997
997
|
} )
|
|
998
998
|
|
|
999
|
-
it(
|
|
999
|
+
it( "Test listen and emit call.pick on call object", async function() {
|
|
1000
1000
|
new srf.srfscenario( {} )
|
|
1001
1001
|
|
|
1002
|
-
|
|
1002
|
+
const options = {
|
|
1003
1003
|
"contact": "ourcontactstring",
|
|
1004
1004
|
"late": true
|
|
1005
1005
|
}
|
|
1006
1006
|
|
|
1007
|
-
|
|
1007
|
+
const c = await call.newuac( options )
|
|
1008
1008
|
|
|
1009
1009
|
let eventfired = false
|
|
1010
1010
|
c.on( "call.pick", ( callobject ) => {
|
|
@@ -1018,11 +1018,11 @@ describe( "call object", function() {
|
|
|
1018
1018
|
|
|
1019
1019
|
} )
|
|
1020
1020
|
|
|
1021
|
-
it(
|
|
1021
|
+
it( "Create a call and mock rtpengine and ensure we receive events", async function() {
|
|
1022
1022
|
new srf.srfscenario( {} )
|
|
1023
|
-
|
|
1023
|
+
const rtpserver = await callmanager.projectrtp.proxy.listen()
|
|
1024
1024
|
|
|
1025
|
-
|
|
1025
|
+
const connection = net.createConnection( 9002, "127.0.0.1" )
|
|
1026
1026
|
.on( "error", ( e ) => {
|
|
1027
1027
|
console.error( e )
|
|
1028
1028
|
} )
|
|
@@ -1032,7 +1032,7 @@ describe( "call object", function() {
|
|
|
1032
1032
|
connection.write( projectrtpmessage.createmessage( {"status":{"channel":{"available":5000,"current":0},"workercount":12,"instance":"ca0ef6a9-9174-444d-bdeb-4c9eb54d5c94"}} ) )
|
|
1033
1033
|
} )
|
|
1034
1034
|
|
|
1035
|
-
|
|
1035
|
+
const messagestate = projectrtpmessage.newstate()
|
|
1036
1036
|
let msgid
|
|
1037
1037
|
connection.on( "data", ( data ) => {
|
|
1038
1038
|
projectrtpmessage.parsemessage( messagestate, data, ( msg ) => {
|
|
@@ -1050,7 +1050,7 @@ describe( "call object", function() {
|
|
|
1050
1050
|
await new Promise( ( resolve ) => setTimeout( () => resolve(), 100 ) )
|
|
1051
1051
|
|
|
1052
1052
|
/* this flow mimicks the flow associated with a voicemail being left */
|
|
1053
|
-
|
|
1053
|
+
const c = await call.newuac( {
|
|
1054
1054
|
"contact": "ourcontactstring"
|
|
1055
1055
|
} )
|
|
1056
1056
|
|
|
@@ -1100,17 +1100,17 @@ describe( "call object", function() {
|
|
|
1100
1100
|
await rtpserver.destroy()
|
|
1101
1101
|
} )
|
|
1102
1102
|
|
|
1103
|
-
it(
|
|
1103
|
+
it( "set get moh", async function() {
|
|
1104
1104
|
new srf.srfscenario( {} )
|
|
1105
1105
|
|
|
1106
|
-
|
|
1106
|
+
const options = {
|
|
1107
1107
|
"contact": "ourcontactstring",
|
|
1108
1108
|
"late": true
|
|
1109
1109
|
}
|
|
1110
1110
|
|
|
1111
|
-
|
|
1111
|
+
const c = await call.newuac( options )
|
|
1112
1112
|
|
|
1113
|
-
|
|
1113
|
+
const s = {
|
|
1114
1114
|
"loop": true,
|
|
1115
1115
|
"files": [
|
|
1116
1116
|
{ "wav": "some.wav" }
|
|
@@ -1128,41 +1128,41 @@ describe( "call object", function() {
|
|
|
1128
1128
|
|
|
1129
1129
|
} )
|
|
1130
1130
|
|
|
1131
|
-
it(
|
|
1131
|
+
it( "overide caller id name", async function() {
|
|
1132
1132
|
new srf.srfscenario( {} )
|
|
1133
1133
|
|
|
1134
|
-
|
|
1134
|
+
const options = {
|
|
1135
1135
|
"contact": "ourcontactstring",
|
|
1136
1136
|
"callerid": {
|
|
1137
1137
|
"name": "Hello"
|
|
1138
1138
|
}
|
|
1139
1139
|
}
|
|
1140
1140
|
|
|
1141
|
-
|
|
1141
|
+
const c = await call.newuac( options )
|
|
1142
1142
|
|
|
1143
1143
|
/* no default configured */
|
|
1144
|
-
expect( c.options.headers[ "Remote-Party-ID" ] ).to.equal(
|
|
1144
|
+
expect( c.options.headers[ "Remote-Party-ID" ] ).to.equal( "\"Hello\" <sip:0000000000@localhost.localdomain>" )
|
|
1145
1145
|
|
|
1146
1146
|
c._onhangup( "wire" )
|
|
1147
1147
|
|
|
1148
1148
|
} )
|
|
1149
1149
|
|
|
1150
1150
|
|
|
1151
|
-
it(
|
|
1151
|
+
it( "overide caller id number", async function() {
|
|
1152
1152
|
new srf.srfscenario( {} )
|
|
1153
1153
|
|
|
1154
|
-
|
|
1154
|
+
const options = {
|
|
1155
1155
|
"contact": "ourcontactstring",
|
|
1156
1156
|
"callerid": {
|
|
1157
1157
|
"number": "012345789"
|
|
1158
1158
|
}
|
|
1159
1159
|
}
|
|
1160
1160
|
|
|
1161
|
-
|
|
1161
|
+
const c = await call.newuac( options )
|
|
1162
1162
|
|
|
1163
1163
|
|
|
1164
1164
|
/* no default configured */
|
|
1165
|
-
expect( c.options.headers[ "Remote-Party-ID" ] ).to.equal(
|
|
1165
|
+
expect( c.options.headers[ "Remote-Party-ID" ] ).to.equal( "\"\" <sip:012345789@localhost.localdomain>" )
|
|
1166
1166
|
|
|
1167
1167
|
c._onhangup( "wire" )
|
|
1168
1168
|
|