Skip to content

Commit

Permalink
Add headers for SIP call transfer.
Browse files Browse the repository at this point in the history
  • Loading branch information
dennwc committed Dec 17, 2024
1 parent 9eb0489 commit bd346ea
Show file tree
Hide file tree
Showing 9 changed files with 515 additions and 448 deletions.
6 changes: 6 additions & 0 deletions .changeset/strong-seahorses-hug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@livekit/protocol": minor
"github.com/livekit/protocol": minor
---

Add headers for SIP call transfer.
405 changes: 212 additions & 193 deletions livekit/livekit_sip.pb.go

Large diffs are not rendered by default.

315 changes: 158 additions & 157 deletions livekit/livekit_sip.twirp.go

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions livekit/sip.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,9 @@ func (p *TransferSIPParticipantRequest) Validate() error {
if p.TransferTo == "" {
return errors.New("missing transfer to")
}
if err := validateHeaderKeys(p.Headers); err != nil {
return err
}

return nil
}
Expand Down
2 changes: 2 additions & 0 deletions protobufs/livekit_sip.proto
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,8 @@ message TransferSIPParticipantRequest {

// Optionally play dialtone to the SIP participant as an audible indicator of being transferred
bool play_dialtone = 4;

map<string, string> headers = 5;
}

message SIPCallInfo {
Expand Down
2 changes: 2 additions & 0 deletions protobufs/rpc/sip.proto
Original file line number Diff line number Diff line change
Expand Up @@ -114,5 +114,7 @@ message InternalTransferSIPParticipantRequest {

// Optionally play dialtone to the SIP participant as an audible indicator of being transferred
bool play_dialtone = 3;

map<string, string> headers = 4;
}

14 changes: 14 additions & 0 deletions rpc/sip.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,17 @@ func NewCreateSIPParticipantRequest(
MaxCallDuration: req.MaxCallDuration,
}, nil
}

// NewTransferSIPParticipantRequest fills InternalTransferSIPParticipantRequest from
// livekit.TransferSIPParticipantRequest.
func NewTransferSIPParticipantRequest(
callID string,
req *livekit.TransferSIPParticipantRequest,
) (*InternalTransferSIPParticipantRequest, error) {
return &InternalTransferSIPParticipantRequest{
SipCallId: callID,
TransferTo: req.TransferTo,
PlayDialtone: req.PlayDialtone,
Headers: req.Headers,
}, nil
}
99 changes: 59 additions & 40 deletions rpc/sip.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit bd346ea

Please sign in to comment.