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