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
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@

## develop

- [FIX] Forwarding Filter の Action 項目は本来オプション項目だったが、 action は `std::optional` 型になっていなかったため修正
- @torikizi
- [ADD] Forwarding Filter の項目に Version と Metadata を追加
- Version と Metadata はオプション項目として追加し、値がない場合は項目を設定しない
- @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