From 9fe08675a1d3f0a8ba9c777befed7d6cc8a921f9 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 20 Jul 2012 12:11:02 -0500 Subject: [PATCH] add tags to allow crypto in avp --- src/mod/endpoints/mod_sofia/mod_sofia.h | 3 ++- src/mod/endpoints/mod_sofia/sofia.c | 6 ++++++ src/mod/endpoints/mod_sofia/sofia_glue.c | 11 +++++++---- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 5782fa04d6..5ef35315e7 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -279,7 +279,8 @@ typedef enum { PFLAG_NDLB_BROKEN_AUTH_HASH = (1 << 1), PFLAG_NDLB_SENDRECV_IN_SESSION = (1 << 2), PFLAG_NDLB_ALLOW_BAD_IANANAME = (1 << 3), - PFLAG_NDLB_ALLOW_NONDUP_SDP = (1 << 4) + PFLAG_NDLB_ALLOW_NONDUP_SDP = (1 << 4), + PFLAG_NDLB_ALLOW_CRYPTO_IN_AVP = (1 << 5) } sofia_NDLB_t; typedef enum { diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index e331e6d4f6..d7758e7371 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -3456,6 +3456,12 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile) } else { profile->ndlb &= ~PFLAG_NDLB_ALLOW_BAD_IANANAME; } + } 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_CRYPTO_IN_AVP; + } } else if (!strcasecmp(var, "NDLB-allow-nondup-sdp")) { if (switch_true(val)) { profile->ndlb |= PFLAG_NDLB_ALLOW_NONDUP_SDP; diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 878bf73a7f..dd8a365f88 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -4831,10 +4831,13 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s } else if (!got_crypto && !strcasecmp(attr->a_name, "crypto") && !zstr(attr->a_value)) { int crypto_tag; - if (m->m_proto != sdp_proto_srtp) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "a=crypto in RTP/AVP, refer to rfc3711\n"); - match = 0; - goto done; + if (!(tech_pvt->profile->ndlb & PFLAG_NDLB_ALLOW_CRYPTO_IN_AVP) && + !switch_true(switch_channel_get_variable(tech_pvt->channel, "sip_allow_crypto_in_sdp"))) { + if (m->m_proto != sdp_proto_srtp) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "a=crypto in RTP/AVP, refer to rfc3711\n"); + match = 0; + goto done; + } } crypto = attr->a_value;