FSCORE-405
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@14373 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
49d14d9934
commit
1b26db6e55
|
@ -231,6 +231,7 @@ static void *SWITCH_THREAD_FUNC switch_nat_multicast_runtime(switch_thread_t *th
|
||||||
{
|
{
|
||||||
char *buf = NULL;
|
char *buf = NULL;
|
||||||
char newip[16];
|
char newip[16];
|
||||||
|
char *pos;
|
||||||
switch_event_t *event = NULL;
|
switch_event_t *event = NULL;
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "NAT thread started\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "NAT thread started\n");
|
||||||
|
@ -259,19 +260,25 @@ static void *SWITCH_THREAD_FUNC switch_nat_multicast_runtime(switch_thread_t *th
|
||||||
if (nat_globals.nat_type == SWITCH_NAT_TYPE_UPNP) {
|
if (nat_globals.nat_type == SWITCH_NAT_TYPE_UPNP) {
|
||||||
/* look for our desc URL and servicetype in the packet */
|
/* look for our desc URL and servicetype in the packet */
|
||||||
if (strstr(buf, nat_globals.descURL) && (buf == NULL || strstr(buf, nat_globals.data.servicetype))) {
|
if (strstr(buf, nat_globals.descURL) && (buf == NULL || strstr(buf, nat_globals.data.servicetype))) {
|
||||||
if (strstr(buf, "NTS: ssdp:alive")) {
|
if ((pos = strstr(buf, "NTS:"))) {
|
||||||
|
pos = pos + 4;
|
||||||
|
while(*pos && *pos == ' ') {
|
||||||
|
pos++;
|
||||||
|
}
|
||||||
|
if (!strncmp(pos, "ssdp:alive", 10)) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "got UPnP keep alive packet: \n%s\n", buf);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "got UPnP keep alive packet: \n%s\n", buf);
|
||||||
/* did pub ip change */
|
/* did pub ip change */
|
||||||
if (get_upnp_pubaddr(newip) != SWITCH_STATUS_SUCCESS) {
|
if (get_upnp_pubaddr(newip) != SWITCH_STATUS_SUCCESS) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unable to get current pubaddr after receiving UPnP keep alive packet.\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unable to get current pubaddr after receiving UPnP keep alive packet.\n");
|
||||||
}
|
}
|
||||||
} else if (strstr(buf, "NTS: ssdp:byebye")) {
|
} else if (!strncmp(pos, "ssdp:byebye", 11)) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "got UPnP signoff packet. Your NAT gateway is probably going offline.\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "got UPnP signoff packet. Your NAT gateway is probably going offline.\n");
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "got UPnP signoff packet: \n%s\n", buf);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "got UPnP signoff packet: \n%s\n", buf);
|
||||||
} else {
|
} else {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "got UNKNOWN UPnP keep alive packet: \n%s\n", buf);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "got UNKNOWN UPnP keep alive packet: \n%s\n", buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
/* got some data in NAT-PMP mode, treat any data as a republish event */
|
/* got some data in NAT-PMP mode, treat any data as a republish event */
|
||||||
if (get_pmp_pubaddr(newip) < 0) {
|
if (get_pmp_pubaddr(newip) < 0) {
|
||||||
|
|
Loading…
Reference in New Issue