How to get single dispatch rule using go server sd...
# ask-ai
r
How to get single dispatch rule using go server sdk ?
t
Thanks for reaching out, Saurabh. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I’m responding to your question about how to get a single SIP dispatch rule using the Go Server SDK. There isn’t a dedicated “get single dispatch rule” method in the Go SDK. Instead, use the
ListSIPDispatchRules
call and filter by the
sip_dispatch_rule_id
. Because dispatch rule IDs are unique, the returned list will contain the single rule when it exists. Example (Go):
Copy code
client := livekit.NewLiveKitClient("<wss://your-instance.livekit.cloud>", apiKey, apiSecret)

resp, err := client.SIP.ListSIPDispatchRules(ctx, &livekit.ListSIPDispatchRulesRequest{
    SipDispatchRuleId: "your-dispatch-rule-id",
})
if err != nil {
    // handle error
}
if len(resp.Items) > 0 {
    rule := resp.Items[0]
    // use rule
} else {
    // no rule found with that ID
}
Notes and tips: • Replace
"<wss://your-instance.livekit.cloud>"
,
apiKey
,
apiSecret
, and the rule ID with your actual values. • Check
len(resp.Items)
to determine whether a rule was returned. • If you need help parsing fields from
rule
or want an example showing specific fields to read, tell me which fields you need and I’ll show a snippet. Would you like a full runnable example (imports, context setup) or help locating the package import path for your project? Sources: Python SDKs | livekit/livekit_composite | DeepWiki | server-sdk-go | livekit/livekit_composite | DeepWiki