Skip to content

Commit b5a1c15

Browse files
authored
Adding configurable display name (#459)
1 parent ad3ba54 commit b5a1c15

File tree

4 files changed

+18
-9
lines changed

4 files changed

+18
-9
lines changed

go.mod

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ require (
1212
github.com/livekit/mageutil v0.0.0-20250511045019-0f1ff63f7731
1313
github.com/livekit/media-sdk v0.0.0-20250918175425-11d305ef5503
1414
github.com/livekit/mediatransportutil v0.0.0-20250519131108-fb90f5acfded
15-
github.com/livekit/protocol v1.40.1-0.20250827075523-9bd0fc7c95be
16-
github.com/livekit/psrpc v0.6.1-0.20250726180611-3915e005e741
15+
github.com/livekit/protocol v1.41.1-0.20250919162624-3476f457ed91
16+
github.com/livekit/psrpc v0.7.0
1717
github.com/livekit/server-sdk-go/v2 v2.11.1
1818
github.com/livekit/sipgo v0.13.2-0.20250601220430-a77cc3f220fb
1919
github.com/mjibson/go-dsp v0.0.0-20180508042940-11479a337f12
@@ -33,6 +33,7 @@ require (
3333
)
3434

3535
require (
36+
github.com/nyaruka/phonenumbers v1.6.5 // indirect
3637
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
3738
go.opentelemetry.io/otel v1.37.0 // indirect
3839
go.opentelemetry.io/otel/metric v1.37.0 // indirect

go.sum

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,10 @@ github.com/livekit/media-sdk v0.0.0-20250918175425-11d305ef5503 h1:zQsJzxh3Xzg+L
127127
github.com/livekit/media-sdk v0.0.0-20250918175425-11d305ef5503/go.mod h1:7ssWiG+U4xnbvLih9WiZbhQP6zIKMjgXdUtIE1bm/E8=
128128
github.com/livekit/mediatransportutil v0.0.0-20250519131108-fb90f5acfded h1:ylZPdnlX1RW9Z15SD4mp87vT2D2shsk0hpLJwSPcq3g=
129129
github.com/livekit/mediatransportutil v0.0.0-20250519131108-fb90f5acfded/go.mod h1:mSNtYzSf6iY9xM3UX42VEI+STHvMgHmrYzEHPcdhB8A=
130-
github.com/livekit/protocol v1.40.1-0.20250827075523-9bd0fc7c95be h1:KeqTnGdU8HybxjAjQNAHTZ3nEFVynqgK4ZmiQfz3cl8=
131-
github.com/livekit/protocol v1.40.1-0.20250827075523-9bd0fc7c95be/go.mod h1:Scx8arfj5y65w6EYA3ZIKJafoN2xBuV8pauvyrvI4eg=
132-
github.com/livekit/psrpc v0.6.1-0.20250726180611-3915e005e741 h1:KKL1u94l6dF9u4cBwnnfozk27GH1txWy2SlvkfgmzoY=
133-
github.com/livekit/psrpc v0.6.1-0.20250726180611-3915e005e741/go.mod h1:AuDC5uOoEjQJEc69v4Li3t77Ocz0e0NdjQEuFfO+vfk=
130+
github.com/livekit/protocol v1.41.1-0.20250919162624-3476f457ed91 h1:XoxTN5GkqZCrUz02bTxQQhB34yDgSWnmVv12oQJgpuo=
131+
github.com/livekit/protocol v1.41.1-0.20250919162624-3476f457ed91/go.mod h1:vhMS30QoEyH2p34vi6X1eWkC4EMV72ZGZwQb74ajY7A=
132+
github.com/livekit/psrpc v0.7.0 h1:rtfqfjYN06WJYloE/S0nmkJ/Y04x4pxLQLe8kQ4FVHU=
133+
github.com/livekit/psrpc v0.7.0/go.mod h1:AuDC5uOoEjQJEc69v4Li3t77Ocz0e0NdjQEuFfO+vfk=
134134
github.com/livekit/server-sdk-go/v2 v2.11.1 h1:mBRlkstQxueAl+2BHqQad1wTzbyyC4DYbA6VE1UUajw=
135135
github.com/livekit/server-sdk-go/v2 v2.11.1/go.mod h1:x9JXFdPeDPr0jdObS7pPfcytxYLdxNQhLk0pK/NcHSg=
136136
github.com/livekit/sipgo v0.13.2-0.20250601220430-a77cc3f220fb h1:onh9h110573vcxmse38aSZifEsRB8bbrXu2VYVt8PC0=
@@ -161,6 +161,8 @@ github.com/nats-io/nkeys v0.4.11 h1:q44qGV008kYd9W1b1nEBkNzvnWxtRSQ7A8BoqRrcfa0=
161161
github.com/nats-io/nkeys v0.4.11/go.mod h1:szDimtgmfOi9n25JpfIdGw12tZFYXqhGxjhVxsatHVE=
162162
github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw=
163163
github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
164+
github.com/nyaruka/phonenumbers v1.6.5 h1:aBCaUhfpRA7hU6fsXk+p7KF1aNx4nQlq9hGeo2qdFg8=
165+
github.com/nyaruka/phonenumbers v1.6.5/go.mod h1:7gjs+Lchqm49adhAKB5cdcng5ZXgt6x7Jgvi0ZorUtU=
164166
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
165167
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
166168
github.com/opencontainers/image-spec v1.1.0 h1:8SG7/vwALn54lVB/0yZ/MMwhFrPYtpEHQb2IpWsCzug=

pkg/sip/client.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ func (c *Client) createSIPParticipant(ctx context.Context, req *rpc.InternalCrea
221221
maxCallDuration: req.MaxCallDuration.AsDuration(),
222222
enabledFeatures: req.EnabledFeatures,
223223
mediaEncryption: enc,
224+
displayName: req.DisplayName,
224225
}
225226
log.Infow("Creating SIP participant")
226227
call, err := c.newCall(ctx, c.conf, log, LocalTag(req.SipCallId), roomConf, sipConf, state, req.ProjectId)

pkg/sip/outbound.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ type sipOutboundConfig struct {
6262
maxCallDuration time.Duration
6363
enabledFeatures []livekit.SIPFeature
6464
mediaEncryption sdp.Encryption
65+
displayName *string
6566
}
6667

6768
type outboundCall struct {
@@ -113,7 +114,7 @@ func (c *Client) newCall(ctx context.Context, conf *config.Config, log logger.Lo
113114
Host: sipConf.host,
114115
Addr: contact.Addr,
115116
Transport: tr,
116-
}, contact, func(headers map[string]string) map[string]string {
117+
}, contact, sipConf.displayName, func(headers map[string]string) map[string]string {
117118
c := call
118119
if len(c.sipConf.attrsToHeaders) == 0 {
119120
return headers
@@ -648,10 +649,14 @@ func (c *outboundCall) transferCall(ctx context.Context, transferTo string, head
648649
return nil
649650
}
650651

651-
func (c *Client) newOutbound(log logger.Logger, id LocalTag, from, contact URI, getHeaders setHeadersFunc) *sipOutbound {
652+
func (c *Client) newOutbound(log logger.Logger, id LocalTag, from, contact URI, displayName *string, getHeaders setHeadersFunc) *sipOutbound {
652653
from = from.Normalize()
654+
if displayName == nil { // Nothing specified, preserve legacy behavior
655+
displayName = &from.User
656+
}
657+
653658
fromHeader := &sip.FromHeader{
654-
DisplayName: from.User,
659+
DisplayName: *displayName,
655660
Address: *from.GetURI(),
656661
Params: sip.NewParams(),
657662
}

0 commit comments

Comments
 (0)