@bitcall/webrtc-sip-gateway 0.3.3 → 0.3.4

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.
Files changed (3) hide show
  1. package/README.md +4 -3
  2. package/package.json +1 -1
  3. package/src/index.js +29 -13
package/README.md CHANGED
@@ -7,10 +7,11 @@ Latest updates:
7
7
  startup, so advertise/origin/SIP transport values are runtime-accurate.
8
8
  - `init` and `reconfigure` stop an existing stack before preflight checks so
9
9
  the gateway's own `:5060` listener does not trigger false port conflicts.
10
- - `update` now syncs `BITCALL_GATEWAY_IMAGE` to the CLI target image tag
11
- before pulling and restarting.
10
+ - `update` now syncs `BITCALL_GATEWAY_IMAGE` to the CLI target image tag,
11
+ pulls, and force-recreates containers so new image layers are applied.
12
12
  - Docker image includes `sngrep` and `tcpdump` for SIP troubleshooting.
13
- - `sip-trace` opens a live SIP message viewer using `sngrep` in the container.
13
+ - `sip-trace` opens a live SIP message viewer using `sngrep` in the container
14
+ via compose service execution.
14
15
  - `TURN_MODE=coturn` now generates a compose stack with a dedicated coturn
15
16
  container.
16
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitcall/webrtc-sip-gateway",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "Linux CLI for bootstrapping and managing the Bitcall WebRTC-to-SIP Gateway",
5
5
  "repository": {
6
6
  "type": "git",
package/src/index.js CHANGED
@@ -1424,16 +1424,23 @@ function logsCommand(service, options) {
1424
1424
 
1425
1425
  function sipTraceCommand() {
1426
1426
  ensureInitialized();
1427
- const compose = detectComposeCommand();
1428
- const containerName = "bitcall-gateway";
1427
+ const serviceName = "gateway";
1428
+ const containerNameFallback = "bitcall-gateway";
1429
1429
 
1430
1430
  // Check if sngrep is available in the container
1431
- const check = run(
1432
- compose.command,
1433
- [...compose.prefixArgs, "exec", "-T", containerName, "which", "sngrep"],
1434
- { cwd: GATEWAY_DIR, check: false, stdio: "pipe" }
1431
+ let check = runCompose(
1432
+ ["exec", "-T", serviceName, "which", "sngrep"],
1433
+ { check: false, stdio: "pipe" }
1435
1434
  );
1436
1435
 
1436
+ // Backward-compatible fallback for stacks where service naming diverged.
1437
+ if (check.status !== 0) {
1438
+ check = run("docker", ["exec", containerNameFallback, "which", "sngrep"], {
1439
+ check: false,
1440
+ stdio: "pipe",
1441
+ });
1442
+ }
1443
+
1437
1444
  if (check.status !== 0) {
1438
1445
  console.error("sngrep is not available in this gateway image.");
1439
1446
  console.error("Update to the latest image: sudo bitcall-gateway update");
@@ -1441,11 +1448,10 @@ function sipTraceCommand() {
1441
1448
  }
1442
1449
 
1443
1450
  // Run sngrep interactively inside the container
1444
- const result = run(
1445
- compose.command,
1446
- [...compose.prefixArgs, "exec", containerName, "sngrep"],
1447
- { cwd: GATEWAY_DIR, stdio: "inherit" }
1448
- );
1451
+ const result = runCompose(["exec", serviceName, "sngrep"], {
1452
+ check: false,
1453
+ stdio: "inherit",
1454
+ });
1449
1455
 
1450
1456
  process.exit(result.status || 0);
1451
1457
  }
@@ -1624,7 +1630,8 @@ function updateCommand() {
1624
1630
  }
1625
1631
 
1626
1632
  runCompose(["pull"], { stdio: "inherit" });
1627
- runSystemctl(["reload", SERVICE_NAME], ["up", "-d", "--remove-orphans"]);
1633
+ runCompose(["up", "-d", "--force-recreate", "--remove-orphans"], { stdio: "inherit" });
1634
+ run("systemctl", ["start", SERVICE_NAME], { check: false, stdio: "ignore" });
1628
1635
 
1629
1636
  console.log(`\n${clr(_c.green, "✓")} Gateway updated to ${clr(_c.bold, PACKAGE_VERSION)}.`);
1630
1637
  console.log(clr(_c.dim, " To update the CLI: sudo npm i -g @bitcall/webrtc-sip-gateway@latest"));
@@ -1835,7 +1842,16 @@ function buildProgram() {
1835
1842
 
1836
1843
  async function main(argv = process.argv) {
1837
1844
  const program = buildProgram();
1838
- await program.parseAsync(argv);
1845
+ const normalizedArgv = argv.map((value, index) => {
1846
+ if (index <= 1) {
1847
+ return value;
1848
+ }
1849
+ if (value === "--sip-trace" || value === "-sip-trace") {
1850
+ return "sip-trace";
1851
+ }
1852
+ return value;
1853
+ });
1854
+ await program.parseAsync(normalizedArgv);
1839
1855
  }
1840
1856
 
1841
1857
  module.exports = {