[Freeswitch-trunk] [commit] r6913 - in freeswitch/trunk/src: . include mod/endpoints/mod_dingaling mod/endpoints/mod_sofia
Freeswitch SVN
anthm at freeswitch.org
Thu Dec 20 10:41:46 EST 2007
Author: anthm
Date: Thu Dec 20 10:41:45 2007
New Revision: 6913
Modified:
freeswitch/trunk/src/include/switch_rtp.h
freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c
freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
freeswitch/trunk/src/switch_rtp.c
Log:
add more code to free rtp ports
Modified: freeswitch/trunk/src/include/switch_rtp.h
==============================================================================
--- freeswitch/trunk/src/include/switch_rtp.h (original)
+++ freeswitch/trunk/src/include/switch_rtp.h Thu Dec 20 10:41:45 2007
@@ -75,7 +75,7 @@
\return the new port to use
*/
SWITCH_DECLARE(switch_port_t) switch_rtp_request_port(const char *ip);
-
+SWITCH_DECLARE(void) switch_rtp_release_port(const char *ip, switch_port_t port);
/*!
\brief create a new RTP session handle
\param new_rtp_session a poiter to aim at the new session
Modified: freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c Thu Dec 20 10:41:45 2007
@@ -687,6 +687,11 @@
tech_pvt = switch_core_session_get_private(*session);
+
+ if (tech_pvt->profile->ip && tech_pvt->local_port) {
+ switch_rtp_release_port(tech_pvt->profile->ip, tech_pvt->local_port);
+ }
+
if (!switch_core_session_running(*session) && (!tech_pvt || !switch_test_flag(tech_pvt, TFLAG_READY))) {
switch_core_session_destroy(session);
return;
@@ -1209,6 +1214,10 @@
tech_pvt = switch_core_session_get_private(session);
switch_assert(tech_pvt != NULL);
+ if (tech_pvt->profile->ip && tech_pvt->local_port) {
+ switch_rtp_release_port(tech_pvt->profile->ip, tech_pvt->local_port);
+ }
+
switch_clear_flag_locked(tech_pvt, TFLAG_IO);
switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
switch_set_flag_locked(tech_pvt, TFLAG_BYE);
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c Thu Dec 20 10:41:45 2007
@@ -201,7 +201,10 @@
tech_pvt = (private_object_t *) switch_core_session_get_private(session);
switch_assert(tech_pvt != NULL);
-
+
+ if (tech_pvt->profile->rtpip && tech_pvt->local_sdp_audio_port) {
+ switch_rtp_release_port(tech_pvt->profile->rtpip, tech_pvt->local_sdp_audio_port);
+ }
if (switch_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
const char *buuid;
Modified: freeswitch/trunk/src/switch_rtp.c
==============================================================================
--- freeswitch/trunk/src/switch_rtp.c (original)
+++ freeswitch/trunk/src/switch_rtp.c Thu Dec 20 10:41:45 2007
@@ -316,16 +316,16 @@
return END_PORT;
}
-static void release_port(const char *host, switch_port_t port)
+SWITCH_DECLARE(void) switch_rtp_release_port(const char *ip, switch_port_t port)
{
switch_core_port_allocator_t *alloc = NULL;
- if (!host) {
+ if (!ip) {
return;
}
switch_mutex_lock(port_lock);
- if ((alloc = switch_core_hash_find(alloc_hash, host))) {
+ if ((alloc = switch_core_hash_find(alloc_hash, ip))) {
switch_core_port_allocator_free_port(alloc, port);
}
switch_mutex_unlock(port_lock);
@@ -634,7 +634,7 @@
rtp_session->rx_host = switch_core_strdup(rtp_session->pool, rx_host);
rtp_session->rx_port = rx_port;
} else {
- release_port(rx_host, rx_port);
+ switch_rtp_release_port(rx_host, rx_port);
}
return rtp_session;
@@ -731,7 +731,7 @@
switch_core_timer_destroy(&(*rtp_session)->timer);
}
- release_port((*rtp_session)->rx_host, (*rtp_session)->rx_port);
+ switch_rtp_release_port((*rtp_session)->rx_host, (*rtp_session)->rx_port);
switch_mutex_unlock((*rtp_session)->flag_mutex);
return;
More information about the Freeswitch-trunk
mailing list