FS-3771 --resolve
This commit is contained in:
parent
faf40311c6
commit
8059cdca81
|
@ -645,6 +645,8 @@ struct sofia_profile {
|
||||||
char *tls_passphrase;
|
char *tls_passphrase;
|
||||||
char *tls_verify_in_subjects_str;
|
char *tls_verify_in_subjects_str;
|
||||||
su_strlst_t *tls_verify_in_subjects;
|
su_strlst_t *tls_verify_in_subjects;
|
||||||
|
uint32_t sip_force_expires;
|
||||||
|
uint32_t sip_expires_max_deviation;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct private_object {
|
struct private_object {
|
||||||
|
|
|
@ -3439,6 +3439,20 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile)
|
||||||
} else {
|
} else {
|
||||||
sofia_clear_pflag(profile, PFLAG_OPTIONS_RESPOND_503_ON_BUSY);
|
sofia_clear_pflag(profile, PFLAG_OPTIONS_RESPOND_503_ON_BUSY);
|
||||||
}
|
}
|
||||||
|
} else if (!strcasecmp(var, "sip-force-expires")) {
|
||||||
|
uint32_t sip_force_expires = atoi(val);
|
||||||
|
if (sip_force_expires >= 0) {
|
||||||
|
profile->sip_force_expires = sip_force_expires;
|
||||||
|
} else {
|
||||||
|
profile->sip_force_expires = 0;
|
||||||
|
}
|
||||||
|
} else if (!strcasecmp(var, "sip-expires-max-deviation")) {
|
||||||
|
uint32_t sip_expires_max_deviation = atoi(val);
|
||||||
|
if (sip_expires_max_deviation >= 0) {
|
||||||
|
profile->sip_expires_max_deviation = sip_expires_max_deviation;
|
||||||
|
} else {
|
||||||
|
profile->sip_expires_max_deviation = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3662,6 +3676,8 @@ switch_status_t config_sofia(int reload, char *profile_name)
|
||||||
switch_thread_rwlock_create(&profile->rwlock, profile->pool);
|
switch_thread_rwlock_create(&profile->rwlock, profile->pool);
|
||||||
switch_mutex_init(&profile->flag_mutex, SWITCH_MUTEX_NESTED, profile->pool);
|
switch_mutex_init(&profile->flag_mutex, SWITCH_MUTEX_NESTED, profile->pool);
|
||||||
profile->dtmf_duration = 100;
|
profile->dtmf_duration = 100;
|
||||||
|
profile->sip_force_expires = 0;
|
||||||
|
profile->sip_expires_max_deviation = 0;
|
||||||
profile->tls_version = 0;
|
profile->tls_version = 0;
|
||||||
profile->mflags = MFLAG_REFER | MFLAG_REGISTER;
|
profile->mflags = MFLAG_REFER | MFLAG_REGISTER;
|
||||||
profile->server_rport_level = 1;
|
profile->server_rport_level = 1;
|
||||||
|
@ -4483,6 +4499,20 @@ switch_status_t config_sofia(int reload, char *profile_name)
|
||||||
} else {
|
} else {
|
||||||
sofia_clear_pflag(profile, PFLAG_OPTIONS_RESPOND_503_ON_BUSY);
|
sofia_clear_pflag(profile, PFLAG_OPTIONS_RESPOND_503_ON_BUSY);
|
||||||
}
|
}
|
||||||
|
} else if (!strcasecmp(var, "sip-force-expires")) {
|
||||||
|
uint32_t sip_force_expires = atoi(val);
|
||||||
|
if (sip_force_expires >= 0) {
|
||||||
|
profile->sip_force_expires = sip_force_expires;
|
||||||
|
} else {
|
||||||
|
profile->sip_force_expires = 0;
|
||||||
|
}
|
||||||
|
} else if (!strcasecmp(var, "sip-expires-max-deviation")) {
|
||||||
|
uint32_t sip_expires_max_deviation = atoi(val);
|
||||||
|
if (sip_expires_max_deviation >= 0) {
|
||||||
|
profile->sip_expires_max_deviation = sip_expires_max_deviation;
|
||||||
|
} else {
|
||||||
|
profile->sip_expires_max_deviation = 0;
|
||||||
|
}
|
||||||
} else if (!strcasecmp(var, "reuse-connections")) {
|
} else if (!strcasecmp(var, "reuse-connections")) {
|
||||||
switch_bool_t value = switch_true(val);
|
switch_bool_t value = switch_true(val);
|
||||||
if (!value) {
|
if (!value) {
|
||||||
|
|
|
@ -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) {
|
if (contact && exptime && v_event && *v_event) {
|
||||||
char *exp_var;
|
uint32_t exp_var;
|
||||||
|
uint32_t exp_max_deviation_var;
|
||||||
char *allow_multireg = NULL;
|
char *allow_multireg = NULL;
|
||||||
int auto_connectile = 0;
|
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"))) {
|
if ( (( exp_var = atoi(switch_event_get_header_nil(*v_event, "sip-force-expires")) )) ||
|
||||||
int tmp = atoi(exp_var);
|
(( exp_var = profile->sip_force_expires )) ) {
|
||||||
if (tmp > 0) {
|
if (exp_var > 0) {
|
||||||
exptime = tmp;
|
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) {
|
if (auth_res != AUTH_OK && auth_res != AUTH_RENEWED && !stale) {
|
||||||
|
|
Loading…
Reference in New Issue