diff --git a/libs/srtp/crypto/Makefile b/libs/srtp/crypto/Makefile index fe5ae96f33..d7ac61fb14 100644 --- a/libs/srtp/crypto/Makefile +++ b/libs/srtp/crypto/Makefile @@ -12,7 +12,7 @@ CC = gcc INCDIR = -Iinclude -I$(srcdir)/include DEFS = -DHAVE_CONFIG_H CPPFLAGS= -CFLAGS = -fPIC -Wall -O4 -fexpensive-optimizations -funroll-loops +CFLAGS = -Wall -O4 -fexpensive-optimizations -funroll-loops LIBS = LDFLAGS = -L. COMPILE = $(CC) $(DEFS) $(INCDIR) $(CPPFLAGS) $(CFLAGS) diff --git a/src/mod/endpoints/mod_dingaling/mod_dingaling.c b/src/mod/endpoints/mod_dingaling/mod_dingaling.c index fb9fdc65db..03a2459d6e 100644 --- a/src/mod/endpoints/mod_dingaling/mod_dingaling.c +++ b/src/mod/endpoints/mod_dingaling/mod_dingaling.c @@ -349,6 +349,28 @@ static void *SWITCH_THREAD_FUNC negotiate_thread_run(switch_thread *thread, void switch_core_session_set_read_codec(session, &tech_pvt->read_codec); switch_core_session_set_write_codec(session, &tech_pvt->write_codec); + if (!tech_pvt->rtp_session) { + const char *err; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SETUP RTP %s:%d -> %s:%d\n", tech_pvt->profile->ip, tech_pvt->local_port, tech_pvt->remote_ip, tech_pvt->remote_port); + + if (!(tech_pvt->rtp_session = switch_rtp_new(tech_pvt->profile->ip, + tech_pvt->local_port, + tech_pvt->remote_ip, + tech_pvt->remote_port, + tech_pvt->codec_num, + tech_pvt->read_codec.implementation->encoded_bytes_per_frame, + tech_pvt->read_codec.implementation->microseconds_per_frame, + 0, + NULL, + &err, switch_core_session_get_pool(tech_pvt->session)))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "RTP ERROR %s\n", err); + switch_channel_hangup(channel); + return NULL; + } + switch_rtp_activate_ice(tech_pvt->rtp_session, tech_pvt->remote_user, tech_pvt->local_user); + } + + //printf("WAIT %s %d\n", switch_channel_get_name(channel), switch_test_flag(tech_pvt, TFLAG_OUTBOUND)); if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) { @@ -1283,30 +1305,7 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi tech_pvt->cand_id = ldl_session_candidates(dlsession, cand, 1); tech_pvt->desc_id = ldl_session_describe(dlsession, payloads, 1, LDL_DESCRIPTION_ACCEPT); - - - if (!tech_pvt->rtp_session) { - const char *err; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SETUP RTP %s:%d -> %s:%d\n", profile->ip, tech_pvt->local_port, tech_pvt->remote_ip, tech_pvt->remote_port); - - if (!(tech_pvt->rtp_session = switch_rtp_new(profile->ip, - tech_pvt->local_port, - tech_pvt->remote_ip, - tech_pvt->remote_port, - tech_pvt->codec_num, - tech_pvt->read_codec.implementation->encoded_bytes_per_frame, - tech_pvt->read_codec.implementation->microseconds_per_frame, - 0, - NULL, - &err, switch_core_session_get_pool(tech_pvt->session)))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "RTP ERROR %s\n", err); - switch_channel_hangup(channel); - return LDL_STATUS_FALSE; - } - switch_set_flag(tech_pvt, TFLAG_RTP_READY); - switch_rtp_activate_ice(tech_pvt->rtp_session, tech_pvt->remote_user, tech_pvt->local_user); - } - + switch_set_flag(tech_pvt, TFLAG_RTP_READY); return LDL_STATUS_SUCCESS; } } diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 3cc0d9366c..e94a789db7 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -544,7 +544,7 @@ SWITCH_DECLARE(switch_status) switch_rtp_read(switch_rtp *rtp_session, void *dat int bytes = rtp_common_read(rtp_session, data, payload_type, flags); - if (bytes <= 0) { + if (bytes < 0) { *datalen = 0; return SWITCH_STATUS_GENERR; } @@ -562,7 +562,7 @@ SWITCH_DECLARE(switch_status) switch_rtp_zerocopy_read(switch_rtp *rtp_session, int bytes = rtp_common_read(rtp_session, data, payload_type, flags); *data = rtp_session->recv_msg.body; - if (bytes <= 0) { + if (bytes < 0) { *datalen = 0; return SWITCH_STATUS_GENERR; }