@babblevoice/projectrtp 2.4.3 → 2.4.5

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/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # ProjectRTP
2
2
 
3
+ [![Build](https://github.com/babblevoice/projectrtp/actions/workflows/buildimage.yaml/badge.svg)](https://github.com/babblevoice/projectrtp/actions/workflows/buildimage.yaml)
4
+
3
5
  An RTP node addon which offers functionality to process RTP data streams and mix it. All performance tasks are implemented in C++ and use boost::asio for IO completion ports for high concurrency.
4
6
 
5
7
  ProjectRTP is designed to scale to multiple servers serving other signalling servers. RTP and signalling should be kept separate, and this architecture allows that. It is provided with a proxy server and client to allow for remote nodes.
@@ -30,21 +32,9 @@ Given a version number MAJOR.MINOR.PATCH, increment the:
30
32
 
31
33
  As part of this, we maintain jsdoc documentation to document our public interface to this programme.
32
34
 
33
- Only when we release version 1.0.0 will the public API be settled.
34
-
35
35
  ## Release process
36
36
 
37
- 1. Update package.json to the new version number (see Version numbers above)
38
- 2. Update Dockerfile with the new version number
39
- 3. npm test && stress testing
40
- 4. git commit && push
41
- 5. npm publish
42
- 6. docker buildx prune
43
- 7. docker buildx build --platform linux/amd64,linux/arm64 -t tinpotnick/projectrtp:<version> . --push
44
- 8. Git release
45
- 9. Github tag <version>
46
-
47
- <version> should simply the semantic version number. For late stage test builds this could be <version>betax.
37
+ Releases are managed on GitHub actions. It builds and tests any version.
48
38
 
49
39
  ## Docker
50
40
 
@@ -102,27 +92,6 @@ has a submodule so (although this is handled inteh Dockerfile if you are buildin
102
92
  git submodule update --init --recursive
103
93
  ```
104
94
 
105
- ### Fedora
106
-
107
- After installing standard build tools - including g++.
108
-
109
- ```
110
- dnf install ilbc-devel spandsp-devel boost gnutls libsrtp libsrtp-devel g++
111
- ```
112
-
113
- ### Ubuntu
114
-
115
- Build ilbc from the sub module plus install other dependancies.
116
-
117
- ```bash
118
-
119
- apt install libboost-dev libboost-system-dev libspandsp-dev gnutls-dev libsrtp2-dev cmake ccache
120
-
121
- cd libilbc
122
- cmake . -DCMAKE_INSTALL_LIBDIR=/lib -DCMAKE_INSTALL_INCLUDEDIR=/usr/include; cmake --build .; cmake --install .
123
- cd ..
124
- ```
125
-
126
95
  ## Docker/Podman
127
96
 
128
97
  Podman has some shortfalls. Remove and install docker.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babblevoice/projectrtp",
3
- "version": "2.4.3",
3
+ "version": "2.4.5",
4
4
  "description": "A scalable Node addon RTP server",
5
5
  "main": "index.js",
6
6
  "directories": {
@@ -10,7 +10,7 @@
10
10
  },
11
11
  "scripts": {
12
12
  "test": "./node_modules/mocha/bin/_mocha test/**/*.js --check-leaks",
13
- "github:check": "node test/basictests.js; npm update; npm test",
13
+ "github:check": "node test/basictests.js; npm update; ./node_modules/mocha/bin/_mocha test/**/*.js --check-leaks --exit",
14
14
  "check": "tsc --checkJs --noEmit --target es6 --module commonjs --skipLibCheck *.js test/**/*.js; ./node_modules/eslint/bin/eslint.js ./",
15
15
  "docs": "jsdoc -c jsdoc.conf.json ./README.md",
16
16
  "stress": "node stress/index.js",
@@ -25,14 +25,14 @@
25
25
  },
26
26
  "repository": {
27
27
  "type": "git",
28
- "url": "git+https://github.com/tinpotnick/projectrtp.git"
28
+ "url": "git+https://github.com/babblevoice/projectrtp.git"
29
29
  },
30
30
  "author": "Nick Knight",
31
31
  "license": "MIT",
32
32
  "bugs": {
33
- "url": "https://github.com/tinpotnick/projectrtp/issues"
33
+ "url": "https://github.com/babblevoice/projectrtp/issues"
34
34
  },
35
- "homepage": "https://github.com/tinpotnick/projectrtp#readme",
35
+ "homepage": "https://github.com/babblevoice/projectrtp#readme",
36
36
  "dependencies": {
37
37
  "uuid": "^9.0.0"
38
38
  },
@@ -23,8 +23,23 @@ async function testopen() {
23
23
  }
24
24
  }
25
25
 
26
+ let retval = 0
27
+ console.log( "Running project RTP" )
26
28
  prtp.projectrtp.run()
27
- testopen()
29
+
30
+ console.log( "Test open channel" )
31
+
32
+ try{
33
+ testopen()
34
+ } catch( e ) {
35
+ console.log( e )
36
+ retval = 1
37
+ }
38
+
39
+ console.log( "Shutting down projectrtp" )
28
40
  prtp.projectrtp.shutdown()
41
+ console.log( "Shutdown - good to proceed" )
42
+
43
+ process.exit( retval )
29
44
 
30
45
 
@@ -437,7 +437,7 @@ describe( "rtpchannel", function() {
437
437
  expect( closedstats.stats.in.count ).to.equal( 300 )
438
438
  expect( closedstats.stats.out.count ).to.be.within( 180, 190 )
439
439
  expect( totalsndiff ).to.equal( 0 ) // received should be reordered
440
- expect( totaltsdiff ).to.equal( 18400 )
440
+ expect( totaltsdiff ).to.be.within( 18240, 18400 ) // Allow some loss in test
441
441
  expect( lastsn - firstsn ).to.be.within( 180, 192 )
442
442
  } )
443
443
 
@@ -432,7 +432,7 @@ describe( "dtls", function() {
432
432
  await finished
433
433
 
434
434
  expect( clientcclose.stats.in.count ).to.be.above( 10 )
435
- expect( clientcclose.stats.in.skip ).to.equal( 0 )
435
+ expect( clientcclose.stats.in.skip ).to.be.below( 2 ) // allow a little loss in test
436
436
 
437
437
  } )
438
438
  } )
@@ -338,7 +338,7 @@ describe( "dtmf", function() {
338
338
  } )
339
339
 
340
340
 
341
- it( "Send multiple 2833 DTMF and check event", function( done ) {
341
+ it( "Send multiple 2833 DTMF and check event", async function() {
342
342
 
343
343
  /* create our RTP/UDP endpoint */
344
344
  const server = dgram.createSocket( "udp4" )
@@ -348,53 +348,58 @@ describe( "dtmf", function() {
348
348
  this.slow( 2500 )
349
349
 
350
350
  server.bind()
351
- server.on( "listening", async function() {
351
+ await new Promise( ( resolve ) => { server.on( "listening", () => resolve() ) } )
352
352
 
353
- const ourport = server.address().port
353
+ const ourport = server.address().port
354
354
 
355
- let expectedmessagecount = 0
356
- const expectedmessages = [
357
- { action: "telephone-event", event: "4" },
358
- { action: "telephone-event", event: "5" },
359
- { action: "close" }
360
- ]
355
+ const receivedmessages = []
356
+ const channel = await projectrtp.openchannel( { "remote": { "address": "localhost", "port": ourport, "codec": 0 } }, function( d ) {
357
+ receivedmessages.push( d )
358
+ if( "close" === d.action ) {
359
+ server.close()
360
+ }
361
+ } )
361
362
 
362
- const channel = await projectrtp.openchannel( { "remote": { "address": "localhost", "port": ourport, "codec": 0 } }, function( d ) {
363
- expect( d ).to.deep.include( expectedmessages[ expectedmessagecount ] )
364
- expectedmessagecount++
363
+ expect( channel.echo() ).to.be.true
365
364
 
366
- if( "close" === d.action ) {
367
- server.close()
368
- done()
369
- }
370
- } )
365
+ /* send a packet every 20mS x 50 */
366
+ for( let i = 0; 13 > i; i ++ ) {
367
+ sendpk( i, i*160, i*20, channel.local.port, server )
368
+ }
371
369
 
372
- expect( channel.echo() ).to.be.true
370
+ /* DTMF every 50mS */
371
+ senddtmf( 13, 12*160, 13*20, channel.local.port, server, false, "4" )
372
+ sendpk( 14, 13*160, 13*20, channel.local.port, server )
373
+ sendpk( 15, 14*160, 14*20, channel.local.port, server )
374
+ senddtmf( 16, 14*160, (13*20)+50, channel.local.port, server, false, "4" )
375
+ // Packet loss
376
+ // senddtmf( 15, 12 * 160, 15*20, channel.port, server, true, "4" )
373
377
 
374
- /* send a packet every 20mS x 50 */
375
- for( let i = 0; 13 > i; i ++ ) {
376
- sendpk( i, i*160, i*20, channel.local.port, server )
377
- }
378
+ for( let i = 17; 30 > i; i ++ ) {
379
+ sendpk( i, (i-2)*160, (i-2)*20, channel.local.port, server )
380
+ }
378
381
 
379
- senddtmf( 13, 12 * 160, 13*20, channel.local.port, server, false, "4" )
380
- senddtmf( 14, 12 * 160, 14*20, channel.local.port, server, false, "4" )
381
- // Packet loss
382
- // senddtmf( 15, 12 * 160, 15*20, channel.port, server, true, "4" )
382
+ senddtmf( 31, 29*160, 29*20, channel.local.port, server, false, "5" )
383
+ sendpk( 32, 29*160, 29*20, channel.local.port, server )
384
+ sendpk( 33, 30*160, 30*20, channel.local.port, server )
385
+ senddtmf( 34, 30*160, (29*20)+50, channel.local.port, server, false, "5" )
386
+ sendpk( 35, 31*160, 31*20, channel.local.port, server )
387
+ sendpk( 36, 32*160, 32*20, channel.local.port, server )
388
+ senddtmf( 37, 32*160, (29*20)+100, channel.local.port, server, true, "5" )
383
389
 
384
- for( let i = 16; 23 > i; i ++ ) {
385
- sendpk( i, i*160, (i-3)*20, channel.local.port, server )
386
- }
390
+ for( let i = 37; 45 > i; i ++ ) {
391
+ sendpk( i, i*160, (i-6)*20, channel.local.port, server )
392
+ }
387
393
 
388
- senddtmf( 23, 22 * 160, 23*20, channel.local.port, server, false, "5" )
389
- senddtmf( 24, 22 * 160, 24*20, channel.local.port, server, false, "5" )
390
- senddtmf( 25, 22 * 160, 25*20, channel.local.port, server, true, "5" )
394
+ setTimeout( () => channel.close(), 1100 )
395
+ await new Promise( resolve => { server.on( "close", resolve ) } )
391
396
 
392
- for( let i = 26; 33 > i; i ++ ) {
393
- sendpk( i, i*160, (i-6)*20, channel.local.port, server )
394
- }
397
+ expect( receivedmessages[ 0 ].action ).to.equal( "telephone-event" )
398
+ expect( receivedmessages[ 0 ].event ).to.equal( "4" )
399
+ expect( receivedmessages[ 1 ].action ).to.equal( "telephone-event" )
400
+ expect( receivedmessages[ 1 ].event ).to.equal( "5" )
401
+ expect( receivedmessages[ 2 ].action ).to.equal( "close" )
395
402
 
396
- setTimeout( () => channel.close(), 1000 )
397
- } )
398
403
  } )
399
404
 
400
405
  it( "Lose end packet", async function() {
@@ -686,9 +691,6 @@ describe( "dtmf", function() {
686
691
 
687
692
  const receveiedmessages = []
688
693
 
689
- let done
690
- const finished = new Promise( ( r ) => { done = r } )
691
-
692
694
  const channela = await projectrtp.openchannel( { "remote": { "address": "localhost", "port": endpointa.address().port, "codec": 0 } }, function( d ) {
693
695
  receveiedmessages.push( d )
694
696
 
@@ -702,7 +704,11 @@ describe( "dtmf", function() {
702
704
 
703
705
  const channelc = await projectrtp.openchannel( { "remote": { "address": "localhost", "port": endpointc.address().port, "codec": 97 } }, function( d ) {
704
706
  expect( d.action).to.not.equal( "telephone-event" )
705
- if( "close" === d.action ) done()
707
+ if( "close" === d.action ) {
708
+ endpointa.close()
709
+ endpointb.close()
710
+ endpointc.close()
711
+ }
706
712
  } )
707
713
 
708
714
  /* mix */
@@ -735,32 +741,32 @@ describe( "dtmf", function() {
735
741
  senddtmf( 13, 13*160, 13*20, channela.local.port, endpointa, false, "4" )
736
742
  sendpk( 14, 13*160, 13*20, channela.local.port, endpointa, 0 )
737
743
  sendpk( 15, 14*160, 14*20, channela.local.port, endpointa, 0 )
738
- senddtmf( 16, (16*160), (13*20)+50, channela.local.port, endpointa, false, "4" )
739
- sendpk( 17, 15*160, 15*20, channela.local.port, endpointa, 0 )
744
+ sendpk( 16, 15*160, 15*20, channela.local.port, endpointa, 0 )
745
+ senddtmf( 17, (15*160), (13*20)+50, channela.local.port, endpointa, false, "4" )
740
746
  sendpk( 18, 16*160, 16*20, channela.local.port, endpointa, 0 )
741
- senddtmf( 19, (19*160), (13*20)+100, channela.local.port, endpointa, true, "4" )
742
- sendpk( 20, 17*160, 17*20, channela.local.port, endpointa, 0 )
747
+ sendpk( 19, 17*160, 17*20, channela.local.port, endpointa, 0 )
748
+ senddtmf( 20, (17*160), (13*20)+100, channela.local.port, endpointa, true, "4" )
743
749
  sendpk( 21, 18*160, 18*20, channela.local.port, endpointa, 0 )
744
- senddtmf( 22, (22*160)+20, (13*20)+150, channela.local.port, endpointa, true, "4" )
745
- sendpk( 23, 19*160, 19*20, channela.local.port, endpointa, 0 )
750
+ sendpk( 22, 19*160, 19*20, channela.local.port, endpointa, 0 )
751
+ sendpk( 23, 20*160, 20*20, channela.local.port, endpointa, 0 )
752
+ senddtmf( 24, (20*160), (13*20)+150, channela.local.port, endpointa, true, "4" )
753
+ sendpk( 25, 21*160, 21*20, channela.local.port, endpointa, 0 )
754
+ sendpk( 26, 22*160, 22*20, channela.local.port, endpointa, 0 )
755
+ sendpk( 27, 23*160, 23*20, channela.local.port, endpointa, 0 )
756
+ sendpk( 28, 24*160, 24*20, channela.local.port, endpointa, 0 )
757
+ sendpk( 29, 25*160, 25*20, channela.local.port, endpointa, 0 )
746
758
 
747
- senddtmf( 24, 20*160, 20*20, channela.local.port, endpointa, false, "5" )
748
- sendpk( 25, 20*160, 20*20, channela.local.port, endpointa, 0 )
749
- sendpk( 26, 21*160, 21*20, channela.local.port, endpointa, 0 )
750
- senddtmf( 27, (27*160), (20*20)+50, channela.local.port, endpointa, false, "5" )
751
- sendpk( 28, 22*160, 22*20, channela.local.port, endpointa, 0 )
752
- sendpk( 29, 23*160, 23*20, channela.local.port, endpointa, 0 )
753
- senddtmf( 30, (30*160), (20*20)+100, channela.local.port, endpointa, true, "5" )
754
- sendpk( 31, 24*160, 24*20, channela.local.port, endpointa, 0 )
755
- sendpk( 32, 25*160, 25*20, channela.local.port, endpointa, 0 )
756
- senddtmf( 33, (33*160), (20*20)+150, channela.local.port, endpointa, true, "5" )
757
- sendpk( 34, 26*160, 26*20, channela.local.port, endpointa, 0 )
758
- sendpk( 35, 27*160, 27*20, channela.local.port, endpointa, 0 )
759
- sendpk( 36, 28*160, 28*20, channela.local.port, endpointa, 0 )
760
- sendpk( 37, 29*160, 29*20, channela.local.port, endpointa, 0 )
761
- sendpk( 38, 30*160, 30*20, channela.local.port, endpointa, 0 )
762
- sendpk( 39, 31*160, 31*20, channela.local.port, endpointa, 0 )
763
- sendpk( 40, 32*160, 32*20, channela.local.port, endpointa, 0 )
759
+ senddtmf( 30, 25*160, 25*20, channela.local.port, endpointa, false, "5" )
760
+ sendpk( 31, 26*160, 26*20, channela.local.port, endpointa, 0 )
761
+ sendpk( 32, 27*160, 27*20, channela.local.port, endpointa, 0 )
762
+ senddtmf( 33, (27*160), (25*20)+50, channela.local.port, endpointa, false, "5" )
763
+ sendpk( 34, 28*160, 28*20, channela.local.port, endpointa, 0 )
764
+ sendpk( 35, 29*160, 29*20, channela.local.port, endpointa, 0 )
765
+ senddtmf( 36, (29*160), (25*20)+100, channela.local.port, endpointa, true, "5" )
766
+ sendpk( 37, 30*160, 30*20, channela.local.port, endpointa, 0 )
767
+ sendpk( 38, 31*160, 31*20, channela.local.port, endpointa, 0 )
768
+ sendpk( 39, 32*160, 32*20, channela.local.port, endpointa, 0 )
769
+ senddtmf( 40, (32*160), (25*20)+150, channela.local.port, endpointa, true, "5" )
764
770
  sendpk( 41, 33*160, 33*20, channela.local.port, endpointa, 0 )
765
771
  sendpk( 42, 34*160, 34*20, channela.local.port, endpointa, 0 )
766
772
  sendpk( 43, 35*160, 35*20, channela.local.port, endpointa, 0 )
@@ -774,15 +780,22 @@ describe( "dtmf", function() {
774
780
  sendpk( 51, 43*160, 43*20, channela.local.port, endpointa, 0 )
775
781
  sendpk( 52, 44*160, 44*20, channela.local.port, endpointa, 0 )
776
782
  sendpk( 53, 45*160, 45*20, channela.local.port, endpointa, 0 )
783
+ sendpk( 54, 46*160, 46*20, channela.local.port, endpointa, 0 )
784
+ sendpk( 55, 47*160, 47*20, channela.local.port, endpointa, 0 )
785
+ sendpk( 56, 48*160, 48*20, channela.local.port, endpointa, 0 )
786
+ sendpk( 57, 49*160, 49*20, channela.local.port, endpointa, 0 )
787
+ sendpk( 58, 50*160, 50*20, channela.local.port, endpointa, 0 )
788
+ sendpk( 59, 52*160, 51*20, channela.local.port, endpointa, 0 )
777
789
 
778
790
  await new Promise( ( resolve ) => { setTimeout( () => resolve(), 1200 ) } )
779
791
 
780
792
  channela.close()
781
- endpointa.close()
782
- endpointb.close()
783
- endpointc.close()
784
793
 
785
- await finished
794
+ await Promise.all( [
795
+ new Promise( resolve => { endpointa.on( "close", resolve ) } ),
796
+ new Promise( resolve => { endpointb.on( "close", resolve ) } ),
797
+ new Promise( resolve => { endpointc.on( "close", resolve ) } )
798
+ ] )
786
799
 
787
800
  expect( endpointapkcount ).to.be.within( 59, 70 )
788
801
  expect( endpointbpkcount ).to.be.within( 59, 70 )