mirror of
https://github.com/livekit/livekit.git
synced 2026-05-14 16:15:25 +00:00
SIP: Update protocol, use NoPin flag. (#2250)
This commit is contained in:
@@ -18,7 +18,7 @@ require (
|
||||
github.com/jxskiss/base62 v1.1.0
|
||||
github.com/livekit/mageutil v0.0.0-20230125210925-54e8a70427c1
|
||||
github.com/livekit/mediatransportutil v0.0.0-20231017082622-43f077b4e60e
|
||||
github.com/livekit/protocol v1.9.1
|
||||
github.com/livekit/protocol v1.9.2-0.20231116141704-aa43aa7482d7
|
||||
github.com/livekit/psrpc v0.5.2
|
||||
github.com/mackerelio/go-osstat v0.2.4
|
||||
github.com/magefile/mage v1.15.0
|
||||
@@ -34,7 +34,7 @@ require (
|
||||
github.com/pion/sdp/v3 v3.0.6
|
||||
github.com/pion/transport/v2 v2.2.4
|
||||
github.com/pion/turn/v2 v2.1.4
|
||||
github.com/pion/webrtc/v3 v3.2.22
|
||||
github.com/pion/webrtc/v3 v3.2.23
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/prometheus/client_golang v1.17.0
|
||||
github.com/redis/go-redis/v9 v9.3.0
|
||||
|
||||
@@ -125,8 +125,8 @@ github.com/livekit/mageutil v0.0.0-20230125210925-54e8a70427c1 h1:jm09419p0lqTkD
|
||||
github.com/livekit/mageutil v0.0.0-20230125210925-54e8a70427c1/go.mod h1:Rs3MhFwutWhGwmY1VQsygw28z5bWcnEYmS1OG9OxjOQ=
|
||||
github.com/livekit/mediatransportutil v0.0.0-20231017082622-43f077b4e60e h1:yNeIo7MSMUWgoLu7LkNKnBYnJBFPFH9Wq4S6h1kS44M=
|
||||
github.com/livekit/mediatransportutil v0.0.0-20231017082622-43f077b4e60e/go.mod h1:+WIOYwiBMive5T81V8B2wdAc2zQNRjNQiJIcPxMTILY=
|
||||
github.com/livekit/protocol v1.9.1 h1:RTycWwtGUoYLb+7WYosJ3IP8f0e8j4lLxC/osy/dQi0=
|
||||
github.com/livekit/protocol v1.9.1/go.mod h1:kqDGmx+WZ6WMZ5V/T9lF8DgnuThAjetwjHq1nd7moSE=
|
||||
github.com/livekit/protocol v1.9.2-0.20231116141704-aa43aa7482d7 h1:M/ljEz6MCH5lovoTT0t6hyaaZJEn4hvXs9J9OtQ+gS4=
|
||||
github.com/livekit/protocol v1.9.2-0.20231116141704-aa43aa7482d7/go.mod h1:JgFHHd99wgEp4smATlJupOdA7iJHFoj2g3RFeM/Hk8M=
|
||||
github.com/livekit/psrpc v0.5.2 h1:+MvG8Otm/J6MTg2MP/uuMbrkxOWsrj2hDhu/I1VIU1U=
|
||||
github.com/livekit/psrpc v0.5.2/go.mod h1:cQjxg1oCxYHhxxv6KJH1gSvdtCHQoRZCHgPdm5N8v2g=
|
||||
github.com/mackerelio/go-osstat v0.2.4 h1:qxGbdPkFo65PXOb/F/nhDKpF2nGmGaCFDLXoZjJTtUs=
|
||||
@@ -221,8 +221,8 @@ github.com/pion/transport/v3 v3.0.1/go.mod h1:UY7kiITrlMv7/IKgd5eTUcaahZx5oUN3l9
|
||||
github.com/pion/turn/v2 v2.1.3/go.mod h1:huEpByKKHix2/b9kmTAM3YoX6MKP+/D//0ClgUYR2fY=
|
||||
github.com/pion/turn/v2 v2.1.4 h1:2xn8rduI5W6sCZQkEnIUDAkrBQNl2eYIBCHMZ3QMmP8=
|
||||
github.com/pion/turn/v2 v2.1.4/go.mod h1:huEpByKKHix2/b9kmTAM3YoX6MKP+/D//0ClgUYR2fY=
|
||||
github.com/pion/webrtc/v3 v3.2.22 h1:Hno262T7+V56MgUO30O0ZirZmVSvbXtnau31SB0WSpc=
|
||||
github.com/pion/webrtc/v3 v3.2.22/go.mod h1:1CaT2fcZzZ6VZA+O1i9yK2DU4EOcXVvSbWG9pr5jefs=
|
||||
github.com/pion/webrtc/v3 v3.2.23 h1:GbqEuxBbVLFhXk0GwxKAoaIJYiEa9TyoZPEZC+2HZxM=
|
||||
github.com/pion/webrtc/v3 v3.2.23/go.mod h1:1CaT2fcZzZ6VZA+O1i9yK2DU4EOcXVvSbWG9pr5jefs=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
|
||||
@@ -32,9 +32,6 @@ func sipRulePriority(info *livekit.SIPDispatchRuleInfo) int32 {
|
||||
return 0
|
||||
}
|
||||
return 100
|
||||
case *livekit.SIPDispatchRule_DispatchRulePin:
|
||||
// TODO: If we assume that Pin is optional, this rule type is very similar to Direct. Could remove it?
|
||||
return 0
|
||||
case *livekit.SIPDispatchRule_DispatchRuleIndividual:
|
||||
if rule.DispatchRuleIndividual.GetPin() != "" {
|
||||
return 1
|
||||
@@ -115,9 +112,6 @@ func sipGetPinAndRoom(info *livekit.SIPDispatchRuleInfo) (room, pin string, err
|
||||
case *livekit.SIPDispatchRule_DispatchRuleDirect:
|
||||
pin = rule.DispatchRuleDirect.GetPin()
|
||||
room = rule.DispatchRuleDirect.GetRoomName()
|
||||
case *livekit.SIPDispatchRule_DispatchRulePin:
|
||||
pin = rule.DispatchRulePin.GetPin()
|
||||
room = rule.DispatchRulePin.GetRoomName()
|
||||
case *livekit.SIPDispatchRule_DispatchRuleIndividual:
|
||||
pin = rule.DispatchRuleIndividual.GetPin()
|
||||
room = rule.DispatchRuleIndividual.GetRoomPrefix()
|
||||
@@ -189,13 +183,7 @@ func sipMatchDispatchRule(trunk *livekit.SIPTrunkInfo, rules []*livekit.SIPDispa
|
||||
specificRules []*livekit.SIPDispatchRuleInfo
|
||||
defaultRules []*livekit.SIPDispatchRuleInfo
|
||||
)
|
||||
// TODO: Apart from Pin, it would be nice to have a NoPin flag.
|
||||
// The way it would work is that we will first list the rules and figure out if at least one has a Pin required.
|
||||
// If it does, we will immediately respond with RequestPin=true. Now, on the SIP bridge side, we will run
|
||||
// audio prompt asking for a Pin. The user will have an options to skip the pin (e.g. press #) and only try
|
||||
// to match no-ping rooms. This will be very useful if only 1 number is available and has to route to both
|
||||
// private and public rooms.
|
||||
noPin := false
|
||||
noPin := req.NoPin
|
||||
sentPin := req.GetPin()
|
||||
for _, info := range rules {
|
||||
_, rulePin, err := sipGetPinAndRoom(info)
|
||||
|
||||
Reference in New Issue
Block a user