FS-3771 --resolve

This commit is contained in:
Brian West
2011-12-22 14:03:32 -06:00
parent faf40311c6
commit 8059cdca81
3 changed files with 50 additions and 5 deletions
+18 -5
View File
@@ -1270,7 +1270,8 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
}
if (contact && exptime && v_event && *v_event) {
char *exp_var;
uint32_t exp_var;
uint32_t exp_max_deviation_var;
char *allow_multireg = NULL;
int auto_connectile = 0;
@@ -1363,12 +1364,24 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
}
}
if ((exp_var = switch_event_get_header(*v_event, "sip-force-expires"))) {
int tmp = atoi(exp_var);
if (tmp > 0) {
exptime = tmp;
if ( (( exp_var = atoi(switch_event_get_header_nil(*v_event, "sip-force-expires")) )) ||
(( exp_var = profile->sip_force_expires )) ) {
if (exp_var > 0) {
exptime = exp_var;
}
}
if ( (( exp_max_deviation_var = atoi(switch_event_get_header_nil(*v_event, "sip-expires-max-deviation")) )) ||
(( exp_max_deviation_var = profile->sip_expires_max_deviation )) ) {
if (exp_max_deviation_var > 0) {
int exp_deviation;
srand( (unsigned) ( (unsigned)(intptr_t)switch_thread_self() + switch_micro_time_now() ) );
/* random number between negative exp_max_deviation_var and positive exp_max_deviation_var: */
exp_deviation = ( rand() % ( exp_max_deviation_var * 2 ) ) - exp_max_deviation_var;
exptime += exp_deviation;
}
}
}
if (auth_res != AUTH_OK && auth_res != AUTH_RENEWED && !stale) {