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

Enact the 'No device left behind' act. All stupid sip params that only help…

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
上级 f0b58efb
......@@ -317,7 +317,7 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
}
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());
}
......@@ -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);
}
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());
switch_channel_mark_answered(channel);
}
......
......@@ -114,6 +114,11 @@ typedef enum {
PFLAG_RESPAWN = (1 << 9)
} PFLAGS;
typedef enum {
PFLAG_NDLB_TO_IN_200_CONTACT = (1 << 1)
} sofia_NDLB_t;
typedef enum {
TFLAG_IO = (1 << 0),
TFLAG_CHANGE_MEDIA = (1 << 1),
......@@ -223,6 +228,7 @@ struct sofia_profile {
int dtmf_duration;
unsigned int flags;
unsigned int pflags;
unsigned int ndlb;
uint32_t max_calls;
uint32_t nonce_ttl;
nua_t *nua;
......@@ -287,6 +293,7 @@ struct private_object {
switch_port_t adv_sdp_audio_port;
char *proxy_sdp_audio_ip;
switch_port_t proxy_sdp_audio_port;
char *reply_contact;
char *from_uri;
char *to_uri;
char *from_address;
......
......@@ -789,6 +789,10 @@ switch_status_t config_sofia(int reload, char *profile_name)
if (switch_true(val)) {
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")) {
if (switch_true(val)) {
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);
if ((val = switch_channel_get_variable(channel, "sip_to_uri"))) {
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 {
tech_pvt->to_uri = tech_pvt->profile->url;
tech_pvt->reply_contact = tech_pvt->profile->url;
}
}
......
......@@ -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 (!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) {
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);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论