Skip to content

Commit

Permalink
Merge pull request #571 from shiguredo/feature/multi-forwarding-filter
Browse files Browse the repository at this point in the history
Feature/multi forwarding filter
  • Loading branch information
voluntas authored Oct 28, 2024
2 parents e989704 + 1804752 commit 2b99f5e
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
5 changes: 4 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@

## develop

- [ADD] メッセージングヘッダーに対応する
- [ADD] シグナリング項目に `forwarding_filters` を追加する
- @voluntas
- [ADD] DataChannel メッセージング機能のヘッダー項目を追加する
- `header: [{"type": "sender_connection_id"}]`
- @voluntas
- [CHANGE] Sora 側からの切断の SoraCloseEvent の title を `SHUTDOWN` に変更する
- @voluntas
Expand Down
31 changes: 30 additions & 1 deletion packages/sdk/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ export type SignalingConnectMessage = {
redirect?: true
data_channels?: SignalingConnectDataChannel[]
audio_streaming_language_code?: string
forwarding_filters?: JSONType
// @deprecated このオプションは非推奨です。将来のバージョンで削除される可能性があります。
forwarding_filter?: JSONType
}

Expand Down Expand Up @@ -325,6 +327,31 @@ export type DataChannelConfiguration = {
header?: MessagingHeaderField[]
}

type ForwardingFilterRuleField = 'connection_id' | 'client_id' | 'kind'

type ForwardingFilterRuleOperator = 'is_in' | 'is_not_in'

type ForwardingFilterRuleKindValue = 'audio' | 'video'

type ForwardingFilterRuleValue = string | ForwardingFilterRuleKindValue

type ForwardingFilterRule = {
field: ForwardingFilterRuleField
operator: ForwardingFilterRuleOperator
values: [ForwardingFilterRuleValue]
}

type ForwardingFilterAction = 'block' | 'allow'

type ForwardingFilter = {
version?: string
metadata?: JSONType
action?: ForwardingFilterAction
rules: [[ForwardingFilterRule]]
name?: string
priority?: number
}

export type ConnectionOptions = {
audio?: boolean
audioCodecType?: AudioCodecType
Expand Down Expand Up @@ -363,7 +390,9 @@ export type ConnectionOptions = {
dataChannels?: DataChannelConfiguration[]
bundleId?: string
audioStreamingLanguageCode?: string
forwardingFilter?: JSONType
forwardingFilters?: ForwardingFilter[]
// @deprecated このオプションは非推奨です。将来のバージョンで削除される可能性があります。
forwardingFilter?: ForwardingFilter

// Sora JavaScript SDK 内部で利用するオプション
// SDP で Answer に stereo=1 を追記する
Expand Down
3 changes: 3 additions & 0 deletions packages/sdk/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ export function createSignalingMessage(
if (options.signalingNotifyMetadata !== undefined) {
message.signaling_notify_metadata = options.signalingNotifyMetadata
}
if (options.forwardingFilters !== undefined) {
message.forwarding_filters = options.forwardingFilters
}
if (options.forwardingFilter !== undefined) {
message.forwarding_filter = options.forwardingFilter
}
Expand Down

0 comments on commit 2b99f5e

Please sign in to comment.