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 Jan 10, 2022
1 parent f2cd392 commit a3bb23f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions plugins/janus_videoroom.c
Original file line number Diff line number Diff line change
Expand Up @@ -2328,11 +2328,14 @@ int janus_videoroom_init(janus_callbacks *callback, const char *config_path) {
videoroom->is_private = priv && priv->value && janus_is_true(priv->value);
videoroom->require_pvtid = req_pvtid && req_pvtid->value && janus_is_true(req_pvtid->value);
if(signed_tokens && signed_tokens->value && janus_is_true(signed_tokens->value)) {
JANUS_LOG(LOG_INFO, "Room id %s signed_tokens value: %s\n", videoroom->room_id_str, signed_tokens->value);
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;
}
} else {
JANUS_LOG(LOG_INFO, "Room id %s signed_tokens value: false\n", videoroom->room_id_str);
}
videoroom->require_e2ee = req_e2ee && req_e2ee->value && janus_is_true(req_e2ee->value);
videoroom->max_publishers = 3; /* FIXME How should we choose a default? */
Expand Down Expand Up @@ -3005,6 +3008,7 @@ static int janus_videoroom_access_room(json_t *root, gboolean check_modify, gboo
}
}
if(check_join) {
JANUS_LOG(LOG_INFO, "check_join = true (%s)\n", room_id_str);
char error_cause2[100];
/* Signed tokens are enforced, so they precede any pin validation */
if(gateway->auth_is_signed() && (*videoroom)->signed_tokens) {
Expand All @@ -3024,6 +3028,8 @@ static int janus_videoroom_access_room(json_t *root, gboolean check_modify, gboo
g_strlcpy(error_cause, error_cause2, error_cause_size);
return error_code;
}
} else {
JANUS_LOG(LOG_INFO, "check_join = false (%s)\n", room_id_str);
}
return 0;
}
Expand Down Expand Up @@ -3445,6 +3451,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 @@ -3629,6 +3637,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 a3bb23f

Please sign in to comment.