@babblevoice/babble-drachtio-callmanager 3.7.31 → 3.8.1

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 ADDED
@@ -0,0 +1,6 @@
1
+ node_modules
2
+ .git
3
+ .github
4
+ *.md
5
+ Dockerfile
6
+ .dockerignore
package/Dockerfile ADDED
@@ -0,0 +1,52 @@
1
+ # babble-drachtio-callmanager test image
2
+ #
3
+ # callmanager talks to projectrtp as a client, but its interface tests boot a
4
+ # real local engine (projectrtp.run()). @babblevoice/projectrtp 3.x is a Rust
5
+ # napi addon shipped as source (rust/ + libilbc/) with no install hook, so we
6
+ # compile it in a rust-builder stage and drop the resulting .so into
7
+ # node_modules/@babblevoice/projectrtp/build/Release/ — then run the suite
8
+ # against the real engine (no mocking). Mirrors babble-rtp's Dockerfile.
9
+ #
10
+ # docker build --target test -t callmanager:test .
11
+ # docker run --rm callmanager:test
12
+ # docker run --rm callmanager:test npx mocha --recursive --check-leaks --grep '486'
13
+
14
+ # --- Stage 1: install node deps (incl. dev deps for the test run) -----------
15
+ FROM alpine:3.22 AS deps
16
+ WORKDIR /usr/src/callmanager/
17
+ RUN apk add --no-cache nodejs npm
18
+ COPY package.json package-lock.json ./
19
+ # --ignore-scripts: projectrtp 3.x has no install hook; we build the Rust
20
+ # addon ourselves in the next stage.
21
+ RUN npm ci --ignore-scripts
22
+
23
+ # --- Stage 2: build the Rust napi cdylib + libilbc --------------------------
24
+ # Pinned to rust 1.92 to match projectrtp's own build.
25
+ FROM rust:1.92-alpine3.22 AS rust-builder
26
+ WORKDIR /src
27
+ RUN apk add --no-cache musl-dev pkgconfig cmake build-base linux-headers spandsp3-dev
28
+ COPY --from=deps /usr/src/callmanager/node_modules/@babblevoice/projectrtp/libilbc/ /src/libilbc/
29
+ RUN mkdir -p /src/libilbc/_build && \
30
+ cd /src/libilbc/_build && \
31
+ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local .. && \
32
+ make -j"$(nproc)" && make install && \
33
+ ldconfig /usr/local/lib 2>/dev/null || true
34
+ COPY --from=deps /usr/src/callmanager/node_modules/@babblevoice/projectrtp/rust/ /src/rust/
35
+ WORKDIR /src/rust
36
+ # Alpine's rust defaults to musl with +crt-static; a cdylib loaded by Node at
37
+ # runtime needs dynamic linkage, so override.
38
+ ENV RUSTFLAGS="-C target-feature=-crt-static"
39
+ RUN cargo build --release
40
+
41
+ # --- Stage 3: test image ----------------------------------------------------
42
+ FROM alpine:3.22 AS test
43
+ WORKDIR /usr/src/callmanager/
44
+ RUN apk add --no-cache nodejs npm spandsp3 libstdc++ libc6-compat ca-certificates
45
+ COPY --from=deps /usr/src/callmanager/node_modules ./node_modules
46
+ COPY --from=rust-builder /usr/local/lib/libilbc.so* /usr/lib/
47
+ COPY --from=rust-builder /src/rust/target/release/libprojectrtp.so \
48
+ ./node_modules/@babblevoice/projectrtp/build/Release/projectrtp.node
49
+ COPY package.json package-lock.json index.js ./
50
+ COPY lib/ ./lib/
51
+ COPY test/ ./test/
52
+ CMD [ "npm", "test" ]
package/README.md CHANGED
@@ -162,28 +162,48 @@ npm link projectrtp
162
162
  npm link babble-drachtio-registrar
163
163
  npm link babble-drachtio-auth
164
164
 
