提交 a800a5fc authored 作者: Anthony Minessale's avatar Anthony Minessale

FS-4708 add <param name="NDLB-allow-crypto-in-avp" value="true"/> to your sofia…

FS-4708 add <param name="NDLB-allow-crypto-in-avp" value="true"/> to your sofia profile and it should set the header
上级 21d19b61
......@@ -283,7 +283,8 @@ typedef enum {
PFLAG_NDLB_SENDRECV_IN_SESSION = (1 << 2),
PFLAG_NDLB_ALLOW_BAD_IANANAME = (1 << 3),
PFLAG_NDLB_ALLOW_NONDUP_SDP = (1 << 4),
PFLAG_NDLB_ALLOW_CRYPTO_IN_AVP = (1 << 5)
PFLAG_NDLB_ALLOW_CRYPTO_IN_AVP = (1 << 5),
PFLAG_NDLB_EXPIRES_IN_REGISTER_RESPONSE = (1 << 6)
} sofia_NDLB_t;
typedef enum {
......
......@@ -3807,6 +3807,12 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile)
} 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;
......@@ -4949,6 +4955,12 @@ switch_status_t config_sofia(int reload, char *profile_name)
} 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;
......
......@@ -1073,6 +1073,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
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");
......@@ -1773,12 +1774,17 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
/* 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() */
......@@ -1789,9 +1795,11 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
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);
......@@ -1799,7 +1807,8 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
} 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());
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论