@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.
@@ -6,8 +6,8 @@ const call = require( "../../lib/call.js" )
6
6
 
7
7
  describe( "sdp", function() {
8
8
 
9
- it( `create new sdp object`, async function() {
10
- let s = sdp.create()
9
+ it( "create new sdp object", async function() {
10
+ const s = sdp.create()
11
11
 
12
12
  /* check basic strcture */
13
13
  expect( s.sdp ).to.have.property( "version" ).that.is.a( "number" ).to.equal( 0 )
@@ -18,9 +18,9 @@ describe( "sdp", function() {
18
18
  expect( s.sdp ).to.have.property( "media" ).that.is.a( "array" ).to.have.lengthOf( 1 )
19
19
  } )
20
20
 
21
- it( `pcma intersection`, async function() {
21
+ it( "pcma intersection 1", async function() {
22
22
 
23
- let testsdp = `v=0
23
+ const testsdp = `v=0
24
24
  o=- 1608235282228 0 IN IP4 127.0.0.1
25
25
  s=
26
26
  c=IN IP4 192.168.0.141
@@ -34,9 +34,9 @@ a=sendrecv`.replace(/(\r\n|\n|\r)/gm, "\r\n")
34
34
 
35
35
  } )
36
36
 
37
- it( `pcma intersection`, async function() {
37
+ it( "pcma intersection 2", async function() {
38
38
 
39
- let testsdp = `v=0
39
+ const testsdp = `v=0
40
40
  o=Z 1608236465345 1 IN IP4 192.168.0.141
41
41
  s=Z
42
42
  c=IN IP4 192.168.0.141
@@ -60,10 +60,10 @@ a=sendrecv`.replace(/(\r\n|\n|\r)/gm, "\r\n")
60
60
 
61
61
  } )
62
62
 
63
- it( `generate sdp from object pcma`, async function() {
63
+ it( "generate sdp from object pcma", async function() {
64
64
 
65
65
  /* Setsession id only to permorm the test - normally use the default changing one */
66
- let newsdp = sdp.create().setsessionid( 0 ).addcodecs( "pcma" ).setconnectionaddress( "192.168.0.100" ).toString()
66
+ const newsdp = sdp.create().setsessionid( 0 ).addcodecs( "pcma" ).setconnectionaddress( "192.168.0.100" ).toString()
67
67
 
68
68
  expect( newsdp ).to.equal( "v=0\r\n" +
69
69
  "o=- 0 0 IN IP4 127.0.0.1\r\n" +
@@ -76,8 +76,8 @@ a=sendrecv`.replace(/(\r\n|\n|\r)/gm, "\r\n")
76
76
  "a=sendrecv\r\n" )
77
77
  } )
78
78
 
79
- it( `generate sdp from object ilbc pcma`, async function() {
80
- let newsdp = sdp.create().setsessionid( 0 ).addcodecs( "ilbc pcma" ).toString()
79
+ it( "generate sdp from object ilbc pcma", async function() {
80
+ const newsdp = sdp.create().setsessionid( 0 ).addcodecs( "ilbc pcma" ).toString()
81
81
 
82
82
  expect( newsdp ).to.equal( "v=0\r\n" +
83
83
  "o=- 0 0 IN IP4 127.0.0.1\r\n" +
@@ -92,9 +92,9 @@ a=sendrecv`.replace(/(\r\n|\n|\r)/gm, "\r\n")
92
92
  "a=sendrecv\r\n" )
93
93
  } )
94
94
 
95
- it( `don't duplicate codec request`, async function() {
95
+ it( "don't duplicate codec request", async function() {
96
96
 
97
- let newsdp = sdp.create().setsessionid( 0 ).addcodecs( "ilbc ilbc pcma" ).toString()
97
+ const newsdp = sdp.create().setsessionid( 0 ).addcodecs( "ilbc ilbc pcma" ).toString()
98
98
 
99
99
  expect( newsdp ).to.equal( "v=0\r\n" +
100
100
  "o=- 0 0 IN IP4 127.0.0.1\r\n" +
@@ -109,9 +109,9 @@ a=sendrecv`.replace(/(\r\n|\n|\r)/gm, "\r\n")
109
109
  "a=sendrecv\r\n" )
110
110
  } )
111
111
 
112
- it( `exclude a ptime of 30`, async function() {
112
+ it( "exclude a ptime of 30", async function() {
113
113
 
114
- let testsdp = `v=0
114
+ const testsdp = `v=0
115
115
  o=Z 1608292844058 1 IN IP4 192.168.0.141
116
116
  s=Z
117
117
  c=IN IP4 192.168.0.141
@@ -131,9 +131,9 @@ a=sendrecv`.replace(/(\r\n|\n|\r)/gm, "\r\n")
131
131
 
132
132
  } )
133
133
 
134
- it( `looking for pcma`, async function() {
134
+ it( "looking for pcma", async function() {
135
135
 
136
- let testsdp = `v=0
136
+ const testsdp = `v=0
137
137
  o=Z 1608303841226 1 IN IP4 192.168.0.141
138
138
  s=Z
139
139
  c=IN IP4 192.168.0.141
@@ -146,9 +146,9 @@ a=sendrecv`
146
146
  expect( sdp.create( testsdp ).intersection( "pcmu pcma" ) ).to.equal( "pcma" )
147
147
  } )
148
148
 
149
- it( `looking for g722`, async function() {
149
+ it( "looking for g722", async function() {
150
150
 
151
- let testsdp = `v=0
151
+ const testsdp = `v=0
152
152
  o=Z 1610744131900 1 IN IP4 127.0.0.1
153
153
  s=Z
154
154
  c=IN IP4 127.0.0.1
@@ -164,7 +164,7 @@ a=rtpmap:18 G729/8000
164
164
  a=fmtp:18 annexb=no
165
165
  a=sendrecv`.replace(/(\r\n|\n|\r)/gm, "\r\n")
166
166
 
167
- let remote = sdp.create( testsdp )
167
+ const remote = sdp.create( testsdp )
168
168
  expect( remote.intersection( "g722 pcmu", true ) ).to.equal( "g722" )
169
169
 
170
170
  remote.setaudiodirection( "inactive" )
@@ -187,8 +187,8 @@ a=sendrecv`.replace(/(\r\n|\n|\r)/gm, "\r\n")
187
187
  )
188
188
  } )
189
189
 
190
- it( `sdp member functions`, async function() {
191
- let testsdp = `v=0
190
+ it( "sdp member functions", async function() {
191
+ const testsdp = `v=0
192
192
  o=Z 1610744131900 1 IN IP4 127.0.0.1
193
193
  s=Z
194
194
  c=IN IP4 192.168.0.100
@@ -205,15 +205,15 @@ a=fmtp:18 annexb=no
205
205
  a=sendrecv`.replace(/(\r\n|\n|\r)/gm, "\r\n")
206
206
 
207
207
 
208
- let oursdp = sdp.create( testsdp )
208
+ const oursdp = sdp.create( testsdp )
209
209
 
210
- let a = oursdp.getaudio()
210
+ const a = oursdp.getaudio()
211
211
  expect( a.port ).to.equal( 56858 )
212
212
  expect( a.address ).to.equal( "192.168.0.100" )
213
213
 
214
214
  } )
215
215
 
216
- it( `sdp webrtc parse`, async function() {
216
+ it( "sdp webrtc parse", async function() {
217
217
 
218
218
  const testsdp = `v=0
219
219
  o=- 5012137047437522294 2 IN IP4 127.0.0.1
@@ -261,7 +261,7 @@ a=ssrc:2706351154 msid:XjKU0noZQudw5wysGsQOsBwJVp0Dk9PbZxHw 83ac3abd-cc86-427a-9
261
261
  a=ssrc:2706351154 mslabel:XjKU0noZQudw5wysGsQOsBwJVp0Dk9PbZxHw
262
262
  a=ssrc:2706351154 label:83ac3abd-cc86-427a-9cb7-ebac0c73964a`.replace(/(\r\n|\n|\r)/gm, "\r\n")
263
263
 
264
- let oursdp = sdp.create( testsdp )
264
+ const oursdp = sdp.create( testsdp )
265
265
 
266
266
  expect( oursdp.sdp.media[ 0 ].fingerprint.hash )
267
267
  .to.equal( "D7:88:04:4B:B1:F2:B1:B3:ED:58:49:0C:31:5A:1D:E2:D3:1F:2D:43:FF:74:8E:9B:97:1F:E7:61:BE:27:62:3A" )
@@ -270,16 +270,16 @@ a=ssrc:2706351154 label:83ac3abd-cc86-427a-9cb7-ebac0c73964a`.replace(/(\r\n|\n|
270
270
 
271
271
  } )
272
272
 
273
- it( `sdp webrtc generate`, async function() {
273
+ it( "sdp webrtc generate", async function() {
274
274
 
275
- let oursdp = sdp.create()
276
- .addcodecs( "pcma" )
277
- .setconnectionaddress( "127.0.0.1" )
278
- .setaudioport( 4 )
279
- .addssrc( 44 )
280
- .secure( "ourfingerprint", "act" )
281
- .addicecandidates( "127.0.0.1", 4 )
282
- .rtcpmux()
275
+ const oursdp = sdp.create()
276
+ .addcodecs( "pcma" )
277
+ .setconnectionaddress( "127.0.0.1" )
278
+ .setaudioport( 4 )
279
+ .addssrc( 44 )
280
+ .secure( "ourfingerprint", "act" )
281
+ .addicecandidates( "127.0.0.1", 4 )
282
+ .rtcpmux()
283
283
 
284
284
  expect( oursdp.sdp.media[ 0 ].rtcpMux ).to.equal( "rtcp-mux" )
285
285
  expect( oursdp.sdp.media[ 0 ].fingerprint.type ).to.equal( "sha-256" )
@@ -295,8 +295,8 @@ a=ssrc:2706351154 label:83ac3abd-cc86-427a-9cb7-ebac0c73964a`.replace(/(\r\n|\n|
295
295
  expect( oursdp.sdp.media[ 0 ].candidates[ 0 ].generation ).to.equal( 0 )
296
296
  } )
297
297
 
298
- it( `sdp pcma real life sdp avon`, async function() {
299
- const testsdp = `v=0
298
+ it( "sdp pcma real life sdp avon", async function() {
299
+ const testsdp = `v=0
300
300
  o=MTLSBC 1657399906 1657399907 IN IP4 213.166.4.136
301
301
  s=SIP Call
302
302
  c=IN IP4 213.166.4.136
@@ -305,13 +305,13 @@ a=sendrecv
305
305
  m=audio 48380 RTP/AVP 8
306
306
  a=rtpmap:8 PCMA/8000`
307
307
 
308
- let oursdp = sdp.create( testsdp )
309
- let selectedcodec = oursdp.intersection( "g722 ilbc pcmu pcma", true )
308
+ const oursdp = sdp.create( testsdp )
309
+ const selectedcodec = oursdp.intersection( "g722 ilbc pcmu pcma", true )
310
310
  expect( selectedcodec ).to.equal( "pcma" )
311
311
 
312
312
  } )
313
313
 
314
- it( `sdp pcma real life sdp getautdio avon`, async function() {
314
+ it( "sdp pcma real life sdp getautdio avon", async function() {
315
315
  const testsdp = `v=0
316
316
  o=MTLSBC 1657399906 1657399907 IN IP4 213.166.4.136
317
317
  s=SIP Call
@@ -321,17 +321,17 @@ a=sendrecv
321
321
  m=audio 48380 RTP/AVP 8
322
322
  a=rtpmap:8 PCMA/8000`
323
323
 
324
- let oursdp = sdp.create( testsdp )
325
- let remoteaudio = oursdp.getaudio()
324
+ const oursdp = sdp.create( testsdp )
325
+ const remoteaudio = oursdp.getaudio()
326
326
 
327
- let def = call._createchannelremotedef( remoteaudio.address, remoteaudio.port, remoteaudio.audio.payloads[ 0 ] )
327
+ const def = call._createchannelremotedef( remoteaudio.address, remoteaudio.port, remoteaudio.audio.payloads[ 0 ] )
328
328
 
329
329
  expect( def.remote.address ).to.equal( "213.166.4.136" )
330
330
  expect( def.remote.port ).to.equal( 48380 )
331
331
  expect( def.remote.codec ).to.equal( 8 )
332
332
  } )
333
333
 
334
- it( `another real life example`, async function() {
334
+ it( "another real life example", async function() {
335
335
  const testsdp = `v=0
336
336
  o=MTLSBC 1664810796 1664810796 IN IP4 213.166.4.133
337
337
  s=SIP Call
@@ -348,11 +348,10 @@ a=fmtp:101 0-16
348
348
  a=rtpmap:13 CN/8000
349
349
  a=ptime:20`
350
350
 
351
- let oursdp = sdp.create( testsdp )
352
-
353
- let selectedcodec = oursdp.intersection( "g722", true )
351
+ const oursdp = sdp.create( testsdp )
352
+ const selectedcodec = oursdp.intersection( "g722", true )
354
353
  console.log("selectedcodec",selectedcodec)
355
- return
354
+ /*
356
355
  selectedcodec = oursdp.intersection( "g722", true )
357
356
  let remoteaudio = oursdp.getaudio()
358
357
 
@@ -365,6 +364,281 @@ a=ptime:20`
365
364
  .setaudioport( 1000 )
366
365
 
367
366
  console.log(ourlocalsdp.toString())
367
+ */
368
368
 
369
369
  } )
370
+
371
+ it( "outbound example - 2 legged", async () => {
372
+ /*
373
+ bv desktop invites external call.
374
+
375
+ desktop bv magrathea
376
+ INVITE (bvdeskinvitesdp) ---->
377
+ INVITE (bvinvitesdp) ---------->
378
+ <----------------------------100
379
+ <----------183 (magrathea183sdp)
380
+ <--- 183 (bvdeskinvite183sdp)
381
+ <----------200 (magrathea200sdp)
382
+ <--- 200 (bvdesktopinvite200sdp)
383
+ BYE ------------------------>
384
+ (488 not acceptable here)
385
+ */
386
+
387
+ const bvdeskinvitesdp = `v=0
388
+ o=- 2641339458124228143 2 IN IP4 127.0.0.1
389
+ s=-
390
+ t=0 0
391
+ a=group:BUNDLE 0 1
392
+ a=extmap-allow-mixed
393
+ a=msid-semantic: WMS eb9baf47-f163-4701-9a10-e388580c7de5
394
+ m=audio 54702 UDP/TLS/RTP/SAVPF 111 63 9 0 8 13 110 126
395
+ c=IN IP4 82.19.206.102
396
+ a=rtcp:9 IN IP4 0.0.0.0
397
+ a=candidate:870150696 1 udp 1686052607 82.19.206.102 54702 typ srflx raddr 192.168.160.1 rport 54702 generation 0 network-id 1
398
+ a=ice-ufrag:qLvc
399
+ a=ice-pwd:gkGlGf07JxDRnLQFHIoQWvNZ
400
+ a=ice-options:trickle
401
+ a=fingerprint:sha-256 4C:16:43:4D:77:F5:02:B4:A8:2E:ED:71:AB:B5:0E:27:D5:58:B5:6A:B7:DA:11:6F:5B:35:63:5E:3E:C8:56:3C
402
+ a=setup:actpass
403
+ a=mid:0
404
+ a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
405
+ a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
406
+ a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
407
+ a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid
408
+ a=sendrecv
409
+ a=msid:eb9baf47-f163-4701-9a10-e388580c7de5 53d56e97-1cd8-4f4c-b62a-c48fdc003b3d
410
+ a=rtcp-mux
411
+ a=rtpmap:111 opus/48000/2
412
+ a=rtcp-fb:111 transport-cc
413
+ a=fmtp:111 minptime=10;useinbandfec=1
414
+ a=rtpmap:63 red/48000/2
415
+ a=fmtp:63 111/111
416
+ a=rtpmap:9 G722/8000
417
+ a=rtpmap:0 PCMU/8000
418
+ a=rtpmap:8 PCMA/8000
419
+ a=rtpmap:13 CN/8000
420
+ a=rtpmap:110 telephone-event/48000
421
+ a=rtpmap:126 telephone-event/8000
422
+ a=ssrc:168464047 cname:LxqEV0kknnvratqJ
423
+ a=ssrc:168464047 msid:eb9baf47-f163-4701-9a10-e388580c7de5 53d56e97-1cd8-4f4c-b62a-c48fdc003b3d
424
+ m=video 57333 UDP/TLS/RTP/SAVPF 96 97 102 103 104 105 106 107 108 109 127 125 39 40 45 46 98 99 100 101 112 113 114
425
+ c=IN IP4 192.168.160.1
426
+ a=rtcp:9 IN IP4 0.0.0.0
427
+ a=ice-ufrag:qLvc
428
+ a=ice-pwd:gkGlGf07JxDRnLQFHIoQWvNZ
429
+ a=ice-options:trickle
430
+ a=fingerprint:sha-256 4C:16:43:4D:77:F5:02:B4:A8:2E:ED:71:AB:B5:0E:27:D5:58:B5:6A:B7:DA:11:6F:5B:35:63:5E:3E:C8:56:3C
431
+ a=setup:actpass
432
+ a=mid:1
433
+ a=extmap:14 urn:ietf:params:rtp-hdrext:toffset
434
+ a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
435
+ a=extmap:13 urn:3gpp:video-orientation
436
+ a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
437
+ a=extmap:5 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay
438
+ a=extmap:6 http://www.webrtc.org/experiments/rtp-hdrext/video-content-type
439
+ a=extmap:7 http://www.webrtc.org/experiments/rtp-hdrext/video-timing
440
+ a=extmap:8 http://www.webrtc.org/experiments/rtp-hdrext/color-space
441
+ a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid
442
+ a=extmap:10 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id
443
+ a=extmap:11 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id
444
+ a=sendrecv
445
+ a=msid:eb9baf47-f163-4701-9a10-e388580c7de5 dbdb36a1-7dbd-40b3-b870-1ac4cc089ee6
446
+ a=rtcp-mux
447
+ a=rtcp-rsize
448
+ a=rtpmap:96 VP8/90000
449
+ a=rtcp-fb:96 goog-remb
450
+ a=rtcp-fb:96 transport-cc
451
+ a=rtcp-fb:96 ccm fir
452
+ a=rtcp-fb:96 nack
453
+ a=rtcp-fb:96 nack pli
454
+ a=rtpmap:97 rtx/90000
455
+ a=fmtp:97 apt=96
456
+ a=rtpmap:102 H264/90000
457
+ a=rtcp-fb:102 goog-remb
458
+ a=rtcp-fb:102 transport-cc
459
+ a=rtcp-fb:102 ccm fir
460
+ a=rtcp-fb:102 nack
461
+ a=rtcp-fb:102 nack pli
462
+ a=fmtp:102 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42001f
463
+ a=rtpmap:103 rtx/90000
464
+ a=fmtp:103 apt=102
465
+ a=rtpmap:104 H264/90000
466
+ a=rtcp-fb:104 goog-remb
467
+ a=rtcp-fb:104 transport-cc
468
+ a=rtcp-fb:104 ccm fir
469
+ a=rtcp-fb:104 nack
470
+ a=rtcp-fb:104 nack pli
471
+ a=fmtp:104 level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42001f
472
+ a=rtpmap:105 rtx/90000
473
+ a=fmtp:105 apt=104
474
+ a=rtpmap:106 H264/90000
475
+ a=rtcp-fb:106 goog-remb
476
+ a=rtcp-fb:106 transport-cc
477
+ a=rtcp-fb:106 ccm fir
478
+ a=rtcp-fb:106 nack
479
+ a=rtcp-fb:106 nack pli
480
+ a=fmtp:106 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f
481
+ a=rtpmap:107 rtx/90000
482
+ a=fmtp:107 apt=106
483
+ a=rtpmap:108 H264/90000
484
+ a=rtcp-fb:108 goog-remb
485
+ a=rtcp-fb:108 transport-cc
486
+ a=rtcp-fb:108 ccm fir
487
+ a=rtcp-fb:108 nack
488
+ a=rtcp-fb:108 nack pli
489
+ a=fmtp:108 level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42e01f
490
+ a=rtpmap:109 rtx/90000
491
+ a=fmtp:109 apt=108
492
+ a=rtpmap:127 H264/90000
493
+ a=rtcp-fb:127 goog-remb
494
+ a=rtcp-fb:127 transport-cc
495
+ a=rtcp-fb:127 ccm fir
496
+ a=rtcp-fb:127 nack
497
+ a=rtcp-fb:127 nack pli
498
+ a=fmtp:127 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=4d001f
499
+ a=rtpmap:125 rtx/90000
500
+ a=fmtp:125 apt=127
501
+ a=rtpmap:39 H264/90000
502
+ a=rtcp-fb:39 goog-remb
503
+ a=rtcp-fb:39 transport-cc
504
+ a=rtcp-fb:39 ccm fir
505
+ a=rtcp-fb:39 nack
506
+ a=rtcp-fb:39 nack pli
507
+ a=fmtp:39 level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=4d001f
508
+ a=rtpmap:40 rtx/90000
509
+ a=fmtp:40 apt=39
510
+ a=rtpmap:45 AV1/90000
511
+ a=rtcp-fb:45 goog-remb
512
+ a=rtcp-fb:45 transport-cc
513
+ a=rtcp-fb:45 ccm fir
514
+ a=rtcp-fb:45 nack
515
+ a=rtcp-fb:45 nack pli
516
+ a=rtpmap:46 rtx/90000
517
+ a=fmtp:46 apt=45
518
+ a=rtpmap:98 VP9/90000
519
+ a=rtcp-fb:98 goog-remb
520
+ a=rtcp-fb:98 transport-cc
521
+ a=rtcp-fb:98 ccm fir
522
+ a=rtcp-fb:98 nack
523
+ a=rtcp-fb:98 nack pli
524
+ a=fmtp:98 profile-id=0
525
+ a=rtpmap:99 rtx/90000
526
+ a=fmtp:99 apt=98
527
+ a=rtpmap:100 VP9/90000
528
+ a=rtcp-fb:100 goog-remb
529
+ a=rtcp-fb:100 transport-cc
530
+ a=rtcp-fb:100 ccm fir
531
+ a=rtcp-fb:100 nack
532
+ a=rtcp-fb:100 nack pli
533
+ a=fmtp:100 profile-id=2
534
+ a=rtpmap:101 rtx/90000
535
+ a=fmtp:101 apt=100
536
+ a=rtpmap:112 red/90000
537
+ a=rtpmap:113 rtx/90000
538
+ a=fmtp:113 apt=112
539
+ a=rtpmap:114 ulpfec/90000
540
+ a=ssrc-group:FID 3026998553 2660365910
541
+ a=ssrc:3026998553 cname:LxqEV0kknnvratqJ
542
+ a=ssrc:3026998553 msid:eb9baf47-f163-4701-9a10-e388580c7de5 dbdb36a1-7dbd-40b3-b870-1ac4cc089ee6
543
+ a=ssrc:2660365910 cname:LxqEV0kknnvratqJ
544
+ a=ssrc:2660365910 msid:eb9baf47-f163-4701-9a10-e388580c7de5 dbdb36a1-7dbd-40b3-b870-1ac4cc089ee6`
545
+
546
+ const bvdeskinvite183sdp = `v=0
547
+ o=- 4317 0 IN IP4 127.0.0.1
548
+ s=project
549
+ c=IN IP4 13.42.100.66
550
+ t=0 0
551
+ a=msid-semantic: WMS 136f9ec7464dca67065c81da42013e84
552
+ m=audio 10036 UDP/TLS/RTP/SAVPF 9 101
553
+ a=rtpmap:9 G722/8000
554
+ a=rtpmap:101 telephone-event/8000
555
+ a=fmtp:101 0-16
556
+ a=setup:passive
557
+ a=msid:136f9ec7464dca67065c81da42013e84 ff8ebd1be43cdf5170974bf0d1efb772
558
+ a=ptime:20
559
+ a=sendrecv
560
+ a=ice-ufrag:50cf0e6109bad2be
561
+ a=ice-pwd:9Tbl7U92hrzTUluayFbRPYh9
562
+ a=fingerprint:sha-256 12:31:FB:95:BB:00:1A:D8:24:94:71:21:CE:05:57:8F:47:1E:5E:C5:43:41:19:3F:2A:B8:8C:92:07:BB:BC:56
563
+ a=candidate:1 1 udp 255 13.42.100.66 10036 typ host generation 0
564
+ a=ssrc:3127369874 cname:97016b88e9a33a3b465b15cff21fec35
565
+ a=ssrc:3127369874 msid:136f9ec7464dca67065c81da42013e84 ff8ebd1be43cdf5170974bf0d1efb772
566
+ a=ssrc:3127369874 mslabel:136f9ec7464dca67065c81da42013e84
567
+ a=ssrc:3127369874 label:ff8ebd1be43cdf5170974bf0d1efb772
568
+ a=rtcp-mux`
569
+
570
+
571
+ const bvinvitesdp = `v=0
572
+ o=- 4316 0 IN IP4 127.0.0.1
573
+ s=project
574
+ c=IN IP4 18.170.39.61
575
+ t=0 0
576
+ m=audio 10038 RTP/AVP 9 97 0 8
577
+ a=rtpmap:9 G722/8000
578
+ a=rtpmap:97 ilbc/8000
579
+ a=rtpmap:0 PCMU/8000
580
+ a=rtpmap:8 PCMA/8000
581
+ a=fmtp:97 mode=20
582
+ a=ptime:20
583
+ a=sendrecv`
584
+
585
+ const magrathea183sdp = `v=0
586
+ o=MTLSBC 1686295122 1686295122 IN IP4 213.166.4.135
587
+ s=SIP Call
588
+ c=IN IP4 213.166.4.135
589
+ t=0 0
590
+ a=sendrecv
591
+ m=audio 54330 RTP/AVP 8
592
+ a=rtpmap:8 PCMA/8000`
593
+
594
+ const magrathea200sdp = `v=0
595
+ o=MTLSBC 1686295122 1686295123 IN IP4 213.166.4.135
596
+ s=SIP Call
597
+ c=IN IP4 213.166.4.135
598
+ t=0 0
599
+ a=sendrecv
600
+ m=audio 54330 RTP/AVP 8
601
+ a=rtpmap:8 PCMA/8000`
602
+
603
+ const bvdesktopinvite200sdp = `v=0
604
+ o=- 4317 0 IN IP4 127.0.0.1
605
+ s=project
606
+ c=IN IP4 13.42.100.66
607
+ t=0 0
608
+ a=msid-semantic: WMS 136f9ec7464dca67065c81da42013e84
609
+ m=audio 10036 UDP/TLS/RTP/SAVPF 9 101
610
+ a=rtpmap:9 G722/8000
611
+ a=rtpmap:101 telephone-event/8000
612
+ a=fmtp:101 0-16
613
+ a=setup:passive
614
+ a=msid:136f9ec7464dca67065c81da42013e84 ff8ebd1be43cdf5170974bf0d1efb772
615
+ a=ptime:20
616
+ a=sendrecv
617
+ a=ice-ufrag:50cf0e6109bad2be
618
+ a=ice-pwd:9Tbl7U92hrzTUluayFbRPYh9
619
+ a=fingerprint:sha-256 12:31:FB:95:BB:00:1A:D8:24:94:71:21:CE:05:57:8F:47:1E:5E:C5:43:41:19:3F:2A:B8:8C:92:07:BB:BC:56
620
+ a=candidate:1 1 udp 255 13.42.100.66 10036 typ host generation 0
621
+ a=ssrc:3127369874 cname:97016b88e9a33a3b465b15cff21fec35
622
+ a=ssrc:3127369874 msid:136f9ec7464dca67065c81da42013e84 ff8ebd1be43cdf5170974bf0d1efb772
623
+ a=ssrc:3127369874 mslabel:136f9ec7464dca67065c81da42013e84
624
+ a=ssrc:3127369874 label:ff8ebd1be43cdf5170974bf0d1efb772
625
+ a=rtcp-mux`
626
+
627
+
628
+ const bvdeskinvitesdpobj = sdp.create( bvdeskinvitesdp )
629
+ const bvdeskinvite183sdpobj = sdp.create( bvdeskinvite183sdp )
630
+ const bvdesktopinvite200sdpobj = sdp.create( bvdesktopinvite200sdp )
631
+ const bvinvitesdpobj = sdp.create( bvinvitesdp )
632
+ const magrathea183sdpobj = sdp.create( magrathea183sdp )
633
+ const magrathea200sdpobj = sdp.create( magrathea200sdp )
634
+
635
+ const ourcodecs = "g722 ilbc pcmu pcma"
636
+ expect( bvdeskinvite183sdpobj.intersection( ourcodecs ) ).to.equal( "g722" )
637
+ expect( bvdeskinvitesdpobj.intersection( ourcodecs ) ).to.equal( "g722 pcmu pcma" )
638
+ expect( bvinvitesdpobj.intersection( ourcodecs ) ).to.equal( "g722 ilbc pcmu pcma" )
639
+ expect( magrathea183sdpobj.intersection( ourcodecs ) ).to.equal( "pcma" )
640
+
641
+ expect( bvdesktopinvite200sdpobj.intersection( ourcodecs, true ) ).to.equal( "g722" )
642
+ expect( magrathea200sdpobj.intersection( ourcodecs, true ) ).to.equal( "pcma" )
643
+ } )
370
644
  } )