@bitcall/webrtc-sip-gateway 0.2.7 → 0.2.8

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
@@ -5,7 +5,7 @@ Linux-only CLI to install and operate the Bitcall WebRTC-to-SIP gateway.
5
5
  ## Install
6
6
 
7
7
  ```bash
8
- sudo npm i -g @bitcall/webrtc-sip-gateway@0.2.7
8
+ sudo npm i -g @bitcall/webrtc-sip-gateway@0.2.8
9
9
  ```
10
10
 
11
11
  ## Main workflow
@@ -22,8 +22,14 @@ ports only. Host IPv6 remains enabled for signaling and non-media traffic.
22
22
  Backend selection prefers nftables on non-UFW hosts and uses ip6tables when UFW
23
23
  is active.
24
24
 
25
+ Default `init` and `init --dev` run in dev profile:
26
+ - `BITCALL_ENV=dev`
27
+ - `ROUTING_MODE=universal`
28
+ - provider allowlist/origin/source IPs are permissive by default (with warnings)
29
+
25
30
  Use `sudo bitcall-gateway init --production` for strict input validation and
26
- hardening checks.
31
+ hardening checks. Production universal routing requires explicit
32
+ `ALLOWED_SIP_DOMAINS`.
27
33
  Use `--verbose` to stream apt/docker output during install. Default mode keeps
28
34
  console output concise and writes command details to
29
35
  `/var/log/bitcall-gateway-install.log`.
