steep-mechanic-38687
03/04/2026, 9:55 PMtall-airline-16756
03/04/2026, 9:55 PMtall-airline-16756
03/04/2026, 9:56 PMcreate_sip_participant.
Short answer: check the Twirp error’s metadata for SIP fields such as sip_status_code and sip_status. A non‑attributed / not‑found phone number is typically indicated by a SIP status like 404 (Not Found) or a 403/forbidden from the SIP provider.
What to check and why
• e.metadata['sip_status_code'] — numeric SIP code (e.g., "404", "403").
• e.metadata['sip_status'] — textual SIP reason (e.g., "404 Not Found", "Forbidden").
These metadata fields are returned on SIP call errors and identify whether the provider rejected or could not route the number.
Example (Python) — how to detect and handle it
try:
await ctx.api.sip.create_sip_participant(
api.CreateSIPParticipantRequest(
room_name=ctx.room.name,
sip_trunk_id='ST_xxxx',
sip_call_to='+15105550123',
participant_identity='caller',
wait_until_answered=True,
)
)
except api.TwirpError as e:
sip_status = e.metadata.get('sip_status_code')
sip_message = e.metadata.get('sip_status', '')
# Detect non-attributed / not found
if sip_status == '404' or 'Not Found' in sip_message:
# handle non-attributed number
print("Number not attributed / does not exist.")
elif sip_status == '403' or 'Forbidden' in sip_message:
# handle forbidden / blocked
print("Number blocked or forbidden by provider.")
else:
print(f"SIP error: {sip_status} - {sip_message}")
If this detection isn’t reliable in your environment
• Let me know the exact TwirpError payload you’re seeing (copy of e.metadata) and the SDK/language you’re using.
• I can suggest more specific checks or parsing logic for your SDK.
I can also help with next steps (retries, logging best practices, or mapping SIP codes to user‑friendly messages) if you’d like.
Sources: Agents telephony integration | LiveKit Documentation