arnacon-webrtc-service 0.1.78 → 0.1.79

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arnacon-webrtc-service",
3
- "version": "0.1.78",
3
+ "version": "0.1.79",
4
4
  "description": "Arnacon WebRTC core runtime and service modules",
5
5
  "main": "./webRTCservice/core.js",
6
6
  "type": "commonjs",
@@ -86,7 +86,7 @@ function createBlockchainApi({
86
86
  "function findNextOwnedCallerId(uint256 startIndex, address expectedOwner, uint256 maxAttempts) view returns (string phoneNumber, uint256 foundIndex, bool found)",
87
87
  "function getPoolSize() view returns (uint256)",
88
88
  "function admin() view returns (address)",
89
- "function getTokens() view returns (uint256[])",
89
+ "function tokenByIndex(uint256 index) view returns (uint256)",
90
90
  "function getCallerIdByTokenId(uint256 tokenId) view returns (string phoneNumber, string metadata, address owner)",
91
91
  ];
92
92
 
@@ -476,11 +476,8 @@ function createBlockchainApi({
476
476
  // Explicit request: if PKEY is not set, assign directly from pool
477
477
  // without owner filtering (pure round-robin by token list index).
478
478
  if (!roflKeyAddress) {
479
- const tokens = await pool.getTokens();
480
- if (!tokens || tokens.length === 0) return null;
481
-
482
- const idx = roflCallerIdIndex % tokens.length;
483
- const tokenId = tokens[idx];
479
+ const idx = roflCallerIdIndex % toSafeNumber(poolSize);
480
+ const tokenId = await pool.tokenByIndex(idx);
484
481
  const [fromNumber] = await pool.getCallerIdByTokenId(tokenId);
485
482
  if (!fromNumber || fromNumber === "") return null;
486
483
 
@@ -88,6 +88,9 @@ function createCallRuntimeCore({
88
88
  async function routeCall(sessionId, session, destination, parsedFrom) {
89
89
  if (destination.route === "sbc") {
90
90
  const callerIdResult = await resolveCallerId(parsedFrom, session.walletAddress, session.serviceId || null);
91
+ if (callerIdResult?.privateId && !callerIdResult?.callerId && !callerIdResult?.identity?.fromUri) {
92
+ throw new Error("SBC privacy policy requires a masked caller ID, but none was available");
93
+ }
91
94
  const sipFrom = callerIdResult?.callerId || session.callerEns;
92
95
  const sipTo = destination?.number;
93
96
  const sipDirective = {