orange-boots-48752
12/16/2025, 3:16 PMX-TCN-Virtual-Number: 7788071156
i want to make it as virtualNumber but as <tel:+17788071156|+17788071156>
that is adding a prefix of +1, if it doesn't exist. how?tall-airline-16756
12/16/2025, 3:16 PMtall-airline-16756
12/16/2025, 3:17 PMheaders_to_attributes on your inbound trunk:
{
"trunk": {
"name": "My Inbound Trunk",
"numbers": [
"+15105550100"
],
"headers_to_attributes": {
"X-TCN-Virtual-Number": "virtualNumber"
}
}
}
This exposes the header value as participant attribute virtualNumber.
2) Add the +1 prefix in your app where you read the attribute
• LiveKit does not auto-format phone numbers, so format after retrieving virtualNumber. Example functions:
Node.js:
function formatVirtualNumber(v) {
if (!v) return v;
if (v.startsWith('+')) return v;
if (v.length === 10) return '+1' + v;
if (v.length === 11 && v.startsWith('1')) return '+' + v;
return v;
}
Python:
def format_virtual_number(v):
if not v: return v
if v.startswith('+'): return v
if len(v) == 10: return '+1' + v
if len(v) == 11 and v.startswith('1'): return '+' + v
return v
Use the formatted value (e.g., +17788071156) in your app logic after retrieving participant.attributes['virtualNumber'].
Would you like a version that enforces E.164 validation or handles other country codes?
Sources: SIP APIs | LiveKit docs | sip | livekit/livekit_composite | DeepWiki