-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for key/value attributes on Participant #733
Conversation
Key/value attributes lets us: * allow various components to provide more information about the participant (i.e. SIP including the phone number) * allow Agents to communicate their own status to the end user via RTC * enable applications to update specific fields without overriding others
🦋 Changeset detectedLatest commit: a4d0f89 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR 💥 An error occurred when fetching the changed packages and changesets in this PR
|
for sip we need a way to copy information about the caller from the sip api to the participant. this data is created once when the participant is created and never updated. for agents we need a way to change the job config after the job is dispatched ie. update the voice or language. this config is initially copied from the job description to the job and can be modified while the job is running. ideally this would work the same way for both room and publisher jobs. for sip i'm not sure we've considered the privacy implications of broadcasting pii to everyone in the room. caller information should not be part of the participant api. it does not change so we do not need to retransmit it and we should deliver it only to privileged participants. similarly agent config updates should not be delivered to every participant in a room. any private information the agent needs would be publicly visible. for agents the proposed change does not provide a way to update room jobs or to update one job specifically. developers could implement their own namespaces and try to avoid collisions but this is kludgy... we should define a new message type for agents we should add signal and agents api methods for updating jobs. this can work the same as the proposed changes to the update participant apis but specify job rather than participant subjects. updates can be delivered to the agent worker ws and dispatched to the running job by the agent client framework. |
Sorry, did not read @paulwe 's comments before bonking this. I think this needs more discussion after reading his comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@davidzhao Looks good! For SIP we'll also need it in a few other places (like CreateSIPParticipant
and DispatchRule
). Should I edit this PR directly?
But @paulwe made a good point about a separate permission. Initially I thought that we could reuse hide_phone_number
that we already have, but I guess users will want to have it both ways - hide for participants, but show for agents and other services.
So @paulwe do I understand correctly that you still propose to completely move SIP part out of Participant
and deliver it separately as an update? Is there a way to deliver it with the first participant info, so that other services won't need to wait for a separate update to arrive?
I've synced with Paul. He had two concerns:
This is a good callout. The decision of exposing the phone number vs not should not be up to us, but it should be up to the developer.
Paul was saying it would be more clear to have specific APIs for each use case. While I don't disagree, I think it becomes a burden on the client teams to implement a lot of different features. For that reason, I personally prefer general constructs. @dennwc for 1, do you think this can be a SIP specific option? for example, a setting to indicate if a user's phone number should be anonymous. Perhaps it should be specified on the trunk or dispatch rule? |
Yes, we already have a |
@davidzhao I added SIP-related attributes, should be good to go from my side. Please check the attribute prefix for SIP, we won't be able to change it later. |
livekit/attrs.go
Outdated
// Names of participant attributes for SIP. | ||
const ( | ||
// AttrSIPPrefix is shared for all SIP attributes. | ||
AttrSIPPrefix = "lk.sip." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you think the lk.
namespace adds value here? IMO since we don't have any reserved namespace, it could just be tagged SIP?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason for us not wanting a reserved namespace?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the mechanism for us to set these attributes is via token grants, we do not have a way to enforce that a particular component is SIP vs something else. Since the developer is responsible for issuing tokens, they should be "trusting" information that they are providing.
One more note, there's no way currently to set attributes on participant creation, right? |
ah yeah.. I will add that in a few |
Also worth adding a changeset. |
will do! |
One thing I'm unsure about is using the same permission for both metadata and attributes. |
I think for certain attributes, you do want the participant to update: i.e. their current state or preferences. Do you think it makes sense to have another permission |
yeah, totally agree, for certain use cases (esp. agents) that makes a lot of sense.
that's what I was thinking, yeah. Not sure if it's worth it though, we'd probably want a separate signal message then as well just for the attributes... |
I guess the question is.. do we see any use cases where it makes sense to allow participants to update one, but not the other? If so it might be worth it to separate. |
# Conflicts: # livekit/livekit_sip.pb.go # livekit/livekit_sip.twirp.go # rpc/sip.go
I tried integrating this change to SIP, and it looks like it will have to send attribute update at least once too. Some headers are available only later during the call, there's no way to bake them into the token. But all SIP attrs mentioned in this PR can be. |
decided to keep the permissions the same, in order to avoid additional complexity without a use case that requires it. merging. |
This picks up after #728
Key/value attributes lets us: