From 983ca0086dfe74075790e5fcea385ab19a8ce579 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sat, 8 Mar 2008 21:37:17 +0000 Subject: [PATCH] update git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7848 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/endpoints/mod_sofia/mod_sofia.c | 8 ++++++-- src/mod/endpoints/mod_sofia/sofia_glue.c | 17 +++++++++++------ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 3efb6a1651..248878c1c1 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -223,8 +223,12 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session) switch_call_cause_t cause = switch_channel_get_cause(channel); int sip_cause = hangup_cause_to_sip(cause); - 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 (tech_pvt->profile->rtpip) { + if (tech_pvt->local_sdp_audio_port) { + switch_rtp_release_port(tech_pvt->profile->rtpip, tech_pvt->local_sdp_audio_port); + } else if (tech_pvt->local_sdp_video_port) { + switch_rtp_release_port(tech_pvt->profile->rtpip, tech_pvt->local_sdp_video_port); + } } if (switch_test_flag(tech_pvt, TFLAG_SIP_HOLD) && cause != SWITCH_CAUSE_ATTENDED_TRANSFER) { diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 586a37b556..cda7b7c2e0 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -488,8 +488,9 @@ switch_status_t sofia_glue_tech_choose_port(private_object_t *tech_pvt, int forc return SWITCH_STATUS_SUCCESS; } } - if (tech_pvt->adv_sdp_audio_port) { - switch_rtp_release_port(tech_pvt->adv_sdp_audio_ip, tech_pvt->adv_sdp_audio_port); + + if (tech_pvt->local_sdp_audio_port) { + switch_rtp_release_port(tech_pvt->profile->rtpip, tech_pvt->local_sdp_audio_port); } @@ -527,6 +528,10 @@ switch_status_t sofia_glue_tech_choose_video_port(private_object_t *tech_pvt) return SWITCH_STATUS_SUCCESS; } + if (tech_pvt->local_sdp_video_port) { + switch_rtp_release_port(tech_pvt->profile->rtpip, tech_pvt->local_sdp_video_port); + } + if (!(tech_pvt->local_sdp_video_port = switch_rtp_request_port(tech_pvt->profile->rtpip))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "No RTP ports available!\n"); return SWITCH_STATUS_FALSE; @@ -1634,11 +1639,11 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f sofia_glue_check_video_codecs(tech_pvt); - if (!tech_pvt->local_sdp_video_port) { - sofia_glue_tech_choose_video_port(tech_pvt); - } - if (switch_test_flag(tech_pvt, TFLAG_VIDEO) && tech_pvt->video_rm_encoding) { + if (!tech_pvt->local_sdp_video_port) { + sofia_glue_tech_choose_video_port(tech_pvt); + } + flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_USE_TIMER | SWITCH_RTP_FLAG_AUTOADJ | SWITCH_RTP_FLAG_DATAWAIT | SWITCH_RTP_FLAG_NOBLOCK | SWITCH_RTP_FLAG_RAW_WRITE); sofia_glue_tech_set_video_codec(tech_pvt, 0);