Skip to content

Commit 1975b61

Browse files
authored
Add headers for SIP call transfer. (#926)
1 parent 9eb0489 commit 1975b61

File tree

9 files changed

+519
-448
lines changed

9 files changed

+519
-448
lines changed

.changeset/strong-seahorses-hug.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@livekit/protocol": minor
3+
"github.com/livekit/protocol": minor
4+
---
5+
6+
Add headers for SIP call transfer.

livekit/livekit_sip.pb.go

Lines changed: 213 additions & 193 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

livekit/livekit_sip.twirp.go

Lines changed: 158 additions & 157 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

livekit/sip.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,9 @@ func (p *TransferSIPParticipantRequest) Validate() error {
240240
if p.TransferTo == "" {
241241
return errors.New("missing transfer to")
242242
}
243+
if err := validateHeaderKeys(p.Headers); err != nil {
244+
return err
245+
}
243246

244247
return nil
245248
}

protobufs/livekit_sip.proto

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,9 @@ message TransferSIPParticipantRequest {
497497

498498
// Optionally play dialtone to the SIP participant as an audible indicator of being transferred
499499
bool play_dialtone = 4;
500+
501+
// Add the following headers to the REFER SIP request.
502+
map<string, string> headers = 5;
500503
}
501504

502505
message SIPCallInfo {

protobufs/rpc/sip.proto

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,5 +114,8 @@ message InternalTransferSIPParticipantRequest {
114114

115115
// Optionally play dialtone to the SIP participant as an audible indicator of being transferred
116116
bool play_dialtone = 3;
117+
118+
// Add the following headers to the REFER SIP request.
119+
map<string, string> headers = 4;
117120
}
118121

rpc/sip.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,17 @@ func NewCreateSIPParticipantRequest(
9898
MaxCallDuration: req.MaxCallDuration,
9999
}, nil
100100
}
101+
102+
// NewTransferSIPParticipantRequest fills InternalTransferSIPParticipantRequest from
103+
// livekit.TransferSIPParticipantRequest.
104+
func NewTransferSIPParticipantRequest(
105+
callID string,
106+
req *livekit.TransferSIPParticipantRequest,
107+
) (*InternalTransferSIPParticipantRequest, error) {
108+
return &InternalTransferSIPParticipantRequest{
109+
SipCallId: callID,
110+
TransferTo: req.TransferTo,
111+
PlayDialtone: req.PlayDialtone,
112+
Headers: req.Headers,
113+
}, nil
114+
}

rpc/sip.pb.go

Lines changed: 60 additions & 40 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)