Skip to content

Commit

Permalink
Remove sip prefix and rename phone number attrs.
Browse files Browse the repository at this point in the history
  • Loading branch information
dennwc committed Jun 17, 2024
1 parent c03793c commit 34ad2db
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
10 changes: 5 additions & 5 deletions livekit/attrs.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ package livekit
// Names of participant attributes for SIP.
const (
// AttrSIPPrefix is shared for all SIP attributes.
AttrSIPPrefix = "lk.sip."
AttrSIPPrefix = "sip."
// AttrSIPCallID attribute contains LiveKit SIP call ID.
AttrSIPCallID = AttrSIPPrefix + "callID"
// AttrSIPTrunkID attribute contains LiveKit SIP Trunk ID used for the call.
AttrSIPTrunkID = AttrSIPPrefix + "trunkID"
// AttrSIPDispatchRuleID attribute contains LiveKit SIP DispatchRule ID used for the inbound call.
AttrSIPDispatchRuleID = AttrSIPPrefix + "ruleID"
// AttrSIPFromNumber attribute contains number from which the call was made.
// AttrSIPTrunkNumber attribute contains number associate with LiveKit SIP Trunk.
// This attribute will be omitted if HidePhoneNumber is set.
AttrSIPFromNumber = AttrSIPPrefix + "fromNumber"
// AttrSIPToNumber attribute contains number to which the call was made.
AttrSIPTrunkNumber = AttrSIPPrefix + "trunkPhoneNumber"
// AttrSIPPhoneNumber attribute contains number external to LiveKit SIP (caller for inbound and called number for outbound).
// This attribute will be omitted if HidePhoneNumber is set.
AttrSIPToNumber = AttrSIPPrefix + "toNumber"
AttrSIPPhoneNumber = AttrSIPPrefix + "phoneNumber"
)
4 changes: 2 additions & 2 deletions rpc/sip.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ func NewCreateSIPParticipantRequest(
}
attrs[livekit.AttrSIPTrunkID] = trunkID
if !req.HidePhoneNumber {
attrs[livekit.AttrSIPToNumber] = req.SipCallTo
attrs[livekit.AttrSIPFromNumber] = trunk.OutboundNumber
attrs[livekit.AttrSIPPhoneNumber] = req.SipCallTo
attrs[livekit.AttrSIPTrunkNumber] = trunk.OutboundNumber
}
return &InternalCreateSIPParticipantRequest{
SipCallId: callID,
Expand Down
10 changes: 5 additions & 5 deletions rpc/sip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ func TestNewCreateSIPParticipantRequest(t *testing.T) {
Dtmf: "1234#",
PlayRingtone: true,
ParticipantAttributes: map[string]string{
"extra": "1",
livekit.AttrSIPCallID: "call-id",
livekit.AttrSIPTrunkID: "trunk",
livekit.AttrSIPFromNumber: "+1111",
livekit.AttrSIPToNumber: "+3333",
"extra": "1",
livekit.AttrSIPCallID: "call-id",
livekit.AttrSIPTrunkID: "trunk",
livekit.AttrSIPTrunkNumber: "+1111",
livekit.AttrSIPPhoneNumber: "+3333",
},
}, res)

Expand Down
4 changes: 2 additions & 2 deletions sip/sip.go
Original file line number Diff line number Diff line change
Expand Up @@ -412,8 +412,8 @@ func EvaluateDispatchRule(trunkID string, rule *livekit.SIPDispatchRuleInfo, req
from = from[len(from)-n:]
fromName = "Phone " + from
} else {
attrs[livekit.AttrSIPFromNumber] = req.CallingNumber
attrs[livekit.AttrSIPToNumber] = req.CalledNumber
attrs[livekit.AttrSIPPhoneNumber] = req.CallingNumber
attrs[livekit.AttrSIPTrunkNumber] = req.CalledNumber
}

room, rulePin, err := GetPinAndRoom(rule)
Expand Down
4 changes: 2 additions & 2 deletions sip/sip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -552,8 +552,8 @@ func TestEvaluateDispatchRule(t *testing.T) {
livekit.AttrSIPCallID: "call-id",
livekit.AttrSIPTrunkID: "trunk",
livekit.AttrSIPDispatchRuleID: "rule",
livekit.AttrSIPFromNumber: "+11112222",
livekit.AttrSIPToNumber: "+3333",
livekit.AttrSIPPhoneNumber: "+11112222",
livekit.AttrSIPTrunkNumber: "+3333",
},
}, res)

Expand Down

0 comments on commit 34ad2db

Please sign in to comment.