mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-27 20:59:50 +00:00
sigh
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8527 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
abb7a49e2b
commit
f2e8d44218
@ -146,7 +146,8 @@ typedef enum {
|
|||||||
PFLAG_UNREG_OPTIONS_FAIL = (1 << 18),
|
PFLAG_UNREG_OPTIONS_FAIL = (1 << 18),
|
||||||
PFLAG_DISABLE_TIMER = (1 << 19),
|
PFLAG_DISABLE_TIMER = (1 << 19),
|
||||||
PFLAG_DISABLE_100REL = (1 << 20),
|
PFLAG_DISABLE_100REL = (1 << 20),
|
||||||
PFLAG_AGGRESSIVE_NAT_DETECTION = (1 << 21)
|
PFLAG_AGGRESSIVE_NAT_DETECTION = (1 << 21),
|
||||||
|
PFLAG_RECIEVED_IN_NAT_REG_CONTACT = (1 << 22)
|
||||||
} PFLAGS;
|
} PFLAGS;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -1117,6 +1117,8 @@ switch_status_t config_sofia(int reload, char *profile_name)
|
|||||||
switch_set_flag(profile, TFLAG_LATE_NEGOTIATION);
|
switch_set_flag(profile, TFLAG_LATE_NEGOTIATION);
|
||||||
} else if (!strcasecmp(var, "inbound-proxy-media") && switch_true(val)) {
|
} else if (!strcasecmp(var, "inbound-proxy-media") && switch_true(val)) {
|
||||||
switch_set_flag(profile, TFLAG_PROXY_MEDIA);
|
switch_set_flag(profile, TFLAG_PROXY_MEDIA);
|
||||||
|
} else if (!strcasecmp(var, "received-in-nat-reg-contact") && switch_true(val)) {
|
||||||
|
profile->pflags |= PFLAG_RECIEVED_IN_NAT_REG_CONTACT;
|
||||||
} else if (!strcasecmp(var, "aggressive-nat-detection") && switch_true(val)) {
|
} else if (!strcasecmp(var, "aggressive-nat-detection") && switch_true(val)) {
|
||||||
profile->pflags |= PFLAG_AGGRESSIVE_NAT_DETECTION;
|
profile->pflags |= PFLAG_AGGRESSIVE_NAT_DETECTION;
|
||||||
} else if (!strcasecmp(var, "rfc2833-pt")) {
|
} else if (!strcasecmp(var, "rfc2833-pt")) {
|
||||||
|
@ -704,32 +704,44 @@ uint8_t sofia_reg_handle_register(nua_t * nua, sofia_profile_t *profile, nua_han
|
|||||||
|
|
||||||
if (regtype == REG_REGISTER) {
|
if (regtype == REG_REGISTER) {
|
||||||
char *new_contact = NULL;
|
char *new_contact = NULL;
|
||||||
char *p;
|
char new_port[30] = "";
|
||||||
|
char received_data[128] = "";
|
||||||
if ((p = strstr(contact_str, ";nat"))) {
|
char exp_param[128] = "";
|
||||||
*p = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (exptime) {
|
if (exptime) {
|
||||||
if (is_nat || nat_hack) {
|
switch_snprintf(exp_param, sizeof(exp_param), ";expires=%ld", exptime);
|
||||||
new_contact = switch_mprintf("%s;expires=%ld;received=\"%s:%d\"", contact_str, (long)exptime, network_ip, network_port);
|
|
||||||
} else {
|
|
||||||
new_contact = switch_mprintf("%s;expires=%ld", contact_str, (long)exptime);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (contact->m_url->url_port) {
|
||||||
|
switch_snprintf(new_port, sizeof(new_port), ":%s", contact->m_url->url_port);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((is_nat || nat_hack) && (profile->pflags & PFLAG_RECIEVED_IN_NAT_REG_CONTACT)) {
|
||||||
|
switch_snprintf(received_data, sizeof(received_data), ";received=\"%s:%d\"", network_ip, network_port);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (contact->m_url->url_params) {
|
||||||
|
new_contact = switch_mprintf("%s <sip:%s@%s%s;%s>%s%s",
|
||||||
|
display, contact->m_url->url_user, contact->m_url->url_host, new_port, contact->m_url->url_params,
|
||||||
|
exp_param, received_data);
|
||||||
|
} else {
|
||||||
|
new_contact = switch_mprintf("%s <sip:%s@%s%s>%s%s",
|
||||||
|
display, contact->m_url->url_user, contact->m_url->url_host, new_port,
|
||||||
|
exp_param, received_data);
|
||||||
|
}
|
||||||
|
|
||||||
nua_respond(nh,
|
nua_respond(nh,
|
||||||
SIP_200_OK,
|
SIP_200_OK,
|
||||||
SIPTAG_CONTACT_STR(new_contact), NUTAG_WITH_THIS(nua), TAG_END());
|
SIPTAG_CONTACT_STR(new_contact), NUTAG_WITH_THIS(nua), TAG_END());
|
||||||
switch_safe_free(new_contact);
|
switch_safe_free(new_contact);
|
||||||
|
|
||||||
|
if (exptime) {
|
||||||
if (switch_event_create(&event, SWITCH_EVENT_MESSAGE_QUERY) == SWITCH_STATUS_SUCCESS) {
|
if (switch_event_create(&event, SWITCH_EVENT_MESSAGE_QUERY) == SWITCH_STATUS_SUCCESS) {
|
||||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Message-Account", "sip:%s@%s", to_user, to_host);
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Message-Account", "sip:%s@%s", to_user, to_host);
|
||||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "VM-Sofia-Profile", "%s", profile->name);
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "VM-Sofia-Profile", "%s", profile->name);
|
||||||
switch_event_fire(&event);
|
switch_event_fire(&event);
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
nua_respond(nh,
|
|
||||||
SIP_200_OK,
|
|
||||||
SIPTAG_CONTACT(contact), NUTAG_WITH_THIS(nua), TAG_END());
|
|
||||||
|
|
||||||
if (switch_event_create_subclass(&s_event, SWITCH_EVENT_CUSTOM, MY_EVENT_UNREGISTER) == SWITCH_STATUS_SUCCESS) {
|
if (switch_event_create_subclass(&s_event, SWITCH_EVENT_CUSTOM, MY_EVENT_UNREGISTER) == SWITCH_STATUS_SUCCESS) {
|
||||||
switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "profile-name", "%s", profile->name);
|
switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "profile-name", "%s", profile->name);
|
||||||
switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "from-user", "%s", to_user);
|
switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "from-user", "%s", to_user);
|
||||||
@ -741,6 +753,8 @@ uint8_t sofia_reg_handle_register(nua_t * nua, sofia_profile_t *profile, nua_han
|
|||||||
switch_event_fire(&s_event);
|
switch_event_fire(&s_event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user