} else {
profile->ndlb &= ~PFLAG_NDLB_ALLOW_BAD_IANANAME;
}
+ } else if (!strcasecmp(var, "NDLB-expires-in-register-response")) {
+ if (switch_true(val)) {
+ profile->ndlb |= PFLAG_NDLB_EXPIRES_IN_REGISTER_RESPONSE;
+ } else {
+ profile->ndlb &= ~PFLAG_NDLB_EXPIRES_IN_REGISTER_RESPONSE;
+ }
} else if (!strcasecmp(var, "NDLB-allow-crypto-in-avp")) {
if (switch_true(val)) {
profile->ndlb |= PFLAG_NDLB_ALLOW_CRYPTO_IN_AVP;
} else {
profile->ndlb &= ~PFLAG_NDLB_ALLOW_BAD_IANANAME;
}
+ } else if (!strcasecmp(var, "NDLB-expires-in-register-response")) {
+ if (switch_true(val)) {
+ profile->ndlb |= PFLAG_NDLB_EXPIRES_IN_REGISTER_RESPONSE;
+ } else {
+ profile->ndlb &= ~PFLAG_NDLB_EXPIRES_IN_REGISTER_RESPONSE;
+ }
} else if (!strcasecmp(var, "NDLB-allow-crypto-in-avp")) {
if (switch_true(val)) {
profile->ndlb |= PFLAG_NDLB_ALLOW_CRYPTO_IN_AVP;
const char *pres_on_reg = NULL;
int send_pres = 0;
int is_tls = 0, is_tcp = 0;
+ char expbuf[35] = "";
if (v_event && *v_event) pres_on_reg = switch_event_get_header(*v_event, "send-presence-on-register");
/* generate and respond a 200 OK */
+ if ((profile->ndlb & PFLAG_NDLB_EXPIRES_IN_REGISTER_RESPONSE)) {
+ switch_snprintf(expbuf, sizeof(expbuf), "%ld", exptime);
+ }
+
if (mod_sofia_globals.reg_deny_binding_fetch_and_no_lookup) {
/* handle backwards compatibility - contacts will not be looked up but only copied from the request into the response
remove this condition later if nobody complains about the extra select of the below new behavior
also remove the parts in mod_sofia.h, sofia.c and sofia_reg.c that refer to reg_deny_binding_fetch_and_no_lookup */
nua_respond(nh, SIP_200_OK, TAG_IF(contact, SIPTAG_CONTACT(sip->sip_contact)), TAG_IF(path_val, SIPTAG_PATH_STR(path_val)),
- NUTAG_WITH_THIS_MSG(de->data->e_msg), SIPTAG_DATE_STR(date), TAG_END());
+ TAG_IF(!zstr(expbuf), SIPTAG_EXPIRES_STR(expbuf)),
+ NUTAG_WITH_THIS_MSG(de->data->e_msg), SIPTAG_DATE_STR(date), TAG_END());
} else if ((contact_list = sofia_reg_find_reg_url_with_positive_expires_multi(profile, from_user, reg_host))) {
/* all + 1 tag_i elements initialized as NULL - last one implies TAG_END() */
contact_tags[i].t_value = (tag_value_t) m->val;
++i;
}
+
nua_respond(nh, SIP_200_OK, TAG_IF(path_val, SIPTAG_PATH_STR(path_val)),
- NUTAG_WITH_THIS_MSG(de->data->e_msg), SIPTAG_DATE_STR(date), TAG_NEXT(contact_tags));
+ TAG_IF(!zstr(expbuf), SIPTAG_EXPIRES_STR(expbuf)),
+ NUTAG_WITH_THIS_MSG(de->data->e_msg), SIPTAG_DATE_STR(date), TAG_NEXT(contact_tags));
switch_safe_free(contact_tags);
switch_console_free_matches(&contact_list);
} else {
/* respond without any contacts */
nua_respond(nh, SIP_200_OK, TAG_IF(path_val, SIPTAG_PATH_STR(path_val)),
- NUTAG_WITH_THIS_MSG(de->data->e_msg), SIPTAG_DATE_STR(date), TAG_END());
+ TAG_IF(!zstr(expbuf), SIPTAG_EXPIRES_STR(expbuf)),
+ NUTAG_WITH_THIS_MSG(de->data->e_msg), SIPTAG_DATE_STR(date), TAG_END());
}