add rtp port allocator

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6658 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale
2007-12-11 19:15:02 +00:00
parent 4968e0f6a1
commit efb1b62938
9 changed files with 194 additions and 50 deletions
+4 -1
View File
@@ -153,7 +153,10 @@ SWITCH_STANDARD_APP(bcast_function)
}
if (ready == SEND_TYPE_RTP) {
rtp_port = switch_rtp_request_port();
if (!(rtp_port = switch_rtp_request_port(guess_ip))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "RTP Port Error\n");
goto fail;
}
switch_find_local_ip(guess_ip, sizeof(guess_ip), AF_INET);
rtp_session = switch_rtp_new(guess_ip,
rtp_port,
@@ -1697,7 +1697,11 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
switch_core_session_set_private(*new_session, tech_pvt);
tech_pvt->session = *new_session;
tech_pvt->codec_index = -1;
tech_pvt->local_port = switch_rtp_request_port();
if (!(tech_pvt->local_port = switch_rtp_request_port(tech_pvt->profile->ip))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "No RTP port available!\n");
terminate_session(new_session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
}
tech_pvt->recip = switch_core_session_strdup(*new_session, full_id);
tech_pvt->dnis = switch_core_session_strdup(*new_session, dnis);
} else {
@@ -2584,7 +2588,12 @@ static ldl_status handle_signalling(ldl_handle_t * handle, ldl_session_t * dlses
tech_pvt->session = session;
tech_pvt->codec_index = -1;
tech_pvt->profile = profile;
tech_pvt->local_port = switch_rtp_request_port();
if (!(tech_pvt->local_port = switch_rtp_request_port(profile->ip))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "No RTP port available!\n");
terminate_session(&session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
status = LDL_STATUS_FALSE;
goto done;
}
switch_set_flag_locked(tech_pvt, TFLAG_ANSWER);
tech_pvt->recip = switch_core_session_strdup(session, from);
if (!(exten = ldl_session_get_value(dlsession, "dnis"))) {
+8 -2
View File
@@ -398,7 +398,10 @@ switch_status_t sofia_glue_tech_choose_port(private_object_t *tech_pvt)
}
tech_pvt->local_sdp_audio_ip = ip;
tech_pvt->local_sdp_audio_port = switch_rtp_request_port();
if (!(tech_pvt->local_sdp_audio_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;
}
sdp_port = tech_pvt->local_sdp_audio_port;
if (tech_pvt->profile->extrtpip) {
@@ -428,7 +431,10 @@ switch_status_t sofia_glue_tech_choose_video_port(private_object_t *tech_pvt)
return SWITCH_STATUS_SUCCESS;
}
tech_pvt->local_sdp_video_port = switch_rtp_request_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;
}
sdp_port = tech_pvt->local_sdp_video_port;
if (tech_pvt->profile->extrtpip) {