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/config/accountconfigdialog.c b/sflphone-client-gnome/src/config/accountconfigdialog.c index 476597d41f6088e4d03ff0174a9264071b008b15..e6e5df0af8a987e649930b865c58fabe57869e61 100644 --- a/sflphone-client-gnome/src/config/accountconfigdialog.c +++ b/sflphone-client-gnome/src/config/accountconfigdialog.c @@ -175,9 +175,6 @@ static GtkWidget * create_basic_tab(account_t **a) curUsername = g_hash_table_lookup(currentAccount->properties, ACCOUNT_USERNAME); curMailbox = g_hash_table_lookup(currentAccount->properties, ACCOUNT_MAILBOX); } - - // DEBUG("-------- Basic parameters from config"); - // DEBUG("curAccountID %s, curAccountType %s, curAccountEnabled %s, curAlias %s, curHostname %s, curPassword %s, curUsername %s, curMailbox %s\n", curAccountID, curAccountType, curAccountEnabled, curAlias, curHostname, curPassword, curUsername, curMailbox); gnome_main_section_new (_("Account Parameters"), &frame); diff --git a/sflphone-client-gnome/src/config/accountlistconfigdialog.c b/sflphone-client-gnome/src/config/accountlistconfigdialog.c index 5216d71a20f7acf02d94941b03d5435736c057a5..13ccf28619f703b238b42678778bff4a19d1b4e1 100644 --- a/sflphone-client-gnome/src/config/accountlistconfigdialog.c +++ b/sflphone-client-gnome/src/config/accountlistconfigdialog.c @@ -444,11 +444,11 @@ create_account_list(GtkDialog * dialog) g_signal_connect_swapped(G_OBJECT(helpButton), "clicked", G_CALLBACK(help_contents_cb), NULL); gtk_box_pack_start(GTK_BOX(buttonHbox), helpButton, FALSE, FALSE, 0); - + GtkWidget * closeButton = gtk_button_new_from_stock (GTK_STOCK_CLOSE); g_signal_connect_swapped(G_OBJECT(closeButton), "clicked", G_CALLBACK(close_dialog_cb), NULL); gtk_box_pack_start(GTK_BOX(buttonHbox), closeButton, FALSE, FALSE, 0); - + gtk_widget_show_all(table); // account_list_config_dialog_fill(); @@ -459,9 +459,9 @@ create_account_list(GtkDialog * dialog) gtk_widget_size_request(GTK_WIDGET(deleteButton), &requisitionButton); gtk_widget_set_size_request(GTK_WIDGET(closeButton), requisitionButton.width, -1); gtk_widget_set_size_request(GTK_WIDGET(helpButton), requisitionButton.width, -1); - + gtk_widget_show_all(table); - + return table; } diff --git a/sflphone-client-gnome/src/config/preferencesdialog.c b/sflphone-client-gnome/src/config/preferencesdialog.c index d804865fa4dba066698196f1538f8ac3c4d28458..fc4a2b0389342a16528813e5ef50630ad1dcca88 100644 --- a/sflphone-client-gnome/src/config/preferencesdialog.c +++ b/sflphone-client-gnome/src/config/preferencesdialog.c @@ -219,7 +219,7 @@ GtkWidget* create_direct_ip_calls_tab() - GtkWidget * vbox = gtk_vbox_new(FALSE, 10); + GtkWidget * vbox = gtk_vbox_new(FALSE, 10); gtk_container_set_border_width(GTK_CONTAINER(vbox), 10); description = g_markup_printf_escaped(_("This profile is used when you want to reach a remote peer simply by typing a sip URI such as <b>sip:remotepeer</b>. The settings you define here will also be used if no account can be matched to an incoming or outgoing call.")); @@ -485,12 +485,15 @@ create_general_settings () gtk_table_attach( GTK_TABLE(table), label, 2, 3, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 5); // Configuration File + // Commented out because not functional yet + /* gnome_main_section_new_with_table (_("Configuration File"), &frame, &table, 1, 1); gtk_box_pack_start(GTK_BOX(ret), frame, FALSE, FALSE, 0); checkBoxWidget = gtk_check_button_new_with_mnemonic(_("Store SIP credentials as MD5 hash")); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(checkBoxWidget), dbus_is_md5_credential_hashing() ); g_signal_connect(G_OBJECT( checkBoxWidget ) , "clicked" , G_CALLBACK(set_md5_hash_cb) , NULL); gtk_table_attach( GTK_TABLE(table), checkBoxWidget, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 5); + */ gtk_widget_show_all(ret); 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 521574dca30d68862af514d5acbc3fe805dae1bd..8bd79c5d83fbd7254d5861fdba1c4ac184f4e090 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"); - // 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 b82a15428d291ab1ef873b4a798240ec81672880..046d81cec1bc871f172e34182b2d7c9878cc8159 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); @@ -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" , 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 884705ab1f60b1d199e3a408d0e89ae4acb1cb14..f3ab27a4afc1251c94154ceb168536b7c84dcd45 100644 --- a/sflphone-common/src/managerimpl.cpp +++ b/sflphone-common/src/managerimpl.cpp @@ -3104,6 +3104,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); @@ -3483,7 +3485,7 @@ std::map< std::string, std::string > ManagerImpl::getAccountDetails (const Accou Account * account = _accountMap[accountID]; if (account == NULL) { - _debug ("Cannot getAccountDetails on a non-existing accountID. Defaults will be used."); + _debug ("Cannot getAccountDetails on a non-existing accountID %s. Defaults will be used.", accountID.c_str()); } a.insert (std::pair<std::string, std::string> (CONFIG_ACCOUNT_ALIAS, getConfigString (accountID, CONFIG_ACCOUNT_ALIAS))); @@ -3944,7 +3946,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(); diff --git a/sflphone-common/src/sip/sipaccount.cpp b/sflphone-common/src/sip/sipaccount.cpp index ac33525d27597ded9b2929f6ff68549fed73d2fe..c5fac3216b9be71093127b2ff6969d0e76b8e617 100644 --- a/sflphone-common/src/sip/sipaccount.cpp +++ b/sflphone-common/src/sip/sipaccount.cpp @@ -162,6 +162,8 @@ int SIPAccount::initCredential (void) int SIPAccount::registerVoIPLink() { + _debug ("Register account %s\n", getAccountID().c_str()); + // Init general settings loadConfig(); diff --git a/sflphone-common/src/sip/sipvoiplink.cpp b/sflphone-common/src/sip/sipvoiplink.cpp index 5e9607ac3b153498b48ba02dd5dda8b76c6c737d..f63ef7c4bb2224b01976714ec619eeb8c89ca45d 100644 --- a/sflphone-common/src/sip/sipvoiplink.cpp +++ b/sflphone-common/src/sip/sipvoiplink.cpp @@ -479,7 +479,7 @@ int SIPVoIPLink::sendRegister (AccountID id) status = createUDPServer (id); if (status != PJ_SUCCESS) { - _debug ("Use the local UDP transport"); + _debug ("Use the local UDP transport\n"); account->setAccountTransport (_localUDPTransport); } } @@ -612,7 +612,6 @@ int SIPVoIPLink::sendRegister (AccountID id) _mutexSIP.leaveMutex(); account->setRegistrationInfo (regc); - _debug ("ok"); return true; } @@ -1918,7 +1917,7 @@ int SIPVoIPLink::createUDPServer (AccountID id) pj_status_t status; pj_sockaddr_in bound_addr; pjsip_host_port a_name; - char tmpIP[32]; + // char tmpIP[32]; pjsip_transport *transport; std::string listeningAddress = "127.0.0.1"; int listeningPort = _regPort; @@ -1961,13 +1960,10 @@ int SIPVoIPLink::createUDPServer (AccountID id) // Use here either the local information or the published address if (account != NULL && !account->getPublishedSameasLocal ()) { - - // Set the listening address to the published address listeningAddress = account->getPublishedAddress (); // Set the listening port to the published port listeningPort = account->getPublishedPort (); - _debug (" ******************************** Use the published address %s:%i\n", listeningAddress.c_str (), listeningPort ); } @@ -2724,7 +2720,7 @@ void call_on_state_changed (pjsip_inv_session *inv, pjsip_event *e) case PJSIP_SC_NOT_FOUND: /* peer not found */ - case PJSIP_SC_DECLINE: + case PJSIP_SC_DECLINE: /* We have been ignored */ case PJSIP_SC_REQUEST_TIMEOUT: /* request timeout */ @@ -2736,6 +2732,8 @@ void call_on_state_changed (pjsip_inv_session *inv, pjsip_event *e) case PJSIP_SC_UNAUTHORIZED: + case PJSIP_SC_FORBIDDEN: + case PJSIP_SC_REQUEST_PENDING: accId = Manager::instance().getAccountFromCall (call->getCallId()); link = dynamic_cast<SIPVoIPLink *> (Manager::instance().getAccountLink (accId)); @@ -2844,7 +2842,10 @@ void regc_cb (struct pjsip_regc_cbparam *param) const pj_str_t * description = pjsip_get_status_text (param->code); - if (param->code) { + if (param->code && description) { + + //std::string descriptionprint(description->ptr, description->slen); + //_debug("Received client registration callback wiht code: %i, %s\n", param->code, descriptionprint.c_str()); DBusManager::instance().getCallManager()->registrationStateChanged (account->getAccountID(), std::string (description->ptr, description->slen), param->code); std::pair<int, std::string> details (param->code, std::string (description->ptr, description->slen)); account->setRegistrationStateDetailed (details); diff --git a/sflphone-common/test/audiolayerTest.cpp b/sflphone-common/test/audiolayerTest.cpp index f655843af33c850ad84eecfd1755fe3f038f74fb..eb7ad02999cede6be0b54d253c3012e68a41240d 100644 --- a/sflphone-common/test/audiolayerTest.cpp +++ b/sflphone-common/test/audiolayerTest.cpp @@ -34,8 +34,8 @@ void AudioLayerTest::setUp() { // Instanciate the manager - Manager::instance().initConfigFile(); Manager::instance().init(); + Manager::instance().initConfigFile(); // _audiodriver = Manager::instance().getAudioDriver(); @@ -65,6 +65,12 @@ void AudioLayerTest::testAudioLayerConfig() { int sampling_rate = Manager::instance().getConfigInt (AUDIO, ALSA_SAMPLE_RATE); int frame_size = Manager::instance().getConfigInt (AUDIO, ALSA_FRAME_SIZE); + frame_size = 0; // frame size in config not used anymore + + int layer = Manager::instance().getAudioDriver()->getLayerType(); + + if(layer != ALSA) + Manager::instance().switchAudioManager(); CPPUNIT_ASSERT ( (int) Manager::instance().getAudioDriver()->getSampleRate() == sampling_rate); CPPUNIT_ASSERT ( (int) Manager::instance().getAudioDriver()->getFrameSize() == frame_size); @@ -104,7 +110,8 @@ void AudioLayerTest::testPulseConnect() ManagerImpl* manager; manager = &Manager::instance(); - _pulselayer = new PulseLayer (manager); + // _pulselayer = new PulseLayer (manager); + _pulselayer = (PulseLayer*)Manager::instance().getAudioDriver(); CPPUNIT_ASSERT (_pulselayer->getLayerType() == PULSEAUDIO); @@ -130,32 +137,30 @@ void AudioLayerTest::testPulseConnect() usleep (100000); - CPPUNIT_ASSERT (_pulselayer->getPlaybackStream() != NULL); - CPPUNIT_ASSERT (_pulselayer->getRecordStream() != NULL); + CPPUNIT_ASSERT (_pulselayer->getPlaybackStream() == NULL); + CPPUNIT_ASSERT (_pulselayer->getRecordStream() == NULL); - CPPUNIT_ASSERT (_pulselayer->getPlaybackStream()->pulseStream() != NULL); - CPPUNIT_ASSERT (_pulselayer->getRecordStream()->pulseStream() != NULL); + // CPPUNIT_ASSERT (_pulselayer->getPlaybackStream()->pulseStream() != NULL); + // CPPUNIT_ASSERT (_pulselayer->getRecordStream()->pulseStream() != NULL); // Must return Access failure "PA_ERR_ACCESS" == 2 - CPPUNIT_ASSERT (_pulselayer->getPlaybackStream()->getStreamState() == 2); - CPPUNIT_ASSERT (_pulselayer->getRecordStream()->getStreamState() == 2); - - CPPUNIT_ASSERT (_pulselayer->createStreams (_pulselayer->context) == true); + // CPPUNIT_ASSERT (_pulselayer->getPlaybackStream()->getStreamState() == 2); + // CPPUNIT_ASSERT (_pulselayer->getRecordStream()->getStreamState() == 2); + _debug("-------------------------- \n"); + _pulselayer->startStream (); // usleep(1000000); + CPPUNIT_ASSERT (_pulselayer->getPlaybackStream()->pulseStream() != NULL); CPPUNIT_ASSERT (_pulselayer->getPlaybackStream()->pulseStream() != NULL); // Must return No error "PA_OK" == 1 CPPUNIT_ASSERT (_pulselayer->getPlaybackStream()->getStreamState() == 1); CPPUNIT_ASSERT (_pulselayer->getRecordStream()->getStreamState() == 1); - + CPPUNIT_ASSERT (_pulselayer->getPlaybackStream()->disconnectStream() == true); CPPUNIT_ASSERT (_pulselayer->getRecordStream()->disconnectStream() == true); - - // _debug("%i",_pulselayer->getPlaybackStream()->getStreamState()); - CPPUNIT_ASSERT (_pulselayer->getPlaybackStream()->connectStream() == true); CPPUNIT_ASSERT (_pulselayer->getRecordStream()->connectStream() == true); @@ -170,6 +175,7 @@ void AudioLayerTest::testPulseConnect() // usleep(1000000); CPPUNIT_ASSERT (_pulselayer->disconnectAudioStream() == true); + } diff --git a/sflphone-common/test/mainbufferTest.cpp b/sflphone-common/test/mainbufferTest.cpp index 885f0582f082673bc5027fd190f731f5aa7caa79..f9e8e43c39017bfe396f0cad8a19e02bbcc3d1c2 100644 --- a/sflphone-common/test/mainbufferTest.cpp +++ b/sflphone-common/test/mainbufferTest.cpp @@ -554,7 +554,7 @@ void MainBufferTest::testBindUnbindBuffer() // unbind test_id1 with default_id _mainbuffer.unBindCallID (test_id1); - _debug ("%i", _mainbuffer._ringBufferMap.size()); + _debug ("%i", (int)(_mainbuffer._ringBufferMap.size())); CPPUNIT_ASSERT (_mainbuffer._ringBufferMap.size() == 0); CPPUNIT_ASSERT (_mainbuffer._callIDMap.size() == 0); @@ -1358,10 +1358,10 @@ void MainBufferTest::testConference() CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == init_put_id2); CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (default_id) == 0); CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == 0); - // test mainbuffer availforget + // test mainbuffer availforget (get data even if some participant missing) CPPUNIT_ASSERT (_mainbuffer.availForGet (default_id) == 0); - CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == 0); - CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id2) == 0); + CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == sizeof (int)); + CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id2) == sizeof (int)); //putdata test ring buffers CPPUNIT_ASSERT (_mainbuffer.putData (&testint, sizeof (int), 100, test_id1) == sizeof (int)); test_ring_buffer = _mainbuffer.getRingBuffer (default_id); @@ -1379,11 +1379,11 @@ void MainBufferTest::testConference() CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == init_put_id2); CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (default_id) == 0); CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == 0); - // test mainbuffer availforget - CPPUNIT_ASSERT (_mainbuffer.availForGet (default_id) == 0); - CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == 0); + // test mainbuffer availforget (get data even if some participant missing) + CPPUNIT_ASSERT (_mainbuffer.availForGet (default_id) == sizeof (int)); + CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == sizeof (int)); CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id2) == sizeof (int)); - //putdata test ring buffers + //putdata test ring buffers CPPUNIT_ASSERT (_mainbuffer.putData (&testint, sizeof (int), 100, test_id2) == sizeof (int)); test_ring_buffer = _mainbuffer.getRingBuffer (default_id); CPPUNIT_ASSERT (test_ring_buffer->putLen() == sizeof (int)); @@ -1500,10 +1500,10 @@ void MainBufferTest::testConference() CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == init_put_id2); CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (default_id) == 0); CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == 0); - // test mainbuffer availforget + // test mainbuffer availforget CPPUNIT_ASSERT (_mainbuffer.availForGet (default_id) == 0); - CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == 0); - CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id2) == 0); + CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == sizeof(int)); + CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id2) == sizeof(int)); //putdata test ring buffers CPPUNIT_ASSERT (_mainbuffer.putData (&testint, sizeof (int), 100, test_id1) == sizeof (int)); test_ring_buffer = _mainbuffer.getRingBuffer (default_id); @@ -1522,8 +1522,8 @@ void MainBufferTest::testConference() CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (default_id) == 0); CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == 0); // test mainbuffer availforget - CPPUNIT_ASSERT (_mainbuffer.availForGet (default_id) == 0); - CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == 0); + CPPUNIT_ASSERT (_mainbuffer.availForGet (default_id) == sizeof(int)); + CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == sizeof(int)); CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id2) == sizeof (int)); //putdata test ring buffers CPPUNIT_ASSERT (_mainbuffer.putData (&testint, sizeof (int), 100, test_id2) == sizeof (int)); @@ -1641,8 +1641,8 @@ void MainBufferTest::testConference() CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == 0); // test mainbuffer availforget CPPUNIT_ASSERT (_mainbuffer.availForGet (default_id) == 0); - CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == 0); - CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id2) == 0); + CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == sizeof(int)); + CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id2) == sizeof(int)); //putdata test ring buffers CPPUNIT_ASSERT (_mainbuffer.putData (&testint, sizeof (int), 100, test_id1) == sizeof (int)); test_ring_buffer = _mainbuffer.getRingBuffer (default_id); @@ -1661,8 +1661,8 @@ void MainBufferTest::testConference() CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (default_id) == 0); CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == 0); // test mainbuffer availforget - CPPUNIT_ASSERT (_mainbuffer.availForGet (default_id) == 0); - CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == 0); + CPPUNIT_ASSERT (_mainbuffer.availForGet (default_id) == sizeof(int)); + CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == sizeof(int)); CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id2) == sizeof (int)); //putdata test ring buffers CPPUNIT_ASSERT (_mainbuffer.putData (&testint, sizeof (int), 100, test_id2) == sizeof (int)); diff --git a/sflphone-common/test/rtpTest.cpp b/sflphone-common/test/rtpTest.cpp index 04219eaa7ea2b1382e2b782e8c964535dfcac6bc..7b37b621d0b39badc5c54f89f2c6ee9fc89cf7de 100644 --- a/sflphone-common/test/rtpTest.cpp +++ b/sflphone-common/test/rtpTest.cpp @@ -81,7 +81,7 @@ bool RtpTest::pjsipInit() void RtpTest::testRtpInitClose() { - audiortp = new AudioRtp(); + audiortp = new AudioSymmetricRtpSession(Manager::instance(), sipcall); _debug ("------ void RtpTest::testRtpInit() ------"); diff --git a/sflphone-common/test/rtpTest.h b/sflphone-common/test/rtpTest.h index 2f28c856270748246797d6e63165a5df174cfe73..9e7c39ec6ae21dcecde69a760ddcb51eb299aca0 100644 --- a/sflphone-common/test/rtpTest.h +++ b/sflphone-common/test/rtpTest.h @@ -40,6 +40,7 @@ // Application import #include "manager.h" #include "audio/audiortp/AudioRtpSession.h" +#include "audio/audiortp/AudioSymmetricRtpSession.h" #include "call.h" #include "sip/sipcall.h" #include "sip/sipvoiplink.h" @@ -47,7 +48,7 @@ #include "config/config.h" #include "user_cfg.h" - +using namespace sfl; /* * @file audiorecorderTest.cpp @@ -57,7 +58,8 @@ #ifndef _RTP_TEST_ #define _RTP_TEST_ -class AudioRtp; +class AudioSymmetricRtpSession; +class AudioRtpSession; class AudioRtpRTX; class SIPVoIPLink; @@ -103,7 +105,7 @@ class RtpTest : public CppUnit::TestCase { ManagerImpl* manager; - AudioRtp *audiortp; + AudioSymmetricRtpSession *audiortp; AudioRtpRTX *rtpthread;