diff --git a/src/mod/endpoints/mod_dingaling/mod_dingaling.c b/src/mod/endpoints/mod_dingaling/mod_dingaling.c index ebf3deafc2..367d97b3bc 100644 --- a/src/mod/endpoints/mod_dingaling/mod_dingaling.c +++ b/src/mod/endpoints/mod_dingaling/mod_dingaling.c @@ -1682,7 +1682,7 @@ static void setup_codecs(struct private_object *tech_pvt) } - if (!payloads[1].id) { + if (!payloads[1].id && tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port) { switch_rtp_release_port(tech_pvt->profile->ip, tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port); tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port = 0; } @@ -2846,7 +2846,7 @@ static void set_profile_val(mdl_profile_t *profile, char *var, char *val) } else if (val && !strcasecmp(val, "md5")) { profile->user_flags |= LDL_FLAG_SASL_MD5; } - } else if (!strcasecmp(var, "use-jingle") && !zstr(val)) { + } else if (!strcasecmp(var, "use-jingle") && switch_true(val)) { profile->user_flags |= LDL_FLAG_JINGLE; } else if (!strcasecmp(var, "exten") && !zstr(val)) { profile->exten = switch_core_strdup(module_pool, val); diff --git a/src/switch_core_port_allocator.c b/src/switch_core_port_allocator.c index 4b15318274..5863fddafe 100644 --- a/src/switch_core_port_allocator.c +++ b/src/switch_core_port_allocator.c @@ -174,7 +174,13 @@ SWITCH_DECLARE(switch_status_t) switch_core_port_allocator_free_port(switch_core switch_status_t status = SWITCH_STATUS_FALSE; int even = switch_test_flag(alloc, SPF_EVEN); int odd = switch_test_flag(alloc, SPF_ODD); - int index = port - alloc->start; + int index; + + if (port < alloc->start) { + return SWITCH_STATUS_GENERR; + } + + index = port - alloc->start; if (!(even && odd)) { index /= 2; diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 538a44fe16..f0749d8087 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -1229,7 +1229,7 @@ SWITCH_DECLARE(void) switch_rtp_release_port(const char *ip, switch_port_t port) { switch_core_port_allocator_t *alloc = NULL; - if (!ip) { + if (!ip || !port) { return; }