mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-03-12 12:18:18 +00:00
FS-9225: [mod_sofia] Allow to force SIP REGISTER Expires: to be within configured range.
Allow to force SIP REGISTER Expires: to be within MIN and MAX values. Not just to force it to one specific value using "sip-force-expires". New profile parameters: "sip-force-expires-min" "sip-force-expires-max"
This commit is contained in:
parent
46b9ace417
commit
2766eaf49e
@ -738,6 +738,8 @@ struct sofia_profile {
|
||||
char *tls_verify_in_subjects_str;
|
||||
su_strlst_t *tls_verify_in_subjects;
|
||||
uint32_t sip_force_expires;
|
||||
uint32_t sip_force_expires_min;
|
||||
uint32_t sip_force_expires_max;
|
||||
uint32_t sip_expires_max_deviation;
|
||||
uint32_t sip_expires_late_margin;
|
||||
uint32_t sip_subscription_max_deviation;
|
||||
|
@ -4260,6 +4260,8 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
|
||||
profile->dtmf_duration = 100;
|
||||
profile->rtp_digit_delay = 40;
|
||||
profile->sip_force_expires = 0;
|
||||
profile->sip_force_expires_min = 0;
|
||||
profile->sip_force_expires_max = 0;
|
||||
profile->sip_expires_max_deviation = 0;
|
||||
profile->sip_expires_late_margin = 60;
|
||||
profile->sip_subscription_max_deviation = 0;
|
||||
@ -5514,6 +5516,20 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
|
||||
} else {
|
||||
profile->sip_expires_late_margin = 60;
|
||||
}
|
||||
} else if (!strcasecmp(var, "sip-force-expires-min")) {
|
||||
int32_t sip_force_expires_min = atoi(val);
|
||||
if (sip_force_expires_min >= 0) {
|
||||
profile->sip_force_expires_min = sip_force_expires_min;
|
||||
} else {
|
||||
profile->sip_force_expires_min = 0;
|
||||
}
|
||||
} else if (!strcasecmp(var, "sip-force-expires-max")) {
|
||||
int32_t sip_force_expires_max = atoi(val);
|
||||
if (sip_force_expires_max >= 0) {
|
||||
profile->sip_force_expires_max = sip_force_expires_max;
|
||||
} else {
|
||||
profile->sip_force_expires_max = 0;
|
||||
}
|
||||
} else if (!strcasecmp(var, "sip-force-expires")) {
|
||||
int32_t sip_force_expires = atoi(val);
|
||||
if (sip_force_expires >= 0) {
|
||||
|
@ -1683,6 +1683,18 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu
|
||||
}
|
||||
}
|
||||
|
||||
if ( (( exp_var = atoi(switch_event_get_header_nil(*v_event, "sip-force-expires-min")) )) ||
|
||||
(( exp_var = profile->sip_force_expires_min )) ) {
|
||||
if ( (exp_var > 0) && (exptime < exp_var) ) {
|
||||
exptime = exp_var;
|
||||
}
|
||||
}
|
||||
if ( (( exp_var = atoi(switch_event_get_header_nil(*v_event, "sip-force-expires-max")) )) ||
|
||||
(( exp_var = profile->sip_force_expires_max )) ) {
|
||||
if ( (exp_var > 0) && (exptime > exp_var) ) {
|
||||
exptime = exp_var;
|
||||
}
|
||||
}
|
||||
if ( (( exp_var = atoi(switch_event_get_header_nil(*v_event, "sip-force-expires")) )) ||
|
||||
(( exp_var = profile->sip_force_expires )) ) {
|
||||
if (exp_var > 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user