1 --- ekiga-2.0.3/src/endpoints/manager.cpp.old 2006-11-09 13:35:29.753351000 +0800 2 +++ ekiga-2.0.3/src/endpoints/manager.cpp 2006-11-09 14:26:11.441035000 +0800 3 @@ -1592,14 +1592,20 @@ 4 gnomemeeting_threads_leave (); 5 6 h323EP->RemoveListener (NULL); 7 - if (!h323EP->StartListener (iface, port)) { 8 - 9 - gnomemeeting_threads_enter (); 10 - 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 - if (gtk_window_is_active (GTK_WINDOW (druid))) 12 - gtk_widget_set_parent (dialog, druid); 13 - gnomemeeting_threads_leave (); 14 - } 15 + //Port conflict occured when multiple ekiga instances or DTUs connected with the same SunRay server 16 + //since H.323 uses 1720 as default listen port and SIP uses 5060 17 + //This patch is trying to find the available one in the 10 continous ports from the default 18 + for (int i = 0 ; i < 10 ; i++) 19 + if (h323EP->StartListener (iface, port++)) { 20 + break; 21 + } 22 + else if (i >= 9) { 23 + gnomemeeting_threads_enter (); 24 + 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 + if (gtk_window_is_active (GTK_WINDOW (druid))) 26 + gtk_widget_set_parent (dialog, druid); 27 + gnomemeeting_threads_leave (); 28 + } 29 } 30 31 if (sipEP) { 32 @@ -1609,14 +1615,17 @@ 33 gnomemeeting_threads_leave (); 34 35 sipEP->RemoveListener (NULL); 36 - if (!sipEP->StartListener (iface, port)) { 37 - 38 - gnomemeeting_threads_enter (); 39 - 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 - if (gtk_window_is_active (GTK_WINDOW (druid))) 41 - gtk_widget_set_parent (dialog, druid); 42 - gnomemeeting_threads_leave (); 43 - } 44 + for (int i = 0 ; i < 10 ; i++) 45 + if (sipEP->StartListener (iface, port++)) { 46 + break; 47 + } 48 + else if (i >= 9) { 49 + gnomemeeting_threads_enter (); 50 + 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 + if (gtk_window_is_active (GTK_WINDOW (druid))) 52 + gtk_widget_set_parent (dialog, druid); 53 + gnomemeeting_threads_leave (); 54 + } 55 } 56 57 g_free (iface); 58