diff options
author | Benny Prijono <bennylp@teluu.com> | 2007-12-20 11:23:07 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2007-12-20 11:23:07 +0000 |
commit | 050af3159e072d2cde0e4354a596a5b10959cd55 (patch) | |
tree | d18b49cef4d1dbad6b33bcf0afafc88614834ddb /pjsip/src/pjsua-lib/pjsua_media.c | |
parent | b2a057941ada78ae228da21c311347d2d5469162 (diff) |
Related to Ticket #429: when bind address is specified and public address is not, the bind address should be used as the public address (thanks Arie Velthoen)
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1636 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/src/pjsua-lib/pjsua_media.c')
-rw-r--r-- | pjsip/src/pjsua-lib/pjsua_media.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/pjsip/src/pjsua-lib/pjsua_media.c b/pjsip/src/pjsua-lib/pjsua_media.c index 38788478..3a577247 100644 --- a/pjsip/src/pjsua-lib/pjsua_media.c +++ b/pjsip/src/pjsua-lib/pjsua_media.c @@ -346,16 +346,21 @@ static pj_status_t create_rtp_rtcp_sock(const pjsua_transport_config *cfg, break; } else { - pj_sockaddr addr; - /* Get local IP address. */ - status = pj_gethostip(pj_AF_INET(), &addr); - if (status != PJ_SUCCESS) - goto on_error; + if (bound_addr.sin_addr.s_addr == 0) { + pj_sockaddr addr; + + /* Get local IP address. */ + status = pj_gethostip(pj_AF_INET(), &addr); + if (status != PJ_SUCCESS) + goto on_error; + + bound_addr.sin_addr.s_addr = addr.ipv4.sin_addr.s_addr; + } for (i=0; i<2; ++i) { pj_sockaddr_in_init(&mapped_addr[i], NULL, 0); - mapped_addr[i].sin_addr.s_addr = addr.ipv4.sin_addr.s_addr; + mapped_addr[i].sin_addr.s_addr = bound_addr.sin_addr.s_addr; } mapped_addr[0].sin_port=pj_htons((pj_uint16_t)next_rtp_port); |