diff --git a/livekit/attrs.go b/livekit/attrs.go index 613d8e6e..2102d8b8 100644 --- a/livekit/attrs.go +++ b/livekit/attrs.go @@ -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" ) diff --git a/rpc/sip.go b/rpc/sip.go index 83be131b..4e0a2832 100644 --- a/rpc/sip.go +++ b/rpc/sip.go @@ -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, diff --git a/rpc/sip_test.go b/rpc/sip_test.go index 07ad712d..832176b4 100644 --- a/rpc/sip_test.go +++ b/rpc/sip_test.go @@ -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) diff --git a/sip/sip.go b/sip/sip.go index 34cea4da..e27c2f53 100644 --- a/sip/sip.go +++ b/sip/sip.go @@ -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) diff --git a/sip/sip_test.go b/sip/sip_test.go index 2783dff8..4e10fc2e 100644 --- a/sip/sip_test.go +++ b/sip/sip_test.go @@ -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)