Architect expression to format E.164 phone number

Hey folks,

Stuck on a formatting issue in Architect. We’re pulling the caller ID from the call control data, which comes in as E.164 (+1XXXXXXXXXX). Need to display it as (XXX) XXX-XXXX in a downstream API payload.

Tried chaining substr and concat but the expression is getting messy and I’m hitting the character limit or just making syntax errors. Something like this:

concat("(", substr(%call.caller.phone, 2, 3), ") ", substr(%call.caller.phone, 5, 3), "-", substr(%call.caller.phone, 8, 4))

Works for US numbers, but feels brittle. Is there a cleaner way to handle this in the expression builder? Or a specific function I’m missing?

Also, the system seems to drop the plus sign sometimes before the expression runs, so substr indices shift. Anyone seen that?