165
- If you want to test then projectrtp needs to be able to build locally, this uses the latest projectrtp docker image.
165
+ # Building and testing
166
+
167
+ The interface tests boot a **real** projectrtp engine (`projectrtp.run()`) rather
168
+ than mocking it. `@babblevoice/projectrtp` 3.x is a Rust napi addon published as
169
+ source (`rust/` + `libilbc/`) with no install hook, so the native `.so` has to be
170
+ compiled and dropped into `node_modules/@babblevoice/projectrtp/build/Release/projectrtp.node`
171
+ before the suite can run. The `Dockerfile` does this in a `rust-builder` stage
172
+ (mirroring babble-rtp) so you don't need a local Rust/cmake toolchain.
173
+
174
+ Run the whole suite:
166
175
 
167
176
  ```bash
168
- docker run --rm -it \
169
- -e HOME=/usr/src/app \
170
- -v "$(pwd)":/usr/src/app:Z \
171
- -w /usr/src/app \
172
- tinpotnick/projectrtp \
173
- npm test
177
+ docker build --target test -t callmanager:test .
178
+ docker run --rm callmanager:test
179
+ ```
180
+
181
+ Run a single test (override the default `npm test` command):
174
182
 
183
+ ```bash
184
+ docker run --rm callmanager:test \
185
+ npx mocha --recursive --check-leaks --grep 'Create call and send 183 - early - SAVPF'
175
186
  ```
176
187
 
177
- or for a specific test
188
+ To iterate on test code without rebuilding the image each time, mount your working
189
+ tree over the source (the built engine in the image's `node_modules` is reused):
178
190
 
179
191
  ```bash
180
192
  docker run --rm -it \
181
- -e HOME=/usr/src/app \
182
- -v "$(pwd)":/usr/src/app:Z \
183
- -w /usr/src/app \
184
- tinpotnick/projectrtp \
185
- ./node_modules/mocha/bin/_mocha --recursive --check-leaks --grep 'Create call and send 183 - early - SAVPF'
193
+ -v "$(pwd)/lib":/usr/src/callmanager/lib:Z \
194
+ -v "$(pwd)/test":/usr/src/callmanager/test:Z \
195
+ -v "$(pwd)/index.js":/usr/src/callmanager/index.js:Z \
196
+ callmanager:test
197
+ ```
198
+
199
+ ### Building the engine locally (no Docker)
186
200
 
201
+ If you have Rust + cmake installed you can build the addon straight into the
202
+ installed package and run the tests on the host:
203
+
204
+ ```bash
205
+ ( cd node_modules/@babblevoice/projectrtp && npm run build ) # cargo build → build/Release/projectrtp.node
206
+ npm test
187
207
  ```
188
208
 
189
209
  # References
package/lib/call.js CHANGED
@@ -1973,6 +1973,16 @@ class call {
1973
1973
 
1974
1974
  if( options.early ) {
1975
1975
  this.state.early = true
1976
+
1977
+ /* The call is now progressing with early media. Cancel the ring (uac)
1978
+ timeout: a far end that delivers early media (e.g. a carrier sending
1979
+ 183 Session Progress) and answers only after the ring timeout would
1980
+ otherwise be torn down with a REQUEST_TIMEOUT (487) just before it
1981
+ answers. Once the dialog is established the non-early answer path
1982
+ clears this timer via #setdialog. */
1983
+ clearTimeout( this._timers.newuac )
1984
+ delete this._timers.newuac
1985
+
1976
1986
  this._em.emit( "call.early", this )
1977
1987
  callmanager.options.em.emit( "call.early", this )
1978
1988
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babblevoice/babble-drachtio-callmanager",
3
- "version": "3.7.31",
3
+ "version": "3.8.1",
4
4
  "description": "Call processing to create a PBX",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -21,12 +21,10 @@
21
21
  "license": "MIT",
22
22
  "dependencies": {
23
23
  "@babblevoice/babble-drachtio-auth": "^1.0.2",
24
+ "@babblevoice/projectrtp": "^3.2.2",
24
25
  "drachtio-srf": "^4.4.47",
25
26
  "uuid": "^8.3.2"
26
27
  },
27
- "optionalDependencies": {
28
- "@babblevoice/projectrtp": "^2.6.2"
29
- },
30
28
  "devDependencies": {
31
29
  "@typescript-eslint/eslint-plugin": "^5.48.2",
32
30
  "chai": "^4.3.6",