Add ability to specifiy the source port on the stun request
This commit is contained in:
parent
9df0a987cd
commit
36893d713f
|
@ -1329,6 +1329,8 @@ SWITCH_STANDARD_API(stun_function)
|
||||||
switch_port_t port = 0;
|
switch_port_t port = 0;
|
||||||
switch_memory_pool_t *pool = NULL;
|
switch_memory_pool_t *pool = NULL;
|
||||||
char *error = "";
|
char *error = "";
|
||||||
|
char *argv[3] = { 0 };
|
||||||
|
char *mycmd = NULL;
|
||||||
|
|
||||||
ip = ip_buf;
|
ip = ip_buf;
|
||||||
|
|
||||||
|
@ -1337,9 +1339,15 @@ SWITCH_STANDARD_API(stun_function)
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
stun_ip = strdup(cmd);
|
mycmd = strdup(cmd);
|
||||||
|
switch_split(mycmd, ' ', argv);
|
||||||
|
|
||||||
|
stun_ip = argv[0];
|
||||||
|
|
||||||
switch_assert(stun_ip);
|
switch_assert(stun_ip);
|
||||||
|
|
||||||
|
port = argv[1] ? atoi(argv[1]) : 0;
|
||||||
|
|
||||||
if ((p = strchr(stun_ip, ':'))) {
|
if ((p = strchr(stun_ip, ':'))) {
|
||||||
int iport;
|
int iport;
|
||||||
*p++ = '\0';
|
*p++ = '\0';
|
||||||
|
@ -1374,7 +1382,7 @@ SWITCH_STANDARD_API(stun_function)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_core_destroy_memory_pool(&pool);
|
switch_core_destroy_memory_pool(&pool);
|
||||||
free(stun_ip);
|
switch_safe_free(mycmd);
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue