priv_fix
This commit is contained in:
parent
2bbc57814e
commit
ff6237a382
1 changed files with 21 additions and 0 deletions
|
@ -733,6 +733,27 @@ PJ_DEF(pj_status_t) pj_sockaddr_parse( int af, unsigned options,
|
||||||
|
|
||||||
/* Resolve the IP address of local machine */
|
/* Resolve the IP address of local machine */
|
||||||
PJ_DEF(pj_status_t) pj_gethostip(int af, pj_sockaddr *addr)
|
PJ_DEF(pj_status_t) pj_gethostip(int af, pj_sockaddr *addr)
|
||||||
|
{
|
||||||
|
char *bind = NULL;
|
||||||
|
if (af == PJ_AF_INET) {
|
||||||
|
bind = getenv("PJSIP_BIND4");
|
||||||
|
}
|
||||||
|
else if (af == PJ_AF_INET6) {
|
||||||
|
bind = getenv("PJSIP_BIND6");
|
||||||
|
}
|
||||||
|
if (bind) {
|
||||||
|
pj_str_t pjbind = pj_str(bind);
|
||||||
|
pj_sockaddr dst_addr;
|
||||||
|
pj_status_t status = pj_sockaddr_init(af, &dst_addr, &pjbind, 0);
|
||||||
|
if (status == PJ_SUCCESS) {
|
||||||
|
pj_sockaddr_cp(addr, &dst_addr);
|
||||||
|
printf("---------- af:%d, bind:%s, PJ_SUCCESS:%d\n", af, bind, status);
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return _pj_gethostip(af, addr);
|
||||||
|
}
|
||||||
|
pj_status_t _pj_gethostip(int af, pj_sockaddr *addr)
|
||||||
{
|
{
|
||||||
unsigned i, count, cand_cnt;
|
unsigned i, count, cand_cnt;
|
||||||
enum {
|
enum {
|
||||||
|
|
Loading…
Reference in a new issue