profile->rtp_digit_delay = 40;
profile->sip_force_expires = 0;
profile->sip_expires_max_deviation = 0;
+ profile->sip_expires_late_margin = 60;
profile->sip_subscription_max_deviation = 0;
profile->tls_ciphers = "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH";
profile->tls_version = SOFIA_TLS_VERSION_TLSv1;
} else {
sofia_clear_pflag(profile, PFLAG_OPTIONS_RESPOND_503_ON_BUSY);
}
+ } else if (!strcasecmp(var, "sip-expires-late-margin")) {
+ int32_t sip_expires_late_margin = atoi(val);
+ if (sip_expires_late_margin >= 0) {
+ profile->sip_expires_late_margin = sip_expires_late_margin;
+ } else {
+ profile->sip_expires_late_margin = 60;
+ }
} else if (!strcasecmp(var, "sip-force-expires")) {
int32_t sip_force_expires = atoi(val);
if (sip_force_expires >= 0) {
contact = sofia_glue_get_url_from_contact(contact_str, 1);
url = switch_mprintf("sofia/%q/%s:%q", profile->name, proto, sofia_glue_strip_proto(contact));
- switch_core_add_registration(to_user, reg_host, call_id, url, (long) reg_time + (long) exptime + 60,
+ switch_core_add_registration(to_user, reg_host, call_id, url, (long) reg_time + (long) exptime + profile->sip_expires_late_margin,
network_ip, network_port_c, is_tls ? "tls" : is_tcp ? "tcp" : "udp", reg_meta);
switch_safe_free(url);
"mwi_user,mwi_host, orig_server_host, orig_hostname, sub_host) "
"values ('%q','%q', '%q','%q','%q','%q', '%q', %ld, '%q', '%q', '%q', '%q', '%q', '%q', '%q','%q','%q','%q','%q','%q','%q','%q')",
call_id, to_user, reg_host, profile->presence_hosts ? profile->presence_hosts : "",
- contact_str, reg_desc, rpid, (long) reg_time + (long) exptime + 60,
+ contact_str, reg_desc, rpid, (long) reg_time + (long) exptime + profile->sip_expires_late_margin,
agent, from_user, guess_ip4, profile->name, mod_sofia_globals.hostname, network_ip, network_port_c, username, realm,
mwi_user, mwi_host, guess_ip4, mod_sofia_globals.hostname, sub_host);
} else {
call_id, sub_host, network_ip, network_port_c,
profile->presence_hosts ? profile->presence_hosts : "", guess_ip4, guess_ip4,
mod_sofia_globals.hostname, mod_sofia_globals.hostname,
- (long) reg_time + (long) exptime + 60,
+ (long) reg_time + (long) exptime + profile->sip_expires_late_margin,
to_user, username, reg_host, contact_str);
}
if (multi_reg) {
if (multi_reg_contact) {
- sql = switch_mprintf("delete from sip_registrations where contact='%q' and expires!=%ld", contact_str, (long) reg_time + (long) exptime + 60);
+ sql = switch_mprintf("delete from sip_registrations where contact='%q' and expires!=%ld", contact_str, (long) reg_time + (long) exptime + profile->sip_expires_late_margin);
} else {
- sql = switch_mprintf("delete from sip_registrations where call_id='%q' and expires!=%ld", call_id, (long) reg_time + (long) exptime + 60);
+ sql = switch_mprintf("delete from sip_registrations where call_id='%q' and expires!=%ld", call_id, (long) reg_time + (long) exptime + profile->sip_expires_late_margin);
}
sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);