Ticket #562: In TURN client sample application, when STUN server is specified, contact the STUN server on default STUN port rather than the TURN port

git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@2125 74dad513-b988-da41-8d7b-12977e46ad98
This commit is contained in:
Benny Prijono 2008-07-12 10:08:37 +00:00
parent 41d7013ab0
commit 1222ef697d
1 changed files with 7 additions and 4 deletions

View File

@ -133,6 +133,7 @@ static int init()
for (i=0; i<(int)PJ_ARRAY_SIZE(g.peer); ++i) {
pj_stun_sock_cb stun_sock_cb;
char name[] = "peer0";
pj_uint16_t port;
pj_str_t server;
pj_bzero(&stun_sock_cb, sizeof(stun_sock_cb));
@ -150,13 +151,15 @@ static int init()
return status;
}
if (o.stun_server)
if (o.stun_server) {
server = pj_str(o.stun_server);
else
port = PJ_STUN_PORT;
} else {
server = pj_str(o.srv_addr);
port = (pj_uint16_t)(o.srv_port?atoi(o.srv_port):PJ_STUN_PORT);
}
status = pj_stun_sock_start(g.peer[i].stun_sock, &server,
(pj_uint16_t)(o.srv_port?atoi(o.srv_port):PJ_STUN_PORT),
NULL);
port, NULL);
if (status != PJ_SUCCESS) {
my_perror("pj_stun_sock_start()", status);
return status;