Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ The following channel variables are defined:
* janus-room-record - The value is specified in the *create* request to Janus and indicates that the room mix should be recorded (only applicable if janus-use-existing-room is false). The default value is not to record.
* janus-room-record-file - This value specifies the file name to which the recording should be written. It is passed in the *create* request to Janus (only applicable if janus-use-existing-room is false and janus-room-record is true). If omitted the default filename will be used.
* janus-room-pin - PIN that is used to validate a user entering the room. This value is used to set the PIN for a created room.
* janus-room-allow-ws-participants - When set, the *create* request sets Janus AudioBridge `allow_ws_participants=true`, allowing RTP-over-WebSocket joins later (e.g. BFF `ws-media-session`). Only applicable if janus-use-existing-room is false. Default is not to allow WebSocket media participants.
* janus-user-token - The token for the user that should be passed in the *join* request. NB. no method is provided to set the allowed tokens in the *create* room request. Ignored when the server is configured with `hmac-secret`; a signed token is generated instead.
* janus-hmac-token-ttl - Per-call lifetime (in seconds) for HMAC-signed tokens generated by mod_janus. Only has an effect when the server is configured with `hmac-secret`. Default is 7200 (2 hours), capped at 86400 (24 hours). Short-lived tokens used for session setup and long-poll requests use a fixed 300s TTL regardless of this value.
* janus-user-record - Janus should generate a file containing the audio from the user only. It is specified in the *configure* request. The default value is not to record.
Expand Down
10 changes: 9 additions & 1 deletion api.c
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,8 @@ janus_id_t apiGetSenderId(server_t *pServer, const janus_id_t serverId, const ch

janus_id_t apiCreateRoom(server_t *pServer, const janus_id_t serverId,
const janus_id_t senderId, const janus_id_t roomId, const char *pDescription,
switch_bool_t record, const char *pRecordingFile, const char *pPin, const char *pRoomIdStr) {
switch_bool_t record, const char *pRecordingFile, const char *pPin,
switch_bool_t allow_ws_participants, const char *pRoomIdStr) {
message_t request, *pResponse = NULL;
janus_id_t result = 0;

Expand Down Expand Up @@ -896,6 +897,13 @@ janus_id_t apiCreateRoom(server_t *pServer, const janus_id_t serverId,
}
}

if (allow_ws_participants) {
if (cJSON_AddBoolToObject(request.pJsonBody, "allow_ws_participants", cJSON_True) == NULL) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot create boolean (body.allow_ws_participants)\n");
goto done;
}
}

if (!(pJsonRequest = encode(request))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot create request\n");
goto done;
Expand Down
3 changes: 2 additions & 1 deletion api.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ switch_status_t apiClaimServerId(server_t *pServer, janus_id_t serverId);
janus_id_t apiGetSenderId(server_t *pServer, const janus_id_t serverId, const char *callId);
janus_id_t apiCreateRoom(server_t *pServer, const janus_id_t serverId,
const janus_id_t senderId, const janus_id_t roomId, const char *pDescription,
switch_bool_t record, const char *pRecordingFile, const char *pPin, const char *pRoomIdStr);
switch_bool_t record, const char *pRecordingFile, const char *pPin,
switch_bool_t allow_ws_participants, const char *pRoomIdStr);
switch_status_t apiJoin(server_t *pServer, int hmacTokenTtl,
const janus_id_t serverId, const janus_id_t senderId, const janus_id_t roomId,
const char *pDisplay, const char *pPin, const char *pToken, const char *callId, const char *pRoomIdStr);
Expand Down
1 change: 1 addition & 0 deletions mod_janus.c
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,7 @@ static switch_status_t channel_on_init(switch_core_session_t *session)
switch_channel_var_true(channel, "janus-room-record"),
switch_channel_get_variable(channel, "janus-room-record-file"),
switch_channel_get_variable(channel, "janus-room-pin"),
switch_channel_var_true(channel, "janus-room-allow-ws-participants"),
tech_pvt->pRoomIdStr) == 0) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to create room\n");
switch_channel_hangup(channel, SWITCH_CAUSE_INCOMPATIBLE_DESTINATION);
Expand Down