Skip to content
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

Forwarding Filter に version と metadata を追加する #51

Merged
merged 8 commits into from
Jan 15, 2024
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@

## develop

- [ADD] Forwarding Filter の項目に Version と Metadata を追加
- Version と Metadata はオプション項目として追加し、値がない場合は項目を設定しない
- 既存の Action も同様にオプション項目なので、値がない場合は項目を設定しないよう修正
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

action を optional にするのは微妙に破壊的変更なので、こっちは CHANGE にした方が良さそう

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ありがとうございます。
確かに、ここはまとめてはダメな箇所でした。
CHANGES を修正します。

- @torikizi

## 2023.17.0 (2023-12-25)

- [UPDATE] WebRTC を `m120.6099.1.2` に上げる
Expand Down
4 changes: 3 additions & 1 deletion include/sora/sora_signaling.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,15 @@ struct SoraSignalingConfig {
std::vector<DataChannel> data_channels;

struct ForwardingFilter {
std::string action;
boost::optional<std::string> action;
struct Rule {
std::string field;
std::string op;
std::vector<std::string> values;
};
std::vector<std::vector<Rule>> rules;
boost::optional<std::string> version;
boost::optional<boost::json::value> metadata;
};
boost::optional<ForwardingFilter> forwarding_filter;

Expand Down
10 changes: 9 additions & 1 deletion src/sora_signaling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,9 @@ void SoraSignaling::DoSendConnect(bool redirect) {
if (config_.forwarding_filter) {
boost::json::object obj;
auto& f = *config_.forwarding_filter;
obj["action"] = f.action;
if (f.action) {
obj["action"] = *f.action;
}
obj["rules"] = boost::json::array();
for (const auto& rules : f.rules) {
boost::json::array ar;
Expand All @@ -464,6 +466,12 @@ void SoraSignaling::DoSendConnect(bool redirect) {
}
obj["rules"].as_array().push_back(ar);
}
if (f.version) {
obj["version"] = *f.version;
}
if (f.metadata) {
obj["metadata"] = *f.metadata;
}
m["forwarding_filter"] = obj;
}

Expand Down