fix sofia register stuff (update to this one if you use gateways)

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5122 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale
2007-05-10 16:15:07 +00:00
parent 33d3c1c2d2
commit c07224852c
5 changed files with 55 additions and 9 deletions
+14 -5
View File
@@ -480,8 +480,9 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
*extension = NULL,
*proxy = NULL,
*context = "default",
*expire_seconds = "3600";
*expire_seconds = "3600",
*retry_seconds = "30";
gateway->pool = profile->pool;
gateway->profile = profile;
gateway->name = switch_core_strdup(gateway->pool, name);
@@ -512,6 +513,8 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
context = val;
} else if (!strcmp(var, "expire-seconds")) {
expire_seconds = val;
} else if (!strcmp(var, "retry-seconds")) {
retry_seconds = val;
}
}
@@ -540,6 +543,12 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
if (!switch_true(register_str)) {
gateway->state = REG_STATE_NOREG;
}
gateway->retry_seconds = atoi(retry_seconds);
if (gateway->retry_seconds < 10) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "INVALID: retry_seconds correcting the value to 30\n");
gateway->retry_seconds = 30;
}
gateway->register_scheme = switch_core_strdup(gateway->pool, scheme);
gateway->register_context = switch_core_strdup(gateway->pool, context);
gateway->register_realm = switch_core_strdup(gateway->pool, realm);
@@ -568,9 +577,7 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
}
gateway->freq -= 2;
gateway->next = profile->gateways;
profile->gateways = gateway;
if ((gp = sofia_reg_find_gateway(gateway->name))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Ignoring duplicate gateway '%s'\n", gateway->name);
sofia_reg_release_gateway(gp);
@@ -581,6 +588,8 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Ignoring duplicate contact '%s'\n", gateway->register_from);
sofia_reg_release_gateway(gp);
} else {
gateway->next = profile->gateways;
profile->gateways = gateway;
sofia_reg_add_gateway(gateway->name, gateway);
sofia_reg_add_gateway(gateway->register_from, gateway);
sofia_reg_add_gateway(gateway->register_contact, gateway);