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

Don't call close_pc in SIP plugin if there was no SDP (fixes #3332) #3339

Merged
merged 2 commits into from
Mar 25, 2024
Merged
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 src/ice.c
Original file line number Diff line number Diff line change
Expand Up @@ -1411,6 +1411,7 @@ janus_ice_handle *janus_ice_handle_create(void *core_session, const char *opaque
handle->queued_candidates = g_async_queue_new();
handle->queued_packets = g_async_queue_new();
janus_mutex_init(&handle->mutex);
janus_flags_set(&handle->webrtc_flags, JANUS_ICE_HANDLE_WEBRTC_ALERT);
janus_session_handles_insert(session, handle);
return handle;
}
Expand Down
19 changes: 13 additions & 6 deletions src/plugins/janus_sip.c
Original file line number Diff line number Diff line change
Expand Up @@ -696,8 +696,8 @@


/* Plugin information */
#define JANUS_SIP_VERSION 8
#define JANUS_SIP_VERSION_STRING "0.0.8"
#define JANUS_SIP_VERSION 9
#define JANUS_SIP_VERSION_STRING "0.0.9"
#define JANUS_SIP_DESCRIPTION "This is a simple SIP plugin for Janus, allowing WebRTC peers to register at a SIP server and call SIP user agents through a Janus instance."
#define JANUS_SIP_NAME "JANUS SIP plugin"
#define JANUS_SIP_AUTHOR "Meetecho s.r.l."
Expand Down Expand Up @@ -2466,7 +2466,7 @@ void janus_sip_setup_media(janus_plugin_session *handle) {
g_atomic_int_set(&session->establishing, 0);
g_atomic_int_set(&session->hangingup, 0);
janus_mutex_unlock(&sessions_mutex);
/* TODO Only relay RTP/RTCP when we get this event */
/* Only relay RTP/RTCP when we get this event */
}

void janus_sip_incoming_rtp(janus_plugin_session *handle, janus_plugin_rtp *packet) {
Expand Down Expand Up @@ -4286,7 +4286,7 @@ static void *janus_sip_handler(void *data) {
if(session->stack->s_nh_i == NULL) {
JANUS_LOG(LOG_WARN, "NUA Handle for 200 OK still null??\n");
}
int response_code = 486;
int response_code = 603;
json_t *code_json = json_object_get(root, "code");
if(code_json)
response_code = json_integer_value(code_json);
Expand Down Expand Up @@ -5141,8 +5141,15 @@ void janus_sip_sofia_callback(nua_event_t event, int status, char const *phrase,
session->hangup_reason_header = NULL;
session->hangup_reason_header_protocol = NULL;
session->hangup_reason_header_cause = NULL;
if(g_atomic_int_get(&session->establishing) || g_atomic_int_get(&session->established))
gateway->close_pc(session->handle);
if(g_atomic_int_get(&session->establishing) || g_atomic_int_get(&session->established)) {
if(session->media.has_audio || session->media.has_video) {
/* Get rid of the PeerConnection in the core */
gateway->close_pc(session->handle);
} else {
/* No SDP was exchanged, just clean up locally */
janus_sip_hangup_media_internal(session->handle);
}
}
} else if(session->stack->s_nh_i == nh && callstate == nua_callstate_calling && session->status == janus_sip_call_status_incall) {
/* Have just sent re-INVITE */
janus_sip_call_update_status(session, janus_sip_call_status_incall_reinviting);
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,8 @@ struct janus_callbacks {

/*! \brief Callback to ask the core to close a WebRTC PeerConnection
* \note A call to this method will result in the core invoking the hangup_media
* callback on this plugin when done
* callback on this plugin when done, but only if a PeerConnection had been
* created or was in the process of being negotiated (SDP exchanged)
* @param[in] handle The plugin/gateway session that the PeerConnection is related to */
void (* const close_pc)(janus_plugin_session *handle);
/*! \brief Callback to ask the core to get rid of a plugin/gateway session
Expand Down
Loading