how can i get the room name to be the number of th...
# ask-ai
a
how can i get the room name to be the number of the phone number i called to
t
Thanks for reaching out, Dvir. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
To set the room name to be the phone number you called to, you can use a dispatch rule with the
dispatchRuleCallee
configuration. Here’s how to configure it: 1. Create a dispatch rule with the following configuration:
Copy code
{
  "rule": {
    "dispatchRuleCallee": {
      "roomPrefix": "",
      "randomize": false
    }
  },
  "name": "My dispatch rule"
}
• Set
roomPrefix
to an empty string to avoid adding extra text to the room name. • Set
randomize
to
false
to prevent adding a random suffix. 1. Save this configuration in a file (e.g.,
dispatch-rule.json
). 2. Use the LiveKit CLI to create the dispatch rule:
Copy code
lk sip dispatch create dispatch-rule.json
1. Alternatively, you can create the dispatch rule programmatically using the LiveKit API:
Copy code
const dispatchRule = {
  rule: {
    dispatchRuleCallee: {
      roomPrefix: '',
      randomize: false
    }
  },
  name: 'My dispatch rule'
};

const response = await lk.sip.createSIPDispatchRule(dispatchRule);
This setup ensures that the room name will exactly match the phone number called. Let me know if you need further assistance! Sources: SIP dispatch rule | LiveKit Docs | SIP dispatch rule | LiveKit Docs
a
I want it to be the number called, the number called to, and then random
t
Hey there! If you want to set the room name to include the number called, the number called to, plus a random little suffix, here’s a friendly way to do it with a dispatch rule: 1. First, create a dispatch rule with this setup:
Copy code
{
  "rule": {
    "dispatchRuleCallee": {
      "roomPrefix": "",
      "randomize": true
    }
  },
  "name": "Custom Room Name"
}
• `roomPrefix`: You can leave this empty or add your own prefix (like
"call-"
). • `randomize`: Set this to
true
so it tacks on a random suffix to keep things unique. 1. Save this as a file, maybe call it
dispatch-rule.json
. 2. Then, use the LiveKit CLI to create the dispatch rule by running:
Copy code
lk sip dispatch create dispatch-rule.json
1. If you prefer, you can also set it up programmatically with the LiveKit API like this:
Copy code
const dispatchRule = {
  rule: {
    dispatchRuleCallee: {
      roomPrefix: '',
      randomize: true
    }
  },
  name: 'Custom Room Name'
};

const response = await lk.sip.createSIPDispatchRule(dispatchRule);
And that’s it! This way, your room names will nicely include the number called, the number called to, and a random suffix to keep them unique. If you hit any bumps or want to chat more about it, just let me know—I’m here to help! Sources: SIP dispatch rule | LiveKit Docs | livekit/livekit_sip.pb.go | SIP dispatch rule | LiveKit Docs
a
can i get the callee number using the api?
t
Hey there! The LiveKit API lets you grab the caller's phone number using the
sip.phoneNumber
attribute for inbound calls. But when it comes to the callee's phone number, there isn't a direct attribute or method mentioned. If you have a particular situation in mind, just let me know—I’m happy to help you figure it out!
a
in the on_enter function i need to understand what is the number we call to
t
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!
a
what is the api to get the room details?