[GnomeMeeting-list] External ringing program (was Re: Shifting set of features)



Damien Sandras wrote:
Perhaps then another, easier to implement solution for those of us who have a less-than-usual needs would be to have a "run external program upon incoming call" checkbox, and a text entry to specify the executable's path. Gnomemeeting could then simply exec it to start ringing, and kill it (or send it another signal) to stop ringing.
--8<--8<--

That is too late for 1.00 anyway, but if you can come with an
interesting patch, it can be considered for another version.

Okay, I've made a quick something that works and solves the problem : with the patch below, there's a new "spawn external program on incoming calls" entry in the GnomeMeeting Sound Events submenu, and the sound file in that case is in fact the path to the program in question. It's a dirty UI hack, but I just wanted a quick fix for now.

If the option is enabled, Gnomemeeting spawns the program when a call comes that's not refused or forwarded, and kills it when the call isn't answered in time, is rejected, or if the user picks up.

I use the following "gnomemeeting_ring.sh" shell script as a ringing program:

--8<--8<--
#!/bin/sh

while [ 1 ];do
  play -d /dev/dsp0 /usr/share/sounds/gnomemeeting/gnomemeeting.wav > /dev/null
  sleep 1
done
--8<--8<--

Here's the patch against Gnomemeeting in the CVS:

--8<--8<--
diff -ruN gnomemeeting.ORIG/src/config.cpp gnomemeeting.PATCHED/src/config.cpp
--- gnomemeeting.ORIG/src/config.cpp    2004-01-22 20:54:16.000000000 +0100
+++ gnomemeeting.PATCHED/src/config.cpp 2004-02-03 00:10:19.000000000 +0100
@@ -1823,6 +1823,15 @@
                           sound_events_list_changed_nt,
                           NULL, NULL, NULL);

+  gconf_client_notify_add (client,
+                          SOUND_EVENTS_KEY "enable_on_call_exec",
+                          sound_events_list_changed_nt,
+                          NULL, NULL, NULL);
+  gconf_client_notify_add (client,
+                          SOUND_EVENTS_KEY "on_call_exec",
+                          sound_events_list_changed_nt,
+                          NULL, NULL, NULL);
+

   /* gnomemeeting_pref_window_audio_codecs */
gconf_client_notify_add (client, AUDIO_CODECS_KEY "list", audio_codecs_list_changed_nt, pw->codecs_list_store, 0, 0);
diff -ruN gnomemeeting.ORIG/src/endpoint.cpp gnomemeeting.PATCHED/src/endpoint.cpp
--- gnomemeeting.ORIG/src/endpoint.cpp  2004-01-26 15:31:34.000000000 +0100
+++ gnomemeeting.PATCHED/src/endpoint.cpp       2004-02-03 00:11:35.000000000 +0100
@@ -74,6 +74,7 @@


 extern GtkWidget *gm;
+static gint on_call_exec_pid = -1;


 /* The class */
@@ -700,6 +701,10 @@
   BOOL do_forward = FALSE;
   BOOL do_reject = FALSE;
   BOOL do_answer = FALSE;
+  gchar *on_call_exec = NULL;
+  BOOL enable_on_call_exec = FALSE;
+  GError *gerror = NULL;
+  gchar *argv[2] = {NULL,NULL};

 #ifdef HAS_IXJ
   GMLid *l = NULL;
@@ -713,6 +718,10 @@
     (IncomingCallMode) gconf_get_int (CALL_OPTIONS_KEY "incoming_call_mode");
   show_popup = gconf_get_bool (USER_INTERFACE_KEY "show_popup");
   no_answer_timeout = gconf_get_int (CALL_OPTIONS_KEY "no_answer_timeout");
+  enable_on_call_exec = gconf_get_bool (SOUND_EVENTS_KEY "enable_on_call_exec");
+  if (enable_on_call_exec) {
+    on_call_exec = gconf_get_string (SOUND_EVENTS_KEY "on_call_exec");
+  }
   gnomemeeting_threads_leave ();

   if (forward_host_gconf)
