minor tweaks
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13516 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
ffba850acf
commit
eaf470bd92
|
@ -196,7 +196,7 @@ static switch_status_t switch_nat_add_mapping_upnp(switch_port_t port, switch_na
|
||||||
{
|
{
|
||||||
switch_status_t status = SWITCH_STATUS_FALSE;
|
switch_status_t status = SWITCH_STATUS_FALSE;
|
||||||
char port_str[16];
|
char port_str[16];
|
||||||
int r = -1;
|
int r = UPNPCOMMAND_UNKNOWN_ERROR;
|
||||||
|
|
||||||
sprintf(port_str, "%d", port);
|
sprintf(port_str, "%d", port);
|
||||||
|
|
||||||
|
@ -206,7 +206,7 @@ static switch_status_t switch_nat_add_mapping_upnp(switch_port_t port, switch_na
|
||||||
r = UPNP_AddPortMapping(nat_globals.urls.controlURL, nat_globals.data.servicetype, port_str, port_str, nat_globals.pvt_addr, 0, "UDP", 0);
|
r = UPNP_AddPortMapping(nat_globals.urls.controlURL, nat_globals.data.servicetype, port_str, port_str, nat_globals.pvt_addr, 0, "UDP", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r == 0) {
|
if (r == UPNPCOMMAND_SUCCESS) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "mapped public port %s protocol %s to localport %s\n", port_str,
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "mapped public port %s protocol %s to localport %s\n", port_str,
|
||||||
(proto == SWITCH_NAT_TCP) ? "TCP" : (proto == SWITCH_NAT_UDP ? "UDP" : "UNKNOWN"), port_str);
|
(proto == SWITCH_NAT_TCP) ? "TCP" : (proto == SWITCH_NAT_UDP ? "UDP" : "UNKNOWN"), port_str);
|
||||||
status = SWITCH_STATUS_SUCCESS;
|
status = SWITCH_STATUS_SUCCESS;
|
||||||
|
@ -250,19 +250,21 @@ static switch_status_t switch_nat_del_mapping_upnp(switch_port_t port, switch_na
|
||||||
{
|
{
|
||||||
switch_status_t status = SWITCH_STATUS_FALSE;
|
switch_status_t status = SWITCH_STATUS_FALSE;
|
||||||
char port_str[16];
|
char port_str[16];
|
||||||
|
int r = UPNPCOMMAND_UNKNOWN_ERROR;
|
||||||
|
|
||||||
sprintf(port_str, "%d", port);
|
sprintf(port_str, "%d", port);
|
||||||
|
|
||||||
if (proto == SWITCH_NAT_TCP) {
|
if (proto == SWITCH_NAT_TCP) {
|
||||||
UPNP_DeletePortMapping(nat_globals.urls.controlURL, nat_globals.data.servicetype, port_str, "TCP", 0);
|
r = UPNP_DeletePortMapping(nat_globals.urls.controlURL, nat_globals.data.servicetype, port_str, "TCP", 0);
|
||||||
} else if(proto == SWITCH_NAT_UDP) {
|
} else if(proto == SWITCH_NAT_UDP) {
|
||||||
UPNP_DeletePortMapping(nat_globals.urls.controlURL, nat_globals.data.servicetype, port_str, "UDP", 0);
|
r = UPNP_DeletePortMapping(nat_globals.urls.controlURL, nat_globals.data.servicetype, port_str, "UDP", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (r == UPNPCOMMAND_SUCCESS) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "unmapped public port %s protocol %s to localport %s\n", port_str,
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "unmapped public port %s protocol %s to localport %s\n", port_str,
|
||||||
(proto == SWITCH_NAT_TCP) ? "TCP" : (proto == SWITCH_NAT_UDP ? "UDP" : "UNKNOWN"), port_str);
|
(proto == SWITCH_NAT_TCP) ? "TCP" : (proto == SWITCH_NAT_UDP ? "UDP" : "UNKNOWN"), port_str);
|
||||||
status = SWITCH_STATUS_SUCCESS;
|
status = SWITCH_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue