#242: -s (several) option doesn't work ------------------------+--------------------------------------------------- Reporter: chris-mac | Owner: vadim Type: defect | Status: new Priority: major | Milestone: QuteCom 2.2-RC4 Component: phapi | Version: 2.2 Resolution: | Keywords: Field_os: all | ------------------------+---------------------------------------------------
Old description: > When QuteCom is started with -s (several) switch, all instances try to > bind to the same SIP port number. This results in all but the first > instance can't connect, and report the following error to the console: > > (error) 14:01:46 [PhApi] : osip: > /home/chris/workspace/app/qutecom-2.2-r639/wifo/eXosip/src/eXosip.c:580: > eXosip: TCP transport_listen failed! > (error) 14:01:46 [PhApi] : eXosip_init failed New description: When QuteCom is started with -s (several) switch, all instances try to bind to the same SIP port number. This results in all but the first instance can't connect, and report the following error to the console: (error) 14:01:46 [PhApi] : osip: qutecom-2.2-r639/wifo/eXosip/src/eXosip.c:580: eXosip: TCP transport_listen failed! (error) 14:01:46 [PhApi] : eXosip_init failed -- Comment(by chris-mac): With this patch it is possible to start two instances of QuteCom, but both are binding to the same port number??? See netstat output below: {{{ r...@dom:~# netstat -ltpeu --numeric-hosts --numeric-ports | grep qutecom tcp 0 0 127.0.0.1:25902 0.0.0.0:* LISTEN chris 189954 3886/qutecom udp 0 0 192.168.1.65:5060 0.0.0.0:* john 225246 3957/qutecom udp 0 0 192.168.1.65:5060 0.0.0.0:* chris 219291 3886/qutecom }}} BTW: I have never seen two different processes (owned by different users) binding to the same port before :) Because of that all incoming SIP messages are routed to both instances! Which results in a lot of errors like: {{{ (error) 08:21:27 [PhApi] : osip: /home/chris/workspace/app/temp/qutecom-2.2-r640/wifo/eXosip/src/udp.c:2527: no matching SIP account found }}} Another issue is that both instances try to bind port 25902 for !CommandServer (and only first one succeeds). '''Suggested solution''': check if the port we want to bind is free, and if it is not increment port number by one (trying say 50 ports). Pseudo code: {{{ int cmd_server_port = 0; while (int i = 25902; i <= (25902 + 50); i++) { if (isCmdServerPortFree(i) == true) { cmd_server_port = i; break; } } if (cmd_server_port == 0) { throw error "Failed to bind Command server port"; } int sip_port = 0; for (int i = 5060; i <= (5060 + 50); i++) { if (isSipPortFree(i) == true) { sip_port = i; break; } } if (sip_port == 0) { throw error "Failed to bind SIP port"; } }}} -- Ticket URL: <http://trac.qutecom.org/ticket/242#comment:2> QuteCom <http://trac.qutecom.org> _______________________________________________ QuteCom-dev mailing list QuteCom-dev@lists.qutecom.org http://lists.qutecom.org/mailman/listinfo/qutecom-dev