}
if (switch_core_session_receive_message(other_session, &msg) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Other leg is not available\n");
- nua_respond(tech_pvt->nh, 488, "Hangup in progress", TAG_END());
+ nua_respond(tech_pvt->nh, 403, "Hangup in progress", TAG_END());
}
switch_core_session_rwunlock(other_session);
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Passing SDP to other leg.\n%s\n", r_sdp);
if (switch_core_session_receive_message(other_session, &msg) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Other leg is not available\n");
- nua_respond(tech_pvt->nh, 488, "Hangup in progress", TAG_END());
+ nua_respond(tech_pvt->nh, 403, "Hangup in progress", TAG_END());
}
switch_core_session_rwunlock(other_session);
} else {
return SWITCH_STATUS_SUCCESS;
}
+SWITCH_DECLARE(void) switch_rtp_break(switch_rtp_t *rtp_session)
+{
+ char o = 42;
+ switch_size_t len = sizeof(o);
+
+ switch_assert(rtp_session != NULL);
+ switch_mutex_lock(rtp_session->flag_mutex);
+ if (rtp_session->sock) {
+ switch_set_flag_locked(rtp_session, SWITCH_RTP_FLAG_BREAK);
+ switch_socket_sendto(rtp_session->sock, rtp_session->local_addr, 0, (void *) &o, &len);
+ }
+ switch_mutex_unlock(rtp_session->flag_mutex);
+}
+
SWITCH_DECLARE(void) switch_rtp_kill_socket(switch_rtp_t *rtp_session)
{
switch_assert(rtp_session != NULL);
switch_mutex_lock(rtp_session->flag_mutex);
if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_IO)) {
switch_clear_flag(rtp_session, SWITCH_RTP_FLAG_IO);
- switch_assert(rtp_session->sock != NULL);
- switch_socket_shutdown(rtp_session->sock, SWITCH_SHUTDOWN_READWRITE);
+ if (rtp_session->sock) {
+ switch_socket_shutdown(rtp_session->sock, SWITCH_SHUTDOWN_READWRITE);
+ }
}
switch_mutex_unlock(rtp_session->flag_mutex);
}
bytes = sizeof(rtp_msg_t);
status = switch_socket_recvfrom(rtp_session->from_addr, rtp_session->sock, 0, (void *) &rtp_session->recv_msg, &bytes);
+ if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_BREAK)) {
+ switch_clear_flag_locked(rtp_session, SWITCH_RTP_FLAG_BREAK);
+ bytes = 0;
+ do_cng = 1;
+ goto cng;
+ }
+
if (bytes && switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA)) {
/* Fast PASS! */
*flags |= SFF_PROXY_PACKET;
do_cng = 1;
}
-
- if (do_cng || (!bytes && switch_test_flag(rtp_session, SWITCH_RTP_FLAG_BREAK))) {
- switch_clear_flag_locked(rtp_session, SWITCH_RTP_FLAG_BREAK);
+ cng:
+ if (do_cng) {
memset(&rtp_session->recv_msg.body, 0, 2);
rtp_session->recv_msg.body[0] = 127;
rtp_session->recv_msg.header.pt = SWITCH_RTP_CNG_PAYLOAD;