add distinct-to=true|false to be used with from-domain when you don't want to change the to
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15334 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
36cb95878b
commit
6b15429934
|
@ -206,7 +206,8 @@ typedef enum {
|
|||
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 {
|
||||
|
@ -387,6 +388,7 @@ struct sofia_gateway {
|
|||
int failures;
|
||||
struct sofia_gateway *next;
|
||||
sofia_gateway_subscription_t *subscriptions;
|
||||
int distinct_to;
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
|
@ -733,7 +735,7 @@ void sofia_glue_tech_absorb_sdp(private_object_t *tech_pvt);
|
|||
* \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);
|
||||
|
|
|
@ -1437,7 +1437,7 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
|
|||
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,
|
||||
|
@ -1559,6 +1559,8 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
|
|||
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")) {
|
||||
|
@ -1655,6 +1657,7 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
|
|||
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);
|
||||
|
@ -1930,6 +1933,12 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile)
|
|||
} 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);
|
||||
|
@ -2673,6 +2682,12 @@ switch_status_t config_sofia(int reload, char *profile_name)
|
|||
} 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);
|
||||
|
@ -3604,7 +3619,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
|
|||
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -2591,7 +2591,7 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f
|
|||
|
||||
}
|
||||
|
||||
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;
|
||||
|
@ -2605,6 +2605,8 @@ void sofia_glue_set_r_sdp_codec_string(switch_channel_t *channel,const char *cod
|
|||
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;
|
||||
|
@ -2666,7 +2668,7 @@ void sofia_glue_set_r_sdp_codec_string(switch_channel_t *channel,const char *cod
|
|||
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) {
|
||||
|
@ -2707,7 +2709,7 @@ void sofia_glue_set_r_sdp_codec_string(switch_channel_t *channel,const char *cod
|
|||
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) {
|
||||
|
@ -3075,7 +3077,7 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, sdp_session_t *
|
|||
}
|
||||
|
||||
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;
|
||||
|
@ -3160,7 +3162,7 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, sdp_session_t *
|
|||
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;
|
||||
|
@ -3294,7 +3296,7 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, sdp_session_t *
|
|||
|
||||
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;
|
||||
|
|
|
@ -337,7 +337,7 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now)
|
|||
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),
|
||||
|
@ -349,7 +349,7 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now)
|
|||
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());
|
||||
|
|
Loading…
Reference in New Issue