@babblevoice/projectrtp 2.5.34 → 2.5.38

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/.dockerignore CHANGED
@@ -6,6 +6,8 @@
6
6
  .eslintrc.js
7
7
  .gitignore
8
8
 
9
+ build
10
+
9
11
  Dockerfile
10
12
 
11
13
  node_modules
package/Dockerfile CHANGED
@@ -1,8 +1,5 @@
1
1
 
2
- # docker build . -t <your username>/projectrtp
3
- # I have tied this to version alpine 3.16 as 3.17 has an exception symbol dynamic linking issue.
4
- FROM alpine:3.20 AS builder
5
-
2
+ FROM alpine:3.21 AS builder
6
3
 
7
4
  WORKDIR /usr/src/
8
5
 
@@ -17,10 +14,11 @@ RUN apk add --no-cache \
17
14
  WORKDIR /usr/local/lib/node_modules/@babblevoice/projectrtp/
18
15
  COPY . .
19
16
 
20
- RUN npm ci --no-optional --production;\
21
- rm -fr src/build/Release/obj.target
17
+ RUN npm ci --no-optional --production && \
18
+ rm -fr src/build/Release/obj.target && \
19
+ rm -fr build/Release/obj.target/projectrtp
22
20
 
23
- FROM alpine:3.20 AS app
21
+ FROM alpine:3.21 AS app
24
22
 
25
23
  RUN apk add --no-cache \
26
24
  spandsp tiff gnutls libsrtp libc6-compat openssl ca-certificates nodejs npm
@@ -0,0 +1,42 @@
1
+
2
+ FROM node:22-bookworm-slim AS builder
3
+
4
+ WORKDIR /usr/src/
5
+
6
+ RUN apt-get update && apt-get install -y \
7
+ build-essential cmake python3 wget libspandsp-dev libtiff-dev libgnutls28-dev libsrtp2-dev libboost-all-dev && \
8
+ npm install -g node-gyp && \
9
+ wget https://github.com/TimothyGu/libilbc/releases/download/v3.0.4/libilbc-3.0.4.tar.gz && \
10
+ tar xvzf libilbc-3.0.4.tar.gz && \
11
+ cd libilbc-3.0.4 && \
12
+ cmake . -DCMAKE_INSTALL_LIBDIR=/usr/lib -DCMAKE_INSTALL_INCLUDEDIR=/usr/include && \
13
+ cmake --build . && \
14
+ cmake --install . && \
15
+ cd .. && rm -rf libilbc-3.0.4 libilbc-3.0.4.tar.gz && \
16
+ apt-get clean && rm -rf /var/lib/apt/lists/*
17
+
18
+ WORKDIR /usr/local/lib/node_modules/@babblevoice/projectrtp/
19
+ COPY . .
20
+
21
+ # Install production dependencies
22
+ RUN npm ci --no-optional --production && \
23
+ rm -fr src/build/Release/obj.target && \
24
+ rm -fr build/Release/obj.target/projectrtp
25
+
26
+ FROM node:22-bookworm-slim AS app
27
+
28
+ RUN apt-get update && apt-get install -y \
29
+ libspandsp2 libtiff6 libgnutls30 libc6 openssl ca-certificates && \
30
+ apt-get clean && rm -rf /var/lib/apt/lists/*
31
+
32
+ COPY --from=builder /usr/local/lib/node_modules/@babblevoice/projectrtp/ /usr/local/lib/node_modules/@babblevoice/projectrtp/
33
+ COPY --from=builder /usr/lib/libilbc* /usr/lib/
34
+
35
+ ENV NODE_PATH=/usr/local/lib/node_modules
36
+
37
+ # Expose UDP ports
38
+ EXPOSE 10000-50000/udp
39
+
40
+ # Set working directory and run the app
41
+ WORKDIR /usr/local/lib/node_modules/@babblevoice/projectrtp/
42
+ CMD ["node", "examples/simplenode.js"]
package/README.md CHANGED
@@ -46,6 +46,12 @@ We now have 3 different sets of tests.
46
46
 
47
47
  ### `npm test`
48
48
 
49
+ If you are using an image - that doesn't have dev deps installed then theses might need to be added:
50
+
51
+ ```sh
52
+ npm install --omit=prod --ignore-scripts
53
+ ```
54
+
49
55
  All tests are run from NodeJS. From the root directory, run the `npm test`. These test all our interfaces and should test expected outputs. These tests use mocha.
50
56
 
51
57
  The folder is separated out into interface, unit and mock. The mock folder contains mock objects/functions required for testing. Unit tests are to help test internal functions. Interface tests are used to guarantee a stable interface for a specific version number. If these tests require changing (other than bug fixing i.e. a material API change), then a major version update will happen.
@@ -60,7 +66,18 @@ If you wish to build outsode of a Docker image, there are npm target scripts for
60
66
 
61
67
  ```bash
62
68
  docker buildx prune
63
- docker buildx build --platform linux/amd64,linux/arm64 -t tinpotnick/projectrtp:2.5.29 . --push
69
+ docker buildx build --platform linux/amd64,linux/arm64 -t tinpotnick/projectrtp:2.5.37_beta22 . --push
70
+ ```
71
+
72
+ ### Dev build
73
+
74
+ Some items might need installing.
75
+ ```sh
76
+ sudo dnf install libasan libubsan
77
+ ```
78
+
79
+ ```sh
80
+ npm run build:dev
64
81
  ```
65
82
 
66
83
  ## Example scripts
package/asan.options ADDED
@@ -0,0 +1,2 @@
1
+ verbosity=0
2
+ detect_leaks=1
package/binding.gyp CHANGED
@@ -1,16 +1,43 @@
1
1
  {
2
+ "variables": {
3
+ "build_type%": "prod"
4
+ },
2
5
  "targets": [
3
6
  {
4
7
  "target_name": "projectrtp",
5
8
  "defines": [ "NODE_MODULE", "BOOST_NO_EXCEPTIONS", "BOOST_EXCEPTION_DISABLE", "NAPI_DISABLE_CPP_EXCEPTIONS" ],
6
9
  "cflags_cc!": [ "-fno-rtti" ],
7
10
  "cflags_cc": [
8
- "-O3",
9
11
  "-g",
10
- "-Wall",
11
- "-fstack-protector-strong",
12
12
  "-std=c++20",
13
13
  "-Weffc++" ],
14
+ "conditions": [
15
+ [
16
+ "build_type=='dev'", {
17
+ "cflags": [
18
+ "-O1",
19
+ "-fsanitize=address,undefined,bounds",
20
+ "-fno-omit-frame-pointer",
21
+ "-D_FORTIFY_SOURCE=2",
22
+ "-fstack-protector-strong",
23
+ "-fstack-protector-all",
24
+ "-Wformat-security",
25
+ "-Wall",
26
+ "-Wextra"
27
+ ],
28
+ "ldflags": [
29
+ "-fsanitize=address,undefined,bounds"
30
+ ]
31
+ }
32
+ ],
33
+ [
34
+ "build_type=='prod'", {
35
+ "cflags": [
36
+ "-O3"
37
+ ]
38
+ }
39
+ ]
40
+ ],
14
41
  "ldflags": [
15
42
  "-Wl,-z,relro",
16
43
  "-Wl,-z,now",
package/index.js CHANGED
@@ -10,7 +10,12 @@ const { spawnSync } = require( "child_process" )
10
10
 
11
11
  let localaddress = "127.0.0.1"
12
12
  let privateaddress = "127.0.0.1"
13
- const bin = "./build/Release/projectrtp"
13
+
14
+ let bin = "./build/Release/projectrtp"
15
+ if ( fs.existsSync( "./build/Debug/projectrtp.node" ) ) {
16
+ console.log( "Dev build exists - using dev build..." )
17
+ bin = "./build/Debug/projectrtp"
18
+ }
14
19
 
15
20
 
16
21
  /**
package/jsconfig.json CHANGED
@@ -5,6 +5,6 @@
5
5
  "moduleResolution": "node",
6
6
  "checkJs": true
7
7
  },
8
- "include": [ "index.js", "lib/*.js", "test/interface/*.js", "test/mock/*.js" ],
8
+ "include": [ "index.js", "lib/*.js", "test/interface/*.js", "test/mock/*.js", "stress/*.js" ],
9
9
  "exclude": [ "node_modules" ]
10
10
  }
package/lib/server.js CHANGED
@@ -429,8 +429,8 @@ class channel {
429
429
  * @returns { Promise< Boolean > }
430
430
  */
