diff options
Diffstat (limited to 'pjsip/src/pjsip/sip_transport.c')
-rw-r--r-- | pjsip/src/pjsip/sip_transport.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/pjsip/src/pjsip/sip_transport.c b/pjsip/src/pjsip/sip_transport.c index 4d32bbdc..66e5d1bb 100644 --- a/pjsip/src/pjsip/sip_transport.c +++ b/pjsip/src/pjsip/sip_transport.c @@ -1291,19 +1291,26 @@ static pj_status_t get_net_interface(pjsip_transport_type_e tp_type, { int af; pj_sockaddr itf_addr; - pj_status_t status; + pj_status_t status = -1; af = (tp_type & PJSIP_TRANSPORT_IPV6)? PJ_AF_INET6 : PJ_AF_INET; - status = pj_getipinterface(af, dst, &itf_addr, PJ_FALSE, NULL); - if (status != PJ_SUCCESS) { - /* If it fails, e.g: on WM6 (http://support.microsoft.com/kb/129065), - * just fallback using pj_gethostip(), see ticket #1660. - */ - PJ_LOG(5,(THIS_FILE,"Warning: unable to determine local " - "interface, fallback to default interface!")); - status = pj_gethostip(af, &itf_addr); - if (status != PJ_SUCCESS) - return status; + + if (pjsip_cfg()->endpt.resolve_hostname_to_get_interface) { + status = pj_getipinterface(af, dst, &itf_addr, PJ_TRUE, NULL); + } + + if (status != PJ_SUCCESS) { + status = pj_getipinterface(af, dst, &itf_addr, PJ_FALSE, NULL); + if (status != PJ_SUCCESS) { + /* If it fails, e.g: on WM6(http://support.microsoft.com/kb/129065), + * just fallback using pj_gethostip(), see ticket #1660. + */ + PJ_LOG(5,(THIS_FILE,"Warning: unable to determine local " + "interface, fallback to default interface!")); + status = pj_gethostip(af, &itf_addr); + if (status != PJ_SUCCESS) + return status; + } } /* Print address */ |