add an external port output parameter to switch_nat_add_mapping and use it in sofia_glue_tech_choose_port

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13629 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Mathieu Rene committed 2009-06-05 02:30:44 +00:00
1 parent 60ec88985a
commit b633d3298e
6 files changed
+46 -16

No files matched your search

@@ -49,6 +49,7 @@ SWITCH_STANDARD_API(nat_map_function)
int argc;
char *mydata = NULL, *argv[4];
switch_nat_ip_proto_t proto = SWITCH_NAT_UDP;
switch_port_t external_port = 0;
if (!cmd) {
goto error;
@@ -70,8 +71,8 @@ SWITCH_STANDARD_API(nat_map_function)
}
if (argv[0] && switch_stristr("add", argv[0])) {
if (switch_nat_add_mapping((switch_port_t)atoi(argv[1]), proto) == SWITCH_STATUS_SUCCESS) {
stream->write_function(stream, "true");
if (switch_nat_add_mapping((switch_port_t)atoi(argv[1]), proto, &external_port) == SWITCH_STATUS_SUCCESS) {
stream->write_function(stream, "%d", (int)external_port);
goto ok;
}
} else if (argv[0] && switch_stristr("del", argv[0])) {