Architect expression failing to strip country code and apply parentheses to inbound phone numbers

The routing configuration in the admin UI handles the initial trigger without issues, but the expression editor keeps choking on the phone string manipulation. We’re trying to convert the raw +1XXXXXXXXXX value from the external webhook into a standard (XXX) XXX-XXXX format before it hits the IVR menu. The console shows the parameter binding correctly, yet the output stays unchanged.

Here’s the expression we’ve been testing in the Set Parameter action:
IF(LEN({trigger_phone}) == 11, "(" + SUBSTRING({trigger_phone}, 2, 3) + ") " + SUBSTRING({trigger_phone}, 5, 3) + "-" + SUBSTRING({trigger_phone}, 8, 4), {trigger_phone})

The admin UI documentation doesn’t list exact character offsets for SUBSTRING when dealing with E.164 inputs. Tried wrapping it in REPLACE first to strip the leading +, but Genesys just throws a validation warning about invalid function nesting. Swapped to SUBSTRING directly on the 11-character string, assuming index 0 is the plus sign. The expression evaluator says it’s valid. Actual call flow logs show the exact original string passing through. We’ve verified the parameter type is set to string and not phone.

Also tested a quick Data Action to run a Python snippet, but the external lookup timeout killed the session before the return value populated. Need to stick to native expressions for this step. Does the platform automatically strip the country prefix before evaluation, or is there a specific formatting function that handles this? Checked the expression reference guide twice. Nothing on masking or bracket insertion.

The logs just keep showing +14155551234 instead of (415) 555-1234. Nothing else in the trace. Probably missing a bracket somewhere.