431
431
  async mix( other ) {
432
-
433
- //if( await this._addbridge( other ) ) return true
432
+ if( !other ) return false
433
+ if( !other.uuid ) return false
434
434
 
435
435
  this._write( {
436
436
  "channel": "mix",
@@ -627,7 +627,8 @@ class channel {
627
627
  * @param { object } msg
628
628
  */
629
629
  _on( msg ) {
630
- msg.timestamp = ( new Date ).getTime()
630
+ msg.now = new Date()
631
+ msg.timestamp = msg.now.getTime()
631
632
  this.history.push( msg )
632
633
  if( this._runopen( msg ) ) return
633
634
  if( this.#haserror( msg ) ) return
@@ -653,7 +654,8 @@ class channel {
653
654
 
654
655
  this.connection.sock.write( message.createmessage( msg ) )
655
656
 
656
- msg.timestamp = ( new Date ).getTime()
657
+ msg.now = new Date()
658
+ msg.timestamp = msg.now.getTime()
657
659
  this.history.push( msg )
658
660
 
659
661
  if( this._sockerr && nodeconnectiontype.connect == this.connection.type ) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babblevoice/projectrtp",
3
- "version": "2.5.34",
3
+ "version": "2.5.38",
4
4
  "description": "A scalable Node addon RTP server",
5
5
  "main": "index.js",
6
6
  "directories": {
@@ -9,18 +9,18 @@
9
9
  "test": "test"
10
10
  },
11
11
  "scripts": {
12
- "test": "./node_modules/mocha/bin/_mocha test/**/*.js --check-leaks",
12
+ "test": "ASAN_OPTIONS=$(cat asan.options) LD_PRELOAD=/usr/lib64/libasan.so.8 ./node_modules/mocha/bin/_mocha test/**/*.js --check-leaks",
13
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
- "stress": "node stress/index.js",
17
- "configure:dev": "node-gyp configure --debug",
16
+ "stress": "ASAN_OPTIONS=$(cat asan.options) LD_PRELOAD=/usr/lib64/libasan.so.8 node stress/index.js",
17
+ "configure:dev": "node-gyp configure --build_type=dev",
18
18
  "configure": "node-gyp configure",
19
- "rebuild:dev": "node-gyp configure --debug; node-gyp rebuild --debug",
20
19
  "clean": "node-gyp clean",
21
- "build:dev": "node-gyp configure build --debug",
20
+ "build:dev": "node-gyp configure build --build_type=dev",
22
21
  "build": "node-gyp configure build",
23
22
  "rebuild": "node-gyp rebuild",
23
+ "rebuild:dev": "node-gyp configure --build_type=dev; node-gyp rebuild --build_type=dev",
24
24
  "install": "node-gyp rebuild"
25
25
  },
26
26
  "repository": {
package/src/globals.h CHANGED
@@ -15,6 +15,7 @@
15
15
  #define L16NARROWBANDBYTES 320
16
16
  #define L16WIDEBANDBYTES 640
17
17
  #define ILBC20PAYLOADBYTES 38
18
+ #define ILBC20PAYLOADSAMPLES 38 /* correct ? */
18
19
  #define ILBC30PAYLOADBYTES 50 /* not needed but for completness */
19
20
 
20
21
  #define PCMUPAYLOADTYPE 0
@@ -65,4 +66,6 @@ struct SpinLockGuard {
65
66
  }
66
67
  };
67
68
 
69
+ #define releasespinlock( x ) x.store( false, std::memory_order_release );
70
+
68
71
  #endif /* PROJECTRTPGLOBALS_H */
@@ -1,4 +1,7 @@
1
1
 
2
+ /* needed to build on ubuntu */
3
+ #include <utility>
4
+
2
5
  #include <iostream>
3
6
  #include <cstdlib>
4
7