From 01b46d78656e476b66753a6d58df7de2de27e0bb Mon Sep 17 00:00:00 2001 From: Denys Smirnov Date: Wed, 25 Sep 2024 21:55:48 +0300 Subject: [PATCH] Validate SipCallTo in CreateSIPParticipantRequest. (#823) --- .changeset/wet-guests-eat.md | 5 +++++ livekit/sip.go | 2 ++ 2 files changed, 7 insertions(+) create mode 100644 .changeset/wet-guests-eat.md diff --git a/.changeset/wet-guests-eat.md b/.changeset/wet-guests-eat.md new file mode 100644 index 00000000..7f4bfa47 --- /dev/null +++ b/.changeset/wet-guests-eat.md @@ -0,0 +1,5 @@ +--- +"github.com/livekit/protocol": patch +--- + +Validate SipCallTo in CreateSIPParticipantRequest. diff --git a/livekit/sip.go b/livekit/sip.go index d7ce71c5..e91db6bb 100644 --- a/livekit/sip.go +++ b/livekit/sip.go @@ -182,6 +182,8 @@ func (p *CreateSIPParticipantRequest) Validate() error { } if p.SipCallTo == "" { return errors.New("missing sip callee number") + } else if strings.Contains(p.SipCallTo, "@") { + return errors.New("SipCallTo should be a phone number or SIP user, not a full SIP URI") } if p.RoomName == "" { return errors.New("missing room name")