diff --git a/sflphone-client-gnome/src/actions.c b/sflphone-client-gnome/src/actions.c index 598a91f7c72e4d52ac18bc626a44fe9109a49553..a2506dc62924c99ef2be59b710755a26994caea2 100644 --- a/sflphone-client-gnome/src/actions.c +++ b/sflphone-client-gnome/src/actions.c @@ -330,6 +330,8 @@ void sflphone_get_ip2ip_properties (GHashTable **properties) sflphone_hang_up() { callable_obj_t * selectedCall = calltab_get_selected_call(current_calls); + conference_obj_t * selectedConf = calltab_get_selected_conf(active_calltree); + if(selectedCall) { switch(selectedCall->_state) @@ -373,6 +375,10 @@ sflphone_hang_up() break; } } + else if(selectedConf) { + dbus_hang_up_conference(selectedConf); + } + calltree_update_call(history, selectedCall, NULL); } @@ -436,6 +442,9 @@ sflphone_pick_up() sflphone_on_hold () { callable_obj_t * selectedCall = calltab_get_selected_call(current_calls); + conference_obj_t * selectedConf = calltab_get_selected_conf(active_calltree); + + DEBUG("sflphone_on_hold"); if(selectedCall) { switch(selectedCall->_state) @@ -452,12 +461,18 @@ sflphone_on_hold () break; } } + else if (selectedConf) { + dbus_hold_conference(selectedConf); + } } void sflphone_off_hold () { + DEBUG("sflphone_off_hold"); callable_obj_t * selectedCall = calltab_get_selected_call(current_calls); + conference_obj_t * selectedConf = calltab_get_selected_conf(active_calltree); + if(selectedCall) { switch(selectedCall->_state) @@ -470,7 +485,12 @@ sflphone_off_hold () break; } } + else if (selectedConf) { + + dbus_unhold_conference(selectedConf); + } + /* if(dbus_get_is_recording(selectedCall)) { DEBUG("Currently recording!"); @@ -479,6 +499,7 @@ sflphone_off_hold () { DEBUG("Not recording currently"); } + */ } diff --git a/sflphone-client-gnome/src/contacts/calltab.c b/sflphone-client-gnome/src/contacts/calltab.c index f832d6c561f5c65baa091b0e13b80c1c48d2cfe6..b8376f4a9cb7e99d5b7bab626bfeaa4f46567e2c 100644 --- a/sflphone-client-gnome/src/contacts/calltab.c +++ b/sflphone-client-gnome/src/contacts/calltab.c @@ -50,6 +50,7 @@ calltab_select_call (calltab_t* tab, callable_obj_t * c ) { tab->selectedType = A_CALL; tab->selectedCall = c; + current_calls->selectedConf = NULL; } @@ -58,6 +59,7 @@ calltab_select_conf (conference_obj_t * c ) { current_calls->selectedType = A_CONFERENCE; current_calls->selectedConf = c; + current_calls->selectedCall = NULL; } gint diff --git a/sflphone-client-gnome/src/contacts/calltree.c b/sflphone-client-gnome/src/contacts/calltree.c index fd84153eba3290718b1788fc8d8627db91951b2e..c01a3e890731593e65ef8afa698220240ec42a4d 100644 --- a/sflphone-client-gnome/src/contacts/calltree.c +++ b/sflphone-client-gnome/src/contacts/calltree.c @@ -116,9 +116,12 @@ call_selected_cb(GtkTreeSelection *sel, void* data UNUSED ) selected_call_id = selected_conf->_confID; selected_path = string_path; + selected_call = NULL; } + DEBUG(" selected_path %s, selected_call_id %s, selected_path_depth %i\n", selected_path, selected_call_id, selected_path_depth); + } else { @@ -133,12 +136,16 @@ call_selected_cb(GtkTreeSelection *sel, void* data UNUSED ) selected_call = (callable_obj_t*)g_value_get_pointer(&val); - selected_call_id = selected_call->_callID; - selected_path = string_path; + if(selected_call) { + + selected_call_id = selected_call->_callID; + selected_path = string_path; + selected_conf = NULL; + } + + DEBUG(" selected_path %s, selected_call_id %s, selected_path_depth %i\n", selected_path, selected_call_id, selected_path_depth); } - DEBUG("selected_cb\n"); - DEBUG(" selected_path %s, selected_call_id %s, selected_path_depth %i\n", selected_path, selected_call_id, selected_path_depth); // conferencelist_reset (); // sflphone_fill_conference_list(); diff --git a/sflphone-client-gnome/src/uimanager.c b/sflphone-client-gnome/src/uimanager.c index 78cfc6aa74534ccc548f17867ee1a5afd17fe53d..1a4632c5898cb0c75e8c07bf5ce968830eeda8a6 100644 --- a/sflphone-client-gnome/src/uimanager.c +++ b/sflphone-client-gnome/src/uimanager.c @@ -69,6 +69,8 @@ static gboolean is_inserted (GtkWidget* button, GtkWidget *current_toolbar) void update_actions() { + DEBUG("Update action"); + gtk_action_set_sensitive( GTK_ACTION (newCallAction), TRUE); gtk_action_set_sensitive (GTK_ACTION (pickUpAction), FALSE); gtk_action_set_sensitive (GTK_ACTION (hangUpAction), FALSE); @@ -145,6 +147,7 @@ void update_actions() if (selectedCall) { + // DEBUG("------------------------- selected call ---------------------------\n"); gtk_action_set_sensitive (GTK_ACTION (copyAction), TRUE); switch(selectedCall->_state) @@ -220,9 +223,48 @@ void update_actions() break; } } + else if (selectedConf){ - else - { + // DEBUG("------------------------- selected conf ---------------------------\n"); + + switch(selectedConf->_state) { + + case CONFERENCE_STATE_ACTIVE_ATACHED: + gtk_action_set_sensitive (GTK_ACTION (hangUpAction), TRUE); + gtk_widget_set_sensitive (GTK_WIDGET (holdToolbar), TRUE); + gtk_toolbar_insert (GTK_TOOLBAR (toolbar), GTK_TOOL_ITEM (hangUpWidget), 1); + gtk_toolbar_insert (GTK_TOOLBAR (toolbar), GTK_TOOL_ITEM (holdToolbar), 2); + break; + + case CONFERENCE_STATE_ACTIVE_DETACHED: + gtk_action_set_sensitive (GTK_ACTION (hangUpAction), TRUE); + gtk_widget_set_sensitive (GTK_WIDGET (holdToolbar), TRUE); + gtk_toolbar_insert (GTK_TOOLBAR (toolbar), GTK_TOOL_ITEM (hangUpWidget), 1); + gtk_toolbar_insert (GTK_TOOLBAR (toolbar), GTK_TOOL_ITEM (holdToolbar), 2); + break; + + case CONFERENCE_STATE_RECORD: + gtk_action_set_sensitive (GTK_ACTION (hangUpAction), TRUE); + gtk_widget_set_sensitive (GTK_WIDGET (holdToolbar), TRUE); + gtk_toolbar_insert (GTK_TOOLBAR (toolbar), GTK_TOOL_ITEM (hangUpWidget), 1); + gtk_toolbar_insert (GTK_TOOLBAR (toolbar), GTK_TOOL_ITEM (holdToolbar), 2); + break; + + case CONFERENCE_STATE_HOLD: + gtk_action_set_sensitive (GTK_ACTION (hangUpAction), TRUE); + gtk_widget_set_sensitive (GTK_WIDGET (offHoldToolbar), TRUE); + gtk_toolbar_insert (GTK_TOOLBAR (toolbar), GTK_TOOL_ITEM (hangUpWidget), 1); + gtk_toolbar_insert (GTK_TOOLBAR (toolbar), GTK_TOOL_ITEM (offHoldToolbar), 2); + break; + + default: + WARN("Should not happen in update_action()!"); + break; + + } + } + + else { if( account_list_get_size() > 0 && current_account_has_mailbox ()) { gtk_toolbar_insert (GTK_TOOLBAR (toolbar), GTK_TOOL_ITEM (voicemailToolbar), -2); @@ -343,6 +385,7 @@ switch_account( GtkWidget* item , gpointer data UNUSED) call_hold (void* foo UNUSED) { callable_obj_t * selectedCall = calltab_get_selected_call(current_calls); + conference_obj_t * selectedConf = calltab_get_selected_conf(); if(selectedCall) { @@ -355,6 +398,28 @@ call_hold (void* foo UNUSED) sflphone_on_hold(); } } + else if (selectedConf) { + + switch(selectedConf->_state) { + + case CONFERENCE_STATE_HOLD: + { + selectedConf->_state = CONFERENCE_STATE_ACTIVE_ATACHED; + sflphone_conference_off_hold(selectedConf); + } + break; + + case CONFERENCE_STATE_ACTIVE_ATACHED: + case CONFERENCE_STATE_ACTIVE_DETACHED: { + selectedConf->_state = CONFERENCE_STATE_HOLD; + sflphone_conference_on_hold(selectedConf); + } + break; + default: + break; + } + + } } static void diff --git a/sflphone-common/src/audio/pulseaudio/audiostream.cpp b/sflphone-common/src/audio/pulseaudio/audiostream.cpp index 89986506eede7627bdde82ca37928eca99300d41..38608fbf2bb7a21ad59dfea3b9a13c4e41da6251 100644 --- a/sflphone-common/src/audio/pulseaudio/audiostream.cpp +++ b/sflphone-common/src/audio/pulseaudio/audiostream.cpp @@ -101,15 +101,22 @@ AudioStream::disconnectStream (void) { _debug ("Destroy audio streams\n"); - // pa_threaded_mainloop_lock (_mainloop); + pa_threaded_mainloop_lock (_mainloop); if (_audiostream) { pa_stream_disconnect (_audiostream); + + // make sure we don't get any further callback + pa_stream_set_state_callback(_audiostream, NULL, NULL); + pa_stream_set_write_callback (_audiostream, NULL, NULL); + pa_stream_set_underflow_callback (_audiostream, NULL, NULL); + pa_stream_set_overflow_callback (_audiostream, NULL, NULL); + pa_stream_unref (_audiostream); _audiostream = NULL; } - // pa_threaded_mainloop_unlock (_mainloop); + pa_threaded_mainloop_unlock (_mainloop); return true; } diff --git a/sflphone-common/src/audio/pulseaudio/pulselayer.cpp b/sflphone-common/src/audio/pulseaudio/pulselayer.cpp index 8f5b94c5a0b96f0045417116322fc0f96841e15f..906ba0a541a8ee50575087c0679bea536ec0d177 100644 --- a/sflphone-common/src/audio/pulseaudio/pulselayer.cpp +++ b/sflphone-common/src/audio/pulseaudio/pulselayer.cpp @@ -134,7 +134,7 @@ PulseLayer::closeLayer (void) // record->disconnectStream(); // closeCaptureStream(); - disconnectAudioStream(); + // disconnectAudioStream(); if (context) { pa_context_disconnect (context); @@ -219,7 +219,7 @@ void PulseLayer::context_state_callback (pa_context* c, void* user_data) bool PulseLayer::disconnectAudioStream (void) { - _debug (" PulseLayer::disconnectAudioStream( void ) \n"); + _debug ("PulseLayer::disconnectAudioStream( void ) \n"); closePlaybackStream(); @@ -294,9 +294,7 @@ void PulseLayer::closeCaptureStream (void) { if (record) { - pa_threaded_mainloop_lock (m); delete record; - pa_threaded_mainloop_unlock (m); record=NULL; } } @@ -305,9 +303,7 @@ void PulseLayer::closePlaybackStream (void) { if (playback) { - pa_threaded_mainloop_lock (m); delete playback; - pa_threaded_mainloop_unlock (m); playback=NULL; } } @@ -662,7 +658,6 @@ void PulseLayer::readFromMic (void) size_t r; // if (record->getStreamState() - // pa_threaded_mainloop_lock (m); int readableSize = pa_stream_readable_size (record->pulseStream()); @@ -672,6 +667,7 @@ void PulseLayer::readFromMic (void) _debug ("pa_stream_peek() failed: %s\n" , pa_strerror (pa_context_errno (context))); } + if (data != 0) { int _mainBufferSampleRate = getMainBuffer()->getInternalSamplingRate(); diff --git a/sflphone-common/src/managerimpl.cpp b/sflphone-common/src/managerimpl.cpp index 963a9c4579f9242ede7939a35cbec805fecf449c..82ccda733b0cb10ca086f8d15240a7501825d2c8 100644 --- a/sflphone-common/src/managerimpl.cpp +++ b/sflphone-common/src/managerimpl.cpp @@ -3143,6 +3143,8 @@ void ManagerImpl::switchAudioManager (void) framesize = getConfigInt (AUDIO , ALSA_FRAME_SIZE); + _debug("samplerate: %i, framesize %i\n", samplerate, framesize); + alsaPlugin = getConfigString (AUDIO , ALSA_PLUGIN); numCardIn = getConfigInt (AUDIO , ALSA_CARD_ID_IN); @@ -3985,7 +3987,7 @@ void ManagerImpl::setAccountDetails (const std::string& accountID, const std::ma acc->loadConfig(); if (acc->isEnabled()) { - acc->unregisterVoIPLink(); + // acc->unregisterVoIPLink(); // do not need to send an unregister acc->registerVoIPLink(); } else { acc->unregisterVoIPLink();