Enact the 'No device left behind' act. All stupid sip params that only help broken things *MUST* be prefixed with NDLB-

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5228 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2007-05-29 14:59:03 +00:00
parent f0b58efbac
commit db5ab42c12
4 changed files with 20 additions and 3 deletions

View File

@ -317,7 +317,7 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
} }
nua_respond(tech_pvt->nh, SIP_200_OK, nua_respond(tech_pvt->nh, SIP_200_OK,
SIPTAG_CONTACT_STR(tech_pvt->to_uri), SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), TAG_END()); SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), TAG_END());
} }
@ -680,7 +680,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
sofia_glue_set_local_sdp(tech_pvt, ip, atoi(port), msg->string_arg, 1); sofia_glue_set_local_sdp(tech_pvt, ip, atoi(port), msg->string_arg, 1);
} }
nua_respond(tech_pvt->nh, SIP_200_OK, nua_respond(tech_pvt->nh, SIP_200_OK,
SIPTAG_CONTACT_STR(tech_pvt->to_uri), SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), TAG_END()); SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), TAG_END());
switch_channel_mark_answered(channel); switch_channel_mark_answered(channel);
} }

View File

@ -114,6 +114,11 @@ typedef enum {
PFLAG_RESPAWN = (1 << 9) PFLAG_RESPAWN = (1 << 9)
} PFLAGS; } PFLAGS;
typedef enum {
PFLAG_NDLB_TO_IN_200_CONTACT = (1 << 1)
} sofia_NDLB_t;
typedef enum { typedef enum {
TFLAG_IO = (1 << 0), TFLAG_IO = (1 << 0),
TFLAG_CHANGE_MEDIA = (1 << 1), TFLAG_CHANGE_MEDIA = (1 << 1),
@ -223,6 +228,7 @@ struct sofia_profile {
int dtmf_duration; int dtmf_duration;
unsigned int flags; unsigned int flags;
unsigned int pflags; unsigned int pflags;
unsigned int ndlb;
uint32_t max_calls; uint32_t max_calls;
uint32_t nonce_ttl; uint32_t nonce_ttl;
nua_t *nua; nua_t *nua;
@ -287,6 +293,7 @@ struct private_object {
switch_port_t adv_sdp_audio_port; switch_port_t adv_sdp_audio_port;
char *proxy_sdp_audio_ip; char *proxy_sdp_audio_ip;
switch_port_t proxy_sdp_audio_port; switch_port_t proxy_sdp_audio_port;
char *reply_contact;
char *from_uri; char *from_uri;
char *to_uri; char *to_uri;
char *from_address; char *from_address;

View File

@ -789,6 +789,10 @@ switch_status_t config_sofia(int reload, char *profile_name)
if (switch_true(val)) { if (switch_true(val)) {
profile->pflags |= PFLAG_PRESENCE; profile->pflags |= PFLAG_PRESENCE;
} }
} else if (!strcasecmp(var, "NDLB-to-in-200-contact")) {
if (switch_true(val)) {
profile->ndlb |= PFLAG_NDLB_TO_IN_200_CONTACT;
}
} else if (!strcasecmp(var, "pass-rfc2833")) { } else if (!strcasecmp(var, "pass-rfc2833")) {
if (switch_true(val)) { if (switch_true(val)) {
profile->pflags |= PFLAG_PASS_RFC2833; profile->pflags |= PFLAG_PASS_RFC2833;
@ -1837,8 +1841,14 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
url_set_chanvars(session, sip->sip_to->a_url, sip_to); url_set_chanvars(session, sip->sip_to->a_url, sip_to);
if ((val = switch_channel_get_variable(channel, "sip_to_uri"))) { if ((val = switch_channel_get_variable(channel, "sip_to_uri"))) {
tech_pvt->to_uri = switch_core_session_sprintf(session, "sip:%s", val); tech_pvt->to_uri = switch_core_session_sprintf(session, "sip:%s", val);
if (profile->ndlb & PFLAG_NDLB_TO_IN_200_CONTACT) {
tech_pvt->reply_contact = tech_pvt->to_uri;
} else {
tech_pvt->reply_contact = tech_pvt->profile->url;
}
} else { } else {
tech_pvt->to_uri = tech_pvt->profile->url; tech_pvt->to_uri = tech_pvt->profile->url;
tech_pvt->reply_contact = tech_pvt->profile->url;
} }
} }

View File

@ -365,7 +365,7 @@ uint8_t sofia_reg_handle_register(nua_t * nua, sofia_profile_t *profile, nua_han
} }
if (v_event && *v_event && (v_contact_str = switch_event_get_header(*v_event, "force-contact"))) { if (v_event && *v_event && (v_contact_str = switch_event_get_header(*v_event, "force-contact"))) {
if (!strcasecmp(v_contact_str, "nat-connectile-dysfunction")) { if (!strcasecmp(v_contact_str, "nat-connectile-dysfunction") || !strcasecmp(v_contact_str, "NDLB-connectile-dysfunction")) {
if (contact->m_url->url_params) { if (contact->m_url->url_params) {
snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s:%d;%s>", snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s:%d;%s>",
display, contact->m_url->url_user, network_ip, network_port, contact->m_url->url_params); display, contact->m_url->url_user, network_ip, network_port, contact->m_url->url_params);