SWITCH_DECLARE(uint8_t) switch_rtp_ready(switch_rtp_t *rtp_session)
{
- return (rtp_session != NULL && rtp_session->ready) ? 1 : 0;
+ return (rtp_session != NULL && rtp_session->sock && rtp_session->ready) ? 1 : 0;
}
SWITCH_DECLARE(void) switch_rtp_destroy(switch_rtp_t **rtp_session)
return;
}
+ rtp_session->ready = 0;
+
switch_mutex_lock((*rtp_session)->flag_mutex);
if ((*rtp_session)->dtmf_data.dtmf_buffer) {
rtp_session->last_time = switch_time_now();
}
- while(rtp_session->ready) {
+ while(switch_rtp_ready(rtp_session)) {
bytes = sizeof(rtp_msg_t);
status = switch_socket_recvfrom(rtp_session->from_addr, rtp_session->sock, 0, (void *)&rtp_session->recv_msg, &bytes);