mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-23 12:42:02 +00:00
fix MODENDP-66
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7078 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
@@ -914,6 +914,21 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
||||
nua_respond(tech_pvt->nh, SIP_302_MOVED_TEMPORARILY, SIPTAG_CONTACT_STR(msg->string_arg), TAG_END());
|
||||
}
|
||||
break;
|
||||
|
||||
case SWITCH_MESSAGE_INDICATE_DEFLECT:
|
||||
{
|
||||
char ref_to[128] = "";
|
||||
|
||||
if (!strstr(msg->string_arg, "sip:")) {
|
||||
switch_snprintf(ref_to, sizeof(ref_to), "sip:%s@%s", msg->string_arg, tech_pvt->profile->sipip);
|
||||
} else {
|
||||
switch_set_string(ref_to, msg->string_arg);
|
||||
}
|
||||
|
||||
nua_refer(tech_pvt->nh, SIPTAG_REFER_TO_STR(ref_to), SIPTAG_REFERRED_BY_STR(tech_pvt->contact_url), TAG_END());
|
||||
}
|
||||
break;
|
||||
|
||||
case SWITCH_MESSAGE_INDICATE_RESPOND:
|
||||
if (msg->numeric_arg || msg->string_arg) {
|
||||
int code = msg->numeric_arg;
|
||||
|
||||
@@ -2241,7 +2241,7 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
|
||||
switch_event_t *v_event = NULL;
|
||||
uint32_t sess_count = switch_core_session_count();
|
||||
uint32_t sess_max = switch_core_session_limit(0);
|
||||
int is_auth = 0;
|
||||
int is_auth = 0, calling_myself = 0;
|
||||
su_addrinfo_t *my_addrinfo = msg_addrinfo(nua_current_request(nua));
|
||||
|
||||
if (sess_count >= sess_max) {
|
||||
@@ -2261,12 +2261,19 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
get_addr(network_ip, sizeof(network_ip), &((struct sockaddr_in *) my_addrinfo->ai_addr)->sin_addr);
|
||||
|
||||
if ((profile->pflags & PFLAG_AUTH_CALLS) || sip->sip_proxy_authorization || sip->sip_authorization) {
|
||||
if (sofia_reg_handle_register(nua, profile, nh, sip, REG_INVITE, key, sizeof(key), &v_event)) {
|
||||
if (v_event) {
|
||||
switch_event_destroy(&v_event);
|
||||
if (strcmp(network_ip, profile->sipip)) {
|
||||
if (sofia_reg_handle_register(nua, profile, nh, sip, REG_INVITE, key, sizeof(key), &v_event)) {
|
||||
if (v_event) {
|
||||
switch_event_destroy(&v_event);
|
||||
}
|
||||
return;
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
calling_myself++;
|
||||
}
|
||||
is_auth++;
|
||||
}
|
||||
@@ -2288,13 +2295,16 @@ 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 *) my_addrinfo->ai_addr)->sin_addr);
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
|
||||
if (is_auth) {
|
||||
switch_channel_set_variable(channel, "sip_authorized", "true");
|
||||
}
|
||||
|
||||
if (calling_myself) {
|
||||
switch_channel_set_variable(channel, "sip_looped_call", "true");
|
||||
}
|
||||
|
||||
if (v_event) {
|
||||
switch_event_header_t *hp;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user