From 3ee3a453675cb1c6a4e328b51d25c19725287a8d Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 23 Jul 2026 22:08:24 +0000 Subject: [PATCH] Fix personal-DID inbound lookup: 10-digit storage vs 11-digit EXTEN mismatch Confirmed live: PSTN_PERSONAL_OWNER came back empty despite a real assignment existing, because the Security Dashboard stores personal DIDs as 10 digits (PERSONAL_DID_RE = ^\d{10}$) while Anveo's inbound INVITE delivers the called number as 11-digit E.164 (with leading 1) in ${EXTEN} - confirmed via PSTN_DID_CALLED=15557776655 in the live test. AST_CONFIG() looking up an 11-digit key never found the 10-digit section. Normalizes to 10 digits before the lookup (strips a leading digit only when the string is actually 11 characters, so this doesn't misfire against a provider that already sends 10). Also fixed the dashboard's own DID input placeholder, which contradicted its own 10-digit validation error. --- services/pstn-trunk.sh | 3 ++- services/security-dashboard.sh | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/services/pstn-trunk.sh b/services/pstn-trunk.sh index 8cbc163..23cf40a 100644 --- a/services/pstn-trunk.sh +++ b/services/pstn-trunk.sh @@ -402,7 +402,8 @@ exten => _X.,1,NoOp(Inbound PSTN call from ${CALLERID(num)} to ${EXTEN}) same => n,Set(PSTN_DID_CALLED=${EXTEN}) same => n,Set(PSTN_KILLED=${AST_CONFIG(pstn-trunk-killswitch.conf,state,tripped)}) same => n,GotoIf($["${PSTN_KILLED}" = "1"]?pstn_in_killed,1) - same => n,Set(PSTN_PERSONAL_OWNER=${AST_CONFIG(pstn-personal-dids.conf,${EXTEN},owner)}) + same => n,Set(PSTN_DID_10=${IF($[${LEN(${EXTEN})} = 11]?${EXTEN:1}:${EXTEN})}) + same => n,Set(PSTN_PERSONAL_OWNER=${AST_CONFIG(pstn-personal-dids.conf,${PSTN_DID_10},owner)}) same => n,GotoIf($["${PSTN_PERSONAL_OWNER}" != ""]?pstn_personal_inbound,1) same => n,Set(PSTN_RING_LIST=) same => n,Set(PSTN_RING_SEP=) diff --git a/services/security-dashboard.sh b/services/security-dashboard.sh index b2cf083..038bbf9 100644 --- a/services/security-dashboard.sh +++ b/services/security-dashboard.sh @@ -1606,7 +1606,7 @@ INDEX_HTML = """ Multiple DIDs can share this one trunk. Assigning a DID to an extension routes inbound calls to that DID straight to its owner (still gated by the owner's own tier/approved-numbers above — no ring-group fallback), and makes that extension's outbound calls show this DID as Caller-ID instead of the shared trunk DID. The shared DID/ring-group keeps working regardless.

- +