linphone-developers
[Top][All Lists]
Advanced

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

[Linphone-developers] "Terminate" and "Quit" command-line options


From: Alain Momboisse
Subject: [Linphone-developers] "Terminate" and "Quit" command-line options
Date: Wed, 30 Jul 2014 15:56:27 +0200

Hi

We've been using Linphone for some time and have had problems properly shutting down Linphone under Linux.
We have (badly) patched Linphone in order to add -t / --terminate and -q / --quit command-line switches to be able to terminate a call and quit a running Linphone instance remotely.
Can someone please review this patch ? We have no idea if it is the correct way to do what we want.
Otherwise, can you please evaluate a way to properly terminate calls / quit Linphone from the command-line and implement ti in a future release ?

--- a/gtk/main.c    2014-07-15 13:44:50.000000000 +0200
+++ b/gtk/main.c    2014-07-15 13:50:22.000000000 +0200
@@ -74,6 +74,7 @@
 void _linphone_gtk_enable_video(gboolean val);
 void linphone_gtk_on_uribar_changed(GtkEditable *uribar, gpointer user_data);
 static void linphone_gtk_init_ui(void);
+static void linphone_gtk_quit(void);
 
 #ifndef HAVE_GTK_OSX
 static gint main_window_x=0;
@@ -84,6 +85,8 @@
 static gboolean auto_answer = 0;
 static gchar * addr_to_call = NULL;
 static gboolean no_video=FALSE;
+static gboolean terminate_call=FALSE;
+static gboolean terminate_instance=FALSE;
 static gboolean iconified=FALSE;
 static gchar *workingdir=NULL;
 static char *progpath=NULL;
@@ -129,6 +132,13 @@
         .arg_data = &addr_to_call,
         .description = N_("address to call right now")
     },
+        {
+            .long_name = "terminate-call",
+            .short_name = 't',
+            .arg = G_OPTION_ARG_NONE,
+            .arg_data = (gpointer) & terminate_call,
+            .description = N_("Terminate current call.")
+        },
     {
         .long_name = "auto-answer",
         .short_name = 'a',
@@ -143,6 +153,13 @@
         .arg_data = (gpointer) & workingdir,
         .description = N_("Specifiy a working directory (should be the base of the installation, eg: c:\\Program Files\\Linphone)")
     },
+        {
+            .long_name = "quit",
+            .short_name = 'q',
+            .arg = G_OPTION_ARG_NONE,
+            .arg_data = (gpointer) & terminate_instance,
+            .description = N_("Terminate current instance")
+        },
     {
         .long_name = "config",
         .short_name = '\0',
@@ -2056,13 +2073,22 @@
 
 
 void linphone_gtk_refer_received(LinphoneCore *lc, const char *refer_to){
-    GtkEntry * uri_bar =GTK_ENTRY(linphone_gtk_get_widget(
-        linphone_gtk_get_main_window(), "uribar"));
-    char *text;
-    linphone_gtk_notify(NULL,(text=ms_strdup_printf(_("We are transferred to %s"),refer_to)));
-    g_free(text);
-    gtk_entry_set_text(uri_bar, refer_to);
-    linphone_gtk_start_call(linphone_gtk_get_main_window());
+        if (strncmp(refer_to,"quit", 4) == 0){
+                gtk_main_quit();
+                linphone_gtk_quit();
+        } else if (strncmp(refer_to,"terminate", 9) == 0) {
+                if (linphone_core_in_call(lc)){
+                        linphone_core_terminate_all_calls(lc);
+                }
+        } else {
+        GtkEntry * uri_bar =GTK_ENTRY(linphone_gtk_get_widget(
+            linphone_gtk_get_main_window(), "uribar"));
+        char *text;
+        linphone_gtk_notify(NULL,(text=ms_strdup_printf(_("We are transferred to %s"),refer_to)));
+        g_free(text);
+        gtk_entry_set_text(uri_bar, refer_to);
+        linphone_gtk_start_call(linphone_gtk_get_main_window());
+    }
 }
 
 static void linphone_gtk_check_soundcards(){
@@ -2252,6 +2278,11 @@
         app_name=lp_config_get_string(factory,"GtkUi","title","Linphone");
         icon_path=lp_config_get_string(factory,"GtkUi","icon",LINPHONE_ICON);
     }
+        if (terminate_call) {
+                addr_to_call="terminate";
+        } else if (terminate_instance) {
+                addr_to_call="quit";
+        }
     g_set_application_name(app_name);
     pbuf=create_pixbuf(icon_path);
     if (pbuf!=NULL) gtk_window_set_default_icon(pbuf);


reply via email to

[Prev in Thread] Current Thread [Next in Thread]