how to extract the from and to number in an indivi...
# ask-ai
s
how to extract the from and to number in an individual dispatch rule call
t
Thanks for reaching out, A. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
You can extract the from and to phone numbers in an individual dispatch rule call using the following methods: • From the SIPCallInfo object (in LiveKit SDKs):
Copy code
from_number = call_info.from_uri.user   # The caller's phone number
to_number = call_info.to_uri.user       # The called number
From participant attributes (if
hide_phone_number
is not enabled):
Copy code
from_number = participant_attributes.get("livekit.sip.phone_number")     # Caller (from)
to_number = participant_attributes.get("livekit.sip.trunk_number")     # Called (to)
During dispatch rule processing, these are extracted as
call.From.User
(from) and
call.To.User
(to). If
hide_phone_number
is enabled, the phone numbers will not appear in participant attributes and are partially masked elsewhere. For more information, see the SIP SDK documentation for your programming language. References: Sources: livekit-protocol/livekit/protocol/sip.py | livekit/livekit_sip.pb.go | SIP APIs | LiveKit Docs