Skip to content

Commit

Permalink
fix saving signed_tokens field when room is permanent
Browse files Browse the repository at this point in the history
  • Loading branch information
Timofey S committed Dec 28, 2021
1 parent f2cd392 commit 09a8695
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions plugins/janus_videoroom.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ room-<unique room ID>: {
"new_pin" : "<new password required to join the room, optional>",
"new_is_private" : <true|false, whether the room should appear in a list request>,
"new_require_pvtid" : <true|false, whether the room should require private_id from subscribers>,
"new_signed_tokens" : <true|false, whether access to the room requires signed tokens>,
"new_bitrate" : <new bitrate cap to force on all publishers (except those with custom overrides)>,
"new_fir_freq" : <new period for regular PLI keyframe requests to publishers>,
"new_publishers" : <new cap on the number of concurrent active WebRTC publishers>,
Expand Down Expand Up @@ -3445,6 +3446,8 @@ static json_t *janus_videoroom_process_synchronous_request(janus_videoroom_sessi
janus_config_add(config, c, janus_config_item_create("is_private", "yes"));
if(videoroom->require_pvtid)
janus_config_add(config, c, janus_config_item_create("require_pvtid", "yes"));
if(videoroom->signed_tokens)
janus_config_add(config, c, janus_config_item_create("signed_tokens", "yes"));
if(videoroom->require_e2ee)
janus_config_add(config, c, janus_config_item_create("require_e2ee", "yes"));
g_snprintf(value, BUFSIZ, "%"SCNu32, videoroom->bitrate);
Expand Down Expand Up @@ -3557,6 +3560,7 @@ static json_t *janus_videoroom_process_synchronous_request(janus_videoroom_sessi
json_t *desc = json_object_get(root, "new_description");
json_t *is_private = json_object_get(root, "new_is_private");
json_t *req_pvtid = json_object_get(root, "new_require_pvtid");
json_t *signed_tokens = json_object_get(root, "new_signed_tokens");
json_t *secret = json_object_get(root, "new_secret");
json_t *pin = json_object_get(root, "new_pin");
json_t *bitrate = json_object_get(root, "new_bitrate");
Expand Down Expand Up @@ -3589,6 +3593,13 @@ static json_t *janus_videoroom_process_synchronous_request(janus_videoroom_sessi
videoroom->is_private = json_is_true(is_private);
if(req_pvtid)
videoroom->require_pvtid = json_is_true(req_pvtid);
if(signed_tokens && json_is_true(signed_tokens)) {
if(!gateway->auth_is_signed()) {
JANUS_LOG(LOG_WARN, "Can't enforce signed tokens for this room, signed-mode not in use in the core\n");
} else {
videoroom->signed_tokens = TRUE;
}
}
if(publishers)
videoroom->max_publishers = json_integer_value(publishers);
if(bitrate) {
Expand Down Expand Up @@ -3629,6 +3640,8 @@ static json_t *janus_videoroom_process_synchronous_request(janus_videoroom_sessi
janus_config_add(config, c, janus_config_item_create("is_private", "yes"));
if(videoroom->require_pvtid)
janus_config_add(config, c, janus_config_item_create("require_pvtid", "yes"));
if(videoroom->signed_tokens)
janus_config_add(config, c, janus_config_item_create("signed_tokens", "yes"));
if(videoroom->require_e2ee)
janus_config_add(config, c, janus_config_item_create("require_e2ee", "yes"));
g_snprintf(value, BUFSIZ, "%"SCNu32, videoroom->bitrate);
Expand Down

0 comments on commit 09a8695

Please sign in to comment.