@@ -795,6 +804,7 @@
     g_free (utf8_name);
     g_free (utf8_app);
     g_free (msg);
+    g_free (on_call_exec);

     if (do_reject) {

@@ -850,6 +860,19 @@
   CallPendingTimer.RunContinuous (PTimeInterval (5));


+  /* Do we need to run an external ringing program ? */
+  if (enable_on_call_exec && on_call_exec) {
+    argv[0] = on_call_exec;
+    if (!g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL,
+                       &on_call_exec_pid, &gerror)) {
+      gnomemeeting_statusbar_push (gw->statusbar, gerror->message);
+      gnomemeeting_log_insert (gerror->message);
+      g_free (gerror);
+    }
+
+    gnomemeeting_threads_leave ();
+  }
+
   /* Incoming Call Popup, if needed */
   if (show_popup) {

@@ -868,6 +891,7 @@
   g_free (utf8_name);
   g_free (utf8_app);
   g_free (utf8_url);
+  g_free (on_call_exec);

   return TRUE;
 }
@@ -967,7 +991,13 @@
                                  TRUE);
   }

-
+
+  /* Stop the external ringing program */
+  if (on_call_exec_pid > -1) {
+    kill (on_call_exec_pid,SIGHUP);
+    on_call_exec_pid=-1;
+  }
+
   if (gw->incoming_call_popup) {

     gtk_widget_destroy (gw->incoming_call_popup);
@@ -1252,7 +1282,13 @@
   OutgoingCallTimer.Stop ();
   NoIncomingMediaTimer.Stop ();

-
+
+  /* Stop the external ringing program */
+  if (on_call_exec_pid > -1) {
+    kill (on_call_exec_pid,SIGHUP);
+    on_call_exec_pid=-1;
+  }
+
   if (gw->incoming_call_popup) {

     gtk_widget_destroy (gw->incoming_call_popup);
@@ -2091,6 +2127,12 @@

   gw = GnomeMeeting::Process ()->GetMainWindow ();

+  /* Stop the external ringing program */
+  if (on_call_exec_pid > -1) {
+    kill (on_call_exec_pid,SIGHUP);
+    on_call_exec_pid=-1;
+  }
+
   /* Destroy the incoming call popup */
   if (gw->incoming_call_popup) {

diff -ruN gnomemeeting.ORIG/src/pref_window.cpp gnomemeeting.PATCHED/src/pref_window.cpp
--- gnomemeeting.ORIG/src/pref_window.cpp       2004-01-25 16:04:59.000000000 +0100
+++ gnomemeeting.PATCHED/src/pref_window.cpp    2004-02-03 00:12:06.000000000 +0100
@@ -724,6 +724,15 @@
                      3, SOUND_EVENTS_KEY "enable_busy_tone_sound",
                      -1);

+  enabled = gconf_get_bool (SOUND_EVENTS_KEY "enable_on_call_exec");
+  gtk_list_store_append (GTK_LIST_STORE (model), &iter);
+  gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+                     0, enabled,
+                     1, _("Spawn external program on incoming calls"),
+                     2, SOUND_EVENTS_KEY "on_call_exec",
+                     3, SOUND_EVENTS_KEY "enable_on_call_exec",
+                     -1);
+
   if (!path)
     path = gtk_tree_path_new_from_string ("0");

@@ -1137,7 +1146,8 @@
   hbox = gtk_hbox_new (0, FALSE);
   gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 2);

-  label = gtk_label_new (_("Sound to play:"));
+//  label = gtk_label_new (_("Sound to play:"));
+  label = gtk_label_new (_("File:"));
   gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 2);

   entry = gtk_entry_new ();
--8<--8<--

Take care!

--
Pierre-Philippe Coupard <pcoupard easyconnect fr>
Software Engineer
--
"Shelter," what a nice name for for a place where you polish your cat.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]