Skip to content

Commit

Permalink
Fix stuck sip sessions
Browse files Browse the repository at this point in the history
  • Loading branch information
ldt-jbecker committed Feb 23, 2024
1 parent b98e3bb commit 97aaeae
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/ice.c
Original file line number Diff line number Diff line change
Expand Up @@ -3571,6 +3571,14 @@ void janus_ice_setup_remote_candidates(janus_ice_handle *handle, guint stream_id
pc->process_started = TRUE;
}

void janus_ice_reset_webrtc_alert(janus_ice_handle *handle) {
if(!handle || g_atomic_int_get(&handle->destroyed))
if(janus_flags_is_set(&handle->webrtc_flags, JANUS_ICE_HANDLE_WEBRTC_HAS_AGENT)) {
JANUS_LOG(LOG_WARN, "[%"SCNu64"] Agent already exists?\n", handle->handle_id);
}
janus_flags_clear(&handle->webrtc_flags, JANUS_ICE_HANDLE_WEBRTC_ALERT);
}

int janus_ice_setup_local(janus_ice_handle *handle, gboolean offer, gboolean trickle, janus_dtls_role dtls_role) {
if(!handle || g_atomic_int_get(&handle->destroyed))
return -1;
Expand Down
2 changes: 2 additions & 0 deletions src/ice.h
Original file line number Diff line number Diff line change
Expand Up @@ -811,4 +811,6 @@ json_t *janus_ice_static_event_loops_info(void);
* @note This will wait for the related threads to exit, and so may delay the shutdown process */
void janus_ice_stop_static_event_loops(void);

void janus_ice_reset_webrtc_alert(janus_ice_handle *handle);

#endif
7 changes: 7 additions & 0 deletions src/janus.c
Original file line number Diff line number Diff line change
Expand Up @@ -3705,6 +3705,13 @@ int janus_plugin_push_event(janus_plugin_session *plugin_session, janus_plugin *
return JANUS_ERROR_JSEP_INVALID_SDP;
}
}
} else {
janus_ice_handle *ice_handle = (janus_ice_handle *)plugin_session->gateway_handle;
//~ if(ice_handle == NULL || janus_flags_is_set(&ice_handle->webrtc_flags, JANUS_ICE_HANDLE_WEBRTC_READY)) {
if(ice_handle == NULL) {
JANUS_LOG(LOG_ERR, "Invalid ICE handle\n");
}
janus_ice_reset_webrtc_alert(ice_handle);
}
/* Reference the payload, as the plugin may still need it and will do a decref itself */
json_incref(message);
Expand Down

0 comments on commit 97aaeae

Please sign in to comment.