From: <Gil...@al...> - 2005-03-23 11:33:05
|
Hi, there the pb i mentioned some days ago has a work-around now as follows in sipp.cpp: /* debut modification */ /* Here, bind with main_socket if transport = UDP */ /* For TCP transport, call bind with tcp_multiplex */ /* see modification below on TCP transport and not server mode*/ if((!local_port) && (transport != T_TCP)) { /* fin modification */ /* Not already binded, use user_port of 0 to leave * the system choose a port. */ if (is_ipv6) { (_RCAST(struct sockaddr_in6 *, &local_sockaddr))->sin6_port = htons((short)user_port); } else { (_RCAST(struct sockaddr_in *, &local_sockaddr))->sin_port = htons((short)user_port); } #ifdef _USE_OPENSSL if((!multisocket) && (transport == T_TCP || transport == T_TLS) && #else if((!multisocket) && (transport == T_TCP) && #endif (toolMode != MODE_SERVER)) { if((tcp_multiplex = socket(is_ipv6 ? AF_INET6 : AF_INET, SOCK_STREAM, 0))== -1) { ERROR_NO("Unable to get a TCP socket"); } /* debut modification */ /* bind for TCP transport uses tcp_multiplex, see modification done before on former line :*/ /* if((!local_port) && (transport != T_TCP)) { */ /* pb with bind = 1) main_socket binds on the -p value : user_port; 2) but it's tcp_multiplex which is used to establish tcp connection... => user_port is no longer available... */ (_RCAST(struct sockaddr_in *, &local_sockaddr))->sin_port = htons((short)user_port); if(bind(tcp_multiplex, (sockaddr *)(void *)&local_sockaddr, SOCK_ADDR_SIZE(&local_sockaddr))) { ERROR_NO("Unable to bind main socket"); } /* fin modification */ it is ok for me when using SIPP has active or passive in UDP or TCP mode on the same machine, for simulation between client 1 (active one) and client 2 (passive one): sipp (port1 for client 1) SIP Core sipp (port 2 for client 2) UDP/IP1/port5061 UDP/IP2/port5060 UDP/IP1/portt5062 or TCP/IP1/port5061 TCP/IP2/port5060 TCP/IP1/portt5062 INVITE (client1->client2) ------------------------------------------------------> INVITE (client1 -> client2) ------------------------------------------------------------> I can not test all other cases. What do you think? BR Gildas. |