Skip to content

Commit

Permalink
Add SIP headers to the table view. (#461)
Browse files Browse the repository at this point in the history
  • Loading branch information
dennwc authored Nov 5, 2024
1 parent 23409c6 commit 718674e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions cmd/lk/sip.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,12 +286,14 @@ func listSipInboundTrunk(ctx context.Context, cmd *cli.Command) error {
"SipTrunkID", "Name", "Numbers",
"AllowedAddresses", "AllowedNumbers",
"Authentication",
"Headers",
"Metadata",
}, func(item *livekit.SIPInboundTrunkInfo) []string {
return []string{
item.SipTrunkId, item.Name, strings.Join(item.Numbers, ","),
strings.Join(item.AllowedAddresses, ","), strings.Join(item.AllowedNumbers, ","),
userPass(item.AuthUsername, item.AuthPassword != ""),
fmt.Sprintf("%v, %v", item.Headers, item.HeadersToAttributes),
item.Metadata,
}
})
Expand All @@ -307,13 +309,15 @@ func listSipOutboundTrunk(ctx context.Context, cmd *cli.Command) error {
"Address", "Transport",
"Numbers",
"Authentication",
"Headers",
"Metadata",
}, func(item *livekit.SIPOutboundTrunkInfo) []string {
return []string{
item.SipTrunkId, item.Name,
item.Address, strings.TrimPrefix(item.Transport.String(), "SIP_TRANSPORT_"),
strings.Join(item.Numbers, ","),
userPass(item.AuthUsername, item.AuthPassword != ""),
fmt.Sprintf("%v, %v", item.Headers, item.HeadersToAttributes),
item.Metadata,
}
})
Expand Down Expand Up @@ -385,7 +389,8 @@ func listSipDispatchRule(ctx context.Context, cmd *cli.Command) error {
return err
}
return listAndPrint(ctx, cmd, cli.ListSIPDispatchRule, &livekit.ListSIPDispatchRuleRequest{}, []string{
"SipDispatchRuleID", "Name", "SipTrunks", "Type", "RoomName", "Pin", "HidePhone", "Metadata",
"SipDispatchRuleID", "Name", "SipTrunks", "Type", "RoomName", "Pin", "HidePhone",
"Attributes", "Metadata",
}, func(item *livekit.SIPDispatchRuleInfo) []string {
var room, typ, pin string
switch r := item.GetRule().GetRule().(type) {
Expand All @@ -409,7 +414,10 @@ func listSipDispatchRule(ctx context.Context, cmd *cli.Command) error {
if trunks == "" {
trunks = "<any>"
}
return []string{item.SipDispatchRuleId, item.Name, trunks, typ, room, pin, strconv.FormatBool(item.HidePhoneNumber), item.Metadata}
return []string{
item.SipDispatchRuleId, item.Name, trunks, typ, room, pin, strconv.FormatBool(item.HidePhoneNumber),
fmt.Sprintf("%v", item.Attributes), item.Metadata,
}
})
}

Expand Down

0 comments on commit 718674e

Please sign in to comment.