1 9843 hawklu --- ekiga-2.0.3/src/endpoints/manager.cpp.old 2006-11-09 13:35:29.753351000 +0800 2 9843 hawklu +++ ekiga-2.0.3/src/endpoints/manager.cpp 2006-11-09 14:26:11.441035000 +0800 3 9843 hawklu @@ -1592,14 +1592,20 @@ 4 9843 hawklu gnomemeeting_threads_leave (); 5 9843 hawklu 6 9843 hawklu h323EP->RemoveListener (NULL); 7 9843 hawklu - if (!h323EP->StartListener (iface, port)) { 8 9843 hawklu - 9 9843 hawklu - gnomemeeting_threads_enter (); 10 9843 hawklu - dialog = gnomemeeting_error_dialog (GTK_WINDOW (main_window), _("Error while starting the listener for the H.323 protocol"), _("You will not be able to receive incoming H.323 calls. Please check that no other program is already running on the port used by Ekiga.")); 11 9843 hawklu - if (gtk_window_is_active (GTK_WINDOW (druid))) 12 9843 hawklu - gtk_widget_set_parent (dialog, druid); 13 9843 hawklu - gnomemeeting_threads_leave (); 14 9843 hawklu - } 15 18520 yippi + //Port conflict occured when multiple ekiga instances or DTUs connected with the same Sun Ray server 16 9843 hawklu + //since H.323 uses 1720 as default listen port and SIP uses 5060 17 9843 hawklu + //This patch is trying to find the available one in the 10 continous ports from the default 18 9843 hawklu + for (int i = 0 ; i < 10 ; i++) 19 9843 hawklu + if (h323EP->StartListener (iface, port++)) { 20 9843 hawklu + break; 21 9843 hawklu + } 22 9843 hawklu + else if (i >= 9) { 23 9843 hawklu + gnomemeeting_threads_enter (); 24 9843 hawklu + dialog = gnomemeeting_error_dialog (GTK_WINDOW (main_window), _("Error while starting the listener for the H.323 protocol"), _("You will not be able to receive incoming H.323 calls. Please check that no other program is already running on the port used by Ekiga.")); 25 9843 hawklu + if (gtk_window_is_active (GTK_WINDOW (druid))) 26 9843 hawklu + gtk_widget_set_parent (dialog, druid); 27 9843 hawklu + gnomemeeting_threads_leave (); 28 9843 hawklu + } 29 9843 hawklu } 30 9843 hawklu 31 9843 hawklu if (sipEP) { 32 9843 hawklu @@ -1609,14 +1615,17 @@ 33 9843 hawklu gnomemeeting_threads_leave (); 34 9843 hawklu 35 9843 hawklu sipEP->RemoveListener (NULL); 36 9843 hawklu - if (!sipEP->StartListener (iface, port)) { 37 9843 hawklu - 38 9843 hawklu - gnomemeeting_threads_enter (); 39 9843 hawklu - dialog = gnomemeeting_error_dialog (GTK_WINDOW (main_window), _("Error while starting the listener for the SIP protocol"), _("You will not be able to receive incoming SIP calls. Please check that no other program is already running on the port used by Ekiga.")); 40 9843 hawklu - if (gtk_window_is_active (GTK_WINDOW (druid))) 41 9843 hawklu - gtk_widget_set_parent (dialog, druid); 42 9843 hawklu - gnomemeeting_threads_leave (); 43 9843 hawklu - } 44 9843 hawklu + for (int i = 0 ; i < 10 ; i++) 45 9843 hawklu + if (sipEP->StartListener (iface, port++)) { 46 9843 hawklu + break; 47 9843 hawklu + } 48 9843 hawklu + else if (i >= 9) { 49 9843 hawklu + gnomemeeting_threads_enter (); 50 9843 hawklu + dialog = gnomemeeting_error_dialog (GTK_WINDOW (main_window), _("Error while starting the listener for the SIP protocol"), _("You will not be able to receive incoming SIP calls. Please check that no other program is already running on the port used by Ekiga.")); 51 9843 hawklu + if (gtk_window_is_active (GTK_WINDOW (druid))) 52 9843 hawklu + gtk_widget_set_parent (dialog, druid); 53 9843 hawklu + gnomemeeting_threads_leave (); 54 9843 hawklu + } 55 9843 hawklu } 56 9843 hawklu 57 9843 hawklu g_free (iface); 58