Changeset 1495 for pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c
- Timestamp:
- Oct 12, 2007 12:14:27 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c
r1488 r1495 679 679 680 680 /* Start resolving STUN server */ 681 681 682 status = pjsua_resolve_stun_server(PJ_FALSE); 682 683 if (status != PJ_SUCCESS && status != PJ_EPENDING) { … … 939 940 } 940 941 941 942 pjsua_var.stun_status = pj_gethostbyname(&str_host, &he); 943 944 if (pjsua_var.stun_status == PJ_SUCCESS) { 945 pj_sockaddr_in_init(&pjsua_var.stun_srv.ipv4, NULL, 0); 946 pjsua_var.stun_srv.ipv4.sin_addr = *(pj_in_addr*)he.h_addr; 947 pjsua_var.stun_srv.ipv4.sin_port = pj_htons((pj_uint16_t)port); 948 949 PJ_LOG(3,(THIS_FILE, 950 "STUN server %.*s resolved, address is %s:%d", 951 (int)pjsua_var.ua_cfg.stun_host.slen, 952 pjsua_var.ua_cfg.stun_host.ptr, 953 pj_inet_ntoa(pjsua_var.stun_srv.ipv4.sin_addr), 954 (int)pj_ntohs(pjsua_var.stun_srv.ipv4.sin_port))); 942 pjsua_var.stun_status = 943 pj_sockaddr_in_init(&pjsua_var.stun_srv.ipv4, &str_host, 944 (pj_uint16_t)port); 945 946 if (pjsua_var.stun_status != PJ_SUCCESS) { 947 pjsua_var.stun_status = pj_gethostbyname(&str_host, &he); 948 949 if (pjsua_var.stun_status == PJ_SUCCESS) { 950 pj_sockaddr_in_init(&pjsua_var.stun_srv.ipv4, NULL, 0); 951 pjsua_var.stun_srv.ipv4.sin_addr = *(pj_in_addr*)he.h_addr; 952 pjsua_var.stun_srv.ipv4.sin_port = pj_htons((pj_uint16_t)port); 953 } 955 954 } 955 956 PJ_LOG(3,(THIS_FILE, 957 "STUN server %.*s resolved, address is %s:%d", 958 (int)pjsua_var.ua_cfg.stun_host.slen, 959 pjsua_var.ua_cfg.stun_host.ptr, 960 pj_inet_ntoa(pjsua_var.stun_srv.ipv4.sin_addr), 961 (int)pj_ntohs(pjsua_var.stun_srv.ipv4.sin_port))); 956 962 957 963 } … … 1854 1860 1855 1861 /* 1862 * Detect NAT type. 1863 */ 1864 PJ_DEF(pj_status_t) pjsua_detect_nat_type( void *user_data, 1865 pj_stun_nat_detect_cb *cb) 1866 { 1867 pj_status_t status; 1868 1869 /* Make sure STUN server resolution has completed */ 1870 status = pjsua_resolve_stun_server(PJ_TRUE); 1871 if (status != PJ_SUCCESS) { 1872 return status; 1873 } 1874 1875 /* Make sure we have STUN */ 1876 if (pjsua_var.stun_srv.ipv4.sin_family == 0) { 1877 return PJ_EINVALIDOP; 1878 } 1879 1880 return pj_stun_detect_nat_type(&pjsua_var.stun_srv.ipv4, 1881 &pjsua_var.stun_cfg, 1882 user_data, cb); 1883 } 1884 1885 1886 /* 1856 1887 * Verify that valid SIP url is given. 1857 1888 */
Note: See TracChangeset
for help on using the changeset viewer.