- Timestamp:
- Feb 14, 2007 2:36:13 PM (18 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c
r904 r947 486 486 case OPT_LOCAL_PORT: /* local-port */ 487 487 lval = pj_strtoul(pj_cstr(&tmp, pj_optarg)); 488 if (lval < 1|| lval > 65535) {488 if (lval < 0 || lval > 65535) { 489 489 PJ_LOG(1,(THIS_FILE, 490 490 "Error: expecting integer value for " … … 2892 2892 { 2893 2893 pjsua_transport_id transport_id = -1; 2894 pjsua_transport_config tcp_cfg; 2894 2895 unsigned i; 2895 2896 pj_status_t status; … … 2996 2997 } 2997 2998 2999 pj_memcpy(&tcp_cfg, &app_config.udp_cfg, sizeof(tcp_cfg)); 3000 2998 3001 /* Add UDP transport unless it's disabled. */ 2999 3002 if (!app_config.no_udp) { … … 3010 3013 //pjsua_acc_set_transport(aid, transport_id); 3011 3014 pjsua_acc_set_online_status(current_acc, PJ_TRUE); 3015 3016 if (app_config.udp_cfg.port == 0) { 3017 pjsua_transport_info ti; 3018 pj_sockaddr_in *a; 3019 3020 pjsua_transport_get_info(transport_id, &ti); 3021 a = (pj_sockaddr_in*)&ti.local_addr; 3022 3023 tcp_cfg.port = pj_ntohs(a->sin_port); 3024 } 3012 3025 } 3013 3026 … … 3015 3028 if (!app_config.no_tcp) { 3016 3029 status = pjsua_transport_create(PJSIP_TRANSPORT_TCP, 3017 & app_config.udp_cfg,3030 &tcp_cfg, 3018 3031 &transport_id); 3019 3032 if (status != PJ_SUCCESS) -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c
r941 r947 842 842 } 843 843 844 /* If port is zero, get the bound port */ 845 if (port == 0) { 846 pj_sockaddr_in bound_addr; 847 int namelen = sizeof(bound_addr); 848 status = pj_sock_getsockname(sock, &bound_addr, &namelen); 849 if (status != PJ_SUCCESS) { 850 pjsua_perror(THIS_FILE, "getsockname() error", status); 851 pj_sock_close(sock); 852 return status; 853 } 854 855 port = pj_ntohs(bound_addr.sin_port); 856 } 857 844 858 /* Copy and normalize STUN param */ 845 859 if (use_stun) { … … 874 888 * address, only set the port. 875 889 */ 876 /* Do nothing */ 890 if (p_pub_addr->sin_port == 0) 891 p_pub_addr->sin_port = pj_htons((pj_uint16_t)port); 877 892 878 893 } else {
Note: See TracChangeset
for help on using the changeset viewer.