arnacon-webrtc-service 0.1.76 → 0.1.78

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.
@@ -76,12 +76,12 @@
76
76
  "roflLogic": {
77
77
  "rpc": "https://sapphire.oasis.io",
78
78
  "chainId": 23294,
79
- "businessNumberDbAddress": "",
79
+ "businessNumberDbAddress": "0xeFB374e146440160583960Ce4Dc8525127919b78",
80
80
  "callerIdPoolAddress": "0x903796dc34Bb9A5eD76A41bBA6C40CfebD1f4269",
81
81
  "businessNumberDb": {
82
- "rpc": "https://sapphire.oasis.io",
83
- "chainId": 23294,
84
- "address": "0xFc80534F731E3849Bc06970B0e8645d72A34f493"
82
+ "rpc": "https://testnet.sapphire.oasis.io",
83
+ "chainId": 23295,
84
+ "address": "0xeFB374e146440160583960Ce4Dc8525127919b78"
85
85
  },
86
86
  "callerIdPool": {
87
87
  "rpc": "https://sapphire.oasis.io",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arnacon-webrtc-service",
3
- "version": "0.1.76",
3
+ "version": "0.1.78",
4
4
  "description": "Arnacon WebRTC core runtime and service modules",
5
5
  "main": "./webRTCservice/core.js",
6
6
  "type": "commonjs",
@@ -14,6 +14,13 @@ function createSipClient({
14
14
  startMediaRelay,
15
15
  logger = console,
16
16
  }) {
17
+ function sipIdentityUri(value) {
18
+ const normalized = String(value || "").trim();
19
+ if (!normalized) return null;
20
+ if (/^sip:/i.test(normalized)) return normalized;
21
+ return `sip:${normalized}@${kamailioDomain}`;
22
+ }
23
+
17
24
  async function openSipSession(sessionId, sessionStore, options = {}) {
18
25
  const { callerEns, calleeIdentity, sipDirective } = options;
19
26
  const session = sessionStore.get(sessionId);
@@ -41,20 +48,24 @@ function createSipClient({
41
48
  const targetUri = UserAgent.makeURI(toUri);
42
49
  if (!targetUri) throw new Error(`Invalid To URI for SIP session: ${toUri}`);
43
50
  const extraHeaders = [];
51
+ const assertedIdentity = sipIdentityUri(sipDirective?.callerId);
44
52
  if (sipDirective?.identity?.paiUri) {
45
53
  extraHeaders.push(`P-Asserted-Identity: <${sipDirective.identity.paiUri}>`);
46
- } else if (sipDirective?.privateId) {
47
- extraHeaders.push(`P-Asserted-Identity: <sip:${sipDirective.privateId}@${kamailioDomain}>`);
54
+ } else if (assertedIdentity) {
55
+ extraHeaders.push(`P-Asserted-Identity: <${assertedIdentity}>`);
48
56
  }
49
57
  if (sipDirective?.identity?.rpidUri) {
50
58
  extraHeaders.push(`Remote-Party-ID: <${sipDirective.identity.rpidUri}>`);
51
- } else if (sipDirective?.privateId) {
52
- extraHeaders.push(`Remote-Party-ID: <sip:${sipDirective.privateId}@${kamailioDomain}>`);
59
+ } else if (assertedIdentity) {
60
+ extraHeaders.push(`Remote-Party-ID: <${assertedIdentity}>`);
53
61
  }
54
62
  const privacyEnabled = sipDirective?.privacy?.enabled === true || Boolean(sipDirective?.privateId);
55
63
  if (privacyEnabled) {
56
64
  extraHeaders.push(`Privacy: ${sipDirective?.privacy?.value || "id"}`);
57
65
  }
66
+ if (sipDirective?.privateId) {
67
+ extraHeaders.push(`X-Arnacon-Private-Id: ${sipDirective.privateId}`);
68
+ }
58
69
  if (sipDirective?.headers && typeof sipDirective.headers === "object") {
59
70
  for (const [name, value] of Object.entries(sipDirective.headers)) {
60
71
  if (!name || value === undefined || value === null || value === "") continue;
@@ -9,7 +9,7 @@ function getDomains(helpers) {
9
9
 
10
10
  function looksLikeBusinessDomain(value) {
11
11
  const target = String(value || "").trim().toLowerCase();
12
- return target.includes(".") && !target.includes("@") && !target.endsWith(".global");
12
+ return !!target && !/^[+*]?\d+$/.test(target) && !target.includes("@") && !target.endsWith(".global");
13
13
  }
14
14
 
15
15
  async function resolveInboundTarget(ctx) {
@@ -9,7 +9,7 @@ function getDomains(helpers) {
9
9
 
10
10
  function looksLikeBusinessDomain(value) {
11
11
  const target = String(value || "").trim().toLowerCase();
12
- return target.includes(".") && !target.includes("@") && !target.endsWith(".global");
12
+ return !!target && !/^[+*]?\d+$/.test(target) && !target.includes("@") && !target.endsWith(".global");
13
13
  }
14
14
 
15
15
  async function resolveInboundTarget(ctx) {