add registration-thread-frequency param

This commit is contained in:
Anthony Minessale 2012-01-09 17:17:03 -06:00
parent c614b9d586
commit 5b7e20133a
3 changed files with 20 additions and 3 deletions

View File

@ -647,6 +647,7 @@ struct sofia_profile {
su_strlst_t *tls_verify_in_subjects;
uint32_t sip_force_expires;
uint32_t sip_expires_max_deviation;
int ireg_seconds;
};
struct private_object {

View File

@ -1570,7 +1570,7 @@ void watchdog_triggered_abort(void) {
void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread, void *obj)
{
sofia_profile_t *profile = (sofia_profile_t *) obj;
uint32_t ireg_loops = IREG_SECONDS; /* Number of loop iterations done when we haven't checked for registrations */
uint32_t ireg_loops = profile->ireg_seconds; /* Number of loop iterations done when we haven't checked for registrations */
uint32_t gateway_loops = GATEWAY_SECONDS; /* Number of loop iterations done when we haven't checked for gateways */
void *pop = NULL; /* queue_pop placeholder */
switch_size_t sql_len = 1024 * 32; /* length of sqlbuf */
@ -2972,6 +2972,11 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile)
sofia_glue_parse_rtp_bugs(&profile->auto_rtp_bugs, val);
} else if (!strcasecmp(var, "manual-rtp-bugs")) {
sofia_glue_parse_rtp_bugs(&profile->manual_rtp_bugs, val);
} else if (!strcasecmp(var, "registration-thread-frequency")) {
profile->ireg_seconds = atoi(val);
if (profile->ireg_seconds < 0) {
profile->ireg_seconds = IREG_SECONDS;
}
} else if (!strcasecmp(var, "user-agent-string")) {
profile->user_agent = switch_core_strdup(profile->pool, val);
} else if (!strcasecmp(var, "auto-restart")) {
@ -3693,6 +3698,8 @@ switch_status_t config_sofia(int reload, char *profile_name)
sofia_set_pflag(profile, PFLAG_CID_IN_1XX);
profile->ndlb |= PFLAG_NDLB_ALLOW_NONDUP_SDP;
profile->te = 101;
profile->ireg_seconds = IREG_SECONDS;
profile->tls_verify_policy = TPTLS_VERIFY_NONE;
/* lib default */
@ -3732,6 +3739,11 @@ switch_status_t config_sofia(int reload, char *profile_name)
} else {
sofia_clear_pflag(profile, PFLAG_FORWARD_MWI_NOTIFY);
}
} else if (!strcasecmp(var, "registration-thread-frequency")) {
profile->ireg_seconds = atoi(val);
if (profile->ireg_seconds < 0) {
profile->ireg_seconds = IREG_SECONDS;
}
} else if (!strcasecmp(var, "user-agent-string")) {
profile->user_agent = switch_core_strdup(profile->pool, val);
} else if (!strcasecmp(var, "auto-restart")) {

View File

@ -373,10 +373,14 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now)
gateway_ptr->failures = 0;
if (gateway_ptr->freq > 60) {
if (gateway_ptr->freq >= 60) {
gateway_ptr->expires = now + (gateway_ptr->freq - 15);
} else {
gateway_ptr->expires = now + (gateway_ptr->freq - 2);
if (gateway_ptr->freq < 30 && gateway_ptr->freq >= 5) {
gateway_ptr->expires = now + (gateway_ptr->freq - 5);
} else {
gateway_ptr->expires = now + (gateway_ptr->freq);
}
}
gateway_ptr->state = REG_STATE_REGED;