add multiple rtp-ip support to sofia profiles

add extra rtp-ip params to a profile to add more ip which will be used round-robin as new calls progress.
This commit is contained in:
Anthony Minessale
2010-06-10 17:08:29 -05:00
parent 2e347c9326
commit 22569d4ac5
4 changed files with 67 additions and 34 deletions
+9 -5
View File
@@ -3005,7 +3005,11 @@ switch_status_t config_sofia(int reload, char *profile_name)
} else {
ip = strcasecmp(val, "auto") ? val : mod_sofia_globals.guess_ip;
}
profile->rtpip = switch_core_strdup(profile->pool, ip);
if (profile->rtpip_index < MAX_RTPIP) {
profile->rtpip[profile->rtpip_index++] = switch_core_strdup(profile->pool, ip);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Max IPs configured for profile %s.\n", profile->name);
}
} else if (!strcasecmp(var, "sip-ip")) {
char *ip = mod_sofia_globals.guess_ip;
@@ -3416,8 +3420,8 @@ switch_status_t config_sofia(int reload, char *profile_name)
profile->sipip = switch_core_strdup(profile->pool, mod_sofia_globals.guess_ip);
}
if (!profile->rtpip) {
profile->rtpip = switch_core_strdup(profile->pool, mod_sofia_globals.guess_ip);
if (!profile->rtpip[0]) {
profile->rtpip[profile->rtpip_index++] = switch_core_strdup(profile->pool, mod_sofia_globals.guess_ip);
}
if (switch_core_get_variable("nat_type")) {
@@ -3443,9 +3447,9 @@ switch_status_t config_sofia(int reload, char *profile_name)
profile->username = switch_core_strdup(profile->pool, "FreeSWITCH");
}
if (!profile->rtpip) {
if (!profile->rtpip[0]) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Setting ip to '127.0.0.1'\n");
profile->rtpip = switch_core_strdup(profile->pool, "127.0.0.1");
profile->rtpip[profile->rtpip_index++] = switch_core_strdup(profile->pool, "127.0.0.1");
}
if (!profile->sip_port) {