package/lib/constants.js CHANGED
@@ -14,7 +14,7 @@ module.exports = {
14
14
  SSL_DIR: path.join(GATEWAY_DIR, "ssl"),
15
15
  ENV_PATH: path.join(GATEWAY_DIR, ".env"),
16
16
  COMPOSE_PATH: path.join(GATEWAY_DIR, "docker-compose.yml"),
17
- DEFAULT_GATEWAY_IMAGE: "ghcr.io/bitcallio/webrtc-sip-gateway:0.2.7",
17
+ DEFAULT_GATEWAY_IMAGE: "ghcr.io/bitcallio/webrtc-sip-gateway:0.2.8",
18
18
  DEFAULT_PROVIDER_HOST: "sip.example.com",
19
19
  DEFAULT_WEBPHONE_ORIGIN: "*",
20
20
  RENEW_HOOK_PATH: "/etc/letsencrypt/renewal-hooks/deploy/bitcall-gateway.sh",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitcall/webrtc-sip-gateway",
3
- "version": "0.2.7",
3
+ "version": "0.2.8",
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
@@ -40,7 +40,7 @@ const {
40
40
  isMediaIpv4OnlyRulesPresent,
41
41
  } = require("../lib/firewall");
42
42
 
43
- const PACKAGE_VERSION = "0.2.7";
43
+ const PACKAGE_VERSION = "0.2.8";
44
44
  const INSTALL_LOG_PATH = "/var/log/bitcall-gateway-install.log";
45
45
 
46
46
  function printBanner() {
@@ -545,6 +545,7 @@ function toOriginPattern(origin) {
545
545
  }
546
546
 
547
547
  function normalizeInitProfile(initOptions = {}, existing = {}) {
548
+ void existing;
548
549
  if (initOptions.dev && initOptions.production) {
549
550
  throw new Error("Use only one mode: --dev or --production.");
550
551
  }
@@ -554,7 +555,7 @@ function normalizeInitProfile(initOptions = {}, existing = {}) {
554
555
  if (initOptions.dev) {
555
556
  return "dev";
556
557
  }
557
- return existing.BITCALL_ENV || "dev";
558
+ return "dev";
558
559
  }
559
560
 
560
561
  async function runPreflight(ctx) {
@@ -603,12 +604,20 @@ async function runPreflight(ctx) {
603
604
  function printSummary(config, devWarnings) {
604
605
  const allowedCount = countAllowedDomains(config.allowedDomains);
605
606
  const showDevWarnings = config.bitcallEnv === "dev";
607
+ const providerAllowlistSummary =
608
+ allowedCount > 0
609
+ ? config.allowedDomains
610
+ : config.bitcallEnv === "production"
611
+ ? isSingleProviderConfigured(config)
612
+ ? "(single-provider mode)"
613
+ : "(missing)"
614
+ : "(any)";
606
615
  console.log("\nSummary:");
607
616
  console.log(` Domain: ${config.domain}`);
608
617
  console.log(` Environment: ${config.bitcallEnv}`);
609
618
  console.log(` Routing: ${config.routingMode}`);
610
619
  console.log(
611
- ` Provider allowlist: ${allowedCount > 0 ? config.allowedDomains : "(any)"}${showDevWarnings && allowedCount === 0 ? " [DEV WARNING]" : ""}`
620
+ ` Provider allowlist: ${providerAllowlistSummary}${showDevWarnings && allowedCount === 0 ? " [DEV WARNING]" : ""}`
612
621
  );
613
622
  console.log(
614
623
  ` Webphone origin: ${config.webphoneOrigin === "*" ? `(any)${showDevWarnings ? " [DEV WARNING]" : ""}` : config.webphoneOrigin}`
@@ -629,6 +638,10 @@ function printSummary(config, devWarnings) {
629
638
  }
630
639
  }
631
640
 
641
+ function shouldRequireAllowlist(bitcallEnv, routingMode) {
642
+ return bitcallEnv === "production" && routingMode === "universal";
643
+ }
644
+
632
645
  function parseProviderFromUri(uri = "") {
633
646
  const clean = uri.replace(/^sip:/, "");
634
647
  const [hostPort, transportPart] = clean.split(";");
@@ -698,16 +711,12 @@ async function runWizard(existing = {}, preflight = {}, initOptions = {}) {
698
711
  let turnExternalUsername = "";
699
712
  let turnExternalCredential = "";
700
713
  let webphoneOrigin = existing.WEBPHONE_ORIGIN || DEFAULT_WEBPHONE_ORIGIN;
701
- let configureUfw = initOptions.dev ? true : await prompt.askYesNo("Configure UFW firewall rules now?", true);
714
+ let configureUfw = await prompt.askYesNo("Configure UFW firewall rules now?", true);
702
715
  let mediaIpv4Only = existing.MEDIA_IPV4_ONLY ? existing.MEDIA_IPV4_ONLY === "1" : true;
703
716
 
704
717
  if (!advanced) {
705
718
  acmeEmail = acmeEmail || (await prompt.askText("Let's Encrypt email", "", { required: true }));
706
- if (!initOptions.dev) {
707
- turnMode = await prompt.askYesNo("Enable built-in TURN (coturn)?", true) ? "coturn" : "none";
708
- } else {
709
- turnMode = "coturn";
710
- }
719
+ turnMode = await prompt.askYesNo("Enable built-in TURN (coturn)?", true) ? "coturn" : "none";
711
720
  const quickDefaults = buildQuickFlowDefaults(initProfile, existing);
712
721
  bitcallEnv = quickDefaults.bitcallEnv;
713
722
  routingMode = quickDefaults.routingMode;
@@ -748,11 +757,6 @@ async function runWizard(existing = {}, preflight = {}, initOptions = {}) {
748
757
  if (!initOptions.dev && !initOptions.production) {
749
758
  bitcallEnv = await prompt.askChoice("Environment", ["production", "dev"], bitcallEnv === "dev" ? 1 : 0);
750
759
  }
751
- allowedDomains = await prompt.askText(
752
- "Allowed SIP domains (comma-separated)",
753
- allowedDomains
754
- );
755
-
756
760
  routingMode = await prompt.askChoice(
757
761
  "Routing mode",
758
762
  ["universal", "single-provider"],
@@ -791,6 +795,15 @@ async function runWizard(existing = {}, preflight = {}, initOptions = {}) {
791
795
  sipProviderUri = `sip:${sipProviderHost}:${sipPort};transport=${sipTransport}`;
792
796
  }
793
797
 
798
+ const requireAllowlist = shouldRequireAllowlist(bitcallEnv, routingMode);
799
+ allowedDomains = await prompt.askText(
800
+ requireAllowlist
801
+ ? "Allowed SIP domains (comma-separated; required in production universal mode)"
802
+ : "Allowed SIP domains (comma-separated)",
803
+ allowedDomains,
804
+ { required: requireAllowlist }
805
+ );
806
+
794
807
  sipTrustedIps = await prompt.askText(
795
808
  "Trusted SIP source IPs (optional, comma-separated)",
796
809
  sipTrustedIps
@@ -888,11 +901,9 @@ async function runWizard(existing = {}, preflight = {}, initOptions = {}) {
888
901
  const devWarnings = config.bitcallEnv === "dev" ? buildDevWarnings(config) : [];
889
902
  printSummary(config, devWarnings);
890
903
 
891
- if (!(initOptions.dev && !advanced)) {
892
- const proceed = await prompt.askYesNo("Proceed with provisioning", true);
893
- if (!proceed) {
894
- throw new Error("Initialization canceled.");
895
- }
904
+ const proceed = await prompt.askYesNo("Proceed with provisioning", true);
905
+ if (!proceed) {
906
+ throw new Error("Initialization canceled.");
896
907
  }
897
908
 
898
909
  return config;
@@ -1479,6 +1490,7 @@ module.exports = {
1479
1490
  validateProductionConfig,
1480
1491
  buildDevWarnings,
1481
1492
  buildQuickFlowDefaults,
1493
+ shouldRequireAllowlist,
1482
1494
  isOriginWildcard,
1483
1495
  isSingleProviderConfigured,
1484
1496
  printRequiredPorts,