sip is stupid
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6041 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
62070a02ce
commit
3c1de519da
|
@ -922,6 +922,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
|||
switch_channel_mark_pre_answered(channel);
|
||||
nua_respond(tech_pvt->nh,
|
||||
SIP_183_SESSION_PROGRESS,
|
||||
SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
|
||||
SIPTAG_CONTACT_STR(tech_pvt->profile->url),
|
||||
SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), SOATAG_AUDIO_AUX("cn telephone-event"), TAG_END());
|
||||
}
|
||||
|
|
|
@ -1916,6 +1916,8 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
|
|||
uint32_t sess_count = switch_core_session_count();
|
||||
uint32_t sess_max = switch_core_session_limit(0);
|
||||
int is_auth = 0;
|
||||
su_addrinfo_t *my_addrinfo = msg_addrinfo(nua_current_request(nua));
|
||||
|
||||
|
||||
if ((profile->soft_max && sess_count >= profile->soft_max) || sess_count >= sess_max) {
|
||||
nua_respond(nh, 480, "Maximum Calls In Progress", SIPTAG_RETRY_AFTER_STR("300"), TAG_END());
|
||||
|
@ -1962,7 +1964,8 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
|
|||
tech_pvt->key = switch_core_session_strdup(session, key);
|
||||
}
|
||||
|
||||
get_addr(network_ip, sizeof(network_ip), &((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_addr);
|
||||
|
||||
get_addr(network_ip, sizeof(network_ip), &((struct sockaddr_in *) my_addrinfo->ai_addr)->sin_addr);
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
if (is_auth) {
|
||||
|
@ -2029,16 +2032,30 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
|
|||
|
||||
if (sip->sip_to && sip->sip_to->a_url) {
|
||||
char *val;
|
||||
char *transport = (my_addrinfo->ai_socktype == SOCK_STREAM) ? "tcp" : "udp";
|
||||
|
||||
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);
|
||||
tech_pvt->to_uri = switch_core_session_sprintf(session, "sip:%s;transport=%s", val, transport);
|
||||
if (profile->ndlb & PFLAG_NDLB_TO_IN_200_CONTACT) {
|
||||
tech_pvt->reply_contact = tech_pvt->to_uri;
|
||||
if (strchr(tech_pvt->to_uri, '>')) {
|
||||
tech_pvt->reply_contact = tech_pvt->to_uri;
|
||||
} else {
|
||||
tech_pvt->reply_contact = switch_core_session_sprintf(session, "<%s>", tech_pvt->to_uri);
|
||||
}
|
||||
} else {
|
||||
tech_pvt->reply_contact = switch_core_session_strdup(session, profile->url);
|
||||
if (strchr(profile->url, '>')) {
|
||||
tech_pvt->reply_contact = switch_core_session_sprintf(session, "%s;transport=%s", profile->url, transport);
|
||||
} else {
|
||||
tech_pvt->reply_contact = switch_core_session_sprintf(session, "<%s;transport=%s>", profile->url, transport);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
tech_pvt->reply_contact = switch_core_session_strdup(session, profile->url);
|
||||
if (strchr(profile->url, '>')) {
|
||||
tech_pvt->reply_contact = switch_core_session_sprintf(session, "%s;transport=%s", profile->url, transport);
|
||||
} else {
|
||||
tech_pvt->reply_contact = switch_core_session_sprintf(session, "<%s;transport=%s>", profile->url, transport);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue