typedef enum {
PFLAG_NDLB_TO_IN_200_CONTACT = (1 << 0),
PFLAG_NDLB_BROKEN_AUTH_HASH = (1 << 1),
- PFLAG_NDLB_SENDRECV_IN_SESSION = (1 << 2)
+ PFLAG_NDLB_SENDRECV_IN_SESSION = (1 << 2),
+ PFLAG_NDLB_ALLOW_BAD_IANANAME = (1 << 3)
} sofia_NDLB_t;
typedef enum {
int failures;
struct sofia_gateway *next;
sofia_gateway_subscription_t *subscriptions;
+ int distinct_to;
};
typedef enum {
* \param codec_string The profile's codec string or NULL if inexistant
* \param sdp The parsed SDP content
*/
-void sofia_glue_set_r_sdp_codec_string(switch_channel_t *channel,const char *codec_string, sdp_session_t *sdp);
+void sofia_glue_set_r_sdp_codec_string(switch_core_session_t *session, const char *codec_string, sdp_session_t *sdp);
switch_status_t sofia_glue_tech_media(private_object_t *tech_pvt, const char *r_sdp);
char *sofia_reg_find_reg_url(sofia_profile_t *profile, const char *user, const char *host, char *val, switch_size_t len);
void event_handler(switch_event_t *event);
if ((gateway = switch_core_alloc(profile->pool, sizeof(*gateway)))) {
const char *sipip, *format;
switch_uuid_t uuid;
- uint32_t ping_freq = 0, extension_in_contact = 0;
+ uint32_t ping_freq = 0, extension_in_contact = 0, distinct_to = 0;
char *register_str = "true", *scheme = "Digest",
*realm = NULL,
*username = NULL,
register_proxy = val;
} else if (!strcmp(var, "outbound-proxy")) {
outbound_proxy = val;
+ } else if (!strcmp(var, "distinct-to")) {
+ distinct_to = switch_true(val);
} else if (!strcmp(var, "contact-params")) {
contact_params = val;
} else if (!strcmp(var, "register-transport")) {
gateway->register_username = switch_core_strdup(gateway->pool, username);
gateway->auth_username = switch_core_strdup(gateway->pool, auth_username);
gateway->register_password = switch_core_strdup(gateway->pool, password);
+ gateway->distinct_to = distinct_to;
if (switch_true(caller_id_in_from)) {
sofia_set_flag(gateway, REG_FLAG_CALLERID);
} else {
sofia_clear_pflag(profile, PFLAG_RECIEVED_IN_NAT_REG_CONTACT);
}
+ } else if (!strcasecmp(var, "NDLB-allow-bad-iananame")) {
+ if (switch_true(val)) {
+ sofia_set_pflag(profile, PFLAG_NDLB_ALLOW_BAD_IANANAME);
+ } else {
+ sofia_clear_pflag(profile, PFLAG_NDLB_ALLOW_BAD_IANANAME);
+ }
} else if (!strcasecmp(var, "aggressive-nat-detection")) {
if (switch_true(val)) {
sofia_set_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION);
} else {
profile->ndlb &= ~PFLAG_NDLB_SENDRECV_IN_SESSION;
}
+ } else if (!strcasecmp(var, "NDLB-allow-bad-iananame")) {
+ if (switch_true(val)) {
+ sofia_set_pflag(profile, PFLAG_NDLB_ALLOW_BAD_IANANAME);
+ } else {
+ sofia_clear_pflag(profile, PFLAG_NDLB_ALLOW_BAD_IANANAME);
+ }
} else if (!strcasecmp(var, "pass-rfc2833")) {
if (switch_true(val)) {
sofia_set_pflag(profile, PFLAG_PASS_RFC2833);
if (sofia_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION) && (parser = sdp_parse(NULL, r_sdp, (int) strlen(r_sdp), 0))) {
if ((sdp = sdp_session(parser))) {
- sofia_glue_set_r_sdp_codec_string(channel, (tech_pvt->profile?tech_pvt->profile->codec_string:NULL), sdp);
+ sofia_glue_set_r_sdp_codec_string(session, (tech_pvt->profile?tech_pvt->profile->codec_string:NULL), sdp);
}
sdp_parser_free(parser);
}
}
-void sofia_glue_set_r_sdp_codec_string(switch_channel_t *channel,const char *codec_string, sdp_session_t *sdp)
+void sofia_glue_set_r_sdp_codec_string(switch_core_session_t *session, const char *codec_string, sdp_session_t *sdp)
{
char buf[1024] = {0};
sdp_media_t *m;
int num_codecs = 0;
char *codec_order[SWITCH_MAX_CODECS];
const switch_codec_implementation_t *codecs[SWITCH_MAX_CODECS] = { 0 };
+ switch_channel_t *channel = switch_core_session_get_channel(session);
+ private_object_t *tech_pvt = switch_core_session_get_private(session);
if (!zstr(codec_string)) {
char *tmp_codec_string;
continue;
}
- if (map->rm_pt < 96) {
+ if ((zstr(map->rm_encoding) || (tech_pvt->profile->ndlb & PFLAG_NDLB_ALLOW_BAD_IANANAME)) && map->rm_pt < 96) {
match = (map->rm_pt == imp->ianacode) ? 1 : 0;
} else {
if (map->rm_encoding) {
continue;
}
- if (map->rm_pt < 96) {
+ if ((zstr(map->rm_encoding) || (tech_pvt->profile->ndlb & PFLAG_NDLB_ALLOW_BAD_IANANAME)) && map->rm_pt < 96) {
match = (map->rm_pt == imp->ianacode) ? 1 : 0;
} else {
if(map->rm_encoding) {
}
for (map = m->m_rtpmaps; map; map = map->rm_next) {
- if (zstr(map->rm_encoding) && map->rm_pt < 96) {
+ if ((zstr(map->rm_encoding) || (tech_pvt->profile->ndlb & PFLAG_NDLB_ALLOW_BAD_IANANAME)) && map->rm_pt < 96) {
match = (map->rm_pt == tech_pvt->pt) ? 1 : 0;
} else {
match = strcasecmp(switch_str_nil(map->rm_encoding), tech_pvt->iananame) ? 0 : 1;
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Audio Codec Compare [%s:%d:%u:%d]/[%s:%d:%u:%d]\n",
rm_encoding, map->rm_pt, (int) map->rm_rate, ptime,
imp->iananame, imp->ianacode, codec_rate, imp->microseconds_per_packet / 1000);
- if (zstr(map->rm_encoding) && map->rm_pt < 96) {
+ if ((zstr(map->rm_encoding) || (tech_pvt->profile->ndlb & PFLAG_NDLB_ALLOW_BAD_IANANAME)) && map->rm_pt < 96) {
match = (map->rm_pt == imp->ianacode) ? 1 : 0;
} else {
match = strcasecmp(rm_encoding, imp->iananame) ? 0 : 1;
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Video Codec Compare [%s:%d]/[%s:%d]\n",
rm_encoding, map->rm_pt, imp->iananame, imp->ianacode);
- if (map->rm_pt < 96) {
+ if ((zstr(map->rm_encoding) || (tech_pvt->profile->ndlb & PFLAG_NDLB_ALLOW_BAD_IANANAME)) && map->rm_pt < 96) {
vmatch = (map->rm_pt == imp->ianacode) ? 1 : 0;
} else {
vmatch = strcasecmp(rm_encoding, imp->iananame) ? 0 : 1;
NUTAG_URL(gateway_ptr->register_url),
TAG_IF(gateway_ptr->register_sticky_proxy, NUTAG_PROXY(gateway_ptr->register_sticky_proxy)),
TAG_IF(user_via, SIPTAG_VIA_STR(user_via)),
- SIPTAG_TO_STR(gateway_ptr->register_from),
+ SIPTAG_TO_STR(gateway_ptr->distinct_to ? gateway_ptr->register_from : gateway_ptr->register_to),
SIPTAG_CONTACT_STR(gateway_ptr->register_contact),
SIPTAG_FROM_STR(gateway_ptr->register_from),
SIPTAG_EXPIRES_STR(gateway_ptr->expires_str),
NUTAG_URL(gateway_ptr->register_url),
TAG_IF(user_via, SIPTAG_VIA_STR(user_via)),
SIPTAG_FROM_STR(gateway_ptr->register_from),
- SIPTAG_TO_STR(gateway_ptr->register_from),
+ SIPTAG_TO_STR(gateway_ptr->distinct_to ? gateway_ptr->register_from : gateway_ptr->register_to),
SIPTAG_EXPIRES_STR(gateway_ptr->expires_str),
NUTAG_REGISTRAR(gateway_ptr->register_proxy),
NUTAG_OUTBOUND("no-options-keepalive"), NUTAG_OUTBOUND("no-validate"), NUTAG_KEEPALIVE(0), TAG_NULL());