arnacon-webrtc-service 0.1.78 → 0.1.80
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
|
@@ -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
|
|
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
|
|
480
|
-
|
|
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 = {
|
|
@@ -63,9 +63,6 @@ function createSipClient({
|
|
|
63
63
|
if (privacyEnabled) {
|
|
64
64
|
extraHeaders.push(`Privacy: ${sipDirective?.privacy?.value || "id"}`);
|
|
65
65
|
}
|
|
66
|
-
if (sipDirective?.privateId) {
|
|
67
|
-
extraHeaders.push(`X-Arnacon-Private-Id: ${sipDirective.privateId}`);
|
|
68
|
-
}
|
|
69
66
|
if (sipDirective?.headers && typeof sipDirective.headers === "object") {
|
|
70
67
|
for (const [name, value] of Object.entries(sipDirective.headers)) {
|
|
71
68
|
if (!name || value === undefined || value === null || value === "") continue;
|