diff --git a/libs/dbus-c++/src/eventloop.cpp b/libs/dbus-c++/src/eventloop.cpp index 1d4aa2a19c44409eeb7b7d3161f3195633521c8d..a9b875701c31119a87c323c5c2b5aabfe878e6e1 100644 --- a/libs/dbus-c++/src/eventloop.cpp +++ b/libs/dbus-c++/src/eventloop.cpp @@ -150,7 +150,8 @@ void DefaultMainLoop::dispatch() } _mutex_w.unlock(); - int wait_min = 10000; + // int wait_min = 10000; + int wait_min = 500; DefaultTimeouts::iterator ti; diff --git a/sflphone-gtk/src/actions.c b/sflphone-gtk/src/actions.c index 0e6d68437b9d2b73bab76555f4e7e6082adfe215..0de33223d1a65a311e1ece37a7e7c7ddff535ce5 100644 --- a/sflphone-gtk/src/actions.c +++ b/sflphone-gtk/src/actions.c @@ -233,7 +233,7 @@ gboolean sflphone_init() current_calls = calltab_init(); history = calltab_init(); contacts = calltab_init(); - if(SHOW_SEARCHBAR) histfilter = create_filter(GTK_TREE_MODEL(history->store)); + //if(SHOW_SEARCHBAR) histfilter = create_filter(GTK_TREE_MODEL(history->store)); init(); account_list_init (); codec_list_init(); @@ -368,6 +368,12 @@ sflphone_off_hold () break; } } + + if(dbus_get_is_recording(selectedCall)) + g_print("Currently recording! \n"); + else + g_print("Not recording currently \n"); + } @@ -524,23 +530,18 @@ process_dialing(call_t * c, guint keyval, gchar * key) sflphone_new_call() { + call_t *c; + gchar *from, *to; + sflphone_on_hold(); // Play a tone when creating a new call if( call_list_get_size(current_calls) == 0 ) dbus_start_tone( TRUE , ( voice_mails > 0 )? TONE_WITH_MESSAGE : TONE_WITHOUT_MESSAGE) ; - call_t * c = g_new0 (call_t, 1); - c->state = CALL_STATE_DIALING; - c->from = g_strconcat("\"\" <>", NULL); - - c->callID = g_new0(gchar, 30); - g_sprintf(c->callID, "%d", rand()); - - c->to = g_strdup(""); - - c->_start = 0; - c->_stop = 0; + to = g_strdup(""); + from = g_strconcat("\"\" <>", NULL); + create_new_call (to, from, CALL_STATE_DIALING, "", &c); call_list_add(current_calls,c); update_call_tree_add(current_calls,c); @@ -681,6 +682,9 @@ sflphone_place_call ( call_t * c ) if(c->state == CALL_STATE_DIALING && strcmp(c->to, "") != 0) { + + format_phone_number (&c->to); + if( account_list_get_size() == 0 ) { notify_no_accounts(); @@ -743,6 +747,7 @@ sflphone_place_call ( call_t * c ) } // Update history c->history_state = OUTGOING; + g_print ("add in history\n"); call_list_add(history, c); } } @@ -860,3 +865,13 @@ sflphone_fill_codec_list() } } +void format_phone_number (gchar **number) { + + gchar *_number; + + _number = *number; + + strip_spaces (&_number); + + +} diff --git a/sflphone-gtk/src/callmanager-glue.h b/sflphone-gtk/src/callmanager-glue.h index 1921fbb0e0b630413699dc5b7c71d2e308b4ba5c..7cdb50cdd3e62505b81d8371707ed9a6fae9243a 100644 --- a/sflphone-gtk/src/callmanager-glue.h +++ b/sflphone-gtk/src/callmanager-glue.h @@ -458,6 +458,44 @@ static inline #endif gboolean +org_sflphone_SFLphone_CallManager_get_is_recording (DBusGProxy *proxy, const char * IN_callID, gboolean* OUT_isRecording, GError **error) + +{ + return dbus_g_proxy_call (proxy, "getIsRecording", error, G_TYPE_STRING, IN_callID, G_TYPE_INVALID, G_TYPE_BOOLEAN, OUT_isRecording, G_TYPE_INVALID); +} + +typedef void (*org_sflphone_SFLphone_CallManager_get_is_recording_reply) (DBusGProxy *proxy, gboolean OUT_isRecording, GError *error, gpointer userdata); + +static void +org_sflphone_SFLphone_CallManager_get_is_recording_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data) +{ + DBusGAsyncData *data = (DBusGAsyncData*) user_data; + GError *error = NULL; + gboolean OUT_isRecording; + dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_BOOLEAN, &OUT_isRecording, G_TYPE_INVALID); + (*(org_sflphone_SFLphone_CallManager_get_is_recording_reply)data->cb) (proxy, OUT_isRecording, error, data->userdata); + return; +} + +static +#ifdef G_HAVE_INLINE +inline +#endif +DBusGProxyCall* +org_sflphone_SFLphone_CallManager_get_is_recording_async (DBusGProxy *proxy, const char * IN_callID, org_sflphone_SFLphone_CallManager_get_is_recording_reply callback, gpointer userdata) + +{ + DBusGAsyncData *stuff; + stuff = g_new (DBusGAsyncData, 1); + stuff->cb = G_CALLBACK (callback); + stuff->userdata = userdata; + return dbus_g_proxy_begin_call (proxy, "getIsRecording", org_sflphone_SFLphone_CallManager_get_is_recording_async_callback, stuff, g_free, G_TYPE_STRING, IN_callID, G_TYPE_INVALID); +} +static +#ifdef G_HAVE_INLINE +inline +#endif +gboolean org_sflphone_SFLphone_CallManager_get_call_details (DBusGProxy *proxy, const char * IN_callID, GHashTable** OUT_infos, GError **error) { diff --git a/sflphone-gtk/src/calltab.h b/sflphone-gtk/src/calltab.h index 7d84696df2fa4f4471455b09859b54ccb75d5a79..d3b85ca977f85f159ae9e13dafb44d1a25f09d9b 100644 --- a/sflphone-gtk/src/calltab.h +++ b/sflphone-gtk/src/calltab.h @@ -23,7 +23,7 @@ #include <calllist.h> #include <gtk/gtk.h> -GtkTreeModel* histfilter; +//GtkTreeModel* histfilter; calltab_t* calltab_init(); diff --git a/sflphone-gtk/src/calltree.c b/sflphone-gtk/src/calltree.c index b9fbdab365ebf7065185f8e2469a834cb0fc19e8..f0f1fdfdeca03d9fb872b338d7771a7d57edfc3a 100644 --- a/sflphone-gtk/src/calltree.c +++ b/sflphone-gtk/src/calltree.c @@ -295,80 +295,80 @@ toolbar_update_buttons () gtk_signal_handler_unblock(transfertButton, transfertButtonConnId); call_t * selectedCall = call_get_selected(active_calltree); - if (selectedCall) - { - switch(selectedCall->state) - { - case CALL_STATE_INCOMING: - gtk_widget_set_sensitive( GTK_WIDGET(pickupButton), TRUE); - gtk_widget_set_sensitive( GTK_WIDGET(hangupButton), TRUE); - g_object_ref(callButton); - gtk_container_remove(GTK_CONTAINER(toolbar), GTK_WIDGET(callButton)); - gtk_toolbar_insert(GTK_TOOLBAR(toolbar), pickupButton, 0); - break; - case CALL_STATE_HOLD: - gtk_widget_set_sensitive( GTK_WIDGET(hangupButton), TRUE); - gtk_widget_set_sensitive( GTK_WIDGET(unholdButton), TRUE); - gtk_widget_set_sensitive( GTK_WIDGET(callButton), TRUE); - g_object_ref(holdButton); - gtk_container_remove(GTK_CONTAINER(toolbar), GTK_WIDGET(holdButton)); - gtk_toolbar_insert(GTK_TOOLBAR(toolbar), unholdButton, 3); - break; - case CALL_STATE_RINGING: - gtk_widget_set_sensitive( GTK_WIDGET(hangupButton), TRUE); - gtk_widget_set_sensitive( GTK_WIDGET(callButton), TRUE); - break; - case CALL_STATE_DIALING: - if( active_calltree != history ) gtk_widget_set_sensitive( GTK_WIDGET(hangupButton), TRUE); - gtk_widget_set_sensitive( GTK_WIDGET(pickupButton), TRUE); - g_object_ref(callButton); - gtk_container_remove(GTK_CONTAINER(toolbar), GTK_WIDGET(callButton)); - gtk_toolbar_insert(GTK_TOOLBAR(toolbar), pickupButton, 0); - break; - case CALL_STATE_CURRENT: - gtk_widget_set_sensitive( GTK_WIDGET(hangupButton), TRUE); - gtk_widget_set_sensitive( GTK_WIDGET(holdButton), TRUE); - gtk_widget_set_sensitive( GTK_WIDGET(transfertButton), TRUE); - gtk_widget_set_sensitive( GTK_WIDGET(callButton), TRUE); - gtk_widget_set_sensitive( GTK_WIDGET(recButton), TRUE); - break; - case CALL_STATE_BUSY: - case CALL_STATE_FAILURE: - gtk_widget_set_sensitive( GTK_WIDGET(hangupButton), TRUE); - break; - case CALL_STATE_TRANSFERT: - gtk_signal_handler_block(GTK_OBJECT(transfertButton),transfertButtonConnId); - gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(transfertButton), TRUE); - gtk_signal_handler_unblock(transfertButton, transfertButtonConnId); - gtk_widget_set_sensitive( GTK_WIDGET(callButton), TRUE); - gtk_widget_set_sensitive( GTK_WIDGET(hangupButton), TRUE); - gtk_widget_set_sensitive( GTK_WIDGET(holdButton), TRUE); - gtk_widget_set_sensitive( GTK_WIDGET(transfertButton), TRUE); - break; - case CALL_STATE_RECORD: - gtk_widget_set_sensitive( GTK_WIDGET(hangupButton), TRUE); - gtk_widget_set_sensitive( GTK_WIDGET(holdButton), TRUE); - gtk_widget_set_sensitive( GTK_WIDGET(transfertButton), TRUE); - gtk_widget_set_sensitive( GTK_WIDGET(callButton), TRUE); - gtk_widget_set_sensitive( GTK_WIDGET(recButton), TRUE); - break; - default: - g_warning("Toolbar update - Should not happen!"); - break; - } - } - else - { - if( account_list_get_size() > 0 ) + if (selectedCall) { - gtk_widget_set_sensitive( GTK_WIDGET(callButton), TRUE ); - gtk_widget_set_sensitive( GTK_WIDGET(mailboxButton), TRUE ); + switch(selectedCall->state) + { + case CALL_STATE_INCOMING: + gtk_widget_set_sensitive( GTK_WIDGET(pickupButton), TRUE); + gtk_widget_set_sensitive( GTK_WIDGET(hangupButton), TRUE); + g_object_ref(callButton); + gtk_container_remove(GTK_CONTAINER(toolbar), GTK_WIDGET(callButton)); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), pickupButton, 0); + break; + case CALL_STATE_HOLD: + gtk_widget_set_sensitive( GTK_WIDGET(hangupButton), TRUE); + gtk_widget_set_sensitive( GTK_WIDGET(unholdButton), TRUE); + gtk_widget_set_sensitive( GTK_WIDGET(callButton), TRUE); + g_object_ref(holdButton); + gtk_container_remove(GTK_CONTAINER(toolbar), GTK_WIDGET(holdButton)); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), unholdButton, 3); + break; + case CALL_STATE_RINGING: + gtk_widget_set_sensitive( GTK_WIDGET(hangupButton), TRUE); + gtk_widget_set_sensitive( GTK_WIDGET(callButton), TRUE); + break; + case CALL_STATE_DIALING: + if( active_calltree == current_calls ) gtk_widget_set_sensitive( GTK_WIDGET(hangupButton), TRUE); + gtk_widget_set_sensitive( GTK_WIDGET(pickupButton), TRUE); + g_object_ref(callButton); + gtk_container_remove(GTK_CONTAINER(toolbar), GTK_WIDGET(callButton)); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), pickupButton, 0); + break; + case CALL_STATE_CURRENT: + gtk_widget_set_sensitive( GTK_WIDGET(hangupButton), TRUE); + gtk_widget_set_sensitive( GTK_WIDGET(holdButton), TRUE); + gtk_widget_set_sensitive( GTK_WIDGET(transfertButton), TRUE); + gtk_widget_set_sensitive( GTK_WIDGET(callButton), TRUE); + gtk_widget_set_sensitive( GTK_WIDGET(recButton), TRUE); + break; + case CALL_STATE_BUSY: + case CALL_STATE_FAILURE: + gtk_widget_set_sensitive( GTK_WIDGET(hangupButton), TRUE); + break; + case CALL_STATE_TRANSFERT: + gtk_signal_handler_block(GTK_OBJECT(transfertButton),transfertButtonConnId); + gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(transfertButton), TRUE); + gtk_signal_handler_unblock(transfertButton, transfertButtonConnId); + gtk_widget_set_sensitive( GTK_WIDGET(callButton), TRUE); + gtk_widget_set_sensitive( GTK_WIDGET(hangupButton), TRUE); + gtk_widget_set_sensitive( GTK_WIDGET(holdButton), TRUE); + gtk_widget_set_sensitive( GTK_WIDGET(transfertButton), TRUE); + break; + case CALL_STATE_RECORD: + gtk_widget_set_sensitive( GTK_WIDGET(hangupButton), TRUE); + gtk_widget_set_sensitive( GTK_WIDGET(holdButton), TRUE); + gtk_widget_set_sensitive( GTK_WIDGET(transfertButton), TRUE); + gtk_widget_set_sensitive( GTK_WIDGET(callButton), TRUE); + gtk_widget_set_sensitive( GTK_WIDGET(recButton), TRUE); + break; + default: + g_warning("Toolbar update - Should not happen!"); + break; + } } else { - gtk_widget_set_sensitive( GTK_WIDGET(callButton), FALSE); + if( account_list_get_size() > 0 ) + { + gtk_widget_set_sensitive( GTK_WIDGET(callButton), TRUE ); + gtk_widget_set_sensitive( GTK_WIDGET(mailboxButton), TRUE ); + } + else + { + gtk_widget_set_sensitive( GTK_WIDGET(callButton), FALSE); + } } - } } @@ -399,54 +399,58 @@ void row_activated(GtkTreeView *tree_view UNUSED, GtkTreeViewColumn *column UNUSED, void * data UNUSED) { - g_print("double click action\n"); - call_t* selectedCall; - call_t* new_call; - gchar *to, *from, *account_id; - selectedCall = call_get_selected( active_calltree ); + call_t* selectedCall; + call_t* new_call; + gchar *to, *from, *account_id; + + g_print("double click action\n"); + + selectedCall = call_get_selected( active_calltree ); - if (selectedCall) - { - // Get the right event from the right calltree - if( active_calltree == current_calls ) + if (selectedCall) { - switch(selectedCall->state) - { - case CALL_STATE_INCOMING: - dbus_accept(selectedCall); - stop_notification(); - break; - case CALL_STATE_HOLD: - dbus_unhold(selectedCall); - break; - case CALL_STATE_RINGING: - case CALL_STATE_CURRENT: - case CALL_STATE_BUSY: - case CALL_STATE_FAILURE: - break; - case CALL_STATE_DIALING: - sflphone_place_call (selectedCall); - break; - default: - g_warning("Row activated - Should not happen!"); - break; - } - } - // if history - else - { - to = g_strdup(call_get_number(selectedCall)); - from = g_strconcat("\"\" <", call_get_number(selectedCall), ">",NULL); - account_id = g_strdup (selectedCall->accountID); - - create_new_call (to, from, CALL_STATE_DIALING, account_id, &new_call); - - call_list_add(current_calls, new_call); - update_call_tree_add(current_calls, new_call); - sflphone_place_call(new_call); - display_calltree(current_calls); + // Get the right event from the right calltree + if( active_calltree == current_calls ) + { + switch(selectedCall->state) + { + case CALL_STATE_INCOMING: + dbus_accept(selectedCall); + stop_notification(); + break; + case CALL_STATE_HOLD: + dbus_unhold(selectedCall); + break; + case CALL_STATE_RINGING: + case CALL_STATE_CURRENT: + case CALL_STATE_BUSY: + case CALL_STATE_FAILURE: + break; + case CALL_STATE_DIALING: + sflphone_place_call (selectedCall); + break; + default: + g_warning("Row activated - Should not happen!"); + break; + } + } + + // If history or contact: double click action places a new call + else + { + to = g_strdup(call_get_number(selectedCall)); + from = g_strconcat("\"\" <", call_get_number(selectedCall), ">",NULL); + account_id = g_strdup (selectedCall->accountID); + + // Create a new call + create_new_call (to, from, CALL_STATE_DIALING, account_id, &new_call); + + call_list_add(current_calls, new_call); + update_call_tree_add(current_calls, new_call); + sflphone_place_call(new_call); + display_calltree(current_calls); + } } - } } GtkWidget * diff --git a/sflphone-gtk/src/dbus.c b/sflphone-gtk/src/dbus.c index a0f3189585c84d87d07453b2d14b3e27d494c398..2af40dcd06fee84db517b95c3c9c3a5cef28ab79 100644 --- a/sflphone-gtk/src/dbus.c +++ b/sflphone-gtk/src/dbus.c @@ -1123,6 +1123,25 @@ dbus_set_record(const call_t * c) } } +gboolean* +dbus_get_is_recording(const call_t * c) +{ + g_print("calling dbus_get_is_recording on CallManager\n"); + GError* error = NULL; + gboolean* isRecording = NULL; + org_sflphone_SFLphone_CallManager_get_is_recording ( + callManagerProxy, + c->callID, + &isRecording, + &error); + if(error) + { + g_error_free(error); + } + g_print("RECORDING: %i \n",isRecording); + return isRecording; +} + void dbus_set_record_path(const gchar* path) { diff --git a/sflphone-gtk/src/historyfilter.c b/sflphone-gtk/src/historyfilter.c deleted file mode 100644 index db1d405246aa83a8dd83ea1d07a243c898763d64..0000000000000000000000000000000000000000 --- a/sflphone-gtk/src/historyfilter.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (C) 2008 Savoir-Faire Linux inc. - * Author: Antoine Reversat <antoine.reversat@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <string.h> - -#include <historyfilter.h> -#include <calltree.h> - -GtkWidget * filter_entry; - -GtkTreeModel* -create_filter(GtkTreeModel* child) -{ - GtkTreeModel* ret = gtk_tree_model_filter_new(child, NULL); - gtk_tree_model_filter_set_visible_func(GTK_TREE_MODEL_FILTER(ret), is_visible, NULL, NULL); - return GTK_TREE_MODEL(ret); -} - -gboolean -is_visible(GtkTreeModel* model, GtkTreeIter* iter, gpointer data UNUSED) -{ - if( SHOW_SEARCHBAR ) - { - GValue val; - - gchar* text = NULL; - gchar* search = (gchar*)gtk_entry_get_text(GTK_ENTRY(filter_entry)); - memset (&val, 0, sizeof(val)); - gtk_tree_model_get_value(GTK_TREE_MODEL(model), iter, 1, &val); - if(G_VALUE_HOLDS_STRING(&val)){ - text = (gchar *)g_value_get_string(&val); - } - if(text != NULL && g_ascii_strncasecmp(search, _("Search"), 6) != 0){ - return g_regex_match_simple(search, text, G_REGEX_CASELESS, 0); - } - g_value_unset (&val); - return TRUE; - } - return TRUE; -} - -void -filter_entry_changed(GtkEntry* entry UNUSED, gchar* arg1 UNUSED, gpointer data UNUSED) -{ - gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(historyButton), TRUE); - gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(histfilter)); -} - -void -clear_filter_entry_if_default(GtkWidget* widget UNUSED, gpointer user_data UNUSED) -{ - if(g_ascii_strncasecmp(gtk_entry_get_text(GTK_ENTRY(filter_entry)), _("Search"), 6) == 0) - gtk_entry_set_text(GTK_ENTRY(filter_entry), ""); -} - -GtkWidget* -create_filter_entry() -{ - GtkWidget* image; - GtkWidget* ret = gtk_hbox_new(FALSE, 0); - - filter_entry = sexy_icon_entry_new(); - //filter_entry = gtk_entry_new(); - image = gtk_image_new_from_stock( GTK_STOCK_FIND , GTK_ICON_SIZE_SMALL_TOOLBAR); - sexy_icon_entry_set_icon( SEXY_ICON_ENTRY(filter_entry), SEXY_ICON_ENTRY_PRIMARY , GTK_IMAGE(image) ); - sexy_icon_entry_add_clear_button( SEXY_ICON_ENTRY(filter_entry) ); - gtk_entry_set_text(GTK_ENTRY(filter_entry), _("Search")); - g_signal_connect(GTK_ENTRY(filter_entry), "changed", G_CALLBACK(filter_entry_changed), NULL); - g_signal_connect(GTK_ENTRY(filter_entry), "grab-focus", G_CALLBACK(clear_filter_entry_if_default), NULL); - - gtk_box_pack_start(GTK_BOX(ret), filter_entry, TRUE, TRUE, 0); - return ret; -} diff --git a/sflphone-gtk/src/historyfilter.h b/sflphone-gtk/src/historyfilter.h deleted file mode 100644 index 72d46b8ce7d640dbd5ae0f1c9b9adb2eb2462b66..0000000000000000000000000000000000000000 --- a/sflphone-gtk/src/historyfilter.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2007 Savoir-Faire Linux inc. - * Author: Antoine Reversat <antoine.reversat@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __HFILTER_H__ -#define __HFILTER_H__ - -#include <calllist.h> -#include <gtk/gtk.h> -#include <libsexy/sexy-icon-entry.h> - -GtkTreeModel* create_filter(GtkTreeModel* child); - -gboolean is_visible(GtkTreeModel* model, GtkTreeIter* iter, gpointer data); -GtkWidget* create_filter_entry(); -#endif diff --git a/sflphone-gtk/src/mainwindow.c b/sflphone-gtk/src/mainwindow.c index 5eb09084712bba75755e6280d47930bcf7e927ad..02d274ceeaace8181fd2ab4c1e8918707054f69e 100644 --- a/sflphone-gtk/src/mainwindow.c +++ b/sflphone-gtk/src/mainwindow.c @@ -172,7 +172,7 @@ create_main_window () /* dont't show the contact list */ gtk_widget_hide(contacts->tree); - gtk_tree_view_set_model(GTK_TREE_VIEW(history->view), GTK_TREE_MODEL(histfilter)); + //gtk_tree_view_set_model(GTK_TREE_VIEW(history->view), GTK_TREE_MODEL(histfilter)); // Configuration wizard if (account_list_get_size() == 0) { diff --git a/sflphone-gtk/src/menus.c b/sflphone-gtk/src/menus.c index 2030f12ccef32560ea4b0d72b016d80b6eeca1fa..e32bb3e7da16d2633925f61afde33bae05f665f8 100644 --- a/sflphone-gtk/src/menus.c +++ b/sflphone-gtk/src/menus.c @@ -650,7 +650,7 @@ create_view_menu() gtk_widget_show (volumeMenu); image = gtk_image_new_from_stock( GTK_STOCK_FIND , GTK_ICON_SIZE_MENU ); - searchbarMenu = gtk_image_menu_item_new_with_mnemonic (_("_Search history")); + searchbarMenu = gtk_image_menu_item_new_with_mnemonic (_("_Search contact")); gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM ( searchbarMenu ), image ); gtk_menu_shell_append (GTK_MENU_SHELL (menu), searchbarMenu); g_signal_connect(G_OBJECT (searchbarMenu), "activate", diff --git a/sflphone-gtk/src/searchfilter.c b/sflphone-gtk/src/searchfilter.c index 8cc99aba8bb27ced019d15fc4030cb07da94540c..4df4b3d49f18798b8bd919cd8c5b5e4865229cac 100644 --- a/sflphone-gtk/src/searchfilter.c +++ b/sflphone-gtk/src/searchfilter.c @@ -106,12 +106,12 @@ static void handler_async_search (GList *hits, gpointer user_data) { } -void filter_entry_changed (GtkEntry* entry UNUSED, gchar* arg1 UNUSED, gpointer data UNUSED) { +void filter_entry_changed (GtkEntry* entry, gchar* arg1 UNUSED, gpointer data UNUSED) { AddressBook_Config *addressbook_config; /* Switch to the address book when the focus is on the search bar */ - if (active_calltree == current_calls) + if (active_calltree != contacts) display_calltree (contacts); @@ -120,7 +120,12 @@ void filter_entry_changed (GtkEntry* entry UNUSED, gchar* arg1 UNUSED, gpointer // Load the address book parameters addressbook_load_parameters (&addressbook_config); // Start the asynchronous search as soon as we have an entry */ - search_async (gtk_entry_get_text (GTK_ENTRY (filter_entry)), addressbook_config->max_results, &handler_async_search, addressbook_config); + search_async (gtk_entry_get_text (GTK_ENTRY (entry)), addressbook_config->max_results, &handler_async_search, addressbook_config); + } + + else if (active_calltree == history) { + // Filter the displayed calls + } } @@ -138,7 +143,6 @@ GtkWidget* create_filter_entry() { GtkWidget* ret = gtk_hbox_new(FALSE, 0); filter_entry = sexy_icon_entry_new(); - //filter_entry = gtk_entry_new(); image = gtk_image_new_from_stock( GTK_STOCK_FIND , GTK_ICON_SIZE_SMALL_TOOLBAR); sexy_icon_entry_set_icon( SEXY_ICON_ENTRY(filter_entry), SEXY_ICON_ENTRY_PRIMARY , GTK_IMAGE(image) ); sexy_icon_entry_add_clear_button( SEXY_ICON_ENTRY(filter_entry) ); diff --git a/src/audio/audiortp.cpp b/src/audio/audiortp.cpp index 02972a3058afc50dc73fc175fd7aba350e9732f0..e483830cce819875d72de31937997a7c294244a5 100644 --- a/src/audio/audiortp.cpp +++ b/src/audio/audiortp.cpp @@ -190,6 +190,9 @@ AudioRtpRTX::initAudioRtpSession (void) try { if (_ca == 0) { return; } _audiocodec = _ca->getLocalSDP()->get_session_media (); + + if (_audiocodec == NULL) { return; } + _codecSampleRate = _audiocodec->getClockRate(); ost::InetHostAddress remote_ip(_ca->getLocalSDP()->get_remote_ip().c_str()); diff --git a/src/dbus/callmanager-glue.h b/src/dbus/callmanager-glue.h index 71dd6b5170eca847ee33cbc5d457c7593c2c9f44..1ed93d42f6ec15cfd89bb5db7daf76b22d7ab8eb 100644 --- a/src/dbus/callmanager-glue.h +++ b/src/dbus/callmanager-glue.h @@ -32,6 +32,7 @@ public: register_method(CallManager_adaptor, setVolume, _setVolume_stub); register_method(CallManager_adaptor, getVolume, _getVolume_stub); register_method(CallManager_adaptor, setRecording, _setRecording_stub); + register_method(CallManager_adaptor, getIsRecording, _getIsRecording_stub); register_method(CallManager_adaptor, getCallDetails, _getCallDetails_stub); register_method(CallManager_adaptor, getCurrentCallID, _getCurrentCallID_stub); register_method(CallManager_adaptor, getCurrentCodecName, _getCurrentCodecName_stub); @@ -105,6 +106,12 @@ public: { "callID", "s", true }, { 0, 0, 0 } }; + static ::DBus::IntrospectedArgument getIsRecording_args[] = + { + { "callID", "s", true }, + { "isRecording", "b", false }, + { 0, 0, 0 } + }; static ::DBus::IntrospectedArgument getCallDetails_args[] = { { "callID", "s", true }, @@ -178,6 +185,7 @@ public: { "setVolume", setVolume_args }, { "getVolume", getVolume_args }, { "setRecording", setRecording_args }, + { "getIsRecording", getIsRecording_args }, { "getCallDetails", getCallDetails_args }, { "getCurrentCallID", getCurrentCallID_args }, { "getCurrentCodecName", getCurrentCodecName_args }, @@ -231,6 +239,7 @@ public: virtual void setVolume(const std::string& device, const double& value) = 0; virtual double getVolume(const std::string& device) = 0; virtual void setRecording(const std::string& callID) = 0; + virtual bool getIsRecording(const std::string& callID) = 0; virtual std::map< std::string, std::string > getCallDetails(const std::string& callID) = 0; virtual std::string getCurrentCallID() = 0; virtual std::string getCurrentCodecName(const std::string& callID) = 0; @@ -415,6 +424,17 @@ private: ::DBus::ReturnMessage reply(call); return reply; } + ::DBus::Message _getIsRecording_stub(const ::DBus::CallMessage &call) + { + ::DBus::MessageIter ri = call.reader(); + + std::string argin1; ri >> argin1; + bool argout1 = getIsRecording(argin1); + ::DBus::ReturnMessage reply(call); + ::DBus::MessageIter wi = reply.writer(); + wi << argout1; + return reply; + } ::DBus::Message _getCallDetails_stub(const ::DBus::CallMessage &call) { ::DBus::MessageIter ri = call.reader(); diff --git a/src/dbus/callmanager-introspec.xml b/src/dbus/callmanager-introspec.xml index 9c503cac8dcd7c6a84d784b82d6854c2fcad029b..0558a20e8896c7703f6cb716fbeabe3224f82948 100644 --- a/src/dbus/callmanager-introspec.xml +++ b/src/dbus/callmanager-introspec.xml @@ -55,6 +55,11 @@ <method name="setRecording"> <arg type="s" name="callID" direction="in"/> </method> + + <method name="getIsRecording"> + <arg type="s" name="callID" direction="in"/> + <arg type="b" name="isRecording" direction="out"/> + </method> <method name="getCallDetails"> <arg type="s" name="callID" direction="in"/> diff --git a/src/dbus/callmanager.cpp b/src/dbus/callmanager.cpp index 126b7ef3b69ff5ed5a4afa8df9af05c545d5914f..9830253434321f52eddf4fcc3bf584e2ba68cdac 100644 --- a/src/dbus/callmanager.cpp +++ b/src/dbus/callmanager.cpp @@ -1,3 +1,4 @@ + /* * Copyright (C) 2007 Savoir-Faire Linux inc. * Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com> @@ -122,6 +123,13 @@ CallManager::setRecording(const std::string& callID) Manager::instance().setRecordingCall(callID); } +bool +CallManager::getIsRecording(const std::string& callID) +{ + _debug("CallManager::getIsRecording received \n"); + return Manager::instance().isRecording(callID); +} + std::string CallManager::getCurrentCodecName(const std::string& callID) diff --git a/src/dbus/callmanager.h b/src/dbus/callmanager.h index 7f2e7e689f5c6e2dc0f65cbe21d29c1492885e24..e1fc6de8fa074e7d36e3f7d03738071092bc0465 100644 --- a/src/dbus/callmanager.h +++ b/src/dbus/callmanager.h @@ -49,6 +49,7 @@ public: void setVolume( const std::string& device, const double& value ); double getVolume( const std::string& device ); void setRecording( const std::string& callID ); + bool getIsRecording(const std::string& callID); std::string getCurrentCodecName(const std::string& callID); std::map< std::string, std::string > getCallDetails( const std::string& callID ); std::string getCurrentCallID( ); diff --git a/src/dbus/dbusmanagerimpl.cpp b/src/dbus/dbusmanagerimpl.cpp index 6972e8faa627070e320f3bfc4bec3e4b28dac55d..c2103892f70153549b301c480350c8037e60a0a0 100644 --- a/src/dbus/dbusmanagerimpl.cpp +++ b/src/dbus/dbusmanagerimpl.cpp @@ -46,6 +46,8 @@ DBusManagerImpl::exec(){ void DBusManagerImpl::exit() { + _dispatcher.leave(); + } diff --git a/src/dbus/instance.cpp b/src/dbus/instance.cpp index 0b4ace62a55e9d70271f5a0505cce61dacb19087..4e880722e75e7dc87a1ef72670befed9447eb082 100644 --- a/src/dbus/instance.cpp +++ b/src/dbus/instance.cpp @@ -44,15 +44,20 @@ Instance::Unregister( const int32_t& pid UNUSED) count --; if(count <= 0) { - _debug("0 client running, quitting..."); - DBusManager::instance().exit(); + + + Manager::instance().terminate(); + + DBusManager::instance().exit(); + } } int32_t Instance::getRegistrationCount( void ) { - _debug("Instance::getRegistrationCount\n"); + return count; + } diff --git a/src/managerimpl.cpp b/src/managerimpl.cpp index 0a946e221b2db81c6ecf199b1babcf073a4c74aa..553a58036112f911ddc4fb304e8949d5bf93d609 100644 --- a/src/managerimpl.cpp +++ b/src/managerimpl.cpp @@ -101,7 +101,7 @@ ManagerImpl::ManagerImpl (void) // never call if we use only the singleton... ManagerImpl::~ManagerImpl (void) { - terminate(); + // terminate(); _debug("%s stop correctly.\n", PROGNAME); } @@ -142,21 +142,23 @@ ManagerImpl::init() void ManagerImpl::terminate() { + _debug("ManagerImpl::terminate \n"); saveConfig(); unloadAccountMap(); - _debug("Unload DTMF Key\n"); + _debug("Unload DTMF Key \n"); delete _dtmfKey; - _debug("Unload Audio Driver\n"); + _debug("Unload Audio Driver \n"); delete _audiodriver; _audiodriver = NULL; - _debug("Unload Telephone Tone\n"); + _debug("Unload Telephone Tone \n"); delete _telephoneTone; _telephoneTone = NULL; - _debug("Unload Audio Codecs\n"); + _debug("Unload Audio Codecs \n"); _codecDescriptorMap.deleteHandlePointer(); + } bool @@ -252,6 +254,8 @@ ManagerImpl::answerCall(const CallID& id) { bool isActive = false; + stopTone(true); + AccountID currentaccountid = getAccountFromCall( id ); Call* currentcall = getAccountLink(currentaccountid)->getCall(getCurrentCallId()); _debug("ManagerImpl::answerCall :: current call->getState %i \n",currentcall->getState()); @@ -286,9 +290,9 @@ ManagerImpl::answerCall(const CallID& id) removeWaitingCall(id); switchCall(id); - std::string codecName = getCurrentCodecName(id); + // std::string codecName = getCurrentCodecName(id); // _debug("ManagerImpl::hangupCall(): broadcast codec name %s \n",codecName.c_str()); - if (_dbus) _dbus->getCallManager()->currentSelectedCodec(id,codecName.c_str()); + // if (_dbus) _dbus->getCallManager()->currentSelectedCodec(id,codecName.c_str()); return true; } @@ -302,7 +306,7 @@ ManagerImpl::hangupCall(const CallID& id) AccountID accountid; bool returnValue; - stopTone(true); + stopTone(false); /* Broadcast a signal over DBus */ if (_dbus) _dbus->getCallManager()->callStateChanged(id, "HUNGUP"); @@ -441,9 +445,9 @@ ManagerImpl::offHoldCall(const CallID& id) switchCall(id); - codecName = getCurrentCodecName(id); - _debug("ManagerImpl::hangupCall(): broadcast codec name %s \n",codecName.c_str()); - if (_dbus) _dbus->getCallManager()->currentSelectedCodec(id,codecName.c_str()); + // codecName = getCurrentCodecName(id); + // _debug("ManagerImpl::hangupCall(): broadcast codec name %s \n",codecName.c_str()); + // if (_dbus) _dbus->getCallManager()->currentSelectedCodec(id,codecName.c_str()); return returnValue; } @@ -690,6 +694,8 @@ ManagerImpl::incomingCall(Call* call, const AccountID& accountId) PulseLayer *pulselayer; std::string from, number; + stopTone(true); + _debug("Incoming call %s\n", call->getCallId().data()); associateCallToAccount(call->getCallId(), accountId); @@ -965,16 +971,21 @@ ManagerImpl::ringtone() int layer, samplerate; bool loadFile; + // stopTone(true); + if( isRingtoneEnabled() ) { //TODO Comment this because it makes the daemon crashes since the main thread //synchronizes the ringtone thread. + _debug("RINGING!!! 1\n"); ringchoice = getConfigString(AUDIO, RING_CHOICE); //if there is no / inside the path if ( ringchoice.find(DIR_SEPARATOR_CH) == std::string::npos ) { // check inside global share directory ringchoice = std::string(PROGSHAREDIR) + DIR_SEPARATOR_STR + RINGDIR + DIR_SEPARATOR_STR + ringchoice; + + _debug("RINGING!!! 2\n"); } audiolayer = getAudioDriver(); @@ -982,6 +993,8 @@ ManagerImpl::ringtone() if (audiolayer == 0) return; + _debug("RINGING!!! 3\n"); + samplerate = audiolayer->getSampleRate(); codecForTone = _codecDescriptorMap.getFirstCodecAvailable(); @@ -990,23 +1003,29 @@ ManagerImpl::ringtone() _toneMutex.leaveMutex(); if (loadFile) { + + _debug("RINGING!!! 5\n"); _toneMutex.enterMutex(); _audiofile.start(); _toneMutex.leaveMutex(); if(CHECK_INTERFACE( layer, ALSA )){ //ringback(); + } else{ audiolayer->startStream(); + _debug("RINGING!!! 6\n"); } } else { ringback(); + _debug("RINGING!!! 7\n"); } } else { ringback(); + _debug("RINGING!!! 8\n"); } } @@ -1621,7 +1640,6 @@ ManagerImpl::setRecordingCall(const CallID& id) _debug("ManagerImpl::setRecording()! \n"); AccountID accountid = getAccountFromCall( id ); - // printf("ManagerImpl::CallID: %s", id); getAccountLink(accountid)->setRecording(id); } @@ -2306,12 +2324,13 @@ ManagerImpl::getNewCallID() short ManagerImpl::loadAccountMap() { - _debug("Load account:"); + short nbAccount = 0; TokenList sections = _config.getSections(); std::string accountType; Account* tmpAccount; + TokenList::iterator iter = sections.begin(); while(iter != sections.end()) { // Check if it starts with "Account:" (SIP and IAX pour le moment) @@ -2330,27 +2349,31 @@ ManagerImpl::loadAccountMap() else { _debug("Unknown %s param in config file (%s)\n", CONFIG_ACCOUNT_TYPE, accountType.c_str()); } - + + _debug("tmpAccount.getRegistrationState() %i \n ",tmpAccount->getRegistrationState()); if (tmpAccount != NULL) { - _debug(" %s ", iter->c_str()); + + _debug(" %s \n", iter->c_str()); _accountMap[iter->c_str()] = tmpAccount; nbAccount++; } iter++; } - + _debug("nbAccount loaded %i \n",nbAccount); return nbAccount; } void ManagerImpl::unloadAccountMap() { - _debug("Unloading account map...\n"); + AccountMap::iterator iter = _accountMap.begin(); while ( iter != _accountMap.end() ) { + _debug("-> Deleting account %s\n", iter->first.c_str()); delete iter->second; iter->second = 0; + iter++; } _accountMap.clear(); @@ -2424,26 +2447,21 @@ AccountMap ManagerImpl::getSipAccountMap( void ) void ManagerImpl::restartPJSIP (void) { - //SIPVoIPLink *siplink; - - //unloadAccountMap (); - - /* First unregister all SIP accounts */ - //this->unregisterCurSIPAccounts(); + SIPVoIPLink *siplink; + siplink = dynamic_cast<SIPVoIPLink*> (getSIPAccountLink ()); + + this->unregisterCurSIPAccounts(); /* Terminate and initialize the PJSIP library */ - //siplink = dynamic_cast<SIPVoIPLink*> (getSIPAccountLink ()); - //if (siplink) - //{ - // siplink->terminate (); - // _debug ("*************************************************Terminate done\n"); - //siplink = SIPVoIPLink::instance(""); - //siplink->init (); - //} - //_debug("***************************************************Init Done\n"); - //loadAccountMap(); - //initRegisterAccounts (); + + if (siplink) + { + siplink->terminate (); + siplink = SIPVoIPLink::instance(""); + siplink->init (); + } + /* Then register all enabled SIP accounts */ - //this->registerCurSIPAccounts(siplink); + this->registerCurSIPAccounts(siplink); } VoIPLink* ManagerImpl::getAccountLink(const AccountID& accountID) @@ -2504,17 +2522,21 @@ void ManagerImpl::unregisterCurSIPAccounts() void ManagerImpl::registerCurSIPAccounts(VoIPLink *link) { + Account *current; - + AccountMap::iterator iter = _accountMap.begin(); + while( iter != _accountMap.end() ) { current = iter->second; + if (current) { if ( current->isEnabled() && current->getType() == "sip") { //current->setVoIPLink(link); current->registerVoIPLink(); } } + current = NULL; iter++; } } diff --git a/src/managerimpl.h b/src/managerimpl.h index d36e291400483a487b553ed792692991fe6d2e02..2e4aed50d9023695ebedd627414546a0d567e0c7 100644 --- a/src/managerimpl.h +++ b/src/managerimpl.h @@ -63,9 +63,6 @@ typedef std::map<CallID, Call::CallConfiguration> CallConfigMap; /** Define a type for CallID vector (waiting list, incoming not answered) */ typedef std::set<CallID> CallIDSet; -/** Define a type for recorded audio file names vector */ -typedef std::map<CallID, std::string> RecFileNames; - /** To send multiple string */ typedef std::list<std::string> TokenList; @@ -1058,11 +1055,6 @@ class ManagerImpl { * false otherwise */ bool accountExists(const AccountID& accountID); - - /** - * Map the call id to coresponding call - */ - RecFileNames _fileNamesMap; public: diff --git a/src/plug-in/audiorecorder/audiorecord.cpp b/src/plug-in/audiorecorder/audiorecord.cpp index aa8e064aa04bdd5358da2db969a417b6f1694448..25703101d97e04e9bae349fd92cb7009cc5181dc 100644 --- a/src/plug-in/audiorecorder/audiorecord.cpp +++ b/src/plug-in/audiorecorder/audiorecord.cpp @@ -161,8 +161,8 @@ bool AudioRecord::isOpenFile() { bool AudioRecord::isFileExist() { + _debug("AudioRecord::isFileExist(): try to open name : %s \n", fileName_); - printf("AudioRecord::isFileExist(): try to open name : %s \n", fileName_); if(fopen(fileName_,"rb")==0) { return true; } @@ -171,7 +171,8 @@ bool AudioRecord::isFileExist() { } bool AudioRecord::isRecording() { - _debug("AudioRecording::setRecording() \n"); + _debug("AudioRecording::isRecording() %i \n", recordingEnabled_); + if(recordingEnabled_) return true; @@ -181,17 +182,17 @@ bool AudioRecord::isRecording() { bool AudioRecord::setRecording() { - _debug("AudioRecord::setRecording()\n"); + _debug("AudioRecord::setRecording() \n"); if (isOpenFile()){ - _debug("AuioRecord::setRecording()::file already opened\n"); + _debug("AuioRecord::setRecording()::file already opened \n"); if(!recordingEnabled_) recordingEnabled_ = true; else recordingEnabled_ = false; } else { - _debug("AudioRecord::setRecording():Opening the wave file in call during call instantiation\n"); + _debug("AudioRecord::setRecording():Opening the wave file in call during call instantiation \n"); openFile(); recordingEnabled_ = true; // once opend file, start recording diff --git a/src/sdp.cpp b/src/sdp.cpp index 011875e2ef90491bac7b74e8f51711e5f600a5c7..63a5b69d58da240126aa7ebe7bc8b140e0660fcd 100644 --- a/src/sdp.cpp +++ b/src/sdp.cpp @@ -303,14 +303,20 @@ AudioCodec* Sdp::get_session_media( void ){ int nb_media; int nb_codec; + AudioCodec *codec = NULL; nb_media = _session_media.size(); - nb_codec = _session_media[0]->get_media_codec_list().size(); - - return _session_media[0]->get_media_codec_list()[0]; + if (nb_media > 0) { + nb_codec = _session_media[0]->get_media_codec_list().size(); + if (nb_codec > 0) { + codec = _session_media[0]->get_media_codec_list()[0]; + } + } + return codec; } + void Sdp::toString (void) { std::ostringstream sdp; diff --git a/src/sipaccount.cpp b/src/sipaccount.cpp index 61c8bfd05b2a762891c61ebd8fee8f22fd3f2dda..fc77c0450de4814c82d05b29aea2d5072e82b425 100644 --- a/src/sipaccount.cpp +++ b/src/sipaccount.cpp @@ -56,7 +56,7 @@ int SIPAccount::registerVoIPLink() /* Retrieve the account information */ /* Stuff needed for SIP registration */ - setHostname(Manager::instance().getConfigString(_accountID,HOSTNAME)); + setHostname(Manager::instance().getConfigString(_accountID, HOSTNAME)); setUsername(Manager::instance().getConfigString(_accountID, USERNAME)); setPassword(Manager::instance().getConfigString(_accountID, PASSWORD)); @@ -69,8 +69,15 @@ int SIPAccount::registerVoIPLink() int SIPAccount::unregisterVoIPLink() { - _debug("SIPAccount: unregister account %s\n" , getAccountID().c_str()); - return _link->sendUnregister( _accountID ); + _debug("unregister account %s\n" , getAccountID().c_str()); + + _regc = NULL; + + if(_link->sendUnregister( _accountID )) + return true; + else + return false; + } void SIPAccount::loadConfig() diff --git a/src/sipvoiplink.cpp b/src/sipvoiplink.cpp index d0c6d8edbc3c55e768b7e4fa4d71e3dd7a92aebd..4053df3cc63f12e1942380599078762cb8bfa958 100644 --- a/src/sipvoiplink.cpp +++ b/src/sipvoiplink.cpp @@ -239,7 +239,6 @@ SIPVoIPLink::terminateSIPCall() call = dynamic_cast<SIPCall*>(iter->second); if (call) { // terminate the sip call - _debug("SIPVoIPLink::terminateSIPCall()::the call is deleted, should close recording file \n"); delete call; call = 0; } iter++; @@ -250,12 +249,10 @@ SIPVoIPLink::terminateSIPCall() void SIPVoIPLink::terminateOneCall(const CallID& id) { - _debug("SIPVoIPLink::terminateOneCall(): function called \n"); SIPCall *call = getSIPCall(id); if (call) { // terminate the sip call - _debug("SIPVoIPLink::terminateOneCall()::the call is deleted, should close recording file \n"); delete call; call = 0; } } @@ -291,7 +288,6 @@ SIPVoIPLink::getEvent() int SIPVoIPLink::sendRegister( AccountID id ) { - pj_status_t status; int expire_value; char contactTmp[256]; @@ -301,6 +297,7 @@ int SIPVoIPLink::sendRegister( AccountID id ) SIPAccount *account; pjsip_regc *regc; + account = dynamic_cast<SIPAccount *> (Manager::instance().getAccount(id)); hostname = account->getHostname(); username = account->getUsername(); @@ -312,11 +309,13 @@ int SIPVoIPLink::sendRegister( AccountID id ) regc = account->getRegistrationInfo(); /* If the registration already exists, delete it */ if(regc) { + status = pjsip_regc_destroy(regc); regc = NULL; PJ_ASSERT_RETURN( status == PJ_SUCCESS, 1 ); } + account->setRegister(true); /* Set the expire value of the message from the config file */ @@ -325,6 +324,7 @@ int SIPVoIPLink::sendRegister( AccountID id ) /* Update the state of the voip link */ account->setRegistrationState(Trying); + if (!validStunServer) { account->setRegistrationState(ErrorExistStun); account->setRegister(false); @@ -380,7 +380,7 @@ int SIPVoIPLink::sendRegister( AccountID id ) return false; } - _debug("Send the registration ######### \n"); + status = pjsip_regc_send(regc, tdata); if (status != PJ_SUCCESS) { _debug("UserAgent: Unable to send regc request.\n"); @@ -828,7 +828,8 @@ SIPVoIPLink::setRecording(const CallID& id) { SIPCall* call = getSIPCall(id); - call->setRecording(); + if(call) + call->setRecording(); // _audiortp->setRecording(); } @@ -837,8 +838,11 @@ SIPVoIPLink::setRecording(const CallID& id) SIPVoIPLink::isRecording(const CallID& id) { SIPCall* call = getSIPCall(id); - - return call->isRecording(); + _debug("call->isRecording() %i \n",call->isRecording()); + if(call) + return call->isRecording(); + else + return false; } @@ -846,11 +850,17 @@ SIPVoIPLink::isRecording(const CallID& id) SIPVoIPLink::getCurrentCodecName() { - SIPCall *call = getSIPCall(Manager::instance().getCurrentCallId()); + SIPCall *call; + AudioCodec *ac; + std::string name = ""; + + call = getSIPCall(Manager::instance().getCurrentCallId()); + ac = call->getLocalSDP()->get_session_media(); - AudioCodec *ac = call->getLocalSDP()->get_session_media(); + if (ac) + name = ac->getCodecName(); - return ac->getCodecName(); + return name; } bool @@ -953,7 +963,7 @@ SIPVoIPLink::SIPStartCall(SIPCall* call, const std::string& subject UNUSED) pj_strdup2(_pool, &to, strTo.data()); pj_strdup2(_pool, &contact, account->getContact().data()); - _debug("%s %s %s\n", from.ptr, contact.ptr, to.ptr); + //_debug("%s %s %s\n", from.ptr, contact.ptr, to.ptr); // create the dialog (UAC) status = pjsip_dlg_create_uac(pjsip_ua_instance(), &from, &contact, @@ -1603,7 +1613,6 @@ std::string SIPVoIPLink::getSipTo(const std::string& to_url, std::string hostnam /*******************************/ void call_on_state_changed( pjsip_inv_session *inv, pjsip_event *e){ - _debug("call_on_state_changed!!!!!!!!!\n"); SIPCall *call; AccountID accId; @@ -1822,7 +1831,6 @@ void call_on_tsx_changed(pjsip_inv_session *inv, pjsip_transaction *tsx, pjsip_e pj_bool_t mod_on_rx_request(pjsip_rx_data *rdata) { - _debug("mod_on_rx_request!!!!!!!!!\n"); pj_status_t status; pj_str_t reason; @@ -1894,7 +1902,6 @@ void call_on_tsx_changed(pjsip_inv_session *inv, pjsip_transaction *tsx, pjsip_e method_name = "NOTIFY"; // Retrieve all the message. Should contains only the method name but ... request = rdata->msg_info.msg->line.req.method.name.ptr; - _debug("PRINT REQUEST: %s \n",request); // Check if the message is a notification if( request.find( method_name ) != (size_t)-1 ) { /* Notify the right account */