diff --git a/INSTALL b/INSTALL index b59a48049f1c0546e6e45247e49d60e8b527d79a..90ae4f19c9c28ce5213535850f5cf3c730794618 100644 --- a/INSTALL +++ b/INSTALL @@ -12,9 +12,11 @@ Wiki: https://projects.savoirfairelinux.com/projects/sflphone/wiki/BuildInstruct # Go to the root of the application core directory cd daemon - # Compile pjsip - cd libs - ./compile_pjsip.sh + # Compile contrib + cd contrib + mkdir native && cd native + ../bootstrap + make # Go back to the root cd ../.. ./autogen.sh @@ -36,8 +38,8 @@ Wiki: https://projects.savoirfairelinux.com/projects/sflphone/wiki/BuildInstruct You are done with the gnome client ! -Then, to start SFLphone, simply go in Applications > Internet > SFLphone VoIP Client. +Then, to start Ring, simply go in Applications > Internet > Ring VoIP Client. Thanks You - SFLphone Team + Ring Team diff --git a/README b/README index 247d092fa23abd8a2167606c92dbcebaed4697f2..abd362daeb5b47a7092b3ddd0514afbbd171a483 100644 --- a/README +++ b/README @@ -1,13 +1,13 @@ -SFLphone is an open-source SIP/IAX2 compatible enterprise-class softphone, published under the GNU Public License 3. +Ring (formerly SFLPhone) is an open-source SIP/IAX2 compatible enterprise-class softphone, published under the GNU Public License 3. GIT REPOSITORY Tree information: - * daemon: contains the core application code. This code is mandatory to run the softphone. It may be considered as the core as it implements all the logic (audio layer, communication layer, account management, codecs management, dbus services). - * gnome: contains the GTK+ client for SFLphone. It will connect and communicate to the core application through D-Bus. + * daemon (dring): contains the core application code. This code is mandatory to run the softphone. It may be considered as the core as it implements all the logic (audio layer, communication layer, account management, codecs management, dbus services). + * gnome: contains the GTK+ client for Ring. It will connect and communicate to the core application through D-Bus. * tools: scripts - * sflphone-callto: to start calls from command line + * ring-callto: to start calls from command line * update-copyright: (dev tool) to update copyright notice with new year * sflphone-kde: git clone git://anongit.kde.org/sflphone-kde @@ -18,4 +18,4 @@ Tree information: * Mailing list: http://lists.savoirfairelinux.net/mailman/listinfo/sflphone - SFLphone Team + Ring Team diff --git a/daemon/.gitignore b/daemon/.gitignore index 135e9127e6a26dff6501e7c8632d9970d85f87c2..d6d48fb16c067fc7d005393b03ac00124f76e62d 100644 --- a/daemon/.gitignore +++ b/daemon/.gitignore @@ -3,5 +3,5 @@ aclocal.m4 build-aux configure bin/dbus/*.adaptor.h -bin/dbus/org.sflphone.SFLphone.service -bin/sflphoned +bin/dbus/cx.ring.Ring.service +bin/dring diff --git a/daemon/AUTHORS b/daemon/AUTHORS index c31c5f78055aed5a232e9cf507ad31047c62c505..ba49877300c52895aee036fee2e96c75fec83416 100644 --- a/daemon/AUTHORS +++ b/daemon/AUTHORS @@ -1,23 +1,31 @@ Current authors --------------- +Guillaume Roguez <guillaume dot roguez at savoirfairelinux dot com> + +Adrien Béraud <adrien dot beraud at savoirfairelinux dot com> + +Emmanuel Lepage <emmanuel dot lepage at savoirfairelinux dot com> + +Alexandre Lision <alexandre dot lision at savoirfairelinux dot com> + +Stepan Salenikovich <stepan dot salenikovich at savoirfairelinux dot com> + +Former authors +-------------- + +Tristan Matthews <tristan dot matthews at savoirfairelinux dot com> + Emmanuel Milou <emmanuel dot milou at savoirfairelinux dot com> - ALSA implementation ( replaces portaudio ) - Dynamic loading of audio codecs ( shared libraries ) - Debian packages - GTK client error handling - - Plus many portions of code in sflphoned and sflphone-gtk + - Plus many portions of code in dring and sflphone-gtk - Test and debugging Alexandre Savard <alexandre dot savard at savoirfairelinux dot com> -Tristan Matthews <tristan dot matthews at savoirfairelinux dot com> - -Emmanuel Lepage <emmanuel dot lepage at savoirfairelinux dot com> - -Former authors --------------- - Rafaël Carré <rafael dot carre at savoirfairelinux dot com> Vivien Didelot <vivien dot didelot at savoirfairelinux dot com> @@ -49,7 +57,7 @@ Pierre-Luc Beaudoin <pierre-luc.beaudoin at savoirfairelinux dot com> Yan Morin <yan dot morin at savoirfairelinux dot com> - zeroconf integration - - sflphoned deamon + - dring deamon - add and improve sip core feature - tests and debugging diff --git a/daemon/Makefile.am b/daemon/Makefile.am index 7cb7d5af5f333679278385a5a15ceb1e5c0271e3..ec92645e0f529c5ab81e1743c0ccd44e0a4a3ace 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -21,7 +21,7 @@ endif ACLOCAL_AMFLAGS = -I m4 -#FIXME: this will change when libsflphone is fixed +#FIXME: this will change when libring is fixed if HAVE_WIN32 SUBDIRS = bin else diff --git a/daemon/NEWS b/daemon/NEWS index f7fa5ec38ec36ee4e11b01702bd4a45e77d2abd2..4246258de44ff2fe0f7840ff7322c04360699497 100644 --- a/daemon/NEWS +++ b/daemon/NEWS @@ -64,7 +64,7 @@ SFLphoned/SFLphone (0.6) / 2005-11-04 * installation review SFLphoned/SFLphone (0.5a) / 2005-10-17 - * sflphoned + * dring * bug fixes * sflphone-qt * client/server protocol diff --git a/daemon/README b/daemon/README index caf072e8c3fe3e18eebe4542fa25b1160fb23c14..dc7b22bd954a4a1da1e827bd65f5610435ef7322 100644 --- a/daemon/README +++ b/daemon/README @@ -1,6 +1,6 @@ COPYRIGHT NOTICE -Copyright (C) 2004-2014 Savoir-Faire Linux Inc. +Copyright (C) 2004-2015 Savoir-Faire Linux Inc. 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 @@ -30,7 +30,7 @@ as that of the covered work. Introduction ------------ -SFLPhone is a Voice-over-IP software phone. We want it to be: +Ring is a Voice-over-IP software phone. We want it to be: - user friendly (fast, sleek, easy to learn interface) - professional grade (transfers, holds, optimal audio quality) - fully compatible with Asterisk (SIP and IAX protocols) @@ -82,7 +82,7 @@ make make install # And the GNOME client -cd sflphone-client-gnome +cd ring-client-gnome ./autogen.sh ./configure make @@ -96,10 +96,10 @@ https://projects.savoirfairelinux.com/projects/sflphone/wiki/How_to_build How to compile on OSX --------------------- # These first steps are only necessary if you don't use a package manager. -cd sflphone/daemon/extras/tools +cd daemon/extras/tools ./bootstrap make -export PATH=$PATH:/location/of/sflphone/daemon/extras/tools/build/bin +export PATH=$PATH:/location/of/ring/daemon/extras/tools/build/bin # Or, use your favorite package manager to install the necessary tools (macports or brew). automake libtool check gettext libtoolize ... @@ -131,7 +131,7 @@ sudo update-alternatives --config x86_64-w64-mingw32-gcc sudo update-alternatives --config x86_64-w64-mingw32-g++ # Compile the dependencies -cd sflphone/daemon/contrib/ +cd ring/daemon/contrib/ mkdir win64 && cd win64 ../bootstrap --host=x86_64-w64-mingw32 make diff --git a/daemon/bin/Makefile.am b/daemon/bin/Makefile.am index a28aaae57696da21c4796fa4672872a4d3229002..2df6699f69bcbded840cf21fa10fa5d63b7f2d06 100644 --- a/daemon/bin/Makefile.am +++ b/daemon/bin/Makefile.am @@ -10,18 +10,18 @@ libexec_PROGRAMS = ringcli ringcli_SOURCES = osxmain.cpp ringcli_CXXFLAGS = -I$(top_srcdir)/src \ -DTOP_BUILDDIR=\"$$(cd "$(top_builddir)"; pwd)\" -ringcli_LDADD = $(top_builddir)/src/libsflphone.la +ringcli_LDADD = $(top_builddir)/src/libring.la endif -if SFL_DBUS +if RING_DBUS SUBDIRS=dbus -libexec_PROGRAMS = sflphoned +libexec_PROGRAMS = dring -sflphoned_SOURCES = main.cpp +dring_SOURCES = main.cpp -sflphoned_CXXFLAGS=-I$(top_srcdir)/src ${DBUSCPP_CFLAGS} \ +dring_CXXFLAGS=-I$(top_srcdir)/src ${DBUSCPP_CFLAGS} \ -DTOP_BUILDDIR=\"$$(cd "$(top_builddir)"; pwd)\" -sflphoned_LDADD = dbus/libclient_dbus.la ${DBUSCPP_LIBS} $(top_builddir)/src/libsflphone.la +dring_LDADD = dbus/libclient_dbus.la ${DBUSCPP_LIBS} $(top_builddir)/src/libring.la endif diff --git a/daemon/bin/dbus/Makefile.am b/daemon/bin/dbus/Makefile.am index 5bb2fc87c6f097adfe4c9352ca3da9ee20c82d02..33a89108b573a6fcef752497ab46680579e2787d 100644 --- a/daemon/bin/dbus/Makefile.am +++ b/daemon/bin/dbus/Makefile.am @@ -11,7 +11,7 @@ BUILT_SOURCES+=dbuspresencemanager.adaptor.h dbuspresencemanager.adaptor.h: presencemanager-introspec.xml Makefile.am dbusxx-xml2cpp $< --adaptor=$@ -if SFL_VIDEO +if RING_VIDEO BUILT_SOURCES+=dbusvideomanager.adaptor.h dbusvideomanager.adaptor.h: videomanager-introspec.xml Makefile.am dbusxx-xml2cpp $< --adaptor=$@ @@ -43,29 +43,29 @@ libclient_dbus_la_SOURCES = \ dbuspresencemanager.h \ $(BUILT_SOURCES) -if SFL_VIDEO +if RING_VIDEO libclient_dbus_la_SOURCES += dbusvideomanager.cpp dbusvideomanager.h endif libclient_dbus_la_CXXFLAGS = -I../ \ -I$(top_srcdir)/src \ -DPREFIX=\"$(prefix)\" \ - -DPROGSHAREDIR=\"${datadir}/sflphone\" \ + -DPROGSHAREDIR=\"${datadir}/ring\" \ $(DBUSCPP_CFLAGS) # Dbus service file servicedir = $(datadir)/dbus-1/services -service_DATA = org.sflphone.SFLphone.service +service_DATA = cx.ring.Ring.service EXTRA_DIST = callmanager-introspec.xml \ configurationmanager-introspec.xml \ instance-introspec.xml \ presencemanager-introspec.xml -if SFL_VIDEO +if RING_VIDEO EXTRA_DIST += videomanager-introspec.xml endif CLEANFILES= \ $(BUILT_SOURCES) \ - org.sflphone.SFLphone.service + cx.ring.Ring.service diff --git a/daemon/bin/dbus/callmanager-introspec.xml b/daemon/bin/dbus/callmanager-introspec.xml index 1b8664640354dde871ff8267b8478fc61e6ede42..8b896903eec1407e3b5e3acfe64dbf49b5327a0a 100644 --- a/daemon/bin/dbus/callmanager-introspec.xml +++ b/daemon/bin/dbus/callmanager-introspec.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="UTF-8" ?> <node name="/callmanager-introspec" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"> - <interface name="org.sflphone.SFLphone.CallManager"> + <interface name="cx.ring.Ring.CallManager"> <tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>The CallManager interface is used to manage call and conference related actions.</p> - <p>Since SFLphone-daemon supports multiple incoming/outgoing calls, any actions involving a specific call must address the method by the means of a unique callID. - SFLphone-clients is responsible for generating the callID on outgoing calls. Conversely, SFLphone-daemon will generate a unique callID for incoming calls.</p> + <p>Since Ring-daemon supports multiple incoming/outgoing calls, any actions involving a specific call must address the method by the means of a unique callID. + Ring-clients is responsible for generating the callID on outgoing calls. Conversely, Ring-daemon will generate a unique callID for incoming calls.</p> </tp:docstring> <method name="placeCall" tp:name-for-bindings="placeCall"> <tp:docstring> @@ -204,8 +204,8 @@ <method name="addMainParticipant" tp:name-for-bindings="addMainParticipant"> <tp:added version="0.9.7"/> <tp:docstring> - <p>As the core can handle multiple calls and conferences, it may happen that the client's user leaves a conference to answer an incoming call or to start new calls. This method is used to reintroduce SFLphone-client's user into the conference.</p> - <p>Its put the current call on HOLD or detaches SFLphone-client's user from the another conference.</p> + <p>As the core can handle multiple calls and conferences, it may happen that the client's user leaves a conference to answer an incoming call or to start new calls. This method is used to reintroduce Ring-client's user into the conference.</p> + <p>Its put the current call on HOLD or detaches Ring-client's user from the another conference.</p> </tp:docstring> <arg type="s" name="confID" direction="in"> <tp:docstring> @@ -518,11 +518,11 @@ <tp:docstring> The acceptable states are: <ul> - <li>ACTIVE_ATTACHED: SFLphone user is + <li>ACTIVE_ATTACHED: Ring user is participating to this conference</li> <li>ACTIVE_DETACHED: This situation can occur if a call is received while - SFLphone user is participating to a + Ring user is participating to a conference. In this case, one can leave the conference by answering the call. Other participants may continue @@ -571,7 +571,7 @@ <signal name="conferenceCreated" tp:name-for-bindings="conferenceCreated"> <tp:added version="0.9.7"/> <tp:docstring> - Emited when a new conference is created. SFLphone-client is reponsible for storing the confID and call <tp:member-ref>getParticipantList</tp:member-ref> to update the display. + Emited when a new conference is created. Ring-client is reponsible for storing the confID and call <tp:member-ref>getParticipantList</tp:member-ref> to update the display. </tp:docstring> <arg type="s" name="confID"> <tp:docstring> @@ -583,7 +583,7 @@ <signal name="conferenceRemoved" tp:name-for-bindings="conferenceRemoved"> <tp:added version="0.9.7"/> <tp:docstring> - Emited when a new conference is remove. SFLphone-client should have kept a list of current participant in order to display modification. + Emited when a new conference is remove. Ring-client should have kept a list of current participant in order to display modification. </tp:docstring> <arg type="s" name="confID"> <tp:docstring> @@ -632,7 +632,7 @@ <signal name="sipCallStateChanged" tp:name-for-bindings="sipCallStateChanged"> <tp:docstring> - <p>Call state changed, SFLphone received a notification + <p>Call state changed, Ring received a notification from registrar concerning this call.</p> </tp:docstring> <arg type="s" name="callID" /> @@ -670,7 +670,7 @@ <p>Transfer has been successfully processed. Client should remove transfered call from call list as it is no longer - accessible in SFLphone-daemon.</p> + accessible in Ring-daemon (dring).</p> </tp:docstring> </signal> @@ -678,7 +678,7 @@ <tp:docstring> <p>Transfer operation failed. Corresponding call is no longer accessible in - SFLphone-daemon.</p> + Ring-daemon (dring).</p> </tp:docstring> </signal> diff --git a/daemon/bin/dbus/configurationmanager-introspec.xml b/daemon/bin/dbus/configurationmanager-introspec.xml index 7b65a53e9d9861335e68d9c99ed9df0fd832b63c..68f443166638d87b64afdf266724db42b3808bd4 100644 --- a/daemon/bin/dbus/configurationmanager-introspec.xml +++ b/daemon/bin/dbus/configurationmanager-introspec.xml @@ -1,6 +1,6 @@ <?xml version="1.0" ?> <node name="/configurationmanager-introspec" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"> - <interface name="org.sflphone.SFLphone.ConfigurationManager"> + <interface name="cx.ring.Ring.ConfigurationManager"> <tp:docstring xmlns="http://www.w3.org/1999/xhtml"> Used to handle the configuration stuff: accounts settings, account registration, user preferences, ... @@ -93,7 +93,7 @@ <method name="setAccountDetails" tp:name-for-bindings="setAccountDetails"> <tp:docstring> Send new account parameters, or account parameters changes, to the core. The hash table is not required to be complete, only the updated parameters may be specified. - <tp:rationale>Account settings are written to the configuration file when sflphone properly quits.</tp:rationale> + <tp:rationale>Account settings are written to the configuration file when ring properly quits.</tp:rationale> <tp:rationale>After calling this method, the core will emit the signal <tp:member-ref>accountsChanged</tp:member-ref> with the updated data. The client must subscribe to this signal and use it to update its internal data structure.</tp:rationale> </tp:docstring> <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="MapStringString"/> @@ -551,7 +551,7 @@ <!-- Only used by SIP accounts, data is directly from pjsip --> <signal name="sipRegistrationStateChanged" tp:name-for-bindings="sipRegistrationStateChanged"> <tp:docstring> - <p>Account state changed, SFLphone received a notification from registrar.</p> + <p>Account state changed, Ring received a notification from registrar.</p> </tp:docstring> <annotation name="org.freedesktop.DBus.Deprecated" value="true"/> <arg type="s" name="accountID" > diff --git a/daemon/bin/dbus/cx.ring.Ring.service.in b/daemon/bin/dbus/cx.ring.Ring.service.in new file mode 100644 index 0000000000000000000000000000000000000000..253b6798bbb7ffcf7c7b0d6a09f4c8d2769b1352 --- /dev/null +++ b/daemon/bin/dbus/cx.ring.Ring.service.in @@ -0,0 +1,3 @@ +[D-BUS Service] +Name=cx.ring.Ring +Exec=@LIBEXECDIR@/dring diff --git a/daemon/bin/dbus/dbus_cpp.h b/daemon/bin/dbus/dbus_cpp.h index ba1a89a9b634fdc8d9d4ecc98d13d1ae61c4a874..9b8a0c46481f3b9317e0c2333deb1f62e165444e 100644 --- a/daemon/bin/dbus/dbus_cpp.h +++ b/daemon/bin/dbus/dbus_cpp.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Tristan Matthews <tristan.matthews@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify diff --git a/daemon/bin/dbus/dbuscallmanager.cpp b/daemon/bin/dbus/dbuscallmanager.cpp index c2a96896a97a8cf48a6ab041296a146d14571957..fdab56216f6db47bd5f084cfee4a70134ab4444f 100644 --- a/daemon/bin/dbus/dbuscallmanager.cpp +++ b/daemon/bin/dbus/dbuscallmanager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Philippe Proulx <philippe.proulx@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -28,216 +28,216 @@ * as that of the covered work. */ #include <iostream> -#include "sflphone.h" +#include "ring.h" #include "dbuscallmanager.h" DBusCallManager::DBusCallManager(DBus::Connection& connection) - : DBus::ObjectAdaptor(connection, "/org/sflphone/SFLphone/CallManager") + : DBus::ObjectAdaptor(connection, "/cx/ring/Ring/CallManager") { } bool DBusCallManager::placeCall(const std::string& accountID, const std::string& callID, const std::string& to) { - return sflph_call_place(accountID, callID, to); + return ring_call_place(accountID, callID, to); } bool DBusCallManager::refuse(const std::string& callID) { - return sflph_call_refuse(callID); + return ring_call_refuse(callID); } bool DBusCallManager::accept(const std::string& callID) { - return sflph_call_accept(callID); + return ring_call_accept(callID); } bool DBusCallManager::hangUp(const std::string& callID) { - return sflph_call_hang_up(callID); + return ring_call_hang_up(callID); } bool DBusCallManager::hold(const std::string& callID) { - return sflph_call_hold(callID); + return ring_call_hold(callID); } bool DBusCallManager::unhold(const std::string& callID) { - return sflph_call_unhold(callID); + return ring_call_unhold(callID); } bool DBusCallManager::transfer(const std::string& callID, const std::string& to) { - return sflph_call_transfer(callID, to); + return ring_call_transfer(callID, to); } bool DBusCallManager::attendedTransfer(const std::string& transferID, const std::string& targetID) { - return sflph_call_attended_transfer(transferID, targetID); + return ring_call_attended_transfer(transferID, targetID); } std::map< std::string, std::string > DBusCallManager::getCallDetails(const std::string& callID) { - return sflph_call_get_call_details(callID); + return ring_call_get_call_details(callID); } std::vector< std::string > DBusCallManager::getCallList() { - return sflph_call_get_call_list(); + return ring_call_get_call_list(); } void DBusCallManager::removeConference(const std::string& conference_id) { - sflph_call_remove_conference(conference_id); + ring_call_remove_conference(conference_id); } bool DBusCallManager::joinParticipant(const std::string& sel_callID, const std::string& drag_callID) { - return sflph_call_join_participant(sel_callID, drag_callID); + return ring_call_join_participant(sel_callID, drag_callID); } void DBusCallManager::createConfFromParticipantList(const std::vector< std::string >& participants) { - sflph_call_create_conf_from_participant_list(participants); + ring_call_create_conf_from_participant_list(participants); } bool DBusCallManager::isConferenceParticipant(const std::string& call_id) { - return sflph_call_is_conference_participant(call_id); + return ring_call_is_conference_participant(call_id); } bool DBusCallManager::addParticipant(const std::string& callID, const std::string& confID) { - return sflph_call_add_participant(callID, confID); + return ring_call_add_participant(callID, confID); } bool DBusCallManager::addMainParticipant(const std::string& confID) { - return sflph_call_add_main_participant(confID); + return ring_call_add_main_participant(confID); } bool DBusCallManager::detachParticipant(const std::string& callID) { - return sflph_call_detach_participant(callID); + return ring_call_detach_participant(callID); } bool DBusCallManager::joinConference(const std::string& sel_confID, const std::string& drag_confID) { - return sflph_call_join_conference(sel_confID, drag_confID); + return ring_call_join_conference(sel_confID, drag_confID); } bool DBusCallManager::hangUpConference(const std::string& confID) { - return sflph_call_hang_up_conference(confID); + return ring_call_hang_up_conference(confID); } bool DBusCallManager::holdConference(const std::string& confID) { - return sflph_call_hold_conference(confID); + return ring_call_hold_conference(confID); } bool DBusCallManager::unholdConference(const std::string& confID) { - return sflph_call_unhold_conference(confID); + return ring_call_unhold_conference(confID); } std::vector<std::string> DBusCallManager::getConferenceList() { - return sflph_call_get_conference_list(); + return ring_call_get_conference_list(); } std::vector<std::string> DBusCallManager::getParticipantList(const std::string& confID) { - return sflph_call_get_participant_list(confID); + return ring_call_get_participant_list(confID); } std::vector<std::string> DBusCallManager::getDisplayNames(const std::string& confID) { - return sflph_call_get_display_names(confID); + return ring_call_get_display_names(confID); } std::string DBusCallManager::getConferenceId(const std::string& callID) { - return sflph_call_get_conference_id(callID); + return ring_call_get_conference_id(callID); } std::map<std::string, std::string> DBusCallManager::getConferenceDetails(const std::string& callID) { - return sflph_call_get_conference_details(callID); + return ring_call_get_conference_details(callID); } bool DBusCallManager::startRecordedFilePlayback(const std::string& filepath) { - return sflph_call_play_recorded_file(filepath); + return ring_call_play_recorded_file(filepath); } void DBusCallManager::stopRecordedFilePlayback(const std::string& filepath) { - sflph_call_stop_recorded_file(filepath); + ring_call_stop_recorded_file(filepath); } bool DBusCallManager::toggleRecording(const std::string& callID) { - return sflph_call_toggle_recording(callID); + return ring_call_toggle_recording(callID); } void DBusCallManager::setRecording(const std::string& callID) { - sflph_call_set_recording(callID); + ring_call_set_recording(callID); } void DBusCallManager::recordPlaybackSeek(const double& value) { - sflph_call_record_playback_seek(value); + ring_call_record_playback_seek(value); } bool DBusCallManager::getIsRecording(const std::string& callID) { - return sflph_call_is_recording(callID); + return ring_call_is_recording(callID); } std::string DBusCallManager::getCurrentAudioCodecName(const std::string& callID) { - return sflph_call_get_current_audio_codec_name(callID); + return ring_call_get_current_audio_codec_name(callID); } void DBusCallManager::playDTMF(const std::string& key) { - sflph_call_play_dtmf(key); + ring_call_play_dtmf(key); } void DBusCallManager::startTone(const int32_t& start, const int32_t& type) { - sflph_call_start_tone(start, type); + ring_call_start_tone(start, type); } void DBusCallManager::setSASVerified(const std::string& callID) { - sflph_call_set_sas_verified(callID); + ring_call_set_sas_verified(callID); } void DBusCallManager::resetSASVerified(const std::string& callID) { - sflph_call_reset_sas_verified(callID); + ring_call_reset_sas_verified(callID); } void DBusCallManager::setConfirmGoClear(const std::string& callID) { - sflph_call_set_confirm_go_clear(callID); + ring_call_set_confirm_go_clear(callID); } void DBusCallManager::requestGoClear(const std::string& callID) { - sflph_call_request_go_clear(callID); + ring_call_request_go_clear(callID); } void DBusCallManager::acceptEnrollment(const std::string& callID, const bool& accepted) { - sflph_call_accept_enrollment(callID, accepted); + ring_call_accept_enrollment(callID, accepted); } void DBusCallManager::sendTextMessage(const std::string& callID, const std::string& message) { - sflph_call_send_text_message(callID, message); + ring_call_send_text_message(callID, message); } diff --git a/daemon/bin/dbus/dbuscallmanager.h b/daemon/bin/dbus/dbuscallmanager.h index fbe5f00a80fa0eb372302d7a7c0ef2c605282d83..89185e590b2dabc835d473f1f617f25bfcc075e8 100644 --- a/daemon/bin/dbus/dbuscallmanager.h +++ b/daemon/bin/dbus/dbuscallmanager.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -28,8 +28,8 @@ * as that of the covered work. */ -#ifndef __SFL_CALLMANAGER_H__ -#define __SFL_CALLMANAGER_H__ +#ifndef __RING_CALLMANAGER_H__ +#define __RING_CALLMANAGER_H__ #include <vector> #include <map> @@ -56,7 +56,7 @@ #include <stdexcept> class DBusCallManager : - public org::sflphone::SFLphone::CallManager_adaptor, + public cx::ring::Ring::CallManager_adaptor, public DBus::IntrospectableAdaptor, public DBus::ObjectAdaptor { @@ -107,4 +107,4 @@ class DBusCallManager : void sendTextMessage(const std::string& callID, const std::string& message); }; -#endif // __SFL_CALLMANAGER_H__ +#endif // __RING_CALLMANAGER_H__ diff --git a/daemon/bin/dbus/dbusclient.cpp b/daemon/bin/dbus/dbusclient.cpp index f5588ffe9a4df4ac8326b3488a9d0564b441f9f6..9ebc7460d8a0546c4a9a337b1dcdfa4a037e3fe6 100644 --- a/daemon/bin/dbus/dbusclient.cpp +++ b/daemon/bin/dbus/dbusclient.cpp @@ -31,7 +31,7 @@ #include <iostream> #include <cstring> #include <stdexcept> -#include "sflphone.h" +#include "ring.h" #include "dbusclient.h" #include "dbus_cpp.h" @@ -41,7 +41,7 @@ #include "dbusconfigurationmanager.h" #include "dbuspresencemanager.h" -#ifdef SFL_VIDEO +#ifdef RING_VIDEO #include "dbusvideomanager.h" #endif @@ -66,7 +66,7 @@ DBusClient::DBusClient(int sflphFlags, bool persistent) : , presenceManager_(nullptr) , instanceManager_(nullptr) , dispatcher_(new DBus::BusDispatcher) -#ifdef SFL_VIDEO +#ifdef RING_VIDEO , videoManager_(nullptr) #endif , timeout_(nullptr) @@ -79,10 +79,10 @@ DBusClient::DBusClient(int sflphFlags, bool persistent) : // destructor, so we must NOT delete them ourselves. timeout_ = new DBus::DefaultTimeout(10 /* ms */, true, dispatcher_); // Poll for SIP/IAX events - timeout_->expired = new EventCallback(sflph_poll_events); + timeout_->expired = new EventCallback(ring_poll_events); DBus::Connection sessionConnection(DBus::Connection::SessionBus()); - sessionConnection.request_name("org.sflphone.SFLphone"); + sessionConnection.request_name("cx.ring.Ring"); callManager_ = new DBusCallManager(sessionConnection); configurationManager_ = new DBusConfigurationManager(sessionConnection); @@ -99,7 +99,7 @@ DBusClient::DBusClient(int sflphFlags, bool persistent) : instanceManager_ = new DBusInstance(sessionConnection, onNoMoreClientFunc); -#ifdef SFL_VIDEO +#ifdef RING_VIDEO videoManager_ = new DBusVideoManager(sessionConnection); #endif } catch (const DBus::Error &err) { @@ -109,7 +109,7 @@ DBusClient::DBusClient(int sflphFlags, bool persistent) : auto ret = initLibrary(sflphFlags); if (ret < 0) { - throw std::runtime_error("cannot initialize libsflphone"); + throw std::runtime_error("cannot initialize libring"); } instanceManager_->started(); @@ -117,7 +117,7 @@ DBusClient::DBusClient(int sflphFlags, bool persistent) : DBusClient::~DBusClient() { -#ifdef SFL_VIDEO +#ifdef RING_VIDEO delete videoManager_; #endif @@ -138,7 +138,7 @@ int DBusClient::initLibrary(int sflphFlags) auto callM = callManager_; // just an alias // Call event handlers - sflph_call_ev_handlers callEvHandlers = { + ring_call_ev_handlers callEvHandlers = { bind(&DBusCallManager::callStateChanged, callM, _1, _2), bind(&DBusCallManager::transferFailed, callM), bind(&DBusCallManager::transferSucceeded, callM), @@ -167,7 +167,7 @@ int DBusClient::initLibrary(int sflphFlags) auto confM = configurationManager_; // just an alias // Configuration event handlers - sflph_config_ev_handlers configEvHandlers = { + ring_config_ev_handlers configEvHandlers = { bind(&DBusConfigurationManager::volumeChanged, confM, _1, _2), bind(&DBusConfigurationManager::accountsChanged, confM), bind(&DBusConfigurationManager::historyChanged, confM), @@ -180,41 +180,41 @@ int DBusClient::initLibrary(int sflphFlags) auto presM = presenceManager_; // Presence event handlers - sflph_pres_ev_handlers presEvHandlers = { + ring_pres_ev_handlers presEvHandlers = { bind(&DBusPresenceManager::newServerSubscriptionRequest, presM, _1), bind(&DBusPresenceManager::serverError, presM, _1, _2, _3), bind(&DBusPresenceManager::newBuddyNotification, presM, _1, _2, _3, _4), bind(&DBusPresenceManager::subscriptionStateChanged, presM, _1, _2, _3) }; -#ifdef SFL_VIDEO +#ifdef RING_VIDEO auto videoM = videoManager_; // Video event handlers - sflph_video_ev_handlers videoEvHandlers = { + ring_video_ev_handlers videoEvHandlers = { bind(&DBusVideoManager::deviceEvent, videoM), bind(&DBusVideoManager::startedDecoding, videoM, _1, _2, _3, _4, _5), bind(&DBusVideoManager::stoppedDecoding, videoM, _1, _2, _3) }; -#endif // SFL_VIDEO +#endif // RING_VIDEO // All event handlers - sflph_ev_handlers evHandlers = { + ring_ev_handlers evHandlers = { .call_ev_handlers = callEvHandlers, .config_ev_handlers = configEvHandlers, .pres_ev_handlers = presEvHandlers, -#ifdef SFL_VIDEO +#ifdef RING_VIDEO .video_ev_handlers = videoEvHandlers -#endif // SFL_VIDEO +#endif // RING_VIDEO }; // Initialize now - return sflph_init(&evHandlers, static_cast<sflph_init_flag>(sflphFlags)); + return ring_init(&evHandlers, static_cast<ring_init_flag>(sflphFlags)); } void DBusClient::finiLibrary() { - sflph_fini(); + ring_fini(); } int DBusClient::event_loop() diff --git a/daemon/bin/dbus/dbusclient.h b/daemon/bin/dbus/dbusclient.h index db6e7fe952671acf28af5483950029a72d4152d8..85077020a6a85dbf53625c0ffae4a7d6fb136531 100644 --- a/daemon/bin/dbus/dbusclient.h +++ b/daemon/bin/dbus/dbusclient.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -31,7 +31,7 @@ #ifndef __DBUSCLIENT_H__ #define __DBUSCLIENT_H__ -#include "sflphone.h" +#include "ring.h" #include "noncopyable.h" class DBusConfigurationManager; @@ -40,7 +40,7 @@ class DBusNetworkManager; class DBusInstance; class DBusPresenceManager; -#ifdef SFL_VIDEO +#ifdef RING_VIDEO class DBusVideoManager; #endif @@ -70,7 +70,7 @@ class DBusClient { DBusInstance* instanceManager_; DBus::BusDispatcher* dispatcher_; -#ifdef SFL_VIDEO +#ifdef RING_VIDEO DBusVideoManager *videoManager_; #endif DBus::DefaultTimeout *timeout_; diff --git a/daemon/bin/dbus/dbusconfigurationmanager.cpp b/daemon/bin/dbus/dbusconfigurationmanager.cpp index 3e4fac6ddf9fe1181779c6c8fa3be21276311308..ab06d305fe1d59d264cfd4f366a514e9d1ca7283 100644 --- a/daemon/bin/dbus/dbusconfigurationmanager.cpp +++ b/daemon/bin/dbus/dbusconfigurationmanager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Philippe Proulx <philippe.proulx@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -28,356 +28,356 @@ * as that of the covered work. */ #include <iostream> -#include "sflphone.h" +#include "ring.h" #include "dbusconfigurationmanager.h" DBusConfigurationManager::DBusConfigurationManager(DBus::Connection& connection) - : DBus::ObjectAdaptor(connection, "/org/sflphone/SFLphone/ConfigurationManager") + : DBus::ObjectAdaptor(connection, "/cx/ring/Ring/ConfigurationManager") { } std::map<std::string, std::string> DBusConfigurationManager::getAccountDetails(const std::string& accountID) { - return sflph_config_get_account_details(accountID); + return ring_config_get_account_details(accountID); } std::map<std::string, std::string> DBusConfigurationManager::getVolatileAccountDetails(const std::string& accountID) { - return sflph_config_get_volatile_account_details(accountID); + return ring_config_get_volatile_account_details(accountID); } void DBusConfigurationManager::setAccountDetails(const std::string& accountID, const std::map< std::string, std::string >& details) { - sflph_config_set_account_details(accountID, details); + ring_config_set_account_details(accountID, details); } std::map<std::string, std::string> DBusConfigurationManager::getAccountTemplate() { - return sflph_config_get_account_template(); + return ring_config_get_account_template(); } std::string DBusConfigurationManager::addAccount(const std::map< std::string, std::string >& details) { - return sflph_config_add_account(details); + return ring_config_add_account(details); } void DBusConfigurationManager::removeAccount(const std::string& accountID) { - sflph_config_remove_account(accountID); + ring_config_remove_account(accountID); } std::vector< std::string > DBusConfigurationManager::getAccountList() { - return sflph_config_get_account_list(); + return ring_config_get_account_list(); } void DBusConfigurationManager::sendRegister(const std::string& accountID, const bool& enable) { - sflph_config_send_register(accountID, enable); + ring_config_send_register(accountID, enable); } void DBusConfigurationManager::registerAllAccounts(void) { - sflph_config_register_all_accounts(); + ring_config_register_all_accounts(); } std::map< std::string, std::string > DBusConfigurationManager::getTlsSettingsDefault() { - return sflph_config_get_tls_default_settings(); + return ring_config_get_tls_default_settings(); } std::vector< int32_t > DBusConfigurationManager::getAudioCodecList() { - return sflph_config_get_audio_codec_list(); + return ring_config_get_audio_codec_list(); } std::vector< std::string > DBusConfigurationManager::getSupportedTlsMethod() { - return sflph_config_get_supported_tls_method(); + return ring_config_get_supported_tls_method(); } std::vector< std::string > DBusConfigurationManager::getAudioCodecDetails(const int32_t& payload) { - return sflph_config_get_audio_codec_details(payload); + return ring_config_get_audio_codec_details(payload); } std::vector< int32_t > DBusConfigurationManager::getActiveAudioCodecList(const std::string& accountID) { - return sflph_config_get_active_audio_codec_list(accountID); + return ring_config_get_active_audio_codec_list(accountID); } void DBusConfigurationManager::setActiveAudioCodecList(const std::vector< std::string >& list, const std::string& accountID) { - sflph_config_set_active_audio_codec_list(list, accountID); + ring_config_set_active_audio_codec_list(list, accountID); } std::vector< std::string > DBusConfigurationManager::getAudioPluginList() { - return sflph_config_get_audio_plugin_list(); + return ring_config_get_audio_plugin_list(); } void DBusConfigurationManager::setAudioPlugin(const std::string& audioPlugin) { - sflph_config_set_audio_plugin(audioPlugin); + ring_config_set_audio_plugin(audioPlugin); } std::vector< std::string > DBusConfigurationManager::getAudioOutputDeviceList() { - return sflph_config_get_audio_output_device_list(); + return ring_config_get_audio_output_device_list(); } void DBusConfigurationManager::setAudioOutputDevice(const int32_t& index) { - sflph_config_set_audio_output_device(index); + ring_config_set_audio_output_device(index); } void DBusConfigurationManager::setAudioInputDevice(const int32_t& index) { - sflph_config_set_audio_input_device(index); + ring_config_set_audio_input_device(index); } void DBusConfigurationManager::setAudioRingtoneDevice(const int32_t& index) { - sflph_config_set_audio_ringtone_device(index); + ring_config_set_audio_ringtone_device(index); } std::vector< std::string > DBusConfigurationManager::getAudioInputDeviceList() { - return sflph_config_get_audio_input_device_list(); + return ring_config_get_audio_input_device_list(); } std::vector< std::string > DBusConfigurationManager::getCurrentAudioDevicesIndex() { - return sflph_config_get_current_audio_devices_index(); + return ring_config_get_current_audio_devices_index(); } int32_t DBusConfigurationManager::getAudioInputDeviceIndex(const std::string& name) { - return sflph_config_get_audio_input_device_index(name); + return ring_config_get_audio_input_device_index(name); } int32_t DBusConfigurationManager::getAudioOutputDeviceIndex(const std::string& name) { - return sflph_config_get_audio_output_device_index(name); + return ring_config_get_audio_output_device_index(name); } std::string DBusConfigurationManager::getCurrentAudioOutputPlugin() { - return sflph_config_get_current_audio_output_plugin(); + return ring_config_get_current_audio_output_plugin(); } bool DBusConfigurationManager::getNoiseSuppressState() { - return sflph_config_get_noise_suppress_state(); + return ring_config_get_noise_suppress_state(); } void DBusConfigurationManager::setNoiseSuppressState(const bool& state) { - sflph_config_set_noise_suppress_state(state); + ring_config_set_noise_suppress_state(state); } bool DBusConfigurationManager::isAgcEnabled() { - return sflph_config_is_agc_enabled(); + return ring_config_is_agc_enabled(); } void DBusConfigurationManager::setAgcState(const bool& enabled) { - sflph_config_enable_agc(enabled); + ring_config_enable_agc(enabled); } void DBusConfigurationManager::muteDtmf(const bool& mute) { - sflph_config_mute_dtmf(mute); + ring_config_mute_dtmf(mute); } bool DBusConfigurationManager::isDtmfMuted() { - return sflph_config_is_dtmf_muted(); + return ring_config_is_dtmf_muted(); } bool DBusConfigurationManager::isCaptureMuted() { - return sflph_config_is_capture_muted(); + return ring_config_is_capture_muted(); } void DBusConfigurationManager::muteCapture(const bool& mute) { - sflph_config_mute_capture(mute); + ring_config_mute_capture(mute); } bool DBusConfigurationManager::isPlaybackMuted() { - return sflph_config_is_playback_muted(); + return ring_config_is_playback_muted(); } void DBusConfigurationManager::mutePlayback(const bool& mute) { - sflph_config_mute_playback(mute); + ring_config_mute_playback(mute); } std::map<std::string, std::string> DBusConfigurationManager::getRingtoneList() { - return sflph_config_get_ringtone_list(); + return ring_config_get_ringtone_list(); } std::string DBusConfigurationManager::getAudioManager() { - return sflph_config_get_audio_manager(); + return ring_config_get_audio_manager(); } bool DBusConfigurationManager::setAudioManager(const std::string& api) { - return sflph_config_set_audio_manager(api); + return ring_config_set_audio_manager(api); } std::vector<std::string> DBusConfigurationManager::getSupportedAudioManagers() { - return sflph_config_get_supported_audio_managers(); + return ring_config_get_supported_audio_managers(); } int32_t DBusConfigurationManager::isIax2Enabled() { - return sflph_config_is_iax2_enabled(); + return ring_config_is_iax2_enabled(); } std::string DBusConfigurationManager::getRecordPath() { - return sflph_config_get_record_path(); + return ring_config_get_record_path(); } void DBusConfigurationManager::setRecordPath(const std::string& recPath) { - sflph_config_set_record_path(recPath); + ring_config_set_record_path(recPath); } bool DBusConfigurationManager::getIsAlwaysRecording() { - return sflph_config_is_always_recording(); + return ring_config_is_always_recording(); } void DBusConfigurationManager::setIsAlwaysRecording(const bool& rec) { - sflph_config_set_always_recording(rec); + ring_config_set_always_recording(rec); } void DBusConfigurationManager::setHistoryLimit(const int32_t& days) { - sflph_config_set_history_limit(days); + ring_config_set_history_limit(days); } int32_t DBusConfigurationManager::getHistoryLimit() { - return sflph_config_get_history_limit(); + return ring_config_get_history_limit(); } void DBusConfigurationManager::clearHistory() { - sflph_config_clear_history(); + ring_config_clear_history(); } void DBusConfigurationManager::setAccountsOrder(const std::string& order) { - sflph_config_set_accounts_order(order); + ring_config_set_accounts_order(order); } std::map<std::string, std::string> DBusConfigurationManager::getHookSettings() { - return sflph_config_get_hook_settings(); + return ring_config_get_hook_settings(); } void DBusConfigurationManager::setHookSettings(const std::map<std::string, std::string>& settings) { - sflph_config_set_hook_settings(settings); + ring_config_set_hook_settings(settings); } std::vector<std::map<std::string, std::string> > DBusConfigurationManager::getHistory() { - return sflph_config_get_history(); + return ring_config_get_history(); } std::map<std::string, std::string> DBusConfigurationManager::getTlsSettings() { - return sflph_config_get_tls_settings(); + return ring_config_get_tls_settings(); } std::map<std::string, std::string> DBusConfigurationManager::validateCertificate(const std::string& accountId, const std::string& certificate, const std::string& privateKey) { - return sflph_config_validate_certificate(accountId, certificate, privateKey); + return ring_config_validate_certificate(accountId, certificate, privateKey); } std::map<std::string, std::string> DBusConfigurationManager::getCertificateDetails(const std::string& certificate) { - return sflph_config_get_certificate_details(certificate); + return ring_config_get_certificate_details(certificate); } void DBusConfigurationManager::setTlsSettings(const std::map< std::string, std::string >& details) { - sflph_config_set_tls_settings(details); + ring_config_set_tls_settings(details); } std::map< std::string, std::string > DBusConfigurationManager::getIp2IpDetails() { - return sflph_config_get_ip2ip_details(); + return ring_config_get_ip2ip_details(); } std::vector< std::map< std::string, std::string > > DBusConfigurationManager::getCredentials(const std::string& accountID) { - return sflph_config_get_credentials(accountID); + return ring_config_get_credentials(accountID); } void DBusConfigurationManager::setCredentials(const std::string& accountID, const std::vector< std::map< std::string, std::string > >& details) { - sflph_config_set_credentials(accountID, details); + ring_config_set_credentials(accountID, details); } std::string DBusConfigurationManager::getAddrFromInterfaceName(const std::string& interface) { - return sflph_config_get_addr_from_interface_name(interface); + return ring_config_get_addr_from_interface_name(interface); } std::vector<std::string> DBusConfigurationManager::getAllIpInterface() { - return sflph_config_get_all_ip_interface(); + return ring_config_get_all_ip_interface(); } std::vector<std::string> DBusConfigurationManager::getAllIpInterfaceByName() { - return sflph_config_get_all_ip_interface_by_name(); + return ring_config_get_all_ip_interface_by_name(); } std::map<std::string, std::string> DBusConfigurationManager::getShortcuts() { - return sflph_config_get_shortcuts(); + return ring_config_get_shortcuts(); } void DBusConfigurationManager::setShortcuts(const std::map<std::string, std::string> &shortcutsMap) { - sflph_config_set_shortcuts(shortcutsMap); + ring_config_set_shortcuts(shortcutsMap); } void DBusConfigurationManager::setVolume(const std::string& device, const double& value) { - sflph_config_set_volume(device, value); + ring_config_set_volume(device, value); } double DBusConfigurationManager::getVolume(const std::string& device) { - return sflph_config_get_volume(device); + return ring_config_get_volume(device); } bool DBusConfigurationManager::checkForPrivateKey(const std::string& pemPath) { - return sflph_config_check_for_private_key(pemPath); + return ring_config_check_for_private_key(pemPath); } bool DBusConfigurationManager::checkCertificateValidity(const std::string& caPath, const std::string& pemPath) { - return sflph_config_check_certificate_validity(caPath, pemPath); + return ring_config_check_certificate_validity(caPath, pemPath); } bool DBusConfigurationManager::checkHostnameCertificate(const std::string& host, const std::string& port) { - return sflph_config_check_hostname_certificate(host, port); + return ring_config_check_hostname_certificate(host, port); } diff --git a/daemon/bin/dbus/dbusconfigurationmanager.h b/daemon/bin/dbus/dbusconfigurationmanager.h index eec0ef8db83988fe58745b8afa2add52bf850995..e522973c1460b7c8034d7122fb410d32a2d657d9 100644 --- a/daemon/bin/dbus/dbusconfigurationmanager.h +++ b/daemon/bin/dbus/dbusconfigurationmanager.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com> * Author: Alexandre Bourget <alexandre.bourget@savoirfairelinux.com> * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> @@ -31,8 +31,8 @@ * as that of the covered work. */ -#ifndef __SFL_DBUSCONFIGURATIONMANAGER_H__ -#define __SFL_DBUSCONFIGURATIONMANAGER_H__ +#ifndef __RING_DBUSCONFIGURATIONMANAGER_H__ +#define __RING_DBUSCONFIGURATIONMANAGER_H__ #include <vector> #include <map> @@ -59,7 +59,7 @@ #include <stdexcept> class DBusConfigurationManager : - public org::sflphone::SFLphone::ConfigurationManager_adaptor, + public cx::ring::Ring::ConfigurationManager_adaptor, public DBus::IntrospectableAdaptor, public DBus::ObjectAdaptor { @@ -140,4 +140,4 @@ class DBusConfigurationManager : }; -#endif // __SFL_DBUSCONFIGURATIONMANAGER_H__ +#endif // __RING_DBUSCONFIGURATIONMANAGER_H__ diff --git a/daemon/bin/dbus/dbusinstance.cpp b/daemon/bin/dbus/dbusinstance.cpp index 5eae260e6c6a73b2df4a6b4ee76ef367278a23b9..87f81b0cdf87bb2af704927985774f5f2580979b 100644 --- a/daemon/bin/dbus/dbusinstance.cpp +++ b/daemon/bin/dbus/dbusinstance.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -32,7 +32,7 @@ DBusInstance::DBusInstance(DBus::Connection& connection, const OnNoMoreClientFunc& onNoMoreClientFunc) : - DBus::ObjectAdaptor(connection, "/org/sflphone/SFLphone/Instance"), + DBus::ObjectAdaptor(connection, "/cx/ring/Ring/Instance"), onNoMoreClientFunc_(onNoMoreClientFunc), count_(0) {} diff --git a/daemon/bin/dbus/dbusinstance.h b/daemon/bin/dbus/dbusinstance.h index 1d5716c0cb5edffe94b25613d930e57f2fafed93..2ad3e14c76375708e7776d2181ebe7366ed9c65b 100644 --- a/daemon/bin/dbus/dbusinstance.h +++ b/daemon/bin/dbus/dbusinstance.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -28,8 +28,8 @@ * as that of the covered work. */ -#ifndef __SFL_DBUSINSTANCE_H__ -#define __SFL_DBUSINSTANCE_H__ +#ifndef __RING_DBUSINSTANCE_H__ +#define __RING_DBUSINSTANCE_H__ #include <functional> @@ -48,7 +48,7 @@ #endif class DBusInstance : - public org::sflphone::SFLphone::Instance_adaptor, + public cx::ring::Ring::Instance_adaptor, public DBus::IntrospectableAdaptor, public DBus::ObjectAdaptor { @@ -67,4 +67,4 @@ class DBusInstance : int count_; }; -#endif // __SFL_DBUSINSTANCE_H__ +#endif // __RING_DBUSINSTANCE_H__ diff --git a/daemon/bin/dbus/dbuspresencemanager.cpp b/daemon/bin/dbus/dbuspresencemanager.cpp index 0010acf74758ffc1bc0af2db42de9ee26186280d..3ad66fdf463f567acccbdc57b1c821ed4fdee7ac 100644 --- a/daemon/bin/dbus/dbuspresencemanager.cpp +++ b/daemon/bin/dbus/dbuspresencemanager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Philippe Proulx <philippe.proulx@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -27,36 +27,36 @@ * shall include the source code for the parts of OpenSSL used as well * as that of the covered work. */ -#include "sflphone.h" +#include "ring.h" #include "dbuspresencemanager.h" DBusPresenceManager::DBusPresenceManager(DBus::Connection& connection) - : DBus::ObjectAdaptor(connection, "/org/sflphone/SFLphone/PresenceManager") + : DBus::ObjectAdaptor(connection, "/cx/ring/Ring/PresenceManager") { } void DBusPresenceManager::publish(const std::string& accountID, const bool& status, const std::string& note) { - sflph_pres_publish(accountID, status, note); + ring_pres_publish(accountID, status, note); } void DBusPresenceManager::answerServerRequest(const std::string& uri, const bool& flag) { - sflph_pres_answer_server_request(uri, flag); + ring_pres_answer_server_request(uri, flag); } void DBusPresenceManager::subscribeBuddy(const std::string& accountID, const std::string& uri, const bool& flag) { - sflph_pres_subscribe_buddy(accountID, uri, flag); + ring_pres_subscribe_buddy(accountID, uri, flag); } std::vector<std::map<std::string, std::string> > DBusPresenceManager::getSubscriptions(const std::string& accountID) { - return sflph_pres_get_subscriptions(accountID); + return ring_pres_get_subscriptions(accountID); } void DBusPresenceManager::setSubscriptions(const std::string& accountID, const std::vector<std::string>& uris) { - sflph_pres_set_subscriptions(accountID, uris); + ring_pres_set_subscriptions(accountID, uris); } diff --git a/daemon/bin/dbus/dbuspresencemanager.h b/daemon/bin/dbus/dbuspresencemanager.h index 2c2cfa3f82637bf6aa7ab914643263c4773487e4..fce1283f48fee6fa88cc301f7728363f914637d8 100644 --- a/daemon/bin/dbus/dbuspresencemanager.h +++ b/daemon/bin/dbus/dbuspresencemanager.h @@ -28,8 +28,8 @@ * as that of the covered work. */ -#ifndef __SFL_DBUSPRESENCEMANAGER_H__ -#define __SFL_DBUSPRESENCEMANAGER_H__ +#ifndef __RING_DBUSPRESENCEMANAGER_H__ +#define __RING_DBUSPRESENCEMANAGER_H__ #include <vector> #include <map> @@ -56,7 +56,7 @@ #include <stdexcept> class DBusPresenceManager : - public org::sflphone::SFLphone::PresenceManager_adaptor, + public cx::ring::Ring::PresenceManager_adaptor, public DBus::IntrospectableAdaptor, public DBus::ObjectAdaptor { @@ -71,4 +71,4 @@ class DBusPresenceManager : void setSubscriptions(const std::string& accountID, const std::vector<std::string>& uris); }; -#endif // __SFL_DBUSPRESENCEMANAGER_H__ +#endif // __RING_DBUSPRESENCEMANAGER_H__ diff --git a/daemon/bin/dbus/dbusvideomanager.cpp b/daemon/bin/dbus/dbusvideomanager.cpp index 583e68c6e2774993bd738de6aae9278f928e7c4c..24b1d2400447ec48f250d7b9ba6e970a07916e27 100644 --- a/daemon/bin/dbus/dbusvideomanager.cpp +++ b/daemon/bin/dbus/dbusvideomanager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Philippe Proulx <philippe.proulx@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -27,76 +27,76 @@ * shall include the source code for the parts of OpenSSL used as well * as that of the covered work. */ -#include "sflphone.h" +#include "ring.h" #include "dbusvideomanager.h" DBusVideoManager::DBusVideoManager(DBus::Connection& connection) - : DBus::ObjectAdaptor(connection, "/org/sflphone/SFLphone/VideoManager") + : DBus::ObjectAdaptor(connection, "/cx/ring/Ring/VideoManager") { } std::vector<std::map<std::string, std::string>> DBusVideoManager::getCodecs(const std::string& accountID) { - return sflph_video_get_codecs(accountID); + return ring_video_get_codecs(accountID); } void DBusVideoManager::setCodecs(const std::string& accountID, const std::vector<std::map<std::string, std::string> > &details) { - sflph_video_set_codecs(accountID, details); + ring_video_set_codecs(accountID, details); } std::vector<std::string> DBusVideoManager::getDeviceList() { - return sflph_video_get_device_list(); + return ring_video_get_device_list(); } std::map<std::string, std::map<std::string, std::vector<std::string>>> DBusVideoManager::getCapabilities(const std::string& name) { - return sflph_video_get_capabilities(name); + return ring_video_get_capabilities(name); } std::map<std::string, std::string> DBusVideoManager::getSettings(const std::string& name) { - return sflph_video_get_settings(name); + return ring_video_get_settings(name); } void DBusVideoManager::applySettings(const std::string& name, const std::map<std::string, std::string>& settings) { - sflph_video_apply_settings(name, settings); + ring_video_apply_settings(name, settings); } void DBusVideoManager::setDefaultDevice(const std::string &dev) { - sflph_video_set_default_device(dev); + ring_video_set_default_device(dev); } std::string DBusVideoManager::getDefaultDevice() { - return sflph_video_get_default_device(); + return ring_video_get_default_device(); } std::string DBusVideoManager::getCurrentCodecName(const std::string &callID) { - return sflph_video_get_current_codec_name(callID); + return ring_video_get_current_codec_name(callID); } void DBusVideoManager::startCamera() { - sflph_video_start_camera(); + ring_video_start_camera(); } void DBusVideoManager::stopCamera() { - sflph_video_stop_camera(); + ring_video_stop_camera(); } bool DBusVideoManager::switchInput(const std::string& resource) { - return sflph_video_switch_input(resource); + return ring_video_switch_input(resource); } bool DBusVideoManager::hasCameraStarted() { - return sflph_video_is_camera_started(); + return ring_video_is_camera_started(); } diff --git a/daemon/bin/dbus/dbusvideomanager.h b/daemon/bin/dbus/dbusvideomanager.h index df69a5169744fb0d37272dd824ca6b2d8e607507..2d499c350b2e656468623b726ff1e9c1ef93633b 100644 --- a/daemon/bin/dbus/dbusvideomanager.h +++ b/daemon/bin/dbus/dbusvideomanager.h @@ -27,8 +27,8 @@ * as that of the covered work. */ -#ifndef __SFL_DBUSVIDEOMANAGER_H__ -#define __SFL_DBUSVIDEOMANAGER_H__ +#ifndef __RING_DBUSVIDEOMANAGER_H__ +#define __RING_DBUSVIDEOMANAGER_H__ #include <vector> #include <map> @@ -55,7 +55,7 @@ #include <stdexcept> class DBusVideoManager : - public org::sflphone::SFLphone::VideoManager_adaptor, + public cx::ring::Ring::VideoManager_adaptor, public DBus::IntrospectableAdaptor, public DBus::ObjectAdaptor { @@ -78,4 +78,4 @@ class DBusVideoManager : bool hasCameraStarted(); }; -#endif // __SFL_DBUSVIDEOMANAGER_H__ +#endif // __RING_DBUSVIDEOMANAGER_H__ diff --git a/daemon/bin/dbus/instance-introspec.xml b/daemon/bin/dbus/instance-introspec.xml index f3d1373a6409b7875a4d80db5bf0f815f285d637..d8a620bc218c9122ed38a22450286a31273df92b 100644 --- a/daemon/bin/dbus/instance-introspec.xml +++ b/daemon/bin/dbus/instance-introspec.xml @@ -1,6 +1,6 @@ <?xml version="1.0" ?> <node name="/instance-introspec" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"> - <interface name="org.sflphone.SFLphone.Instance"> + <interface name="cx.ring.Ring.Instance"> <tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>Count the number of clients actually registered to the core. When initializing your client, you need to register it against the core by using this interface.</p> </tp:docstring> diff --git a/daemon/bin/dbus/org.sflphone.SFLphone.service.in b/daemon/bin/dbus/org.sflphone.SFLphone.service.in deleted file mode 100644 index f0d9f4c21d18d4d1374b6f19d35205b93c90f401..0000000000000000000000000000000000000000 --- a/daemon/bin/dbus/org.sflphone.SFLphone.service.in +++ /dev/null @@ -1,3 +0,0 @@ -[D-BUS Service] -Name=org.sflphone.SFLphone -Exec=@LIBEXECDIR@/sflphoned diff --git a/daemon/bin/dbus/presencemanager-introspec.xml b/daemon/bin/dbus/presencemanager-introspec.xml index 77b1527a43bd910c947cc7ff7dd99a2265e6f20c..7aad39b0eee257dd9faaed1de01886726a7a8347 100644 --- a/daemon/bin/dbus/presencemanager-introspec.xml +++ b/daemon/bin/dbus/presencemanager-introspec.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" ?> <node name="/presencemanager-introspec" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"> - <interface name="org.sflphone.SFLphone.PresenceManager"> + <interface name="cx.ring.Ring.PresenceManager"> <!-- METHODS !--> <method name="publish" tp:name-for-bindings="publish"> <tp:added version="1.3.0"/> diff --git a/daemon/bin/dbus/videomanager-introspec.xml b/daemon/bin/dbus/videomanager-introspec.xml index b7773f8379cff93f0e687fb2fede89979c021aed..de9761b9fb7bcb5f8654076db775bc8a5400218a 100644 --- a/daemon/bin/dbus/videomanager-introspec.xml +++ b/daemon/bin/dbus/videomanager-introspec.xml @@ -1,6 +1,6 @@ <?xml version="1.0" ?> <node name="/videomanager-introspec" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"> - <interface name="org.sflphone.SFLphone.VideoManager"> + <interface name="cx.ring.Ring.VideoManager"> <!-- Video device methods --> <method name="getDeviceList" tp:name-for-bindings="getDeviceList"> diff --git a/daemon/bin/main.cpp b/daemon/bin/main.cpp index ce513b160602dca6a2f526e2fe55cc22ae553fcf..20831ad78b9f2f72abad64f2e8fcb2db76b5bb16 100644 --- a/daemon/bin/main.cpp +++ b/daemon/bin/main.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Alexandre Bourget <alexandre.bourget@savoirfairelinux.com> * Author: Yan Morin <yan.morin@savoirfairelinux.com> * Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com> @@ -38,13 +38,13 @@ #include "dbus/dbusclient.h" #include "fileutils.h" -static int sflphFlags = 0; +static int ringFlags = 0; static std::unique_ptr<DBusClient> dbusClient; static void print_title() { - std::cout << "SFLphone Daemon " << sflph_version() << - ", by Savoir-Faire Linux 2004-2014" << std::endl << + std::cout << "Ring Daemon " << ring_version() << + ", by Savoir-Faire Linux 2004-2015" << std::endl << "http://www.sflphone.org/" << std::endl; } @@ -121,10 +121,10 @@ static bool parse_args(int argc, char *argv[], bool &persistent) quit = true; } else { if (consoleFlag) { - sflphFlags |= SFLPH_FLAG_CONSOLE_LOG; + ringFlags |= RING_FLAG_CONSOLE_LOG; } if (debugFlag) { - sflphFlags |= SFLPH_FLAG_DEBUG; + ringFlags |= RING_FLAG_DEBUG; } } return quit; @@ -185,7 +185,7 @@ int main(int argc, char *argv []) // initialize client/library try { - dbusClient = std::unique_ptr<DBusClient>(new DBusClient(sflphFlags, persistent)); + dbusClient = std::unique_ptr<DBusClient>(new DBusClient(ringFlags, persistent)); } catch (const std::exception& ex) { std::cerr << "One does not simply initialize the DBus client: " << ex.what() << std::endl; return 1; @@ -197,7 +197,7 @@ int main(int argc, char *argv []) signal(SIGHUP, signal_handler); signal(SIGTERM, signal_handler); -#ifdef SFL_VIDEO +#ifdef RING_VIDEO std::cerr << "Warning: built with video support" << std::endl; #endif diff --git a/daemon/bin/osxmain.cpp b/daemon/bin/osxmain.cpp index 9f52f0ce44262b363dd1dafc9e1b09dad16d5e2d..e19d5aea9f4a33ae644c3edd2d25ef3a3b1c0e58 100644 --- a/daemon/bin/osxmain.cpp +++ b/daemon/bin/osxmain.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Alexandre Bourget <alexandre.bourget@savoirfairelinux.com> * Author: Yan Morin <yan.morin@savoirfairelinux.com> * Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com> @@ -36,15 +36,15 @@ #include <getopt.h> #include <string> -#include "sflphone.h" +#include "ring.h" #include "fileutils.h" static int sflphFlags = 0; static void print_title() { - std::cout << "SFLphone Daemon " << sflph_version() << - ", by Savoir-Faire Linux 2004-2014" << std::endl << + std::cout << "Ring Daemon " << ring_version() << + ", by Savoir-Faire Linux 2004-2015" << std::endl << "http://www.sflphone.org/" << std::endl; } @@ -121,10 +121,10 @@ static bool parse_args(int argc, char *argv[], bool &persistent) quit = true; } else { if (consoleFlag) { - sflphFlags |= SFLPH_FLAG_CONSOLE_LOG; + sflphFlags |= RING_FLAG_CONSOLE_LOG; } if (debugFlag) { - sflphFlags |= SFLPH_FLAG_DEBUG; + sflphFlags |= RING_FLAG_DEBUG; } } return quit; @@ -137,40 +137,40 @@ void myOnIncomingCall(const std::string& acc_id, const std::string& call_id, con ", Id: " << call_id << ", From: " << from << std::endl << std::endl; - sflph_call_accept(call_id); - sflph_call_set_recording(call_id); - //sflph_call_join_participant(call_id, "patate"); + ring_call_accept(call_id); + ring_call_set_recording(call_id); + //ring_call_join_participant(call_id, "patate"); } static int osxTests() { - sflph_ev_handlers evHandlers = { + ring_ev_handlers evHandlers = { .call_ev_handlers = { .on_incoming_call = myOnIncomingCall }, .config_ev_handlers = {}, .pres_ev_handlers = {} -#ifdef SFL_VIDEO +#ifdef RING_VIDEO .video_ev_handlers = {} #endif }; - sflph_init(&evHandlers, static_cast<sflph_init_flag>(sflphFlags)); + ring_init(&evHandlers, static_cast<ring_init_flag>(sflphFlags)); - //sflph_call_play_dtmf("0"); + //ring_call_play_dtmf("0"); //sleep(1); - //sflph_call_play_dtmf("1"); + //ring_call_play_dtmf("1"); //sleep(1); - //sflph_call_place("IP2IP", "patate", "127.0.0.1"); - //sflph_call_set_recording("patate"); + //ring_call_place("IP2IP", "patate", "127.0.0.1"); + //ring_call_set_recording("patate"); while (true) { - sflph_poll_events(); + ring_poll_events(); sleep(1); } - sflph_fini(); + ring_fini(); } static int run() @@ -226,7 +226,7 @@ int main(int argc, char *argv []) signal(SIGHUP, signal_handler); signal(SIGTERM, signal_handler); -#ifdef SFL_VIDEO +#ifdef RING_VIDEO std::cerr << "Warning: built with video support" << std::endl; #endif diff --git a/daemon/configure.ac b/daemon/configure.ac index 32fabeb5687fffad129a328b1de534a241a13643..55fd1351d3bf155e651913a0dd964af8dfee02c2 100644 --- a/daemon/configure.ac +++ b/daemon/configure.ac @@ -2,13 +2,13 @@ dnl SFLPhone - configure.ac for automake 1.9 and autoconf 2.59 dnl Process this file with autoconf to produce a configure script. AC_PREREQ([2.65]) -AC_INIT([sflphone],[1.4.2],[sflphoneteam@savoirfairelinux.com],[sflphone]) +AC_INIT([ring],[2.0.0],[sflphoneteam@savoirfairelinux.com],[ring]) AC_COPYRIGHT([[Copyright (c) Savoir-Faire Linux 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014]]) AC_REVISION([$Revision$]) dnl Where to find configure files -AC_CONFIG_SRCDIR(src/sflphone_api.cpp) +AC_CONFIG_SRCDIR(src/ring_api.cpp) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_MACRO_DIR([m4]) AC_CANONICAL_BUILD @@ -328,7 +328,7 @@ AS_IF([test "x$with_dbus" = "xyes"], [ AC_SUBST(LIBEXECDIR) AC_CONFIG_FILES([bin/dbus/Makefile - bin/dbus/org.sflphone.SFLphone.service]) + bin/dbus/cx.ring.Ring.service]) AC_CHECK_PROG(HAVE_DBUSXML2CPP, dbusxx-xml2cpp, true, false) if test "x$HAVE_DBUSXML2CPP" = "xfalse"; then @@ -339,8 +339,8 @@ AS_IF([test "x$with_dbus" = "xyes"], [ AC_MSG_ERROR([dbus does not compile when clang is used, rerun with --without-dbus]) ]); - AM_CONDITIONAL(SFL_DBUS, true)], - AM_CONDITIONAL(SFL_DBUS, false)); + AM_CONDITIONAL(RING_DBUS, true)], + AM_CONDITIONAL(RING_DBUS, false)); dnl Video is default-enabled @@ -348,8 +348,8 @@ AC_ARG_ENABLE([video], AS_HELP_STRING([--disable-video], [Disable video])) AS_IF([test "x$enable_video" != "xno"], [ - AC_DEFINE(SFL_VIDEO, [], [Video support enabled]) - AM_CONDITIONAL(SFL_VIDEO, true) + AC_DEFINE(RING_VIDEO, [], [Video support enabled]) + AM_CONDITIONAL(RING_VIDEO, true) PKG_CHECK_MODULES(LIBAVCODEC, libavcodec >= 53.5.0,, AC_MSG_ERROR([Missing libavcodec development files])) LIBAVCODEC_CFLAGS="${LIBAVCODEC_CFLAGS} -D__STDC_CONSTANT_MACROS" @@ -365,7 +365,7 @@ AS_IF([test "x$enable_video" != "xno"], PKG_CHECK_MODULES(UDEV, libudev,, AC_MSG_ERROR([Missing libudev development files])) ], [ - AM_CONDITIONAL(SFL_VIDEO, false) + AM_CONDITIONAL(RING_VIDEO, false) AC_DEFINE_UNQUOTED([USE_CCRTP], 1, [Use ccrtp instead of libavformat]) ]); diff --git a/daemon/doc/dbus-api/Makefile.am b/daemon/doc/dbus-api/Makefile.am index ac890f0a5e04dfe5e43b1947bde08b72a042b416..b7064e5dd9b84c94326da5dddaba2e2455ca2776 100644 --- a/daemon/doc/dbus-api/Makefile.am +++ b/daemon/doc/dbus-api/Makefile.am @@ -17,7 +17,7 @@ doc/spec.html: $(XMLS) tools/doc-generator.xsl doc/spec/index.html: $(XMLS) tools/doc-generator.py tools/specparser.py $(TEMPLATES) @install -d tmp/doc - $(PYTHON) tools/doc-generator.py spec/all.xml doc/spec sflphone-spec org.sflphone.SFLphone + $(PYTHON) tools/doc-generator.py spec/all.xml doc/spec sflphone-spec cx.ring.Ring doc: $(GENERATED_FILES) diff --git a/daemon/globals.mak b/daemon/globals.mak index 8e2764ec54c0ab140394aa86e50bf0633f12013c..9e23e0df5b75c65075652988d33bec574d3e106c 100644 --- a/daemon/globals.mak +++ b/daemon/globals.mak @@ -1,7 +1,7 @@ # Global variables src=$(abs_top_srcdir) -sfllibdir=$(DESTDIR)$(libdir)/sflphone +sfllibdir=$(DESTDIR)$(libdir)/ring sflcodecdir=$(sfllibdir)/codecs sflplugindir=$(sfllibdir)/plugins @@ -27,7 +27,7 @@ AM_CPPFLAGS = \ -I$(src)/test \ $(SIP_CFLAGS) \ -DPREFIX=\"$(prefix)\" \ - -DPROGSHAREDIR=\"${datadir}/sflphone\" \ + -DPROGSHAREDIR=\"${datadir}/ring\" \ -DCODECS_DIR=\""$(sflcodecdir)"\" \ -DPLUGINS_DIR=\""$(sflplugindir)"\" \ -DENABLE_TRACE \ diff --git a/daemon/man/Makefile.am b/daemon/man/Makefile.am index 155e4427c1f7efb8c38706069982f10f7f8aefcf..1670fae98c50deac98421f01f7f349af7be71a8f 100644 --- a/daemon/man/Makefile.am +++ b/daemon/man/Makefile.am @@ -1,8 +1,8 @@ SECTION="1" -TEMPLATES=sflphoned.pod +TEMPLATES=dring.pod -man_MANS=sflphoned.1 +man_MANS=dring.1 POD2MAN=pod2man diff --git a/daemon/man/sflphoned.pod b/daemon/man/dring.pod similarity index 51% rename from daemon/man/sflphoned.pod rename to daemon/man/dring.pod index 8f59d4d2e6c976bbf4731711f7a4d88ee0628042..16669ea1c0c3efcbbe3dae09ecc1af8c312ff51d 100644 --- a/daemon/man/sflphoned.pod +++ b/daemon/man/dring.pod @@ -1,16 +1,16 @@ =head1 NAME -sflphoned - SIP and IAX2 compatible voice over IP softphone core. +dring - SIP and IAX2 compatible voice over IP softphone core. =head1 SYNOPSIS -B<sflphoned> [OPTION]... +B<dring> [OPTION]... =head1 DESCRIPTION -SFLphone is meant to be a robust enterprise-class desktop phone. It provides functions like call transfer, call hold, multiple lines, multiple accounts support. -SFLphone audio layer is build upon a native ALSA interface and and a native PulseAudio interface. -B<sflphoned> is the core of SFLphone; it communicates with the client side through DBus. You need to install a client to use the daemon, for instance GTK+ client, B<sflphone-client-gnome>. +Ring is meant to be a robust enterprise-class desktop phone. It provides functions like call transfer, call hold, multiple lines, multiple accounts support. +Ring audio layer is build upon a native ALSA interface and and a native PulseAudio interface. +B<dring> is the core of Ring; it communicates with the client side through DBus. You need to install a client to use the daemon, for instance GTK+ client, B<ring-client-gnome>. =head1 OPTIONS @@ -36,13 +36,13 @@ Please report bugs at https://projects.savoirfairelinux.com/projects/sflphone/is =head1 AUTHORS -B<sflphoned> is developed in Montreal by Savoir-Faire Linux Inc. The active developers are Tristan Matthews <tristan.matthews@savoirfairelinux.com> and Alexandre Savard <alexandre.savard@savoirfairelinux.com>. +B<dring> is developed in Montreal by Savoir-Faire Linux Inc. The active developers are Tristan Matthews <tristan.matthews@savoirfairelinux.com> and Alexandre Savard <alexandre.savard@savoirfairelinux.com>. This manual page was written by Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>. =head1 SEE ALSO -B<sflphone>(1), B<sflphone-client-gnome>(1) +B<ring>(1), B<ring-client-gnome>(1) =head1 COPYRIGHT @@ -54,4 +54,3 @@ On Debian GNU/Linux systems, the complete text of the GNU General Public License can be found in `/usr/share/common-licenses/GPL'. =cut - diff --git a/daemon/ringtones/Makefile.am b/daemon/ringtones/Makefile.am index 8c986445bb9bc653b5216cc56a791f46600de37e..42b7ccf3ba1b7da413cb52cf0e40bb6253ebcb84 100644 --- a/daemon/ringtones/Makefile.am +++ b/daemon/ringtones/Makefile.am @@ -1,5 +1,5 @@ -sflphoneringsdir = $(datadir)/sflphone/ringtones -dist_sflphonerings_DATA = \ +ringringtonesdir = $(datadir)/ring/ringtones +dist_ringringtones_DATA = \ konga.ul\ phone.au\ phone2.au diff --git a/daemon/src/Makefile.am b/daemon/src/Makefile.am index ff5a087321471c013b3fbff9da6835a6039f4308..37535306928462a9844d78220cc7ebbb592382ca 100644 --- a/daemon/src/Makefile.am +++ b/daemon/src/Makefile.am @@ -1,8 +1,8 @@ include ../globals.mak -if SFL_VIDEO -SFL_VIDEO_SUBDIR = video -SFL_VIDEO_LIBS=./video/libvideo.la \ +if RING_VIDEO +RING_VIDEO_SUBDIR = video +RING_VIDEO_LIBS=./video/libvideo.la \ ./video/v4l2/libv4l2.la endif @@ -35,13 +35,13 @@ TLS_LIB = @GNUTLS_LIBS@ TLS_CFLAGS = @GNUTLS_CFLAGS@ endif -SUBDIRS = client audio config hooks history sip $(IAX_SUBDIR) $(RINGACC_SUBDIR) $(INSTANT_MESSAGING_SUBDIR) $(SFL_VIDEO_SUBDIR) +SUBDIRS = client audio config hooks history sip $(IAX_SUBDIR) $(RINGACC_SUBDIR) $(INSTANT_MESSAGING_SUBDIR) $(RING_VIDEO_SUBDIR) -# libsflphone +# libring -lib_LTLIBRARIES = libsflphone.la +lib_LTLIBRARIES = libring.la -libsflphone_la_LIBADD = \ +libring_la_LIBADD = \ ./sip/libsiplink.la \ ./audio/libaudio.la \ ./client/libclient.la \ @@ -51,9 +51,9 @@ libsflphone_la_LIBADD = \ $(RINGACC_LIBA) \ $(IAX_LIBA) \ $(IM_LIBA) \ - $(SFL_VIDEO_LIBS) + $(RING_VIDEO_LIBS) -libsflphone_la_LDFLAGS = \ +libring_la_LDFLAGS = \ @ZRTPCPP_LIBS@ \ @PJPROJECT_LIBS@ \ @CCRTP_LIBS@ \ @@ -69,10 +69,10 @@ libsflphone_la_LDFLAGS = \ $(PCRE_LIBS) if USE_DHT -libsflphone_la_LDFLAGS += $(OPENDHT_LIBS) +libring_la_LDFLAGS += $(OPENDHT_LIBS) endif -libsflphone_la_CFLAGS = \ +libring_la_CFLAGS = \ @ZRTPCPP_CFLAGS@ \ @PJPROJECT_CFLAGS@ \ @CCRTP_CFLAGS@ \ @@ -83,10 +83,10 @@ libsflphone_la_CFLAGS = \ $(TLS_CFLAGS) if USE_DHT -libsflphone_la_CFLAGS += $(OPENDHT_CFLAGS) +libring_la_CFLAGS += $(OPENDHT_CFLAGS) endif -libsflphone_la_SOURCES = conference.cpp \ +libring_la_SOURCES = conference.cpp \ account_factory.cpp \ call_factory.cpp \ preferences.cpp \ @@ -131,5 +131,5 @@ libsflphone_la_SOURCES = conference.cpp \ string_utils.h \ string_utils.cpp \ rw_mutex.h \ - sflphone.h \ - sflphone_api.cpp + ring.h \ + ring_api.cpp diff --git a/daemon/src/account.cpp b/daemon/src/account.cpp index 7c50293cf2bed548ffddbbd6416345dc6c5d1a7b..8d6de36d9dadbbfc0d379ef898cf5be8f696c785 100644 --- a/daemon/src/account.cpp +++ b/daemon/src/account.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2014 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * Author: Alexandre Bourget <alexandre.bourget@savoirfairelinux.com> @@ -38,7 +38,7 @@ #include <algorithm> #include <iterator> -#ifdef SFL_VIDEO +#ifdef RING_VIDEO #include "video/libav_utils.h" #endif @@ -107,9 +107,9 @@ Account::Account(const string &accountID) // Initialize the codec order, used when creating a new account loadDefaultCodecs(); #ifdef __ANDROID__ - ringtonePath_ = "/data/data/org.sflphone/files/ringtones/konga.ul"; + ringtonePath_ = "/data/data/cx.ring/files/ringtones/konga.ul"; #else - ringtonePath_ = "/usr/share/sflphone/ringtones/konga.ul"; + ringtonePath_ = "/usr/share/ring/ringtones/konga.ul"; #endif } @@ -164,7 +164,7 @@ void Account::loadDefaultCodecs() result.push_back("112"); setActiveAudioCodecs(result); -#ifdef SFL_VIDEO +#ifdef RING_VIDEO // we don't need to validate via setVideoCodecs, since these are defaults videoCodecList_ = libav_utils::getDefaultCodecs(); #endif @@ -204,7 +204,7 @@ void Account::unserialize(const YAML::Node &node) parseValue(node, AUDIO_CODECS_KEY, audioCodecStr_); // Update codec list which one is used for SDP offer - setActiveAudioCodecs(sfl::split_string(audioCodecStr_, '/')); + setActiveAudioCodecs(ring::split_string(audioCodecStr_, '/')); parseValue(node, DISPLAY_NAME_KEY, displayName_); parseValue(node, HOSTNAME_KEY, hostname_); @@ -266,7 +266,7 @@ std::map<std::string, std::string> Account::getVolatileAccountDetails() const return a; } -#ifdef SFL_VIDEO +#ifdef RING_VIDEO static bool isPositiveInteger(const string &s) { @@ -295,7 +295,7 @@ isCodecValid(const map<string, string> &codec, const vector<map<string, string> { const map<string, string>::const_iterator name(codec.find(Account::VIDEO_CODEC_NAME)); if (name == codec.end()) { - SFL_ERR("Field \"name\" missing in codec specification"); + RING_ERR("Field \"name\" missing in codec specification"); return false; } @@ -307,7 +307,7 @@ isCodecValid(const map<string, string> &codec, const vector<map<string, string> and isFieldValid(codec, Account::VIDEO_CODEC_ENABLED, isBoolean); } } - SFL_ERR("Codec %s not supported", name->second.c_str()); + RING_ERR("Codec %s not supported", name->second.c_str()); return false; } @@ -316,7 +316,7 @@ isCodecListValid(const vector<map<string, string> > &list) { const auto defaults(libav_utils::getDefaultCodecs()); if (list.size() != defaults.size()) { - SFL_ERR("New codec list has a different length than the list of supported codecs"); + RING_ERR("New codec list has a different length than the list of supported codecs"); return false; } @@ -331,7 +331,7 @@ isCodecListValid(const vector<map<string, string> > &list) void Account::setVideoCodecs(const vector<map<string, string> > &list) { -#ifdef SFL_VIDEO +#ifdef RING_VIDEO if (isCodecListValid(list)) videoCodecList_ = list; #else @@ -433,7 +433,7 @@ Account::getActiveVideoCodecs() const #define find_iter() \ const auto iter = details.find(key); \ if (iter == details.end()) { \ - SFL_ERR("Couldn't find key \"%s\"", key); \ + RING_ERR("Couldn't find key \"%s\"", key); \ return; \ } diff --git a/daemon/src/account.h b/daemon/src/account.h index 521fdb49801b14314c44261bf9d8a70d23c24a04..016750a5061f2dfdd0a1c4de52430fc4400193d1 100644 --- a/daemon/src/account.h +++ b/daemon/src/account.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2014 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * Author: Yan Morin <yan.morin@savoirfairelinux.com> * Author : Guillaume Roguez <guillaume.roguez@savoirfairelinux.com> diff --git a/daemon/src/account_factory.cpp b/daemon/src/account_factory.cpp index 1c2775e9957ab14447723be532b0c0e4a2072b6b..71b2cc2601944e04e76f2aaa56d98f1fb5cb5361 100644 --- a/daemon/src/account_factory.cpp +++ b/daemon/src/account_factory.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2014 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Guillaume Roguez <guillaume.roguez@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -52,16 +52,16 @@ AccountFactory::AccountFactory() { auto sipfunc = [](const std::string& id){ return std::make_shared<SIPAccount>(id, true); }; generators_.insert(std::make_pair(SIPAccount::ACCOUNT_TYPE, sipfunc)); - SFL_DBG("registered %s account", SIPAccount::ACCOUNT_TYPE); + RING_DBG("registered %s account", SIPAccount::ACCOUNT_TYPE); #if HAVE_IAX auto iaxfunc = [](const std::string& id){ return std::make_shared<IAXAccount>(id); }; generators_.insert(std::make_pair(IAXAccount::ACCOUNT_TYPE, iaxfunc)); - SFL_DBG("registered %s account", IAXAccount::ACCOUNT_TYPE); + RING_DBG("registered %s account", IAXAccount::ACCOUNT_TYPE); #endif #if HAVE_DHT auto dhtfunc = [](const std::string& id){ return std::make_shared<RingAccount>(id, false); }; generators_.insert(std::make_pair(RingAccount::ACCOUNT_TYPE, dhtfunc)); - SFL_DBG("registered %s account", RingAccount::ACCOUNT_TYPE); + RING_DBG("registered %s account", RingAccount::ACCOUNT_TYPE); #endif } @@ -70,7 +70,7 @@ AccountFactory::createAccount(const char* const accountType, const std::string& id) { if (hasAccount(id)) { - SFL_ERR("Existing account %s", id.c_str()); + RING_ERR("Existing account %s", id.c_str()); return nullptr; } @@ -102,10 +102,10 @@ AccountFactory::removeAccount(Account& account) std::lock_guard<std::recursive_mutex> lock(mutex_); const auto& id = account.getAccountID(); - SFL_DBG("Removing account %s", id.c_str()); + RING_DBG("Removing account %s", id.c_str()); auto& map = accountMaps_.at(account.getAccountType()); map.erase(id); - SFL_DBG("Remaining %u %s account(s)", map.size(), account_type); + RING_DBG("Remaining %u %s account(s)", map.size(), account_type); } void @@ -116,7 +116,7 @@ AccountFactory::removeAccount(const std::string& id) if (auto account = getAccount(id)) { removeAccount(*account); } else - SFL_ERR("No account with ID %s", id.c_str()); + RING_ERR("No account with ID %s", id.c_str()); } template <> bool diff --git a/daemon/src/account_factory.h b/daemon/src/account_factory.h index 9770cca3d59f27c3fbfd3bd75c86e77e7e17a9dc..d3734e6c9816755da85a0414ef96693bfd4a50c9 100644 --- a/daemon/src/account_factory.h +++ b/daemon/src/account_factory.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2014 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Guillaume Roguez <guillaume.roguez@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify diff --git a/daemon/src/account_schema.h b/daemon/src/account_schema.h index 59f1cd4e05258f30cbcb1232100542734f6027e3..13774ddbe965fda1fbde66f194a3ade7a552800a 100644 --- a/daemon/src/account_schema.h +++ b/daemon/src/account_schema.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * Author: Yan Morin <yan.morin@savoirfairelinux.com> * diff --git a/daemon/src/array_size.h b/daemon/src/array_size.h index d1bb27d9f2bd16cec7d132d78a874602edf82508..046d75240a43a7153e402703abe41385bae9b48a 100644 --- a/daemon/src/array_size.h +++ b/daemon/src/array_size.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Tristan Matthews <tristan.matthews@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -32,12 +32,12 @@ #define ARRAY_SIZE_H_ // Returns the number of elements in a, calculated at compile-time -#define SFL_ARRAYSIZE(a) \ +#define RING_ARRAYSIZE(a) \ ((sizeof(a) / sizeof(*(a))) / \ static_cast<size_t>(!(sizeof(a) % sizeof(*(a))))) /* Only use this macro with string literals or character arrays, will not work * as expected with char pointers */ -#define CONST_PJ_STR(X) {(char *) (X), SFL_ARRAYSIZE(X) - 1} +#define CONST_PJ_STR(X) {(char *) (X), RING_ARRAYSIZE(X) - 1} #endif // ARRAY_SIZE_H_ diff --git a/daemon/src/audio/Makefile.am b/daemon/src/audio/Makefile.am index dfe71b05bc4926b05dbc7ccd558e985b545d8b5b..363a4c9b012d2a5322c8124aca79787e8685aee1 100644 --- a/daemon/src/audio/Makefile.am +++ b/daemon/src/audio/Makefile.am @@ -23,8 +23,8 @@ endif SUBDIRS += coreaudio if BUILD_SPEEXDSP -SFL_SPEEXDSP_SRC=dsp.cpp -SFL_SPEEXDSP_HEAD=dsp.h +RING_SPEEXDSP_SRC=dsp.cpp +RING_SPEEXDSP_HEAD=dsp.h endif libaudio_la_SOURCES = \ @@ -37,7 +37,7 @@ libaudio_la_SOURCES = \ recordable.cpp \ audiolayer.cpp \ resampler.cpp \ - $(SFL_SPEEXDSP_SRC) \ + $(RING_SPEEXDSP_SRC) \ dcblocker.cpp libaudio_la_CXXFLAGS = -I$(top_srcdir)/src @@ -57,7 +57,7 @@ noinst_HEADERS = \ audiorecorder.h \ audiolayer.h \ recordable.h \ - $(SFL_SPEEXDSP_HEAD) \ + $(RING_SPEEXDSP_HEAD) \ dcblocker.h \ resampler.h diff --git a/daemon/src/audio/alsa/alsalayer.cpp b/daemon/src/audio/alsa/alsalayer.cpp index b0901783e7ede54537c4d1d40d1d66eb02527aae..4c38bd0bcde0bd7660915f2b9fbc66ce11c74a72 100644 --- a/daemon/src/audio/alsa/alsalayer.cpp +++ b/daemon/src/audio/alsa/alsalayer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * Author: Ðндрей Лухнов <aol.nnov@gmail.com> @@ -42,7 +42,7 @@ #include <thread> #include <atomic> -namespace sfl { +namespace ring { class AlsaThread { public: @@ -178,7 +178,7 @@ AlsaLayer::~AlsaLayer() // Retry approach taken from pa_linux_alsa.c, part of PortAudio bool AlsaLayer::openDevice(snd_pcm_t **pcm, const std::string &dev, snd_pcm_stream_t stream) { - SFL_DBG("Alsa: Opening %s", dev.c_str()); + RING_DBG("Alsa: Opening %s", dev.c_str()); static const int MAX_RETRIES = 100; int err = snd_pcm_open(pcm, dev.c_str(), stream, 0); @@ -191,7 +191,7 @@ bool AlsaLayer::openDevice(snd_pcm_t **pcm, const std::string &dev, snd_pcm_stre } if (err < 0) { - SFL_ERR("Alsa: couldn't open device %s : %s", dev.c_str(), + RING_ERR("Alsa: couldn't open device %s : %s", dev.c_str(), snd_strerror(err)); return false; } @@ -251,7 +251,7 @@ AlsaLayer::stopStream() #define ALSA_CALL(call, error) ({ \ int err_code = call; \ if (err_code < 0) \ - SFL_ERR(error ": %s", snd_strerror(err_code)); \ + RING_ERR(error ": %s", snd_strerror(err_code)); \ err_code; \ }) @@ -335,13 +335,13 @@ bool AlsaLayer::alsa_set_params(snd_pcm_t *pcm_handle) snd_pcm_hw_params_t *hwparams; snd_pcm_hw_params_alloca(&hwparams); - const unsigned SFL_ALSA_PERIOD_SIZE = 160; - const unsigned SFL_ALSA_NB_PERIOD = 8; - const unsigned SFL_ALSA_BUFFER_SIZE = SFL_ALSA_PERIOD_SIZE * SFL_ALSA_NB_PERIOD; + const unsigned RING_ALSA_PERIOD_SIZE = 160; + const unsigned RING_ALSA_NB_PERIOD = 8; + const unsigned RING_ALSA_BUFFER_SIZE = RING_ALSA_PERIOD_SIZE * RING_ALSA_NB_PERIOD; - snd_pcm_uframes_t period_size = SFL_ALSA_PERIOD_SIZE; - snd_pcm_uframes_t buffer_size = SFL_ALSA_BUFFER_SIZE; - unsigned int periods = SFL_ALSA_NB_PERIOD; + snd_pcm_uframes_t period_size = RING_ALSA_PERIOD_SIZE; + snd_pcm_uframes_t buffer_size = RING_ALSA_BUFFER_SIZE; + unsigned int periods = RING_ALSA_NB_PERIOD; snd_pcm_uframes_t period_size_min = 0; snd_pcm_uframes_t period_size_max = 0; @@ -365,8 +365,8 @@ bool AlsaLayer::alsa_set_params(snd_pcm_t *pcm_handle) snd_pcm_hw_params_get_buffer_size_max(hwparams, &buffer_size_max); snd_pcm_hw_params_get_period_size_min(hwparams, &period_size_min, nullptr); snd_pcm_hw_params_get_period_size_max(hwparams, &period_size_max, nullptr); - SFL_DBG("Buffer size range from %lu to %lu", buffer_size_min, buffer_size_max); - SFL_DBG("Period size range from %lu to %lu", period_size_min, period_size_max); + RING_DBG("Buffer size range from %lu to %lu", buffer_size_min, buffer_size_max); + RING_DBG("Period size range from %lu to %lu", period_size_min, period_size_max); buffer_size = buffer_size > buffer_size_max ? buffer_size_max : buffer_size; buffer_size = buffer_size < buffer_size_min ? buffer_size_min : buffer_size; period_size = period_size > period_size_max ? period_size_max : period_size; @@ -381,17 +381,17 @@ bool AlsaLayer::alsa_set_params(snd_pcm_t *pcm_handle) snd_pcm_hw_params_get_period_size(hwparams, &period_size, nullptr); snd_pcm_hw_params_get_rate(hwparams, &audioFormat_.sample_rate, nullptr); snd_pcm_hw_params_get_channels(hwparams, &audioFormat_.nb_channels); - SFL_DBG("Was set period_size = %lu", period_size); - SFL_DBG("Was set buffer_size = %lu", buffer_size); + RING_DBG("Was set period_size = %lu", period_size); + RING_DBG("Was set buffer_size = %lu", buffer_size); if (2 * period_size > buffer_size) { - SFL_ERR("buffer to small, could not use"); + RING_ERR("buffer to small, could not use"); return false; } #undef HW - SFL_DBG("%s using format %s", + RING_DBG("%s using format %s", (snd_pcm_stream(pcm_handle) == SND_PCM_STREAM_PLAYBACK) ? "playback" : "capture", audioFormat_.toString().c_str() ); @@ -451,12 +451,12 @@ AlsaLayer::write(SFLAudioSample* buffer, int frames, snd_pcm_t * handle) if (ALSA_CALL(snd_pcm_status(handle, status), "Cannot get playback handle status") >= 0) { if (snd_pcm_status_get_state(status) == SND_PCM_STATE_SETUP) { - SFL_ERR("Writing in state SND_PCM_STATE_SETUP, should be " + RING_ERR("Writing in state SND_PCM_STATE_SETUP, should be " "SND_PCM_STATE_PREPARED or SND_PCM_STATE_RUNNING"); int error = snd_pcm_prepare(handle); if (error < 0) { - SFL_ERR("Failed to prepare handle: %s", snd_strerror(error)); + RING_ERR("Failed to prepare handle: %s", snd_strerror(error)); stopPlaybackStream(); } } @@ -466,7 +466,7 @@ AlsaLayer::write(SFLAudioSample* buffer, int frames, snd_pcm_t * handle) } default: - SFL_ERR("Unknown write error, dropping frames: %s", snd_strerror(err)); + RING_ERR("Unknown write error, dropping frames: %s", snd_strerror(err)); stopPlaybackStream(); break; } @@ -499,12 +499,12 @@ AlsaLayer::read(SFLAudioSample* buffer, int frames) startCaptureStream(); } - SFL_ERR("XRUN capture ignored (%s)", snd_strerror(err)); + RING_ERR("XRUN capture ignored (%s)", snd_strerror(err)); break; } case -EPERM: - SFL_ERR("Can't capture, EPERM (%s)", snd_strerror(err)); + RING_ERR("Can't capture, EPERM (%s)", snd_strerror(err)); prepareCaptureStream(); startCaptureStream(); break; @@ -536,7 +536,7 @@ safeUpdate(snd_pcm_t *handle, int &samples) samples = snd_pcm_recover(handle, samples, 0); if (samples < 0) { - SFL_ERR("Got unrecoverable error from snd_pcm_avail_update: %s", snd_strerror(samples)); + RING_ERR("Got unrecoverable error from snd_pcm_avail_update: %s", snd_strerror(samples)); return false; } } @@ -596,11 +596,11 @@ AlsaLayer::getAudioDeviceIndexMap(bool getCapture) const int err; if ((err = snd_ctl_pcm_info(handle, pcminfo)) < 0) { - SFL_WARN("Cannot get info for %s %s: %s", getCapture ? + RING_WARN("Cannot get info for %s %s: %s", getCapture ? "capture device" : "playback device", name.c_str(), snd_strerror(err)); } else { - SFL_DBG("card %i : %s [%s]", + RING_DBG("card %i : %s [%s]", numCard, snd_ctl_card_info_get_id(info), snd_ctl_card_info_get_name(info)); @@ -671,7 +671,7 @@ AlsaLayer::getAudioDeviceName(int index, DeviceType type) const return getCaptureDeviceList().at(index); default: // Should never happen - SFL_ERR("Unexpected type"); + RING_ERR("Unexpected type"); return ""; } } @@ -683,7 +683,7 @@ void AlsaLayer::capture() int toGetFrames = snd_pcm_avail_update(captureHandle_); if (toGetFrames < 0) - SFL_ERR("Audio: Mic error: %s", snd_strerror(toGetFrames)); + RING_ERR("Audio: Mic error: %s", snd_strerror(toGetFrames)); if (toGetFrames <= 0) return; @@ -693,7 +693,7 @@ void AlsaLayer::capture() captureIBuff_.resize(toGetFrames * audioFormat_.nb_channels); if (read(captureIBuff_.data(), toGetFrames) != toGetFrames) { - SFL_ERR("ALSA MIC : Couldn't read!"); + RING_ERR("ALSA MIC : Couldn't read!"); return; } @@ -818,7 +818,7 @@ void AlsaLayer::audioCallback() playbackBuff_.resize(ringtoneAvailFrames); if (file_tone) { - SFL_DBG("playback gain %d", playbackGain_); + RING_DBG("playback gain %d", playbackGain_); file_tone->getNext(playbackBuff_, playbackGain_); } diff --git a/daemon/src/audio/alsa/alsalayer.h b/daemon/src/audio/alsa/alsalayer.h index 449fc2ccfc301c7caf3fa89cedaf62bbadce2b02..0f060f36ffc199656200ab6f45f23e2e3e7c0498 100644 --- a/daemon/src/audio/alsa/alsalayer.h +++ b/daemon/src/audio/alsa/alsalayer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * Author: Ðндрей Лухнов <aol.nnov@gmail.com> @@ -51,7 +51,7 @@ * @brief Main sound class. Manages the data transfers between the application and the hardware. */ -namespace sfl { +namespace ring { class AlsaThread; class RingBuffer; diff --git a/daemon/src/audio/audiobuffer.cpp b/daemon/src/audio/audiobuffer.cpp index 9aeab1834a9e11a04697b7f28ecd165f590f094f..a0cd6799d68240c501bf558ab28a25c99c89e356 100644 --- a/daemon/src/audio/audiobuffer.cpp +++ b/daemon/src/audio/audiobuffer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Adrien Beraud <adrien.beraud@wisdomvibes.com> * * This program is free software; you can redistribute it and/or modify @@ -31,7 +31,7 @@ #include "audiobuffer.h" #include "logger.h" -namespace sfl { +namespace ring { std::ostream& operator <<(std::ostream& stream, const AudioFormat& f) { stream << f.toString(); @@ -112,7 +112,7 @@ void AudioBuffer::setChannelNum(unsigned n, bool mix /* = false */) return; } - SFL_WARN("Unsupported channel mixing: %dch->%dch", c, n); + RING_WARN("Unsupported channel mixing: %dch->%dch", c, n); samples_.resize(n, samples_[0]); } @@ -137,7 +137,7 @@ std::vector<SFLAudioSample> * AudioBuffer::getChannel(unsigned chan /* = 0 */) if (chan < samples_.size()) return &samples_[chan]; - SFL_ERR("Audio channel %u out of range", chan); + RING_ERR("Audio channel %u out of range", chan); return nullptr; } @@ -147,7 +147,7 @@ void AudioBuffer::applyGain(double gain) const double g = std::max(std::min(1.0, gain), -1.0); if (g != gain) - SFL_DBG("Normalizing %f to [-1.0, 1.0]", gain); + RING_DBG("Normalizing %f to [-1.0, 1.0]", gain); for (auto &channel : samples_) for (auto &sample : channel) diff --git a/daemon/src/audio/audiobuffer.h b/daemon/src/audio/audiobuffer.h index a09fbaff4ae823d6e75fe85f32ec6cef07d4cd18..4ec1a4ce0588d23ea299c586d5c64db5c4ca6eaf 100644 --- a/daemon/src/audio/audiobuffer.h +++ b/daemon/src/audio/audiobuffer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Adrien Beraud <adrien.beraud@wisdomvibes.com> * * This program is free software; you can redistribute it and/or modify @@ -38,7 +38,7 @@ #include "sfl_types.h" -namespace sfl { +namespace ring { /** * Structure to hold sample rate and channel number associated with audio data. diff --git a/daemon/src/audio/audiolayer.cpp b/daemon/src/audio/audiolayer.cpp index d337daed2ecd70249a547387f3ddfd6ec44dd47a..e92be981e8c2054693a7509a613805af4e9910fb 100644 --- a/daemon/src/audio/audiolayer.cpp +++ b/daemon/src/audio/audiolayer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * @@ -38,7 +38,7 @@ #include <ctime> -namespace sfl { +namespace ring { AudioLayer::AudioLayer(const AudioPreference &pref) : isCaptureMuted_(pref.getCaptureMuted()) @@ -64,7 +64,7 @@ AudioLayer::~AudioLayer() void AudioLayer::hardwareFormatAvailable(AudioFormat playback) { std::lock_guard<std::mutex> lock(mutex_); - SFL_DBG("hardwareFormatAvailable : %s", playback.toString().c_str()); + RING_DBG("hardwareFormatAvailable : %s", playback.toString().c_str()); urgentRingBuffer_.setFormat(playback); resampler_->setFormat(playback); Manager::instance().hardwareAudioFormatChanged(playback); diff --git a/daemon/src/audio/audiolayer.h b/daemon/src/audio/audiolayer.h index 52ff8673bbcf2d19738e7e3ad3fce07be38d1c38..eff45116c5d6edc947f0ea2c4f2db261f85bf76f 100644 --- a/daemon/src/audio/audiolayer.h +++ b/daemon/src/audio/audiolayer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Yan Morin <yan.morin@savoirfairelinux.com> * Author: Jerome Oufella <jerome.oufella@savoirfairelinux.com> * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> @@ -64,7 +64,7 @@ namespace ost { class Time; } -namespace sfl { +namespace ring { class Resampler; diff --git a/daemon/src/audio/audioloop.cpp b/daemon/src/audio/audioloop.cpp index f982a866a4f822ba9e1a73c6e6dc5d0b7165c55f..33688ee71cd282bcfd0a239bad8635fc6b34fedf 100644 --- a/daemon/src/audio/audioloop.cpp +++ b/daemon/src/audio/audioloop.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Yan Morin <yan.morin@savoirfairelinux.com> * * Inspired by tonegenerator of @@ -44,7 +44,7 @@ #include <cassert> #include "logger.h" -namespace sfl { +namespace ring { AudioLoop::AudioLoop(unsigned int sampleRate) : buffer_(new AudioBuffer(0, AudioFormat(sampleRate, 1))), pos_(0) @@ -65,7 +65,7 @@ void AudioLoop::getNext(AudioBuffer& output, double gain) { if (!buffer_) { - SFL_ERR("buffer is NULL"); + RING_ERR("buffer is NULL"); return; } @@ -75,10 +75,10 @@ AudioLoop::getNext(AudioBuffer& output, double gain) size_t output_pos = 0; if (buf_samples == 0) { - SFL_ERR("Audio loop size is 0"); + RING_ERR("Audio loop size is 0"); return; } else if (pos >= buf_samples) { - SFL_ERR("Invalid loop position %d", pos); + RING_ERR("Invalid loop position %d", pos); return; } diff --git a/daemon/src/audio/audioloop.h b/daemon/src/audio/audioloop.h index 9e018cd2e4e71f198cb708b7810c087b436c8723..a6a4f6d6a04784ab22f3c06c902d82ab6cbace74 100644 --- a/daemon/src/audio/audioloop.h +++ b/daemon/src/audio/audioloop.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Yan Morin <yan.morin@savoirfairelinux.com> * * Inspired by tonegenerator of @@ -43,7 +43,7 @@ * @brief Loop on a sound file */ -namespace sfl { +namespace ring { class AudioLoop { public: diff --git a/daemon/src/audio/audiorecord.cpp b/daemon/src/audio/audiorecord.cpp index c2070f08cf48334eb464f9137e0f477d323db367..91d98a4110026f4dc98343bb489a8ddf412cda2b 100644 --- a/daemon/src/audio/audiorecord.cpp +++ b/daemon/src/audio/audiorecord.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -43,7 +43,7 @@ #include <cstdio> #include <unistd.h> -namespace sfl { +namespace ring { static std::string createFilename() @@ -96,7 +96,7 @@ AudioRecord::AudioRecord() : fileHandle_(nullptr) , filename_(createFilename()) , savePath_() { - SFL_WARN("Generate filename for this call %s ", filename_.c_str()); + RING_WARN("Generate filename for this call %s ", filename_.c_str()); } AudioRecord::~AudioRecord() @@ -144,7 +144,7 @@ void AudioRecord::initFilename(const std::string &peerNumber) fName.append("-" + sanitize(peerNumber) + "-" PACKAGE); if (filename_.find(".wav") == std::string::npos) { - SFL_DBG("Concatenate .wav file extension: name : %s", filename_.c_str()); + RING_DBG("Concatenate .wav file extension: name : %s", filename_.c_str()); fName.append(".wav"); } @@ -163,19 +163,19 @@ bool AudioRecord::openFile() const bool doAppend = fileExists(); const int access = doAppend ? SFM_RDWR : SFM_WRITE; - SFL_DBG("Opening file %s with format %s", savePath_.c_str(), sndFormat_.toString().c_str()); + RING_DBG("Opening file %s with format %s", savePath_.c_str(), sndFormat_.toString().c_str()); fileHandle_ = new SndfileHandle(savePath_.c_str(), access, SF_FORMAT_WAV | SF_FORMAT_PCM_16, sndFormat_.nb_channels, sndFormat_.sample_rate); // check overloaded boolean operator if (!*fileHandle_) { - SFL_WARN("Could not open WAV file!"); + RING_WARN("Could not open WAV file!"); delete fileHandle_; fileHandle_ = 0; return false; } if (doAppend and fileHandle_->seek(0, SEEK_END) < 0) - SFL_WARN("Couldn't seek to the end of the file "); + RING_WARN("Couldn't seek to the end of the file "); return result; } @@ -215,7 +215,7 @@ bool AudioRecord::toggleRecording() void AudioRecord::stopRecording() { - SFL_DBG("Stop recording"); + RING_DBG("Stop recording"); recordingEnabled_ = false; } @@ -225,14 +225,14 @@ void AudioRecord::recData(AudioBuffer& buffer) return; if (fileHandle_ == 0) { - SFL_DBG("Can't record data, a file has not yet been opened!"); + RING_DBG("Can't record data, a file has not yet been opened!"); return; } auto interleaved = buffer.interleave(); const int nSamples = interleaved.size(); if (fileHandle_->write(interleaved.data(), nSamples) != nSamples) { - SFL_WARN("Could not record data!"); + RING_WARN("Could not record data!"); } else { fileHandle_->writeSync(); } diff --git a/daemon/src/audio/audiorecord.h b/daemon/src/audio/audiorecord.h index 0c13660076756d95bdddab388ab7b81e355a60f5..41f0019c79636f8ed45976a541832b1e8c400f84 100644 --- a/daemon/src/audio/audiorecord.h +++ b/daemon/src/audio/audiorecord.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -41,7 +41,7 @@ class SndfileHandle; -namespace sfl { +namespace ring { class AudioRecord { diff --git a/daemon/src/audio/audiorecorder.cpp b/daemon/src/audio/audiorecorder.cpp index 5045b78bf69731b9d78864ddc350dd3b9d439650..9d9e934bef1cd58976c029fe8527f698de28b2ce 100644 --- a/daemon/src/audio/audiorecorder.cpp +++ b/daemon/src/audio/audiorecorder.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Alexandre Savard <alexandre.savard@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -37,7 +37,7 @@ #include <sstream> #include <unistd.h> -namespace sfl { +namespace ring { int AudioRecorder::count_ = 0; diff --git a/daemon/src/audio/audiorecorder.h b/daemon/src/audio/audiorecorder.h index f3a6fc030e5239d76f459e5788fe60fe1082d726..96cf7329236f37674c44b1269e6aec771daad541 100644 --- a/daemon/src/audio/audiorecorder.h +++ b/daemon/src/audio/audiorecorder.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Alexandre Savard <alexandre.savard@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -37,7 +37,7 @@ #include <atomic> #include <string> -namespace sfl { +namespace ring { class RingBufferPool; class AudioRecord; diff --git a/daemon/src/audio/audiortp/Makefile.am b/daemon/src/audio/audiortp/Makefile.am index 360b36dc01e8eb17a4c8414f6cb587d4901e998f..b1e36b05f9a09827cd19ce533bbbe0391d12964b 100644 --- a/daemon/src/audio/audiortp/Makefile.am +++ b/daemon/src/audio/audiortp/Makefile.am @@ -3,14 +3,14 @@ include $(top_srcdir)/globals.mak noinst_LTLIBRARIES = libaudiortp.la if BUILD_ZRTP -SFL_ZRTP_SRC=audio_zrtp_session.h audio_zrtp_session.cpp zrtp_session_callback.cpp zrtp_session_callback.h +RING_ZRTP_SRC=audio_zrtp_session.h audio_zrtp_session.cpp zrtp_session_callback.cpp zrtp_session_callback.h endif libaudiortp_la_SOURCES = \ - $(SFL_ZRTP_SRC) \ + $(RING_ZRTP_SRC) \ base64.c base64.h -if SFL_VIDEO +if RING_VIDEO libaudiortp_la_SOURCES += \ avformat_rtp_session.cpp \ avformat_rtp_session.h diff --git a/daemon/src/audio/audiortp/audio_rtp_factory.cpp b/daemon/src/audio/audiortp/audio_rtp_factory.cpp index c8c5eedb8264fa5f7e7eb05b604379c9282fe0f3..e10c4d78026fc6e31a9ceace80a3a74b1fca3b57 100644 --- a/daemon/src/audio/audiortp/audio_rtp_factory.cpp +++ b/daemon/src/audio/audiortp/audio_rtp_factory.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Pierre-Luc Bacon <pierre-luc.bacon@savoirfairelinux.com> * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * @@ -44,7 +44,7 @@ #include "sip/sipaccount.h" #include "logger.h" -namespace sfl { +namespace ring { AudioRtpFactory::AudioRtpFactory(SIPCall *ca) : rtpSession_(), audioRtpThreadMutex_(), srtpEnabled_(false), helloHashEnabled_(false), @@ -225,7 +225,7 @@ void AudioRtpFactory::setRemoteCryptoInfo(SdesNegotiator& nego) throw AudioRtpFactoryException(e.what()); } } else { - SFL_ERR("Should not store remote crypto info for non-SDES sessions"); + RING_ERR("Should not store remote crypto info for non-SDES sessions"); } } diff --git a/daemon/src/audio/audiortp/audio_rtp_factory.h b/daemon/src/audio/audiortp/audio_rtp_factory.h index 437558ac2708004766550b01abf11bd9754affa3..12a4deed75e4ba2245f8456cd929f21c0d7e55de 100644 --- a/daemon/src/audio/audiortp/audio_rtp_factory.h +++ b/daemon/src/audio/audiortp/audio_rtp_factory.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Pierre-Luc Bacon <pierre-luc.bacon@savoirfairelinux.com> * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * @@ -41,7 +41,7 @@ class SdesNegotiator; class SIPCall; -namespace sfl { +namespace ring { #if HAVE_ZRTP class AudioZrtpSession; @@ -118,7 +118,7 @@ class AudioRtpFactory { * if the current rtp thread is null, or if it's not of the correct type. * @return The current AudioZrtpSession thread. */ - sfl::AudioZrtpSession* getAudioZrtpSession(); + ring::AudioZrtpSession* getAudioZrtpSession(); #endif void initLocalCryptoInfo(); @@ -128,7 +128,7 @@ class AudioRtpFactory { * Set remote cryptographic info. Should be called after negotiation in SDP * offer/answer session. */ - void setRemoteCryptoInfo(sfl::SdesNegotiator& nego); + void setRemoteCryptoInfo(ring::SdesNegotiator& nego); void setDtmfPayloadType(unsigned int); diff --git a/daemon/src/audio/audiortp/audio_rtp_session.cpp b/daemon/src/audio/audiortp/audio_rtp_session.cpp index d5f62096c6e828b9c38418fa5ec9210a3a771f4b..51d51a7fafce4b58b08ea487381768b0025e6b21 100644 --- a/daemon/src/audio/audiortp/audio_rtp_session.cpp +++ b/daemon/src/audio/audiortp/audio_rtp_session.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Pierre-Luc Bacon <pierre-luc.bacon@savoirfairelinux.com> * Author: Alexandre Bourget <alexandre.bourget@savoirfairelinux.com> * Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com> @@ -43,7 +43,7 @@ #include <algorithm> #endif -namespace sfl { +namespace ring { AudioRtpSession::AudioRtpSession(SIPCall &call, ost::RTPDataQueue &queue) : isStarted_(false) , queue_(queue) @@ -105,13 +105,13 @@ void AudioRtpSession::setSessionMedia(const std::vector<AudioCodec*> &audioCodec } transportRate_ = rtpStream_.getTransportRate(); - SFL_DBG("Switching to a transport rate of %d ms", transportRate_); + RING_DBG("Switching to a transport rate of %d ms", transportRate_); } void AudioRtpSession::sendDtmfEvent() { DTMFEvent &dtmf(dtmfQueue_.front()); - SFL_DBG("Send RTP Dtmf (%d)", dtmf.payload.event); + RING_DBG("Send RTP Dtmf (%d)", dtmf.payload.event); const int increment = getIncrementForDTMF(); if (dtmf.newevent) @@ -181,7 +181,7 @@ void AudioRtpSession::receiveSpeakerData() const double jit_mean = std::accumulate(rxJitters_.begin(), rxJitters_.end(), 0.0) / rxJitters_.size(); const double jit_sq_sum = std::inner_product(rxJitters_.begin(), rxJitters_.end(), rxJitters_.begin(), 0.0); const double jit_stdev = std::sqrt(jit_sq_sum / rxJitters_.size() - jit_mean * jit_mean); - SFL_DBG("Jitter avg: %fms std dev %fms", jit_mean, jit_stdev); + RING_DBG("Jitter avg: %fms std dev %fms", jit_mean, jit_stdev); jitterReportInterval_ = 0; } #endif @@ -193,13 +193,13 @@ void AudioRtpSession::receiveSpeakerData() rxLastSeqNum_ += seqNumDiff; seqNumDiff = 1; } else if (seqNumDiff < 0) { - SFL_DBG("Dropping out-of-order packet %d (last %d)", rxLastSeqNum_ + seqNumDiff, rxLastSeqNum_); + RING_DBG("Dropping out-of-order packet %d (last %d)", rxLastSeqNum_ + seqNumDiff, rxLastSeqNum_); return; } else { rxLastSeqNum_ += seqNumDiff; } if (rxLastSeqNum_ && seqNumDiff > 1) { - SFL_DBG("%d packets lost", seqNumDiff-1); + RING_DBG("%d packets lost", seqNumDiff-1); for (unsigned i = 0, n = seqNumDiff - 1; i < n; i++) rtpStream_.processDataDecode(nullptr, 0, adu->getType()); } @@ -241,7 +241,7 @@ void AudioRtpSession::setSessionTimeouts() { const unsigned schedulingTimeout = 4000; const unsigned expireTimeout = 1000000; - SFL_DBG("Set session scheduling timeout (%d) and expireTimeout (%d)", + RING_DBG("Set session scheduling timeout (%d) and expireTimeout (%d)", schedulingTimeout, expireTimeout); queue_.setSchedulingTimeout(schedulingTimeout); @@ -250,7 +250,7 @@ void AudioRtpSession::setSessionTimeouts() void AudioRtpSession::updateDestinationIpAddress() { - SFL_DBG("Update destination ip address"); + RING_DBG("Update destination ip address"); // Destination address are stored in a list in ccrtp // This method remove the current destination entry @@ -258,28 +258,28 @@ void AudioRtpSession::updateDestinationIpAddress() #if HAVE_IPV6 && !(remoteIp_.isIpv6() == AF_INET6 && queue_.forgetDestination(static_cast<ost::IPV6Host>(remoteIp_), remoteIp_.getPort())) #endif - ) SFL_DBG("Did not remove previous destination"); + ) RING_DBG("Did not remove previous destination"); IpAddr remote = {call_.getSDP().getRemoteIP()}; remote.setPort(call_.getSDP().getRemoteAudioPort()); if (!remote) { - SFL_WARN("Target IP address (%s) is not correct!", call_.getSDP().getRemoteIP().c_str()); + RING_WARN("Target IP address (%s) is not correct!", call_.getSDP().getRemoteIP().c_str()); return; } remoteIp_ = remote; - SFL_DBG("New remote address for session: %s", remote.toString(true).c_str()); + RING_DBG("New remote address for session: %s", remote.toString(true).c_str()); if (!(remoteIp_.isIpv4() && queue_.addDestination(static_cast<ost::IPV4Host>(remoteIp_), remoteIp_.getPort())) #if HAVE_IPV6 && !(remoteIp_.isIpv6() && queue_.addDestination(static_cast<ost::IPV6Host>(remoteIp_), remoteIp_.getPort())) #endif - ) SFL_WARN("Can't add new destination to session!"); + ) RING_WARN("Can't add new destination to session!"); } void AudioRtpSession::prepareRtpReceiveThread(const std::vector<AudioCodec*> &audioCodecs) { - SFL_DBG("Preparing receiving thread"); + RING_DBG("Preparing receiving thread"); isStarted_ = true; #ifdef RTP_DEBUG rxLast_ = std::chrono::high_resolution_clock::now(); @@ -336,13 +336,13 @@ void AudioRtpSession::putDtmfEvent(char digit) CachedAudioRtpState * AudioRtpSession::saveState() const { - SFL_ERR("Not implemented"); + RING_ERR("Not implemented"); return nullptr; } void AudioRtpSession::restoreState(const CachedAudioRtpState &state UNUSED) { - SFL_ERR("Not implemented"); + RING_ERR("Not implemented"); } } diff --git a/daemon/src/audio/audiortp/audio_rtp_session.h b/daemon/src/audio/audiortp/audio_rtp_session.h index ccdf15c5b57dfb92bfd537408fc0b37afedbb8a6..b999e68c4f9c26714d59142346383559bdd87019 100644 --- a/daemon/src/audio/audiortp/audio_rtp_session.h +++ b/daemon/src/audio/audiortp/audio_rtp_session.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Pierre-Luc Bacon <pierre-luc.bacon@savoirfairelinux.com> * Author: Alexandre Bourget <alexandre.bourget@savoirfairelinux.com> * Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com> @@ -48,7 +48,7 @@ class SIPCall; -namespace sfl { +namespace ring { class AudioCodec; class AudioRtpSession; diff --git a/daemon/src/audio/audiortp/audio_rtp_stream.cpp b/daemon/src/audio/audiortp/audio_rtp_stream.cpp index ee9fb1bed2b68a390e9594fd5305ae1c04104185..15f2f8403a8848aea42c18deb188d88c8ba822db 100644 --- a/daemon/src/audio/audiortp/audio_rtp_stream.cpp +++ b/daemon/src/audio/audiortp/audio_rtp_stream.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * Author: Adrien Beraud <adrien.beraud@wisdomvibes.com> * @@ -50,7 +50,7 @@ #include <algorithm> #include <cassert> -namespace sfl { +namespace ring { AudioRtpStream::AudioRtpStream(const std::string &id) : id_(id) @@ -93,22 +93,22 @@ bool AudioRtpStream::isDead() return dead_; } -sfl::AudioCodec * +ring::AudioCodec * AudioRtpStream::getCurrentEncoder() const { if (audioCodecs_.empty() or currentEncoderIndex_ >= audioCodecs_.size()) { - SFL_ERR("No codec found"); + RING_ERR("No codec found"); return nullptr; } return audioCodecs_[currentEncoderIndex_]; } -sfl::AudioCodec * +ring::AudioCodec * AudioRtpStream::getCurrentDecoder() const { if (audioCodecs_.empty() or currentDecoderIndex_ >= audioCodecs_.size()) { - SFL_ERR("No codec found"); + RING_ERR("No codec found"); return nullptr; } @@ -141,14 +141,14 @@ bool AudioRtpStream::tryToSwitchDecoder(int newPt) hasDynamicPayloadType_ = codec->hasDynamicPayload(); resetDecoderPLC(codec); currentDecoderIndex_ = i; // FIXME: this is not reliable - SFL_DBG("Switched payload type to %d", newPt); + RING_DBG("Switched payload type to %d", newPt); return true; } - SFL_ERR("Could not switch payload types"); + RING_ERR("Could not switch payload types"); return false; } -void AudioRtpStream::resetDecoderPLC(const sfl::AudioCodec * codec) +void AudioRtpStream::resetDecoderPLC(const ring::AudioCodec * codec) { if (!plcPool_) return; pj_pool_reset(plcPool_); @@ -243,7 +243,7 @@ void AudioRtpStream::setRtpMedia(const std::vector<AudioCodec*> &audioCodecs) if (audioCodecs.empty()) { codecEncMutex_.unlock(); codecDecMutex_.unlock(); - SFL_ERR("Audio codecs empty"); + RING_ERR("Audio codecs empty"); return; } @@ -317,7 +317,7 @@ size_t AudioRtpStream::processDataEncode() const size_t samples = Manager::instance().getRingBufferPool().getData(micData_, id_); if (samples != samplesToGet) { - SFL_ERR("Asked for %d samples from bindings on call '%s', got %d", + RING_ERR("Asked for %d samples from bindings on call '%s', got %d", samplesToGet, id_.c_str(), samples); return 0; } @@ -325,7 +325,7 @@ size_t AudioRtpStream::processDataEncode() AudioBuffer *out = &micData_; if (encoder_.format_.sample_rate != mainBuffFormat.sample_rate) { if (!encoder_.resampler_) { - SFL_ERR("Resampler already destroyed"); + RING_ERR("Resampler already destroyed"); return 0; } encoder_.resampledData_.setChannelNum(mainBuffFormat.nb_channels); @@ -344,7 +344,7 @@ size_t AudioRtpStream::processDataEncode() std::lock_guard<std::mutex> lock(codecEncMutex_); auto codec = getCurrentEncoder(); if (!codec) { - SFL_ERR("Audio codec already destroyed"); + RING_ERR("Audio codec already destroyed"); return 0; } @@ -373,7 +373,7 @@ void AudioRtpStream::processDataDecode(unsigned char *spkrData, size_t size, int if (not switched) { if (!warningInterval_) { warningInterval_ = 250; - SFL_WARN("Invalid payload type %d, expected %d", payloadType, decPt); + RING_WARN("Invalid payload type %d, expected %d", payloadType, decPt); } warningInterval_--; @@ -387,7 +387,7 @@ void AudioRtpStream::processDataDecode(unsigned char *spkrData, size_t size, int std::lock_guard<std::mutex> lock(codecDecMutex_); auto codec = getCurrentDecoder(); if (!codec) { - SFL_ERR("Audio codec already destroyed"); + RING_ERR("Audio codec already destroyed"); return; } if (spkrData) { // Packet is available @@ -421,7 +421,7 @@ void AudioRtpStream::processDataDecode(unsigned char *spkrData, size_t size, int AudioFormat mainBuffFormat = Manager::instance().getRingBufferPool().getInternalAudioFormat(); if (decFormat.sample_rate != mainBuffFormat.sample_rate) { if (!decoder_.resampler_) { - SFL_ERR("Resampler already destroyed"); + RING_ERR("Resampler already destroyed"); return; } decoder_.resampledData_.setChannelNum(decFormat.nb_channels); diff --git a/daemon/src/audio/audiortp/audio_rtp_stream.h b/daemon/src/audio/audiortp/audio_rtp_stream.h index 058356dcad9b8ea9258c07458501f18036149550..473f61e7251dc64f7c5d51aa7aca67ed611e9fe4 100644 --- a/daemon/src/audio/audiortp/audio_rtp_stream.h +++ b/daemon/src/audio/audiortp/audio_rtp_stream.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * Author: Adrien Beraud <adrien.beraud@wisdomvibes.com> * @@ -48,7 +48,7 @@ #include <atomic> #include <cstddef> -namespace sfl { +namespace ring { class Resampler; class DSP; @@ -145,12 +145,12 @@ class AudioRtpStream { std::shared_ptr<RingBuffer> ringbuffer_{}; void deleteCodecs(); - sfl::AudioCodec* getCurrentEncoder() const; - sfl::AudioCodec* getCurrentDecoder() const; + ring::AudioCodec* getCurrentEncoder() const; + ring::AudioCodec* getCurrentDecoder() const; // Decoder-specific methods bool tryToSwitchDecoder(int newPt); - void resetDecoderPLC(const sfl::AudioCodec *); + void resetDecoderPLC(const ring::AudioCodec *); std::vector<AudioCodec*> audioCodecs_; std::mutex codecEncMutex_; diff --git a/daemon/src/audio/audiortp/audio_srtp_session.cpp b/daemon/src/audio/audiortp/audio_srtp_session.cpp index 02f9c5e07f9f5bc6b3bd535ee4b79af864694a54..247727ba96cc7ec3e6b9d052860156eca223c59d 100644 --- a/daemon/src/audio/audiortp/audio_srtp_session.cpp +++ b/daemon/src/audio/audiortp/audio_srtp_session.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * Author: Pierre-Luc Bacon <pierre-luc.bacon@savoirfairelinux.com> * @@ -43,7 +43,7 @@ #define TOSTRING(x) STRINGIFY(x) #define THROW_ERROR(EXCEPTION_CLASS, M) throw EXCEPTION_CLASS(__FILE__ ":" TOSTRING(__LINE__) ":" M) -namespace sfl { +namespace ring { static std::string encodeBase64(unsigned char *input, int length) @@ -73,7 +73,7 @@ decodeBase64(unsigned char *input, int length) static void bufferFillMasterKey(std::vector<uint8_t>& dest) { - SFL_DBG("Init local master key"); + RING_DBG("Init local master key"); std::uniform_int_distribution<uint8_t> rand_byte(0, 255); // Fill the key @@ -87,7 +87,7 @@ bufferFillMasterKey(std::vector<uint8_t>& dest) static void bufferFillMasterSalt(std::vector<uint8_t>& dest) { - SFL_DBG("Init local master salt"); + RING_DBG("Init local master salt"); std::uniform_int_distribution<uint8_t> rand_byte(0, 255); // Fill the key @@ -123,7 +123,7 @@ AudioSrtpSession::~AudioSrtpSession() void AudioSrtpSession::initLocalCryptoInfo() { - SFL_DBG("AudioSrtpSession: Set cryptographic info for this rtp session"); + RING_DBG("AudioSrtpSession: Set cryptographic info for this rtp session"); // Initialize local Crypto context initializeLocalMasterKey(); @@ -138,7 +138,7 @@ void AudioSrtpSession::initLocalCryptoInfo() void AudioSrtpSession::initLocalCryptoInfoOnOffhold() { - SFL_DBG("AudioSrtpSession: Set cryptographic info for this rtp session"); + RING_DBG("AudioSrtpSession: Set cryptographic info for this rtp session"); // Initialize local Crypto context initializeLocalCryptoContext(); @@ -151,7 +151,7 @@ void AudioSrtpSession::initLocalCryptoInfoOnOffhold() std::vector<std::string> AudioSrtpSession::getLocalCryptoInfo() { - SFL_DBG("Get Cryptographic info from this rtp session"); + RING_DBG("Get Cryptographic info from this rtp session"); std::vector<std::string> crypto_vector; @@ -159,7 +159,7 @@ std::vector<std::string> AudioSrtpSession::getLocalCryptoInfo() // cryptographic context tagged 1, 2, 3... std::string tag = "1"; - std::string crypto_suite(sfl::CryptoSuites[localCryptoSuite_].name); + std::string crypto_suite(ring::CryptoSuites[localCryptoSuite_].name); // srtp keys formated as the following as the following // inline:keyParameters|keylifetime|MasterKeyIdentifier @@ -173,14 +173,14 @@ std::vector<std::string> AudioSrtpSession::getLocalCryptoInfo() crypto_attr += crypto_suite.append(" "); crypto_attr += srtp_keys; - SFL_DBG("%s", crypto_attr.c_str()); + RING_DBG("%s", crypto_attr.c_str()); crypto_vector.push_back(crypto_attr); return crypto_vector; } -void AudioSrtpSession::setRemoteCryptoInfo(const sfl::SdesNegotiator& nego) +void AudioSrtpSession::setRemoteCryptoInfo(const ring::SdesNegotiator& nego) { if (not remoteOfferIsSet_) { // Use second crypto suite if key length is 32 bit, default is 80; @@ -207,19 +207,19 @@ static const size_t BITS_PER_BYTE = 8; void AudioSrtpSession::initializeLocalMasterKey() { - localMasterKey_.resize(sfl::CryptoSuites[localCryptoSuite_].masterKeyLength / BITS_PER_BYTE); + localMasterKey_.resize(ring::CryptoSuites[localCryptoSuite_].masterKeyLength / BITS_PER_BYTE); bufferFillMasterKey(localMasterKey_); } void AudioSrtpSession::initializeLocalMasterSalt() { - localMasterSalt_.resize(sfl::CryptoSuites[localCryptoSuite_].masterSaltLength / BITS_PER_BYTE); + localMasterSalt_.resize(ring::CryptoSuites[localCryptoSuite_].masterSaltLength / BITS_PER_BYTE); bufferFillMasterSalt(localMasterSalt_); } std::string AudioSrtpSession::getBase64ConcatenatedKeys() { - SFL_DBG("Get base64 concatenated keys"); + RING_DBG("Get base64 concatenated keys"); // compute concatenated master and salt length std::vector<uint8> concatKeys; @@ -235,8 +235,8 @@ std::string AudioSrtpSession::getBase64ConcatenatedKeys() void AudioSrtpSession::unBase64ConcatenatedKeys(std::string base64keys) { - remoteMasterKey_.resize(sfl::CryptoSuites[remoteCryptoSuite_].masterKeyLength / BITS_PER_BYTE); - remoteMasterSalt_.resize(sfl::CryptoSuites[remoteCryptoSuite_].masterSaltLength / BITS_PER_BYTE); + remoteMasterKey_.resize(ring::CryptoSuites[remoteCryptoSuite_].masterKeyLength / BITS_PER_BYTE); + remoteMasterSalt_.resize(ring::CryptoSuites[remoteCryptoSuite_].masterSaltLength / BITS_PER_BYTE); // decode concatenated binary keys std::string output(decodeBase64((uint8_t *)base64keys.data(), base64keys.size())); @@ -255,9 +255,9 @@ void AudioSrtpSession::unBase64ConcatenatedKeys(std::string base64keys) void AudioSrtpSession::initializeRemoteCryptoContext() { - SFL_DBG("Initialize remote crypto context"); + RING_DBG("Initialize remote crypto context"); - const CryptoSuiteDefinition &crypto = sfl::CryptoSuites[remoteCryptoSuite_]; + const CryptoSuiteDefinition &crypto = ring::CryptoSuites[remoteCryptoSuite_]; if (remoteCryptoCtx_) removeInQueueCryptoContext(remoteCryptoCtx_); @@ -279,9 +279,9 @@ void AudioSrtpSession::initializeRemoteCryptoContext() void AudioSrtpSession::initializeLocalCryptoContext() { - SFL_DBG("Initialize local crypto context"); + RING_DBG("Initialize local crypto context"); - const CryptoSuiteDefinition &crypto = sfl::CryptoSuites[localCryptoSuite_]; + const CryptoSuiteDefinition &crypto = ring::CryptoSuites[localCryptoSuite_]; if (localCryptoCtx_) removeOutQueueCryptoContext(localCryptoCtx_); diff --git a/daemon/src/audio/audiortp/audio_srtp_session.h b/daemon/src/audio/audiortp/audio_srtp_session.h index 595f9e99b7d8890dfc1257cb4bc0f05400191e4a..459b976ce18a63c33326006509aa6167e01763cb 100644 --- a/daemon/src/audio/audiortp/audio_srtp_session.h +++ b/daemon/src/audio/audiortp/audio_srtp_session.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * Author: Pierre-Luc Bacon <pierre-luc.bacon@savoirfairelinux.com> * @@ -63,7 +63,7 @@ class SIPCall; +---------------------+-------------+--------------+---------------+ */ -namespace sfl { +namespace ring { struct AudioSrtpException : public std::runtime_error { AudioSrtpException(const char *msg) : std::runtime_error(msg) {} @@ -91,7 +91,7 @@ class AudioSrtpSession : public AudioSymmetricRtpSession { * Set remote crypto header from incoming sdp offer. It is expected that the * local cryptographic context is initialized with mehod */ - void setRemoteCryptoInfo(const sfl::SdesNegotiator &nego); + void setRemoteCryptoInfo(const ring::SdesNegotiator &nego); /** * Init local crypto context for outgoing data diff --git a/daemon/src/audio/audiortp/audio_symmetric_rtp_session.cpp b/daemon/src/audio/audiortp/audio_symmetric_rtp_session.cpp index 2155f281b690c0e8364b766c15957028e4cef1c3..222a20d1b3437183ec2755749cc88790539171de 100644 --- a/daemon/src/audio/audiortp/audio_symmetric_rtp_session.cpp +++ b/daemon/src/audio/audiortp/audio_symmetric_rtp_session.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Pierre-Luc Bacon <pierre-luc.bacon@savoirfairelinux.com> * Author: Alexandre Bourget <alexandre.bourget@savoirfairelinux.com> * Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com> @@ -38,13 +38,13 @@ #include "manager.h" #include "client/callmanager.h" -namespace sfl { +namespace ring { AudioSymmetricRtpSession::AudioSymmetricRtpSession(SIPCall &call) : ost::SymmetricRTPSession(static_cast<ost::IPV4Host>(call.getLocalIp()), call.getLocalAudioPort()) , AudioRtpSession(call, *this) { - SFL_DBG("Setting new RTP session with destination %s:%d", + RING_DBG("Setting new RTP session with destination %s:%d", call_.getLocalIp().toString().c_str(), call_.getLocalAudioPort()); } @@ -78,17 +78,17 @@ void AudioSymmetricRtpSession::onGotRR(ost::SyncSource& source, ost::RTCPCompoun { ost::SymmetricRTPSession::onGotRR(source, RR, blocks); #ifdef RTP_DEBUG - SFL_DBG("onGotRR"); - SFL_DBG("Unpacking %d blocks",blocks); + RING_DBG("onGotRR"); + RING_DBG("Unpacking %d blocks",blocks); for (int i = 0; i < blocks; ++i) { - SFL_DBG("fractionLost : %hhu", RR.blocks[i].rinfo.fractionLost); - SFL_DBG("lostMSB : %hhu", RR.blocks[i].rinfo.lostMSB); - SFL_DBG("lostLSW : %hu", RR.blocks[i].rinfo.lostLSW); - SFL_DBG("highestSeqNum : %u", RR.blocks[i].rinfo.highestSeqNum); - SFL_DBG("jitter : %u", RR.blocks[i].rinfo.jitter); - SFL_DBG("lsr : %u", RR.blocks[i].rinfo.lsr); - SFL_DBG("dlsr : %u", RR.blocks[i].rinfo.dlsr); + RING_DBG("fractionLost : %hhu", RR.blocks[i].rinfo.fractionLost); + RING_DBG("lostMSB : %hhu", RR.blocks[i].rinfo.lostMSB); + RING_DBG("lostLSW : %hu", RR.blocks[i].rinfo.lostLSW); + RING_DBG("highestSeqNum : %u", RR.blocks[i].rinfo.highestSeqNum); + RING_DBG("jitter : %u", RR.blocks[i].rinfo.jitter); + RING_DBG("lsr : %u", RR.blocks[i].rinfo.lsr); + RING_DBG("dlsr : %u", RR.blocks[i].rinfo.dlsr); } #endif } @@ -97,7 +97,7 @@ void AudioSymmetricRtpSession::onGotRR(ost::SyncSource& source, ost::RTCPCompoun void AudioSymmetricRtpSession::onGotSR(ost::SyncSource& source, ost::RTCPCompoundHandler::SendReport& SR, uint8 blocks) { #ifdef RTP_DEBUG - SFL_DBG("onGotSR"); + RING_DBG("onGotSR"); std::cout << "I got an SR RTCP report from " << std::hex << (int)source.getID() << "@" << std::dec @@ -148,19 +148,19 @@ void AudioSymmetricRtpSession::onGotSR(ost::SyncSource& source, ost::RTCPCompoun stats["DLSR"] = receiver_report.getDelayLastSR(); #ifdef RTP_DEBUG - SFL_DBG("lastSR NTPTimestamp : %lu", receiver_report.getLastSRNTPTimestampFrac() << 16); - SFL_DBG("NTPTimestampFrac : %lu", timestampFrac); - SFL_DBG("rttMSW : %u", rttMSW); - SFL_DBG("rttLSW : %u", rttLSW); - SFL_DBG("RTT recomposed: %lu", rtt); - SFL_DBG("LDSR: %lu", receiver_report.getDelayLastSR()); - SFL_DBG("Packet count : %u", stats["PACKET_COUNT"]); - SFL_DBG("Fraction packet loss : %.2f", (double) stats["PACKET_LOSS"] * 100 / 256); - SFL_DBG("Cumulative packet loss : %d", stats["CUMUL_PACKET_LOSS"]); - SFL_DBG("HighestSeqNum : %u", stats["HIGH_SEC_NUM"]); - SFL_DBG("Jitter : %u", stats["JITTER"]); - SFL_DBG("RTT : %.2f", (double) stats["RTT"] / 65536); - SFL_DBG("Delay since last report %.2f seconds", (double) stats["DLSR"] / 65536.0); + RING_DBG("lastSR NTPTimestamp : %lu", receiver_report.getLastSRNTPTimestampFrac() << 16); + RING_DBG("NTPTimestampFrac : %lu", timestampFrac); + RING_DBG("rttMSW : %u", rttMSW); + RING_DBG("rttLSW : %u", rttLSW); + RING_DBG("RTT recomposed: %lu", rtt); + RING_DBG("LDSR: %lu", receiver_report.getDelayLastSR()); + RING_DBG("Packet count : %u", stats["PACKET_COUNT"]); + RING_DBG("Fraction packet loss : %.2f", (double) stats["PACKET_LOSS"] * 100 / 256); + RING_DBG("Cumulative packet loss : %d", stats["CUMUL_PACKET_LOSS"]); + RING_DBG("HighestSeqNum : %u", stats["HIGH_SEC_NUM"]); + RING_DBG("Jitter : %u", stats["JITTER"]); + RING_DBG("RTT : %.2f", (double) stats["RTT"] / 65536); + RING_DBG("Delay since last report %.2f seconds", (double) stats["DLSR"] / 65536.0); #endif Manager::instance().getClient()->getCallManager()->onRtcpReportReceived(call_.getCallId(), stats); } @@ -172,7 +172,7 @@ AudioSymmetricRtpSessionIPv6::AudioSymmetricRtpSessionIPv6(SIPCall &call) : ost::SymmetricRTPSessionIPV6(static_cast<ost::IPV6Host>(call.getLocalIp()), call.getLocalAudioPort()) , AudioRtpSession(call, *this) { - SFL_DBG("Setting new RTP/IPv6 session with destination %s:%d", + RING_DBG("Setting new RTP/IPv6 session with destination %s:%d", call_.getLocalIp().toString().c_str(), call_.getLocalAudioPort()); } @@ -224,9 +224,9 @@ size_t AudioSymmetricRtpSessionIPv6::recvData(unsigned char* buffer, size_t len, ost::IPV4Host&, ost::tpport_t& port) { ost::IPV6Host hostv6 = call_.getLocalIp(); - SFL_ERR("recvData %d ", hostv6.getAddressCount()); + RING_ERR("recvData %d ", hostv6.getAddressCount()); size_t r = ost::SymmetricRTPSessionIPV6::recvData(buffer, len, hostv6, port); - SFL_ERR("recvData from %s %d called in ipv6 stack, size %d", IpAddr(hostv6.getAddress()).toString().c_str(), port, len); + RING_ERR("recvData from %s %d called in ipv6 stack, size %d", IpAddr(hostv6.getAddress()).toString().c_str(), port, len); return r; } @@ -235,7 +235,7 @@ AudioSymmetricRtpSessionIPv6::recvControl(unsigned char* buffer, size_t len, ost { ost::IPV6Host hostv6 = call_.getLocalIp(); size_t r = ost::SymmetricRTPSessionIPV6::recvControl(buffer, len, hostv6, port); - SFL_ERR("recvControl from %s %d called in ipv6 stack, size %d", IpAddr(hostv6.getAddress()).toString().c_str(), port, len); + RING_ERR("recvControl from %s %d called in ipv6 stack, size %d", IpAddr(hostv6.getAddress()).toString().c_str(), port, len); return r; } diff --git a/daemon/src/audio/audiortp/audio_symmetric_rtp_session.h b/daemon/src/audio/audiortp/audio_symmetric_rtp_session.h index 8cad4cb0c9c6d98d745fce86cfe4f7ff5c7dfa9f..b00ee519fe1229aaebe9fee687d0395d6d90db5b 100644 --- a/daemon/src/audio/audiortp/audio_symmetric_rtp_session.h +++ b/daemon/src/audio/audiortp/audio_symmetric_rtp_session.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Pierre-Luc Bacon <pierre-luc.bacon@savoirfairelinux.com> * Author: Alexandre Bourget <alexandre.bourget@savoirfairelinux.com> * Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com> @@ -47,7 +47,7 @@ class SIPCall; -namespace sfl { +namespace ring { class AudioSymmetricRtpSession : public ost::SymmetricRTPSession, public AudioRtpSession { public: diff --git a/daemon/src/audio/audiortp/audio_zrtp_session.cpp b/daemon/src/audio/audiortp/audio_zrtp_session.cpp index b2bd6fa75b7f5b93b8ecda8b2e2ef1f5f0736b3e..6b36ede425954b21e7785f706c77c44da0332150 100644 --- a/daemon/src/audio/audiortp/audio_zrtp_session.cpp +++ b/daemon/src/audio/audiortp/audio_zrtp_session.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * Author: Pierre-Luc Bacon <pierre-luc.bacon@savoirfairelinux.com> * @@ -39,7 +39,7 @@ #include "manager.h" #include "fileutils.h" -namespace sfl { +namespace ring { AudioZrtpSession::AudioZrtpSession(SIPCall &call, const std::string &zidFilename, const std::string &localIP) : @@ -55,7 +55,7 @@ AudioZrtpSession::AudioZrtpSession(SIPCall &call, const std::string &zidFilename { #endif initializeZid(); - SFL_DBG("Setting new RTP session with destination %s:%d", + RING_DBG("Setting new RTP session with destination %s:%d", localIP.c_str(), call_.getLocalAudioPort()); } @@ -98,7 +98,7 @@ void AudioZrtpSession::initializeZid() } #endif - SFL_DBG("Initialization from ZID file failed. Trying to remove..."); + RING_DBG("Initialization from ZID file failed. Trying to remove..."); if (remove(zidCompleteFilename.c_str()) != 0) throw ZrtpZidException("zid file deletion failed"); diff --git a/daemon/src/audio/audiortp/audio_zrtp_session.h b/daemon/src/audio/audiortp/audio_zrtp_session.h index 80b4c2c330f0cb2efe1706b0fde872db012d824e..1ea8eaa30159f2c48c0b3eeb70240a01964fba65 100644 --- a/daemon/src/audio/audiortp/audio_zrtp_session.h +++ b/daemon/src/audio/audiortp/audio_zrtp_session.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * Author: Pierre-Luc Bacon <pierre-luc.bacon@savoirfairelinux.com> * @@ -46,7 +46,7 @@ using std::ptrdiff_t; class SIPCall; class AudioCodec; -namespace sfl { +namespace ring { class ZrtpZidException : public std::runtime_error { public: diff --git a/daemon/src/audio/audiortp/avformat_rtp_session.cpp b/daemon/src/audio/audiortp/avformat_rtp_session.cpp index 7f127813d9ffdf2bd89a9b963d3d95e6af03c6ca..412eae00d8d92553f89e4b9a60270f05f20277cd 100644 --- a/daemon/src/audio/audiortp/avformat_rtp_session.cpp +++ b/daemon/src/audio/audiortp/avformat_rtp_session.cpp @@ -43,31 +43,31 @@ #include "manager.h" #include <sstream> -namespace sfl { -using sfl_video::SocketPair; -using sfl_video::VideoEncoder; -using sfl_video::VideoIOHandle; -using sfl_video::VideoEncoderException; +namespace ring { +using ring::video::SocketPair; +using ring::video::VideoEncoder; +using ring::video::VideoIOHandle; +using ring::video::VideoEncoderException; class AudioSender { public: AudioSender(const std::string& id, std::map<std::string, std::string> txArgs, - sfl_video::SocketPair& socketPair); + ring::video::SocketPair& socketPair); ~AudioSender(); private: NON_COPYABLE(AudioSender); bool waitForDataEncode(const std::chrono::milliseconds& max_wait) const; - bool setup(sfl_video::SocketPair& socketPair); + bool setup(ring::video::SocketPair& socketPair); std::string id_; std::map<std::string, std::string> args_; const AudioFormat format_; - std::unique_ptr<sfl_video::VideoEncoder> audioEncoder_; - std::unique_ptr<sfl_video::VideoIOHandle> muxContext_; - std::unique_ptr<sfl::Resampler> resampler_; + std::unique_ptr<ring::video::VideoEncoder> audioEncoder_; + std::unique_ptr<ring::video::VideoIOHandle> muxContext_; + std::unique_ptr<ring::Resampler> resampler_; const double secondsPerPacket_ {0.02}; // 20 ms ThreadLoop loop_; @@ -111,13 +111,13 @@ AudioSender::setup(SocketPair& socketPair) audioEncoder_->setIOContext(muxContext_); audioEncoder_->startIO(); } catch (const VideoEncoderException &e) { - SFL_ERR("%s", e.what()); + RING_ERR("%s", e.what()); return false; } std::string sdp; audioEncoder_->print_sdp(sdp); - SFL_WARN("\n%s", sdp.c_str()); + RING_WARN("\n%s", sdp.c_str()); return true; } @@ -148,7 +148,7 @@ AudioSender::process() micData.setChannelNum(format_.nb_channels, true); // down/upmix as needed if (samples != samplesToGet) { - SFL_ERR("Asked for %d samples from bindings on call '%s', got %d", + RING_ERR("Asked for %d samples from bindings on call '%s', got %d", samplesToGet, id_.c_str(), samples); return; } @@ -156,16 +156,16 @@ AudioSender::process() if (mainBuffFormat.sample_rate != format_.sample_rate) { if (not resampler_) { - SFL_DBG("Creating audio resampler"); + RING_DBG("Creating audio resampler"); resampler_.reset(new Resampler(format_)); } AudioBuffer resampledData(samplesToGet, format_); resampler_->resample(micData, resampledData); if (audioEncoder_->encode_audio(resampledData) < 0) - SFL_ERR("encoding failed"); + RING_ERR("encoding failed"); } else { if (audioEncoder_->encode_audio(micData) < 0) - SFL_ERR("encoding failed"); + RING_ERR("encoding failed"); } const int millisecondsPerPacket = secondsPerPacket_ * 1000; @@ -190,7 +190,7 @@ class AudioReceiveThread public: AudioReceiveThread(const std::string &id, const std::string &sdp); ~AudioReceiveThread(); - void addIOContext(sfl_video::SocketPair &socketPair); + void addIOContext(ring::video::SocketPair &socketPair); void startLoop(); private: @@ -211,10 +211,10 @@ class AudioReceiveThread /*-----------------------------------------------------------------*/ const std::string id_; std::istringstream stream_; - std::unique_ptr<sfl_video::VideoDecoder> audioDecoder_; - std::unique_ptr<sfl_video::VideoIOHandle> sdpContext_; - std::unique_ptr<sfl_video::VideoIOHandle> demuxContext_; - std::shared_ptr<sfl::RingBuffer> ringbuffer_; + std::unique_ptr<ring::video::VideoDecoder> audioDecoder_; + std::unique_ptr<ring::video::VideoIOHandle> sdpContext_; + std::unique_ptr<ring::video::VideoIOHandle> demuxContext_; + std::shared_ptr<ring::RingBuffer> ringbuffer_; ThreadLoop loop_; bool setup(); @@ -240,7 +240,7 @@ AudioReceiveThread::~AudioReceiveThread() bool AudioReceiveThread::setup() { - audioDecoder_.reset(new sfl_video::VideoDecoder()); + audioDecoder_.reset(new ring::video::VideoDecoder()); audioDecoder_->setInterruptCallback(interruptCb, this); // custom_io so the SDP demuxer will not open any UDP connections args_["sdp_flags"] = "custom_io"; @@ -262,32 +262,32 @@ AudioReceiveThread::setup() void AudioReceiveThread::process() { - sfl::AudioFormat mainBuffFormat = Manager::instance().getRingBufferPool().getInternalAudioFormat(); + ring::AudioFormat mainBuffFormat = Manager::instance().getRingBufferPool().getInternalAudioFormat(); std::unique_ptr<AVFrame, void(*)(AVFrame*)> decodedFrame(av_frame_alloc(), [](AVFrame*p){av_frame_free(&p);}); switch (audioDecoder_->decode_audio(decodedFrame.get())) { - case sfl_video::VideoDecoder::Status::FrameFinished: + case ring::video::VideoDecoder::Status::FrameFinished: audioDecoder_->writeToRingBuffer(decodedFrame.get(), *ringbuffer_, mainBuffFormat); return; - case sfl_video::VideoDecoder::Status::DecodeError: - SFL_WARN("decoding failure, trying to reset decoder..."); + case ring::video::VideoDecoder::Status::DecodeError: + RING_WARN("decoding failure, trying to reset decoder..."); if (not setup()) { - SFL_ERR("fatal error, rx thread re-setup failed"); + RING_ERR("fatal error, rx thread re-setup failed"); loop_.stop(); break; } if (not audioDecoder_->setupFromAudioData()) { - SFL_ERR("fatal error, a-decoder setup failed"); + RING_ERR("fatal error, a-decoder setup failed"); loop_.stop(); break; } break; - case sfl_video::VideoDecoder::Status::ReadError: - SFL_ERR("fatal error, read failed"); + case ring::video::VideoDecoder::Status::ReadError: + RING_ERR("fatal error, read failed"); loop_.stop(); break; @@ -353,35 +353,35 @@ AVFormatRtpSession::updateSDP(const Sdp& sdp) // if port has changed if (not desc.empty() and desc != receivingSDP_) { receivingSDP_ = desc; - SFL_WARN("Updated incoming SDP to:\n%s", + RING_WARN("Updated incoming SDP to:\n%s", receivingSDP_.c_str()); } if (desc.empty()) { - SFL_DBG("Audio is inactive"); + RING_DBG("Audio is inactive"); receiving_ = false; sending_ = false; } else if (desc.find("sendrecv") != std::string::npos) { - SFL_DBG("Sending and receiving audio"); + RING_DBG("Sending and receiving audio"); receiving_ = true; sending_ = true; } else if (desc.find("inactive") != std::string::npos) { - SFL_DBG("Audio is inactive"); + RING_DBG("Audio is inactive"); receiving_ = false; sending_ = false; } else if (desc.find("sendonly") != std::string::npos) { - SFL_DBG("Receiving audio disabled, audio set to sendonly"); + RING_DBG("Receiving audio disabled, audio set to sendonly"); receiving_ = false; sending_ = true; } else if (desc.find("recvonly") != std::string::npos) { - SFL_DBG("Sending audio disabled, audio set to recvonly"); + RING_DBG("Sending audio disabled, audio set to recvonly"); sending_ = false; receiving_ = true; } // even if it says sendrecv or recvonly, our peer may disable audio by // setting the port to 0 if (desc.find("m=audio 0") != std::string::npos) { - SFL_DBG("Receiving audio disabled, port was set to 0"); + RING_DBG("Receiving audio disabled, port was set to 0"); receiving_ = false; } @@ -396,7 +396,7 @@ AVFormatRtpSession::updateDestination(const std::string& destination, std::lock_guard<std::recursive_mutex> lock(mutex_); if (destination.empty()) { - SFL_WARN("Destination is empty, ignoring"); + RING_WARN("Destination is empty, ignoring"); return; } @@ -406,15 +406,15 @@ AVFormatRtpSession::updateDestination(const std::string& destination, // if destination has changed if (tmp.str() != txArgs_["destination"]) { if (sender_) { - SFL_WARN("Audio is already being sent"); + RING_WARN("Audio is already being sent"); return; } txArgs_["destination"] = tmp.str(); - SFL_DBG("updated dest to %s", txArgs_["destination"].c_str()); + RING_DBG("updated dest to %s", txArgs_["destination"].c_str()); } if (port == 0) { - SFL_DBG("Sending audio disabled, port was set to 0"); + RING_DBG("Sending audio disabled, port was set to 0"); sending_ = false; } } @@ -426,12 +426,12 @@ AVFormatRtpSession::startSender() return; if (sender_) - SFL_WARN("Restarting audio sender"); + RING_WARN("Restarting audio sender"); try { sender_.reset(new AudioSender(id_, txArgs_, *socketPair_)); } catch (const VideoEncoderException &e) { - SFL_ERR("%s", e.what()); + RING_ERR("%s", e.what()); sending_ = false; } } @@ -441,12 +441,12 @@ AVFormatRtpSession::startReceiver() { if (receiving_) { if (receiveThread_) - SFL_WARN("restarting video receiver"); + RING_WARN("restarting video receiver"); receiveThread_.reset(new AudioReceiveThread(id_, receivingSDP_)); receiveThread_->addIOContext(*socketPair_); receiveThread_->startLoop(); } else { - SFL_DBG("Audio receiving disabled"); + RING_DBG("Audio receiving disabled"); receiveThread_.reset(); } } @@ -464,7 +464,7 @@ AVFormatRtpSession::start(int localPort) try { socketPair_.reset(new SocketPair(txArgs_["destination"].c_str(), localPort)); } catch (const std::runtime_error &e) { - SFL_ERR("Socket creation failed on port %d: %s", localPort, e.what()); + RING_ERR("Socket creation failed on port %d: %s", localPort, e.what()); return; } @@ -502,4 +502,4 @@ AVFormatRtpSession::stop() socketPair_.reset(); } -} // end namespace sfl +} // end namespace ring diff --git a/daemon/src/audio/audiortp/avformat_rtp_session.h b/daemon/src/audio/audiortp/avformat_rtp_session.h index b94c00e6625e6db8f8c950315fba1eb6e921d3aa..1d1fef0336e85da9d28636b4a6ae1bfe963d9d69 100644 --- a/daemon/src/audio/audiortp/avformat_rtp_session.h +++ b/daemon/src/audio/audiortp/avformat_rtp_session.h @@ -40,15 +40,15 @@ #include <memory> #include <mutex> -namespace sfl_video { +namespace ring { namespace video { class SocketPair; class VideoEncoder; -} +}} class Sdp; class ThreadLoop; -namespace sfl { +namespace ring { class RingBuffer; class Resampler; @@ -78,10 +78,10 @@ class AVFormatRtpSession { std::string id_; std::map<std::string, std::string> txArgs_; std::string receivingSDP_; - std::unique_ptr<sfl_video::SocketPair> socketPair_; + std::unique_ptr<ring::video::SocketPair> socketPair_; std::unique_ptr<AudioSender> sender_; std::unique_ptr<AudioReceiveThread> receiveThread_; - std::shared_ptr<sfl::RingBuffer> ringbuffer_; + std::shared_ptr<ring::RingBuffer> ringbuffer_; std::recursive_mutex mutex_; bool sending_; bool receiving_; diff --git a/daemon/src/audio/audiortp/base64.c b/daemon/src/audio/audiortp/base64.c index a504cc54b11976c8c0b94bf21e28188f5522f71e..5c1a916aafa90be6ddf39e6eb880f12237d74bda 100644 --- a/daemon/src/audio/audiortp/base64.c +++ b/daemon/src/audio/audiortp/base64.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2014 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * * 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 diff --git a/daemon/src/audio/audiortp/base64.h b/daemon/src/audio/audiortp/base64.h index a80fdc91fe53283ecf8dd33ae79605d7a5559864..f67138248d8ac725ffd633ef762386bef2fe035e 100644 --- a/daemon/src/audio/audiortp/base64.h +++ b/daemon/src/audio/audiortp/base64.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2014 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * * 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 diff --git a/daemon/src/audio/audiortp/dtmf_event.cpp b/daemon/src/audio/audiortp/dtmf_event.cpp index f6b7d120bd2e7426734007ff5473b216938cfdd5..77635b96b942f9a26f7266369c33dbd79e31e98f 100644 --- a/daemon/src/audio/audiortp/dtmf_event.cpp +++ b/daemon/src/audio/audiortp/dtmf_event.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -30,7 +30,7 @@ #include "dtmf_event.h" #include "logger.h" -namespace sfl { +namespace ring { DTMFEvent::DTMFEvent(char digit) : payload(), newevent(true), length(1000) { @@ -68,7 +68,7 @@ DTMFEvent::DTMFEvent(char digit) : payload(), newevent(true), length(1000) break; default: - SFL_ERR("Unexpected DTMF %c", digit); + RING_ERR("Unexpected DTMF %c", digit); } payload.event = digit; diff --git a/daemon/src/audio/audiortp/dtmf_event.h b/daemon/src/audio/audiortp/dtmf_event.h index 2394404389f83d320fddce5acb3925322494ffa5..560ae6ab7c61c23b19bff62d762d8b04703084a0 100644 --- a/daemon/src/audio/audiortp/dtmf_event.h +++ b/daemon/src/audio/audiortp/dtmf_event.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -32,7 +32,7 @@ #include <ccrtp/rtp.h> -namespace sfl { +namespace ring { struct DTMFEvent { DTMFEvent(char digit); diff --git a/daemon/src/audio/audiortp/zrtp_session_callback.cpp b/daemon/src/audio/audiortp/zrtp_session_callback.cpp index 5ad948f3f016fc1a795fe4fd3701d22710a29782..8e7a22ab37714fe48400500f61d63df1fcdd7560 100644 --- a/daemon/src/audio/audiortp/zrtp_session_callback.cpp +++ b/daemon/src/audio/audiortp/zrtp_session_callback.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Pierre-Luc Bacon <pierre-luc.bacon@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -41,7 +41,7 @@ using namespace GnuZrtpCodes; using namespace ost; -namespace sfl { +namespace ring { ZrtpSessionCallback::ZrtpSessionCallback(SIPCall &call) : call_(call) { @@ -103,28 +103,28 @@ ZrtpSessionCallback::ZrtpSessionCallback(SIPCall &call) : call_(call) void ZrtpSessionCallback::secureOn(std::string cipher) { - SFL_DBG("Secure mode is on with cipher %s", cipher.c_str()); + RING_DBG("Secure mode is on with cipher %s", cipher.c_str()); Manager::instance().getClient()->getCallManager()->secureZrtpOn(call_.getCallId(), cipher); } void ZrtpSessionCallback::secureOff() { - SFL_DBG("Secure mode is off"); + RING_DBG("Secure mode is off"); Manager::instance().getClient()->getCallManager()->secureZrtpOff(call_.getCallId()); } void ZrtpSessionCallback::showSAS(std::string sas, bool verified) { - SFL_DBG("SAS is: %s", sas.c_str()); + RING_DBG("SAS is: %s", sas.c_str()); Manager::instance().getClient()->getCallManager()->showSAS(call_.getCallId(), sas, verified); } void ZrtpSessionCallback::zrtpNotSuppOther() { - SFL_DBG("Callee does not support ZRTP"); + RING_DBG("Callee does not support ZRTP"); Manager::instance().getClient()->getCallManager()->zrtpNotSuppOther(call_.getCallId()); } @@ -133,9 +133,9 @@ ZrtpSessionCallback::showMessage(GnuZrtpCodes::MessageSeverity sev, int32_t subC { if (sev == ZrtpError) { if (subCode < 0) { // received an error packet from peer - SFL_DBG("Received an error packet from peer:"); + RING_DBG("Received an error packet from peer:"); } else - SFL_DBG("Sent error packet to peer:"); + RING_DBG("Sent error packet to peer:"); } } @@ -145,21 +145,21 @@ ZrtpSessionCallback::zrtpNegotiationFailed(MessageSeverity severity, int subCode if (severity == ZrtpError) { if (subCode < 0) { // received an error packet from peer subCode *= -1; - SFL_DBG("Received error packet: "); + RING_DBG("Received error packet: "); } else - SFL_DBG("Sent error packet: "); + RING_DBG("Sent error packet: "); std::map<int32, std::string>::const_iterator iter = zrtpMap_.find(subCode); if (iter != zrtpMap_.end()) { - SFL_DBG("%s", iter->second.c_str()); + RING_DBG("%s", iter->second.c_str()); Manager::instance().getClient()->getCallManager()->zrtpNegotiationFailed(call_.getCallId(), iter->second, "ZRTP"); } } else { std::map<int32, std::string>::const_iterator iter = severeMap_.find(subCode); if (iter != severeMap_.end()) { - SFL_DBG("%s", iter->second.c_str()); + RING_DBG("%s", iter->second.c_str()); Manager::instance().getClient()->getCallManager()->zrtpNegotiationFailed(call_.getCallId(), iter->second, "severe"); } } @@ -168,7 +168,7 @@ ZrtpSessionCallback::zrtpNegotiationFailed(MessageSeverity severity, int subCode void ZrtpSessionCallback::confirmGoClear() { - SFL_DBG("Received go clear message. Until confirmation, ZRTP won't send any data"); + RING_DBG("Received go clear message. Until confirmation, ZRTP won't send any data"); Manager::instance().getClient()->getCallManager()->zrtpNotSuppOther(call_.getCallId()); } diff --git a/daemon/src/audio/audiortp/zrtp_session_callback.h b/daemon/src/audio/audiortp/zrtp_session_callback.h index f109114c7e24761e118e873c337da281acc43a74..d0fcedfb697916c84880ff7a4949ef6fa932e790 100644 --- a/daemon/src/audio/audiortp/zrtp_session_callback.h +++ b/daemon/src/audio/audiortp/zrtp_session_callback.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Pierre-Luc Bacon <pierre-luc.bacon@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -42,7 +42,7 @@ using std::ptrdiff_t; class SIPCall; -namespace sfl { +namespace ring { class ZrtpSessionCallback: public ZrtpUserCallback { public: diff --git a/daemon/src/audio/codecs/alaw.cpp b/daemon/src/audio/codecs/alaw.cpp index 99da540559d38b7a4a487222a5239c88753fe3de..eed361f66f295c22d2c3bd3c7aff07b36867f329 100644 --- a/daemon/src/audio/codecs/alaw.cpp +++ b/daemon/src/audio/codecs/alaw.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Yan Morin <yan.morin@savoirfairelinux.com> * Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com> * @@ -34,11 +34,11 @@ #include "ring_plugin.h" #include "g711.h" -class Alaw : public sfl::AudioCodec { +class Alaw : public ring::AudioCodec { public: // 8 PCMA A 8000 1 [RFC3551] - Alaw() : sfl::AudioCodec(8, "PCMA", 8000, 160, 1) { + Alaw() : ring::AudioCodec(8, "PCMA", 8000, 160, 1) { bitrate_ = 64; hasDynamicPayload_ = false; } diff --git a/daemon/src/audio/codecs/audiocodec.cpp b/daemon/src/audio/codecs/audiocodec.cpp index 7508143f3a8a703d408db7e7893943a725c15db2..5b8093ba3a7c06828296c8f29bbee60df4293aa3 100644 --- a/daemon/src/audio/codecs/audiocodec.cpp +++ b/daemon/src/audio/codecs/audiocodec.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * * Mostly borrowed from asterisk's sources (Steve Underwood <steveu@coppice.org>) @@ -34,7 +34,7 @@ #include <cassert> using std::ptrdiff_t; -namespace sfl { +namespace ring { AudioCodec::AudioCodec(uint8_t payload, const std::string &codecName, uint32_t clockRate, unsigned frameSize, uint8_t channels) : codecName_(codecName), @@ -149,4 +149,4 @@ AudioCodec::getSDPChannels() const return ""; } -} // end namespace sfl +} // end namespace ring diff --git a/daemon/src/audio/codecs/audiocodec.h b/daemon/src/audio/codecs/audiocodec.h index a5e42a74528e5a2d3eec7903d16c3e9e9b4f5cae..b55d626fd6638df9e63f2c90d975e452f416246a 100644 --- a/daemon/src/audio/codecs/audiocodec.h +++ b/daemon/src/audio/codecs/audiocodec.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * * Mostly borrowed from asterisk's sources (Steve Underwood <steveu@coppice.org>) @@ -42,7 +42,7 @@ // opus_decode will not be capable of decoding some packets." #define RAW_BUFFER_SIZE (120 * 48000 / 1000) -namespace sfl { +namespace ring { class AudioCodec { public: @@ -190,7 +190,7 @@ class AudioCodec { AudioCodec& operator=(const AudioCodec&); }; -} // end namespace sfl +} // end namespace ring /** Enumeration that contains known audio payloads */ diff --git a/daemon/src/audio/codecs/audiocodecfactory.cpp b/daemon/src/audio/codecs/audiocodecfactory.cpp index 185eafea600d587e305d66a3707c11d8b81c2245..003a2bc135cd566769271e0d91e9a8ef35c60003 100644 --- a/daemon/src/audio/codecs/audiocodecfactory.cpp +++ b/daemon/src/audio/codecs/audiocodecfactory.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Yan Morin <yan.morin@savoirfairelinux.com> * Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com> * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> @@ -58,7 +58,7 @@ AudioCodecFactory::AudioCodecFactory(PluginManager& pluginManager) * with our C++ binding by providing 'this' access. */ const auto callback = [this](void* data) { - if (auto codec = reinterpret_cast<sfl::AudioCodec*>(data)) { + if (auto codec = reinterpret_cast<ring::AudioCodec*>(data)) { this->registerAudioCodec(codec); return 0; } @@ -69,7 +69,7 @@ AudioCodecFactory::AudioCodecFactory(PluginManager& pluginManager) scanCodecDirectory(); if (codecsMap_.empty()) - SFL_ERR("No codecs available"); + RING_ERR("No codecs available"); } AudioCodecFactory::~AudioCodecFactory() @@ -78,10 +78,10 @@ AudioCodecFactory::~AudioCodecFactory() } void -AudioCodecFactory::registerAudioCodec(sfl::AudioCodec* codec) +AudioCodecFactory::registerAudioCodec(ring::AudioCodec* codec) { - codecsMap_[(int) codec->getPayloadType()] = std::shared_ptr<sfl::AudioCodec>(codec); - SFL_DBG("Loaded codec %s" , codec->getMimeSubtype().c_str()); + codecsMap_[(int) codec->getPayloadType()] = std::shared_ptr<ring::AudioCodec>(codec); + RING_DBG("Loaded codec %s" , codec->getMimeSubtype().c_str()); } void @@ -114,17 +114,17 @@ AudioCodecFactory::getCodecList() const return list; } -std::shared_ptr<sfl::AudioCodec> +std::shared_ptr<ring::AudioCodec> AudioCodecFactory::getCodec(int payload) const { const auto iter = codecsMap_.find(payload); if (iter != codecsMap_.end()) return iter->second; - SFL_ERR("Cannot find codec %i", payload); + RING_ERR("Cannot find codec %i", payload); return nullptr; } -std::shared_ptr<sfl::AudioCodec> +std::shared_ptr<ring::AudioCodec> AudioCodecFactory::getCodec(const std::string &name) const { for (const auto& item : codecsMap_) { @@ -139,14 +139,14 @@ AudioCodecFactory::getCodec(const std::string &name) const os << "/" << channels; const std::string match(codec->getMimeSubtype() + os.str()); - SFL_DBG("Trying %s", match.c_str()); + RING_DBG("Trying %s", match.c_str()); if (name.find(match) != std::string::npos) { - SFL_DBG("Found match"); + RING_DBG("Found match"); return codec; } } - SFL_ERR("Cannot find codec %s", name.c_str()); + RING_ERR("Cannot find codec %s", name.c_str()); return nullptr; } @@ -215,7 +215,7 @@ AudioCodecFactory::scanCodecDirectory() } for (const auto& dirStr : dirToScan) { - SFL_DBG("Scanning %s to find audio codecs....", dirStr.c_str()); + RING_DBG("Scanning %s to find audio codecs....", dirStr.c_str()); DIR *dir = opendir(dirStr.c_str()); if (!dir) @@ -236,7 +236,7 @@ AudioCodecFactory::scanCodecDirectory() } } -sfl::AudioCodec* +ring::AudioCodec* AudioCodecFactory::instantiateCodec(int payload) const { for (const auto& item : codecsMap_) { @@ -245,7 +245,7 @@ AudioCodecFactory::instantiateCodec(int payload) const try { return codec->clone(); } catch (const std::runtime_error &e) { - SFL_ERR("%s", e.what()); + RING_ERR("%s", e.what()); return nullptr; } } @@ -268,7 +268,7 @@ AudioCodecFactory::seemsValid(const std::string &lib) return false; // Second: check the extension of the file name. - // If it is different than SFL_CODEC_VALID_EXTEN , not a SFL shared library + // If it is different than RING_CODEC_VALID_EXTEN , not a SFL shared library if (lib.substr(lib.length() - suffix.length(), lib.length()) != suffix) return false; @@ -293,7 +293,7 @@ AudioCodecFactory::seemsValid(const std::string &lib) }; const std::string name(lib.substr(prefix.length(), len)); - const std::string *end = validCodecs + SFL_ARRAYSIZE(validCodecs); + const std::string *end = validCodecs + RING_ARRAYSIZE(validCodecs); return find(validCodecs, end, name) != end; } diff --git a/daemon/src/audio/codecs/audiocodecfactory.h b/daemon/src/audio/codecs/audiocodecfactory.h index c96d3d79a5cb6bf7f912ea192ea59dfd42599a86..af3bac2606e276641ce5afe8db5b3288a4ba5a7a 100644 --- a/daemon/src/audio/codecs/audiocodecfactory.h +++ b/daemon/src/audio/codecs/audiocodecfactory.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Yan Morin <yan.morin@savoirfairelinux.com> * Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com> * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> @@ -67,14 +67,14 @@ class AudioCodecFactory { * @param payload The payload looked for * @return A shared pointer on a AudioCodec object */ - std::shared_ptr<sfl::AudioCodec> getCodec(int payload) const; + std::shared_ptr<ring::AudioCodec> getCodec(int payload) const; /** * Get the codec object associated with the codec attribute * @param string The name to compare, should be in the form speex/16000 * @return A shared pointer to an AudioCodec object */ - std::shared_ptr<sfl::AudioCodec> getCodec(const std::string &name) const; + std::shared_ptr<ring::AudioCodec> getCodec(const std::string &name) const; /** * Set the default codecs order. @@ -113,7 +113,7 @@ class AudioCodecFactory { * Instantiate a codec, used in AudioRTP to get an instance of Codec per call * @param CodecHandlePointer The map containing the pointer on the object and the pointer on the handle function */ - sfl::AudioCodec* instantiateCodec(int payload) const; + ring::AudioCodec* instantiateCodec(int payload) const; /** * For a given codec, return its specification @@ -135,7 +135,7 @@ class AudioCodecFactory { PluginManager& pluginManager_; /** Maps a pointer on an audiocodec object to a payload */ - typedef std::map<Id, std::shared_ptr<sfl::AudioCodec>> AudioCodecsMap; + typedef std::map<Id, std::shared_ptr<ring::AudioCodec>> AudioCodecsMap; /** * Scan the installation directory ( --prefix configure option ) @@ -147,7 +147,7 @@ class AudioCodecFactory { * Add a new audiocodec to the system. * @note Steals the ownership on given codec. */ - void registerAudioCodec(sfl::AudioCodec* codec); + void registerAudioCodec(ring::AudioCodec* codec); /** * Check if the files found in searched directories seems valid diff --git a/daemon/src/audio/codecs/g722.cpp b/daemon/src/audio/codecs/g722.cpp index b1ddf6e48d5ea4886ae10360710ca4f29d93e104..416127e2edab5e510e6dd2022b8d22c960c4bf65 100644 --- a/daemon/src/audio/codecs/g722.cpp +++ b/daemon/src/audio/codecs/g722.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * * Mostly borrowed from asterisk's sources (Steve Underwood <steveu@coppice.org>) @@ -40,10 +40,10 @@ #include <cstring> #include <iostream> -class G722 : public sfl::AudioCodec { +class G722 : public ring::AudioCodec { public: - G722() : sfl::AudioCodec(9, "G722", 16000, 320, 1), decode_state_(), + G722() : ring::AudioCodec(9, "G722", 16000, 320, 1), decode_state_(), encode_state_() { bitrate_ = 64; hasDynamicPayload_ = false; diff --git a/daemon/src/audio/codecs/g722.h b/daemon/src/audio/codecs/g722.h index 34b05ff08d44dfda5380aaf7697743d1c4d55a76..79146390f843b8c8ba50136abdaa01885508efdd 100644 --- a/daemon/src/audio/codecs/g722.h +++ b/daemon/src/audio/codecs/g722.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * * Mostly borrowed from asterisk's sources (Steve Underwood <steveu@coppice.org>) diff --git a/daemon/src/audio/codecs/g729.cpp b/daemon/src/audio/codecs/g729.cpp index 1653ce15cf2bf79b1800494916a46922294e4249..b1efbc05d01926cc9d9e490004082aac1ab3f629 100644 --- a/daemon/src/audio/codecs/g729.cpp +++ b/daemon/src/audio/codecs/g729.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Emmanuel Lepage <emmanuel.lepage@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -43,7 +43,7 @@ static const int G729_PAYLOAD_TYPE = 18; -G729::G729() : sfl::AudioCodec(G729_PAYLOAD_TYPE, "G729", 8000, 160, 1), +G729::G729() : ring::AudioCodec(G729_PAYLOAD_TYPE, "G729", 8000, 160, 1), decoderContext_(0), encoderContext_(0), handler_(0), @@ -75,7 +75,7 @@ G729::~G729() dlclose(handler_); } -sfl::AudioCodec * +ring::AudioCodec * G729::clone() { return new G729; diff --git a/daemon/src/audio/codecs/g729.h b/daemon/src/audio/codecs/g729.h index d8aa6d63e18bc2d4f6e6adb4e9581743e1290bf6..86b7a4075b3029251501ea4e0510aed8d709a174 100644 --- a/daemon/src/audio/codecs/g729.h +++ b/daemon/src/audio/codecs/g729.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Emmanuel Lepage <emmanuel.lepage@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -39,7 +39,7 @@ class bcg729DecoderChannelContextStruct; class bcg729EncoderChannelContextStruct; -class G729 : public sfl::AudioCodec { +class G729 : public ring::AudioCodec { public: G729(); ~G729(); diff --git a/daemon/src/audio/codecs/gsmcodec.cpp b/daemon/src/audio/codecs/gsmcodec.cpp index 55981b0ac85cdfdd51079ef6de0df9e5c532af66..4c834a070539082f3914c5ee9b88e4b5cb6ae80d 100644 --- a/daemon/src/audio/codecs/gsmcodec.cpp +++ b/daemon/src/audio/codecs/gsmcodec.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Yan Morin <yan.morin@savoirfairelinux.com> * Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com> * @@ -46,11 +46,11 @@ extern "C" { * GSM audio codec C++ class (over gsm/gsm.h) */ -class Gsm : public sfl::AudioCodec { +class Gsm : public ring::AudioCodec { public: // _payload should be 3 - Gsm() : sfl::AudioCodec(3, "GSM", 8000, 160, 1), + Gsm() : ring::AudioCodec(3, "GSM", 8000, 160, 1), decode_gsmhandle_(NULL), encode_gsmhandle_(NULL) { bitrate_ = 13.3; hasDynamicPayload_ = false; diff --git a/daemon/src/audio/codecs/ilbc.cpp b/daemon/src/audio/codecs/ilbc.cpp index 3fc0d05ba8eb5a91876d9c87f209dcad1eaccb7d..8bb64b049d6a5956ba28717f0b1d0b0b46e2fbe3 100644 --- a/daemon/src/audio/codecs/ilbc.cpp +++ b/daemon/src/audio/codecs/ilbc.cpp @@ -36,10 +36,10 @@ extern "C" { #include <ilbc.h> } -class Ilbc: public sfl::AudioCodec { +class Ilbc: public ring::AudioCodec { public: Ilbc() : - sfl::AudioCodec(ILBC_PAYLOAD, "iLBC", 8000, ILBC_FRAME_SIZE, 1), + ring::AudioCodec(ILBC_PAYLOAD, "iLBC", 8000, ILBC_FRAME_SIZE, 1), ilbc_dec_(), ilbc_enc_() { bitrate_ = 13.3; @@ -74,12 +74,12 @@ class Ilbc: public sfl::AudioCodec { }; // the class factories -extern "C" sfl::AudioCodec* AUDIO_CODEC_ENTRY() +extern "C" ring::AudioCodec* AUDIO_CODEC_ENTRY() { return new Ilbc; } -extern "C" void destroy(sfl::AudioCodec* a) +extern "C" void destroy(ring::AudioCodec* a) { delete a; } diff --git a/daemon/src/audio/codecs/opuscodec.cpp b/daemon/src/audio/codecs/opuscodec.cpp index f3d8de6a720486c1c0479637fcec7469b522ea2f..0dfe3c9d8891c2aa60649cfa5bb45775995c30db 100644 --- a/daemon/src/audio/codecs/opuscodec.cpp +++ b/daemon/src/audio/codecs/opuscodec.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Emmanuel Lepage <emmanuel.lepage@savoirfairelinux.com> * Author: Adrien Beraud <adrien.beraud@wisdomvibes.com> * @@ -38,7 +38,7 @@ constexpr uint32_t Opus::VALID_SAMPLING_RATE[]; -Opus::Opus() : sfl::AudioCodec(PAYLOAD_TYPE, "opus", CLOCK_RATE, FRAME_SIZE, CHANNELS), +Opus::Opus() : ring::AudioCodec(PAYLOAD_TYPE, "opus", CLOCK_RATE, FRAME_SIZE, CHANNELS), encoder_(nullptr), decoder_(nullptr), lastDecodedFrameSize_(0) @@ -55,7 +55,7 @@ Opus::~Opus() opus_decoder_destroy(decoder_); } -sfl::AudioCodec * +ring::AudioCodec * Opus::clone() { return new Opus; diff --git a/daemon/src/audio/codecs/opuscodec.h b/daemon/src/audio/codecs/opuscodec.h index c79529a125eaa378569032041f62f2efbe0d8c4a..7543d73da8162c26b28cfff7153806143a741964 100644 --- a/daemon/src/audio/codecs/opuscodec.h +++ b/daemon/src/audio/codecs/opuscodec.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Emmanuel Lepage <emmanuel.lepage@savoirfairelinux.com> * Author: Adrien Beraud <adrien.beraud@wisdomvibes.com> * @@ -38,7 +38,7 @@ #include <opus.h> -class Opus : public sfl::AudioCodec { +class Opus : public ring::AudioCodec { public: Opus(); ~Opus(); @@ -50,7 +50,7 @@ public: } private: - sfl::AudioCodec * clone(); + ring::AudioCodec * clone(); virtual int decode(std::vector<std::vector<SFLAudioSample> > &pcm, const uint8_t *data, size_t len); virtual int decode(std::vector<std::vector<SFLAudioSample> > &pcm); diff --git a/daemon/src/audio/codecs/speexcodec.cpp b/daemon/src/audio/codecs/speexcodec.cpp index 009a79b54305df170979021ce7441b40e53416a1..c730dd32d01c6a69d195aa157039fa15c3c8646c 100644 --- a/daemon/src/audio/codecs/speexcodec.cpp +++ b/daemon/src/audio/codecs/speexcodec.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * diff --git a/daemon/src/audio/codecs/speexcodec.h b/daemon/src/audio/codecs/speexcodec.h index 187828efc0fa227fa716bc4a12139eac100d9551..37235c3f59304a0ea4df5bd9b29cd8617b95cc2f 100644 --- a/daemon/src/audio/codecs/speexcodec.h +++ b/daemon/src/audio/codecs/speexcodec.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * @@ -36,11 +36,11 @@ #include <speex/speex.h> #include <cassert> -class Speex : public sfl::AudioCodec { +class Speex : public ring::AudioCodec { public: Speex(int payload, unsigned clockRate, unsigned frameSize, unsigned bitRate, bool dynamicPayload, const SpeexMode *mode) : - sfl::AudioCodec(payload, "speex", clockRate, frameSize, 1), + ring::AudioCodec(payload, "speex", clockRate, frameSize, 1), speex_dec_bits_(), speex_enc_bits_(), speex_dec_state_(0), diff --git a/daemon/src/audio/codecs/ulaw.cpp b/daemon/src/audio/codecs/ulaw.cpp index 1ce343a6019b91c637fa6bed0ce8b0cb846e7697..962cd51a8657f06f2a5043f7fc6c70514e703524 100644 --- a/daemon/src/audio/codecs/ulaw.cpp +++ b/daemon/src/audio/codecs/ulaw.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Yan Morin <yan.morin@savoirfairelinux.com> * Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com> * @@ -34,10 +34,10 @@ #include "ring_plugin.h" #include "g711.h" -class Ulaw : public sfl::AudioCodec { +class Ulaw : public ring::AudioCodec { public: // 0 PCMU A 8000 1 [RFC3551] - Ulaw() : sfl::AudioCodec(0, "PCMU", 8000, 160, 1) { + Ulaw() : ring::AudioCodec(0, "PCMU", 8000, 160, 1) { bitrate_ = 64; hasDynamicPayload_ = false; } diff --git a/daemon/src/audio/coreaudio/audiodevice.cpp b/daemon/src/audio/coreaudio/audiodevice.cpp index a138e8182e541dce7d95070a6386ec9adacd7f70..aed4e1ede85b1fa7c902a14e4b64d2d2406ea13f 100644 --- a/daemon/src/audio/coreaudio/audiodevice.cpp +++ b/daemon/src/audio/coreaudio/audiodevice.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Philippe Groarke <philippe.groarke@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -30,7 +30,7 @@ #include "audiodevice.h" -namespace sfl { +namespace ring { AudioDevice::AudioDevice(AudioDeviceID devid, bool isInput) { diff --git a/daemon/src/audio/coreaudio/audiodevice.h b/daemon/src/audio/coreaudio/audiodevice.h index 9611e9bdd7cee8646df9b9c56991c9960dafae45..16016bc08769e7955e6649e91829488d21665fdb 100644 --- a/daemon/src/audio/coreaudio/audiodevice.h +++ b/daemon/src/audio/coreaudio/audiodevice.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Philippe Groarke <philippe.groarke@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -36,7 +36,7 @@ #include <string> -namespace sfl { +namespace ring { class AudioDevice { public: diff --git a/daemon/src/audio/coreaudio/corelayer.cpp b/daemon/src/audio/coreaudio/corelayer.cpp index ad490715b8f16f8f920b9c4bf35b9a7e79ccf156..47e83b5280c282c63ca838795f14014ae66856f2 100644 --- a/daemon/src/audio/coreaudio/corelayer.cpp +++ b/daemon/src/audio/coreaudio/corelayer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Philippe Groarke <philippe.groarke@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -40,7 +40,7 @@ #include <thread> #include <atomic> -namespace sfl { +namespace ring { // AudioLayer implementation. CoreLayer::CoreLayer(const AudioPreference &pref) @@ -108,7 +108,7 @@ void CoreLayer::initAudioLayerPlayback() // 4) Initialize everything. // 5) Profit... - SFL_DBG("INIT AUDIO PLAYBACK"); + RING_DBG("INIT AUDIO PLAYBACK"); AudioComponentDescription outputDesc = {0}; outputDesc.componentType = kAudioUnitType_Output; @@ -117,7 +117,7 @@ void CoreLayer::initAudioLayerPlayback() AudioComponent outComp = AudioComponentFindNext(NULL, &outputDesc); if (outComp == NULL) { - SFL_ERR("Can't find default output audio component."); + RING_ERR("Can't find default output audio component."); return; } @@ -175,7 +175,7 @@ void CoreLayer::initAudioLayerPlayback() void CoreLayer::initAudioLayerCapture() { - SFL_DBG("INIT AUDIO INPUT"); + RING_DBG("INIT AUDIO INPUT"); // HALUnit description. AudioComponentDescription desc; desc = {0}; @@ -184,7 +184,7 @@ void CoreLayer::initAudioLayerCapture() desc.componentManufacturer = kAudioUnitManufacturer_Apple; AudioComponent comp = AudioComponentFindNext(NULL, &desc); if (comp == NULL) - SFL_ERR("Can't find an input HAL unit that matches description."); + RING_ERR("Can't find an input HAL unit that matches description."); checkErr(AudioComponentInstanceNew(comp, &inputUnit_)); // HALUnit settings. @@ -303,7 +303,7 @@ void CoreLayer::initAudioLayerCapture() void CoreLayer::startStream() { - SFL_DBG("START STREAM"); + RING_DBG("START STREAM"); dcblocker_.reset(); if (is_playback_running_ and is_capture_running_) @@ -326,7 +326,7 @@ void CoreLayer::destroyAudioLayer() void CoreLayer::stopStream() { - SFL_DBG("STOP STREAM"); + RING_DBG("STOP STREAM"); isStarted_ = is_playback_running_ = is_capture_running_ = false; @@ -371,7 +371,7 @@ void CoreLayer::write(AudioUnitRenderActionFlags* ioActionFlags, unsigned urgentFramesToGet = urgentRingBuffer_.availableForGet(RingBufferPool::DEFAULT_ID); if (urgentFramesToGet > 0) { - SFL_WARN("Getting urgent frames."); + RING_WARN("Getting urgent frames."); size_t totSample = std::min(inNumberFrames, urgentFramesToGet); playbackBuff_.setFormat(audioFormat_); @@ -429,16 +429,16 @@ void CoreLayer::write(AudioUnitRenderActionFlags* ioActionFlags, playbackBuff_.resize(inNumberFrames); if (tone) { - SFL_WARN("TONE"); + RING_WARN("TONE"); tone->getNext(playbackBuff_, playbackGain_); } else if (file_tone) { - SFL_WARN("FILE TONE"); + RING_WARN("FILE TONE"); file_tone->getNext(playbackBuff_, playbackGain_); } else { - SFL_WARN("No tone or file_tone!"); + RING_WARN("No tone or file_tone!"); playbackBuff_.reset(); } for (int i = 0; i < audioFormat_.nb_channels; ++i) { @@ -466,7 +466,7 @@ void CoreLayer::read(AudioUnitRenderActionFlags* ioActionFlags, AudioBufferList* ioData) { if (inNumberFrames <= 0) { - SFL_WARN("No frames for input."); + RING_WARN("No frames for input."); return; } @@ -504,7 +504,7 @@ void CoreLayer::read(AudioUnitRenderActionFlags* ioActionFlags, } if (resample) { - //SFL_WARN("Resampling Input."); + //RING_WARN("Resampling Input."); //FIXME: May be a multiplication, check alsa vs pulse implementation. diff --git a/daemon/src/audio/coreaudio/corelayer.h b/daemon/src/audio/coreaudio/corelayer.h index f9e0179a73c84a40ed86cfd93079d1dccba92e00..0b89b4bc790888a01c0a289aa2a6bcff1097bb7b 100644 --- a/daemon/src/audio/coreaudio/corelayer.h +++ b/daemon/src/audio/coreaudio/corelayer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Philippe Groarke <philippe.groarke@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -52,7 +52,7 @@ * @brief Main OSX sound class. Manages the data transfers between the application and the hardware. */ -namespace sfl { +namespace ring { class RingBuffer; class AudioDevice; diff --git a/daemon/src/audio/dcblocker.cpp b/daemon/src/audio/dcblocker.cpp index 42ae84ce6a01ff9db3cfe6b42b125ff27b8543c4..4a86273a8ba9fc0ee0d7d7ca51085fc7db980767 100644 --- a/daemon/src/audio/dcblocker.cpp +++ b/daemon/src/audio/dcblocker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -30,7 +30,7 @@ #include "dcblocker.h" -namespace sfl { +namespace ring { DcBlocker::DcBlocker(unsigned channels /* = 1 */) : states(channels, (struct StreamState){0, 0, 0, 0}) diff --git a/daemon/src/audio/dcblocker.h b/daemon/src/audio/dcblocker.h index 2e5ddd05071ee1cdb46e54710b674efecdd99e1f..54c39732f4fd8caa886d7e5fdec101d7ae619dd0 100644 --- a/daemon/src/audio/dcblocker.h +++ b/daemon/src/audio/dcblocker.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * Author: Adrien Beraud <adrien.beraud@gmail.com> * @@ -35,7 +35,7 @@ #include "sfl_types.h" #include "audiobuffer.h" -namespace sfl { +namespace ring { class DcBlocker { public: diff --git a/daemon/src/audio/dsp.cpp b/daemon/src/audio/dsp.cpp index eaee672238283522f1ae1efa5f20d49b72325274..8ba0e1037c2ee569bc17ebfe0feb91a105cc5d4b 100644 --- a/daemon/src/audio/dsp.cpp +++ b/daemon/src/audio/dsp.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -32,7 +32,7 @@ #include "dsp.h" #include "audiobuffer.h" -namespace sfl { +namespace ring { void DSP::speexStateDeleter(SpeexPreprocessState *state) @@ -88,7 +88,7 @@ void DSP::disableDenoise() void DSP::process(AudioBuffer& buff, int samples) { if (samples != smplPerFrame_) { - SFL_WARN("Unexpected amount of samples"); + RING_WARN("Unexpected amount of samples"); return; } diff --git a/daemon/src/audio/dsp.h b/daemon/src/audio/dsp.h index d5678ea95f567a956c8caec2d8a57dd49fa4e3ee..69a64b27dc603fd678f4d6dbb5e53c2b82e5348d 100644 --- a/daemon/src/audio/dsp.h +++ b/daemon/src/audio/dsp.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -36,7 +36,7 @@ #include <memory> #include "noncopyable.h" -namespace sfl { +namespace ring { class AudioBuffer; diff --git a/daemon/src/audio/jack/jacklayer.cpp b/daemon/src/audio/jack/jacklayer.cpp index 21ad5ed160e94b0f81fa3cc82aeafc45732215a4..3e23abbfb3e3500ea83b28291f0fd5a0c041c4f0 100644 --- a/daemon/src/audio/jack/jacklayer.cpp +++ b/daemon/src/audio/jack/jacklayer.cpp @@ -50,7 +50,7 @@ TODO * auto connect optional #endif -namespace sfl { +namespace ring { namespace { @@ -61,12 +61,12 @@ void connectPorts(jack_client_t *client, int portType, const std::vector<jack_po const char *port = jack_port_name(ports[i]); if (portType & JackPortIsInput) { if (jack_connect(client, port, physical_ports[i])) { - SFL_ERR("Can't connect %s to %s", port, physical_ports[i]); + RING_ERR("Can't connect %s to %s", port, physical_ports[i]); break; } } else { if (jack_connect(client, physical_ports[i], port)) { - SFL_ERR("Can't connect port %s to %s", physical_ports[i], port); + RING_ERR("Can't connect port %s to %s", physical_ports[i], port); break; } } @@ -102,7 +102,7 @@ void JackLayer::fillWithVoice(AudioBuffer &buffer, size_t samplesAvail) buffer.applyGain(isPlaybackMuted_ ? 0.0 : playbackGain_); if (audioFormat_.sample_rate != (unsigned) mainBuffer.getInternalSamplingRate()) { - SFL_DBG("fillWithVoice sample_rate != mainBuffer.getInternalSamplingRate() \n"); + RING_DBG("fillWithVoice sample_rate != mainBuffer.getInternalSamplingRate() \n"); AudioBuffer out(buffer, false); out.setSampleRate(audioFormat_.sample_rate); resampler_->resample(buffer, out); @@ -177,7 +177,7 @@ convertToFloat(const std::vector<SFLAudioSample> &src, std::vector<float> &dest) { static const float INV_SHORT_MAX = 1 / (float) SHRT_MAX; if (dest.size() != src.size()) { - SFL_ERR("MISMATCH"); + RING_ERR("MISMATCH"); return; } for (size_t i = 0; i < dest.size(); ++i) @@ -188,7 +188,7 @@ static void convertFromFloat(std::vector<float> &src, std::vector<SFLAudioSample> &dest) { if (dest.size() != src.size()) { - SFL_ERR("MISMATCH"); + RING_ERR("MISMATCH"); return; } for (size_t i = 0; i < dest.size(); ++i) @@ -209,7 +209,7 @@ JackLayer::write(AudioBuffer &buffer, std::vector<float> &floatBuffer) const size_t written_bytes = jack_ringbuffer_write(out_ringbuffers_[i], (const char *) floatBuffer.data(), write_bytes); if (written_bytes < write_bytes) - SFL_WARN("Dropped %zu bytes for channel %u", write_bytes - written_bytes, i); + RING_WARN("Dropped %zu bytes for channel %u", write_bytes - written_bytes, i); } } @@ -232,7 +232,7 @@ JackLayer::read(AudioBuffer &buffer) const size_t read_bytes = jack_ringbuffer_read(in_ringbuffers_[i], (char *) captureFloatBuffer_.data(), expected_bytes); if (read_bytes < expected_bytes) { - SFL_WARN("Dropped %zu bytes", expected_bytes - read_bytes); + RING_WARN("Dropped %zu bytes", expected_bytes - read_bytes); break; } @@ -350,7 +350,7 @@ JackLayer::JackLayer(const AudioPreference &p) : const auto playRate = jack_get_sample_rate(playbackClient_); const auto captureRate = jack_get_sample_rate(captureClient_); if (playRate != captureRate) - SFL_ERR("Mismatch between capture rate %u and playback rate %u", playRate, captureRate); + RING_ERR("Mismatch between capture rate %u and playback rate %u", playRate, captureRate); hardwareBufferSize_ = jack_get_buffer_size(playbackClient_); @@ -376,9 +376,9 @@ JackLayer::~JackLayer() jack_port_unregister(captureClient_, p); if (jack_client_close(playbackClient_)) - SFL_ERR("JACK client could not close"); + RING_ERR("JACK client could not close"); if (jack_client_close(captureClient_)) - SFL_ERR("JACK client could not close"); + RING_ERR("JACK client could not close"); for (auto r : out_ringbuffers_) jack_ringbuffer_free(r); @@ -433,7 +433,7 @@ JackLayer::process_capture(jack_nframes_t frames, void *arg) // fill the rest with silence if (bytes_to_rb < bytes_to_read) { // TODO: set some flag for underrun? - SFL_WARN("Dropped %lu bytes", bytes_to_read - bytes_to_rb); + RING_WARN("Dropped %lu bytes", bytes_to_read - bytes_to_rb); } } @@ -490,7 +490,7 @@ JackLayer::startStream() ringbuffer_thread_ = std::thread(&JackLayer::ringbuffer_worker, this); if (jack_activate(playbackClient_) or jack_activate(captureClient_)) { - SFL_ERR("Could not activate JACK client"); + RING_ERR("Could not activate JACK client"); workerAlive_ = false; ringbuffer_thread_.join(); isStarted_ = false; @@ -506,7 +506,7 @@ JackLayer::startStream() void JackLayer::onShutdown(void * /* data */) { - SFL_WARN("JACK server shutdown"); + RING_WARN("JACK server shutdown"); // FIXME: handle this safely } @@ -523,7 +523,7 @@ JackLayer::stopStream() } if (jack_deactivate(playbackClient_) or jack_deactivate(captureClient_)) { - SFL_ERR("JACK client could not deactivate"); + RING_ERR("JACK client could not deactivate"); } isStarted_ = false; diff --git a/daemon/src/audio/jack/jacklayer.h b/daemon/src/audio/jack/jacklayer.h index d6ce0f837e3b0cdceffdbe6bf66c41a9e4a2e82c..405b68e46d28b3f718dfee74213e440c7336bf5f 100644 --- a/daemon/src/audio/jack/jacklayer.h +++ b/daemon/src/audio/jack/jacklayer.h @@ -42,7 +42,7 @@ #include <memory> -namespace sfl { +namespace ring { class RingBuffer; diff --git a/daemon/src/audio/opensl/opensllayer.cpp b/daemon/src/audio/opensl/opensllayer.cpp index e9c29429d17fdf9c6bb2d0d246b3fa6fe91d8f97..39c2ab7fb653e14eb61275cdd1aeaf7a751fa26b 100644 --- a/daemon/src/audio/opensl/opensllayer.cpp +++ b/daemon/src/audio/opensl/opensllayer.cpp @@ -53,7 +53,7 @@ #define SL_ANDROID_RECORDING_PRESET_VOICE_COMMUNICATION ((SLuint32) 0x00000004) #endif -namespace sfl { +namespace ring { const int OpenSLLayer::NB_BUFFER_PLAYBACK_QUEUE = ANDROID_BUFFER_QUEUE_LENGTH; const int OpenSLLayer::NB_BUFFER_CAPTURE_QUEUE = ANDROID_BUFFER_QUEUE_LENGTH; @@ -113,7 +113,7 @@ OpenSLLayer::startStream() if (isStarted_) return; - SFL_DBG("Start OpenSL audio layer"); + RING_DBG("Start OpenSL audio layer"); std::vector<int32_t> hw_infos = Manager::instance().getClient()->getConfigurationManager()->getHardwareAudioFormat(); hardwareFormat_ = AudioFormat(hw_infos[0], 1); // Mono on Android @@ -141,7 +141,7 @@ OpenSLLayer::stopStream() if (not isStarted_) return; - SFL_DBG("Stop OpenSL audio layer"); + RING_DBG("Stop OpenSL audio layer"); stopAudioPlayback(); stopAudioCapture(); @@ -157,30 +157,30 @@ OpenSLLayer::initAudioEngine() const { SLresult result; - SFL_DBG("Create Audio Engine\n"); + RING_DBG("Create Audio Engine\n"); result = slCreateEngine((const SLObjectItf_ * const **)&engineObject_, 0, nullptr, 0, nullptr, nullptr); assert(SL_RESULT_SUCCESS == result); - SFL_DBG("Realize Audio Engine\n"); + RING_DBG("Realize Audio Engine\n"); result = (*engineObject_)->Realize(engineObject_, SL_BOOLEAN_FALSE); assert(SL_RESULT_SUCCESS == result); - SFL_DBG("Create Audio Engine Interface\n"); + RING_DBG("Create Audio Engine Interface\n"); result = (*engineObject_)->GetInterface(engineObject_, SL_IID_ENGINE, (void *)&engineInterface_); assert(SL_RESULT_SUCCESS == result); - SFL_DBG("Create Output Mixer\n"); + RING_DBG("Create Output Mixer\n"); result = (*engineInterface_)->CreateOutputMix(engineInterface_, (const SLObjectItf_ * const **)&outputMixer_, 0, nullptr, nullptr); assert(SL_RESULT_SUCCESS == result); - SFL_DBG("Realize Output Mixer\n"); + RING_DBG("Realize Output Mixer\n"); result = (*outputMixer_)->Realize(outputMixer_, SL_BOOLEAN_FALSE); assert(SL_RESULT_SUCCESS == result); - SFL_DBG("Audio Engine Initialization Done\n"); + RING_DBG("Audio Engine Initialization Done\n"); } void @@ -188,7 +188,7 @@ OpenSLLayer::shutdownAudioEngine() { // destroy buffer queue audio player object, and invalidate all associated interfaces - SFL_DBG("Shutdown audio player\n"); + RING_DBG("Shutdown audio player\n"); if (playerObject_ != nullptr) { (*playerObject_)->Destroy(playerObject_); @@ -198,7 +198,7 @@ OpenSLLayer::shutdownAudioEngine() } // destroy output mix object, and invalidate all associated interfaces - SFL_DBG("Shutdown audio mixer\n"); + RING_DBG("Shutdown audio mixer\n"); if (outputMixer_ != nullptr) { (*outputMixer_)->Destroy(outputMixer_); @@ -213,7 +213,7 @@ OpenSLLayer::shutdownAudioEngine() } // destroy engine object, and invalidate all associated interfaces - SFL_DBG("Shutdown audio engine\n"); + RING_DBG("Shutdown audio engine\n"); if (engineObject_ != nullptr) { (*engineObject_)->Destroy(engineObject_); engineObject_ = nullptr; @@ -231,13 +231,13 @@ OpenSLLayer::initAudioPlayback() const SLresult result; // Initialize the location of the buffer queue - SFL_DBG("Create playback queue\n"); + RING_DBG("Create playback queue\n"); SLDataLocator_AndroidSimpleBufferQueue bufferLocation = {SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE, NB_BUFFER_PLAYBACK_QUEUE }; // Initnialize the audio format for this queue - SFL_DBG("Setting audio format\n"); + RING_DBG("Setting audio format\n"); SLDataFormat_PCM audioFormat = {SL_DATAFORMAT_PCM, 1, audioFormat_.sample_rate * 1000, @@ -248,16 +248,16 @@ OpenSLLayer::initAudioPlayback() const }; // Create the audio source - SFL_DBG("Set Audio Sources\n"); + RING_DBG("Set Audio Sources\n"); SLDataSource audioSource = {&bufferLocation, &audioFormat}; - SFL_DBG("Get Output Mixer interface\n"); + RING_DBG("Get Output Mixer interface\n"); result = (*outputMixer_)->GetInterface(outputMixer_, SL_IID_OUTPUTMIX, (void *)&outputMixInterface_); CheckErr(result); // Cofiguration fo the audio sink as an output mixer - SFL_DBG("Set output mixer location\n"); + RING_DBG("Set output mixer location\n"); SLDataLocator_OutputMix mixerLocation = {SL_DATALOCATOR_OUTPUTMIX, outputMixer_}; SLDataSink audioSink = {&mixerLocation, nullptr}; @@ -267,10 +267,10 @@ OpenSLLayer::initAudioPlayback() const SL_IID_PLAY}; const SLboolean req[] = {SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE}; - const unsigned nbInterface = SFL_ARRAYSIZE(ids); + const unsigned nbInterface = RING_ARRAYSIZE(ids); // create audio player - SFL_DBG("Create audio player\n"); + RING_DBG("Create audio player\n"); result = (*engineInterface_)->CreateAudioPlayer(engineInterface_, (const SLObjectItf_ * const **)&playerObject_, &audioSource, @@ -293,34 +293,34 @@ OpenSLLayer::initAudioPlayback() const &streamType, sizeof(SLint32)); } - SFL_DBG("Realize audio player\n"); + RING_DBG("Realize audio player\n"); result = (*playerObject_)->Realize(playerObject_, SL_BOOLEAN_FALSE); assert(SL_RESULT_SUCCESS == result); if (result != SL_RESULT_SUCCESS) { - SFL_ERR("Unable to set android player configuration"); + RING_ERR("Unable to set android player configuration"); } // create audio interface - SFL_DBG("Create audio player interface\n"); + RING_DBG("Create audio player interface\n"); result = (*playerObject_)->GetInterface(playerObject_, SL_IID_PLAY, (void *)&playerInterface_); assert(SL_RESULT_SUCCESS == result); // create the buffer queue interface - SFL_DBG("Create buffer queue interface\n"); + RING_DBG("Create buffer queue interface\n"); result = (*playerObject_)->GetInterface(playerObject_, SL_IID_BUFFERQUEUE, (void *)&playbackBufferQueue_); assert(SL_RESULT_SUCCESS == result); // register the buffer queue on the buffer object - SFL_DBG("Register audio callback\n"); + RING_DBG("Register audio callback\n"); result = (*playbackBufferQueue_)->RegisterCallback(playbackBufferQueue_, audioPlaybackCallback, (void *)this); assert(SL_RESULT_SUCCESS == result); - SFL_DBG("Audio Playback Initialization Done\n"); + RING_DBG("Audio Playback Initialization Done\n"); } void @@ -329,7 +329,7 @@ OpenSLLayer::initAudioCapture() const SLresult result; // configure audio source - SFL_DBG("Configure audio source\n"); + RING_DBG("Configure audio source\n"); SLDataLocator_IODevice deviceLocator = {SL_DATALOCATOR_IODEVICE, SL_IODEVICE_AUDIOINPUT, SL_DEFAULTDEVICEID_AUDIOINPUT, @@ -341,14 +341,14 @@ OpenSLLayer::initAudioCapture() const }; // configure audio sink - SFL_DBG("Configure audio sink\n"); + RING_DBG("Configure audio sink\n"); SLDataLocator_AndroidSimpleBufferQueue bufferLocator = {SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE, NB_BUFFER_CAPTURE_QUEUE }; - SFL_DBG("Capture-> Sampling Rate: %d", audioFormat_.sample_rate); - SFL_DBG("Capture-> getInternalSamplingRate: %d", Manager::instance().getRingBufferPool().getInternalSamplingRate()); + RING_DBG("Capture-> Sampling Rate: %d", audioFormat_.sample_rate); + RING_DBG("Capture-> getInternalSamplingRate: %d", Manager::instance().getRingBufferPool().getInternalSamplingRate()); SLDataFormat_PCM audioFormat = {SL_DATAFORMAT_PCM, 1, audioFormat_.sample_rate * 1000, SL_PCMSAMPLEFORMAT_FIXED_16, @@ -363,7 +363,7 @@ OpenSLLayer::initAudioCapture() const // create audio recorder // (requires the RECORD_AUDIO permission) - SFL_DBG("Create audio recorder\n"); + RING_DBG("Create audio recorder\n"); const SLInterfaceID id[2] = {SL_IID_ANDROIDSIMPLEBUFFERQUEUE, SL_IID_ANDROIDCONFIGURATION}; const SLboolean req[2] ={SL_BOOLEAN_TRUE, @@ -379,7 +379,7 @@ OpenSLLayer::initAudioCapture() const } if (SL_RESULT_SUCCESS != result) { - SFL_DBG("Error: could not create audio recorder"); + RING_DBG("Error: could not create audio recorder"); return; } @@ -395,40 +395,40 @@ OpenSLLayer::initAudioCapture() const } if (result != SL_RESULT_SUCCESS) { - SFL_DBG("Warning: Unable to set android recorder configuration"); + RING_DBG("Warning: Unable to set android recorder configuration"); return; } // realize the audio recorder - SFL_DBG("Realize the audio recorder\n"); + RING_DBG("Realize the audio recorder\n"); result = (*recorderObject_)->Realize(recorderObject_, SL_BOOLEAN_FALSE); if (SL_RESULT_SUCCESS != result) { - SFL_DBG("Error: could not realize audio recorder"); + RING_DBG("Error: could not realize audio recorder"); return; } // get the record interface - SFL_DBG("Create the record interface\n"); + RING_DBG("Create the record interface\n"); result = (*recorderObject_)->GetInterface(recorderObject_, SL_IID_RECORD, (void *)&recorderInterface_); assert(SL_RESULT_SUCCESS == result); // get the buffer queue interface - SFL_DBG("Create the buffer queue interface\n"); + RING_DBG("Create the buffer queue interface\n"); result = (*recorderObject_)->GetInterface(recorderObject_, SL_IID_ANDROIDSIMPLEBUFFERQUEUE, (void *)&recorderBufferQueue_); assert(SL_RESULT_SUCCESS == result); // register callback on the buffer queue - SFL_DBG("Register the audio capture callback\n"); + RING_DBG("Register the audio capture callback\n"); result = (*recorderBufferQueue_)->RegisterCallback(recorderBufferQueue_, audioCaptureCallback, (void *)this); assert(SL_RESULT_SUCCESS == result); - SFL_DBG("Audio capture initialized\n"); + RING_DBG("Audio capture initialized\n"); } @@ -437,7 +437,7 @@ OpenSLLayer::startAudioPlayback() { assert(nullptr != playbackBufferQueue_); - SFL_DBG("Start audio playback\n"); + RING_DBG("Start audio playback\n"); SLresult result; @@ -450,14 +450,14 @@ OpenSLLayer::startAudioPlayback() result = (*playbackBufferQueue_)->Enqueue(playbackBufferQueue_, buffer.getChannel(0)->data(), buffer.frames()); if (SL_RESULT_SUCCESS != result) { - SFL_DBG("Error could not enqueue initial buffers\n"); + RING_DBG("Error could not enqueue initial buffers\n"); } } result = (*playerInterface_)->SetPlayState(playerInterface_, SL_PLAYSTATE_PLAYING); assert(SL_RESULT_SUCCESS == result); - SFL_DBG("Audio playback started\n"); + RING_DBG("Audio playback started\n"); } void @@ -465,7 +465,7 @@ OpenSLLayer::startAudioCapture() { assert(nullptr != playbackBufferQueue_); - SFL_DBG("Start audio capture\n"); + RING_DBG("Start audio capture\n"); SLresult result; @@ -476,11 +476,11 @@ OpenSLLayer::startAudioCapture() assert(SL_RESULT_SUCCESS == result); } - SFL_DBG("Clearing recorderBufferQueue\n"); + RING_DBG("Clearing recorderBufferQueue\n"); result = (*recorderBufferQueue_)->Clear(recorderBufferQueue_); assert(SL_RESULT_SUCCESS == result); - SFL_DBG("getting next record buffer\n"); + RING_DBG("getting next record buffer\n"); // enqueue an empty buffer to be filled by the recorder // (for streaming recording, we enqueue at least 2 empty buffers to start things off) AudioBuffer &buffer = getNextRecordBuffer(); @@ -488,13 +488,13 @@ OpenSLLayer::startAudioCapture() buffer.reset(); - SFL_DBG("Enqueue record buffer\n"); + RING_DBG("Enqueue record buffer\n"); result = (*recorderBufferQueue_)->Enqueue(recorderBufferQueue_, buffer.getChannel(0)->data(), buffer.frames()); // the most likely other result is SL_RESULT_BUFFER_INSUFFICIENT, // which for this code example would indicate a programming error if (SL_RESULT_SUCCESS != result) { - SFL_DBG("Error could not enqueue buffers in audio capture\n"); + RING_DBG("Error could not enqueue buffers in audio capture\n"); return; } @@ -502,13 +502,13 @@ OpenSLLayer::startAudioCapture() result = (*recorderInterface_)->SetRecordState(recorderInterface_, SL_RECORDSTATE_RECORDING); assert(SL_RESULT_SUCCESS == result); - SFL_DBG("Audio capture started\n"); + RING_DBG("Audio capture started\n"); } void OpenSLLayer::stopAudioPlayback() { - SFL_DBG("Stop audio playback\n"); + RING_DBG("Stop audio playback\n"); if (playerInterface_ != nullptr) { SLresult result; @@ -516,13 +516,13 @@ OpenSLLayer::stopAudioPlayback() assert(SL_RESULT_SUCCESS == result); } - SFL_DBG("Audio playback stopped\n"); + RING_DBG("Audio playback stopped\n"); } void OpenSLLayer::stopAudioCapture() { - SFL_DBG("Stop audio capture\n"); + RING_DBG("Stop audio capture\n"); if (recorderInterface_ != nullptr) { SLresult result; @@ -530,7 +530,7 @@ OpenSLLayer::stopAudioCapture() assert(SL_RESULT_SUCCESS == result); } - SFL_DBG("Audio capture stopped\n"); + RING_DBG("Audio capture stopped\n"); } @@ -559,12 +559,12 @@ OpenSLLayer::getCaptureDeviceList() const // Get the Audio IO DEVICE CAPABILITIES interface, implicit - SFL_DBG("Get the Audio IO DEVICE CAPABILITIES interface, implicit"); + RING_DBG("Get the Audio IO DEVICE CAPABILITIES interface, implicit"); res = (*engineObject_)->GetInterface(engineObject_, SL_IID_AUDIOIODEVICECAPABILITIES, (void*)&AudioIODeviceCapabilitiesItf); CheckErr(res); - SFL_DBG("Get the Audio IO DEVICE CAPABILITIES interface, implicit"); + RING_DBG("Get the Audio IO DEVICE CAPABILITIES interface, implicit"); numInputs = MAX_NUMBER_INPUT_DEVICES; res = (*AudioIODeviceCapabilitiesItf)->GetAvailableAudioInputs(AudioIODeviceCapabilitiesItf, &numInputs, InputDeviceIDs); @@ -581,14 +581,14 @@ OpenSLLayer::getCaptureDeviceList() const if (AudioInputDescriptor.deviceConnection == SL_DEVCONNECTION_ATTACHED_WIRED and AudioInputDescriptor.deviceScope == SL_DEVSCOPE_USER and AudioInputDescriptor.deviceLocation == SL_DEVLOCATION_HEADSET) { - SFL_DBG("SL_DEVCONNECTION_ATTACHED_WIRED : mic_deviceID: %d", InputDeviceIDs[i] ); + RING_DBG("SL_DEVCONNECTION_ATTACHED_WIRED : mic_deviceID: %d", InputDeviceIDs[i] ); mic_deviceID = InputDeviceIDs[i]; mic_available = SL_BOOLEAN_TRUE; break; } else if (AudioInputDescriptor.deviceConnection == SL_DEVCONNECTION_INTEGRATED and AudioInputDescriptor.deviceScope == SL_DEVSCOPE_USER and AudioInputDescriptor.deviceLocation == SL_DEVLOCATION_HANDSET) { - SFL_DBG("SL_DEVCONNECTION_INTEGRATED : mic_deviceID: %d", InputDeviceIDs[i] ); + RING_DBG("SL_DEVCONNECTION_INTEGRATED : mic_deviceID: %d", InputDeviceIDs[i] ); mic_deviceID = InputDeviceIDs[i]; mic_available = SL_BOOLEAN_TRUE; break; @@ -597,7 +597,7 @@ OpenSLLayer::getCaptureDeviceList() const if (!mic_available) { // Appropriate error message here - SFL_ERR("No mic available quitting"); + RING_ERR("No mic available quitting"); exit(1); } @@ -631,7 +631,7 @@ OpenSLLayer::audioPlaybackCallback(SLAndroidSimpleBufferQueueItf queue, void *co static_cast<OpenSLLayer*>(context)->playback(queue); //auto end = std::chrono::high_resolution_clock::now(); //auto elapsed = std::chrono::duration_cast<std::chrono::nanoseconds>(end - start); - //SFL_DBG("Took %d us\n", elapsed/1000); + //RING_DBG("Took %d us\n", elapsed/1000); } void @@ -660,11 +660,11 @@ OpenSLLayer::playback(SLAndroidSimpleBufferQueueItf queue) if (bufferIsFilled_) { SLresult result = (*queue)->Enqueue(queue, buffer.getChannel(0)->data(), buffer.frames()*sizeof(SFLAudioSample)); if (SL_RESULT_SUCCESS != result) { - SFL_DBG("Error could not enqueue buffers in playback callback\n"); + RING_DBG("Error could not enqueue buffers in playback callback\n"); } incrementPlaybackIndex(); } else { - SFL_DBG("Error buffer not filled in audio playback\n"); + RING_DBG("Error buffer not filled in audio playback\n"); } } @@ -779,7 +779,7 @@ size_t OpenSLLayer::audioPlaybackFillWithVoice(AudioBuffer &buffer) buffer.resize(got); buffer.applyGain(isPlaybackMuted_ ? 0.0 : playbackGain_); if (audioFormat_.sample_rate != mainBuffer.getInternalSamplingRate()) { - SFL_DBG("OpenSLLayer::audioPlaybackFillWithVoice sample_rate != mainBuffer.getInternalSamplingRate() \n"); + RING_DBG("OpenSLLayer::audioPlaybackFillWithVoice sample_rate != mainBuffer.getInternalSamplingRate() \n"); AudioBuffer out(buffer, false); out.setSampleRate(audioFormat_.sample_rate); resampler_->resample(buffer, out); @@ -791,14 +791,14 @@ size_t OpenSLLayer::audioPlaybackFillWithVoice(AudioBuffer &buffer) void dumpAvailableEngineInterfaces() { SLresult result; - SFL_DBG("Engine Interfaces\n"); + RING_DBG("Engine Interfaces\n"); SLuint32 numSupportedInterfaces; result = slQueryNumSupportedEngineInterfaces(&numSupportedInterfaces); assert(SL_RESULT_SUCCESS == result); result = slQueryNumSupportedEngineInterfaces(NULL); assert(SL_RESULT_PARAMETER_INVALID == result); - SFL_DBG("Engine number of supported interfaces %lu\n", numSupportedInterfaces); + RING_DBG("Engine number of supported interfaces %lu\n", numSupportedInterfaces); for(SLuint32 i=0; i< numSupportedInterfaces; i++){ SLInterfaceID pInterfaceId; slQuerySupportedEngineInterfaces(i, &pInterfaceId); @@ -854,7 +854,7 @@ void dumpAvailableEngineInterfaces() else if (pInterfaceId==SL_IID_ANDROIDCONFIGURATION) nm="androidconfiguration"; else if (pInterfaceId==SL_IID_ANDROIDSIMPLEBUFFERQUEUE) nm="simplebuferqueue"; //else if (pInterfaceId==//SL_IID_ANDROIDBUFFERQUEUESOURCE) nm="bufferqueuesource"; - SFL_DBG("%s,",nm); + RING_DBG("%s,",nm); } } diff --git a/daemon/src/audio/opensl/opensllayer.h b/daemon/src/audio/opensl/opensllayer.h index 74481d5a260491ad36bb130034ce211d436158af..0e4e603fbdac5202d193edd66b083ea3640d8b71 100644 --- a/daemon/src/audio/opensl/opensllayer.h +++ b/daemon/src/audio/opensl/opensllayer.h @@ -43,7 +43,7 @@ class AudioPreference; #include <memory> -namespace sfl { +namespace ring { class OpenSLThread; class RingBuffer; diff --git a/daemon/src/audio/pulseaudio/audiostream.cpp b/daemon/src/audio/pulseaudio/audiostream.cpp index 491b1d84f5b3b650484e3cc7163d2a61d4bf8ff1..f18604da86dc36f3a463c1766af0a0fc7b49cd5e 100644 --- a/daemon/src/audio/pulseaudio/audiostream.cpp +++ b/daemon/src/audio/pulseaudio/audiostream.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -33,7 +33,7 @@ #include "logger.h" #include <stdexcept> -namespace sfl { +namespace ring { AudioStream::AudioStream(pa_context *c, pa_threaded_mainloop *m, @@ -51,7 +51,7 @@ AudioStream::AudioStream(pa_context *c, channel_map.channels }; - SFL_DBG("%s: trying to create stream with device %s (%dHz, %d channels)", desc, infos->name.c_str(), samplrate, channel_map.channels); + RING_DBG("%s: trying to create stream with device %s (%dHz, %d channels)", desc, infos->name.c_str(), samplrate, channel_map.channels); assert(pa_sample_spec_valid(&sample_spec)); assert(pa_channel_map_valid(&channel_map)); @@ -59,7 +59,7 @@ AudioStream::AudioStream(pa_context *c, audiostream_ = pa_stream_new(c, desc, &sample_spec, &channel_map); if (!audiostream_) { - SFL_ERR("%s: pa_stream_new() failed : %s" , desc, pa_strerror(pa_context_errno(c))); + RING_ERR("%s: pa_stream_new() failed : %s" , desc, pa_strerror(pa_context_errno(c))); throw std::runtime_error("Could not create stream\n"); } @@ -115,32 +115,32 @@ AudioStream::stream_state_callback(pa_stream* s, void* /*user_data*/) switch (pa_stream_get_state(s)) { case PA_STREAM_CREATING: - SFL_DBG("Stream is creating..."); + RING_DBG("Stream is creating..."); break; case PA_STREAM_TERMINATED: - SFL_DBG("Stream is terminating..."); + RING_DBG("Stream is terminating..."); break; case PA_STREAM_READY: - SFL_DBG("Stream successfully created, connected to %s", pa_stream_get_device_name(s)); + RING_DBG("Stream successfully created, connected to %s", pa_stream_get_device_name(s)); #if 0 - SFL_DBG("maxlength %u", pa_stream_get_buffer_attr(s)->maxlength); - SFL_DBG("tlength %u", pa_stream_get_buffer_attr(s)->tlength); - SFL_DBG("prebuf %u", pa_stream_get_buffer_attr(s)->prebuf); - SFL_DBG("minreq %u", pa_stream_get_buffer_attr(s)->minreq); - SFL_DBG("fragsize %u", pa_stream_get_buffer_attr(s)->fragsize); + RING_DBG("maxlength %u", pa_stream_get_buffer_attr(s)->maxlength); + RING_DBG("tlength %u", pa_stream_get_buffer_attr(s)->tlength); + RING_DBG("prebuf %u", pa_stream_get_buffer_attr(s)->prebuf); + RING_DBG("minreq %u", pa_stream_get_buffer_attr(s)->minreq); + RING_DBG("fragsize %u", pa_stream_get_buffer_attr(s)->fragsize); #endif - SFL_DBG("samplespec %s", pa_sample_spec_snprint(str, sizeof(str), pa_stream_get_sample_spec(s))); + RING_DBG("samplespec %s", pa_sample_spec_snprint(str, sizeof(str), pa_stream_get_sample_spec(s))); break; case PA_STREAM_UNCONNECTED: - SFL_DBG("Stream unconnected"); + RING_DBG("Stream unconnected"); break; case PA_STREAM_FAILED: default: - SFL_ERR("Sink/Source doesn't exists: %s" , pa_strerror(pa_context_errno(pa_stream_get_context(s)))); + RING_ERR("Sink/Source doesn't exists: %s" , pa_strerror(pa_context_errno(pa_stream_get_context(s)))); break; } } diff --git a/daemon/src/audio/pulseaudio/audiostream.h b/daemon/src/audio/pulseaudio/audiostream.h index a853b293cc9e65683754ad07a35e5052b48d07e2..1107d8b554df8086dd041afd8c0b3c8160f310bb 100644 --- a/daemon/src/audio/pulseaudio/audiostream.h +++ b/daemon/src/audio/pulseaudio/audiostream.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -37,7 +37,7 @@ #include <pulse/pulseaudio.h> #include <string> -namespace sfl { +namespace ring { /** * This data structure contains the different king of audio streams available diff --git a/daemon/src/audio/pulseaudio/pulselayer.cpp b/daemon/src/audio/pulseaudio/pulselayer.cpp index 04337db9b424037514e494f601d939884e62e0eb..4462719a6fc577d8219a3c632c95c4aa44ec62b2 100644 --- a/daemon/src/audio/pulseaudio/pulselayer.cpp +++ b/daemon/src/audio/pulseaudio/pulselayer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * Author: Ðндрей Лухнов <aol.nnov@gmail.com> @@ -49,7 +49,7 @@ #include <cstdlib> #include <fstream> -namespace sfl { +namespace ring { static void playback_callback(pa_stream * /*s*/, size_t /*bytes*/, void* userdata) @@ -72,7 +72,7 @@ ringtone_callback(pa_stream * /*s*/, size_t /*bytes*/, void* userdata) static void stream_moved_callback(pa_stream *s, void *userdata UNUSED) { - SFL_DBG("stream %d to %d", pa_stream_get_index(s), pa_stream_get_device_index(s)); + RING_DBG("stream %d to %d", pa_stream_get_index(s), pa_stream_get_device_index(s)); } PulseMainLoopLock::PulseMainLoopLock(pa_threaded_mainloop *loop) : loop_(loop), destroyLoop_(false) @@ -184,11 +184,11 @@ void PulseLayer::context_state_callback(pa_context* c, void *user_data) case PA_CONTEXT_CONNECTING: case PA_CONTEXT_AUTHORIZING: case PA_CONTEXT_SETTING_NAME: - SFL_DBG("Waiting...."); + RING_DBG("Waiting...."); break; case PA_CONTEXT_READY: - SFL_DBG("Connection to PulseAudio server established"); + RING_DBG("Connection to PulseAudio server established"); pa_threaded_mainloop_signal(pulse->mainloop_, 0); pa_context_subscribe(c, mask, nullptr, pulse); pa_context_set_subscribe_callback(c, context_changed_callback, pulse); @@ -202,7 +202,7 @@ void PulseLayer::context_state_callback(pa_context* c, void *user_data) case PA_CONTEXT_FAILED: default: - SFL_ERR("%s" , pa_strerror(pa_context_errno(c))); + RING_ERR("%s" , pa_strerror(pa_context_errno(c))); pa_threaded_mainloop_signal(pulse->mainloop_, 0); break; } @@ -242,7 +242,7 @@ bool PulseLayer::inSinkList(const std::string &deviceName) { const bool found = std::find_if(sinkList_.begin(), sinkList_.end(), PaDeviceInfos::NameComparator(deviceName)) != sinkList_.end(); - SFL_DBG("seeking for %s in sinks. %s found", deviceName.c_str(), found ? "" : "NOT"); + RING_DBG("seeking for %s in sinks. %s found", deviceName.c_str(), found ? "" : "NOT"); return found; } @@ -250,7 +250,7 @@ bool PulseLayer::inSourceList(const std::string &deviceName) { const bool found = std::find_if(sourceList_.begin(), sourceList_.end(), PaDeviceInfos::NameComparator(deviceName)) != sourceList_.end(); - SFL_DBG("seeking for %s in sources. %s found", deviceName.c_str(), found ? "" : "NOT"); + RING_DBG("seeking for %s in sources. %s found", deviceName.c_str(), found ? "" : "NOT"); return found; } @@ -285,7 +285,7 @@ int PulseLayer::getAudioDeviceIndex(const std::string& descr, DeviceType type) c case DeviceType::CAPTURE: return 1 + std::distance(sourceList_.begin(), std::find_if(sourceList_.begin(), sourceList_.end(), PaDeviceInfos::DescriptionComparator(descr))); default: - SFL_ERR("Unexpected device type"); + RING_ERR("Unexpected device type"); return 0; } } @@ -301,7 +301,7 @@ int PulseLayer::getAudioDeviceIndexByName(const std::string& name, DeviceType ty case DeviceType::CAPTURE: return 1 + std::distance(sourceList_.begin(), std::find_if(sourceList_.begin(), sourceList_.end(), PaDeviceInfos::NameComparator(name))); default: - SFL_ERR("Unexpected device type"); + RING_ERR("Unexpected device type"); return 0; } } @@ -324,7 +324,7 @@ std::string PulseLayer::getAudioDeviceName(int index, DeviceType type) const case DeviceType::PLAYBACK: case DeviceType::RINGTONE: if (index < 0 or static_cast<size_t>(index) >= sinkList_.size()) { - SFL_ERR("Index %d out of range", index); + RING_ERR("Index %d out of range", index); return ""; } @@ -332,14 +332,14 @@ std::string PulseLayer::getAudioDeviceName(int index, DeviceType type) const case DeviceType::CAPTURE: if (index < 0 or static_cast<size_t>(index) >= sourceList_.size()) { - SFL_ERR("Index %d out of range", index); + RING_ERR("Index %d out of range", index); return ""; } return sourceList_[index].name; default: // Should never happen - SFL_ERR("Unexpected type"); + RING_ERR("Unexpected type"); return ""; } } @@ -363,7 +363,7 @@ void PulseLayer::createStreams(pa_context* c) if (ringtoneDevice.empty()) ringtoneDevice = defaultSink_; - SFL_DBG("playback: %s record: %s ringtone: %s", playbackDevice.c_str(), + RING_DBG("playback: %s record: %s ringtone: %s", playbackDevice.c_str(), captureDevice.c_str(), ringtoneDevice.c_str()); // Create playback stream @@ -371,7 +371,7 @@ void PulseLayer::createStreams(pa_context* c) if (dev_infos == nullptr) { dev_infos = &sinkList_[0]; - SFL_WARN("Prefered playback device %s not found in device list, selecting %s instead.", + RING_WARN("Prefered playback device %s not found in device list, selecting %s instead.", playbackDevice.c_str(), dev_infos->name.c_str()); } @@ -385,7 +385,7 @@ void PulseLayer::createStreams(pa_context* c) if (dev_infos == nullptr) { dev_infos = &sourceList_[0]; - SFL_WARN("Prefered capture device %s not found in device list, selecting %s instead.", + RING_WARN("Prefered capture device %s not found in device list, selecting %s instead.", captureDevice.c_str(), dev_infos->name.c_str()); } @@ -399,7 +399,7 @@ void PulseLayer::createStreams(pa_context* c) if (dev_infos == nullptr) { dev_infos = &sinkList_[0]; - SFL_WARN("Prefered ringtone device %s not found in device list, selecting %s instead.", + RING_WARN("Prefered ringtone device %s not found in device list, selecting %s instead.", ringtoneDevice.c_str(), dev_infos->name.c_str()); } @@ -472,7 +472,7 @@ void PulseLayer::writeToSpeaker() int ret = pa_stream_writable_size(s); if (ret < 0) { - SFL_ERR("Playback error : %s", pa_strerror(ret)); + RING_ERR("Playback error : %s", pa_strerror(ret)); return; } else if (ret == 0) return; @@ -605,7 +605,7 @@ void PulseLayer::readFromMic() mainRingBuffer_->put(*out); if (pa_stream_drop(record_->pulseStream()) < 0) - SFL_ERR("Capture stream drop failed: %s" , pa_strerror(pa_context_errno(context_))); + RING_ERR("Capture stream drop failed: %s" , pa_strerror(pa_context_errno(context_))); } @@ -620,7 +620,7 @@ void PulseLayer::ringtoneToSpeaker() int writable = pa_stream_writable_size(s); if (writable < 0) - SFL_ERR("Ringtone error : %s", pa_strerror(writable)); + RING_ERR("Ringtone error : %s", pa_strerror(writable)); if (writable <= 0) return; @@ -657,7 +657,7 @@ PulseLayer::context_changed_callback(pa_context* c, switch (type & PA_SUBSCRIPTION_EVENT_TYPE_MASK) { case PA_SUBSCRIPTION_EVENT_NEW: case PA_SUBSCRIPTION_EVENT_REMOVE: - SFL_DBG("Updating sink list"); + RING_DBG("Updating sink list"); context->sinkList_.clear(); op = pa_context_get_sink_info_list(c, sink_input_info_callback, userdata); @@ -674,7 +674,7 @@ PulseLayer::context_changed_callback(pa_context* c, switch (type & PA_SUBSCRIPTION_EVENT_TYPE_MASK) { case PA_SUBSCRIPTION_EVENT_NEW: case PA_SUBSCRIPTION_EVENT_REMOVE: - SFL_DBG("Updating source list"); + RING_DBG("Updating source list"); context->sourceList_.clear(); op = pa_context_get_source_info_list(c, source_input_info_callback, userdata); @@ -688,7 +688,7 @@ PulseLayer::context_changed_callback(pa_context* c, break; default: - SFL_DBG("Unhandled event type 0x%x", type); + RING_DBG("Unhandled event type 0x%x", type); break; } } @@ -697,7 +697,7 @@ void PulseLayer::server_info_callback(pa_context*, const pa_server_info *i, void { if (!i) return; char s[PA_SAMPLE_SPEC_SNPRINT_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX]; - SFL_DBG("PulseAudio server info:\n" + RING_DBG("PulseAudio server info:\n" " Server name: %s\n" " Server version: %s\n" " Default Sink %s\n" @@ -736,7 +736,7 @@ void PulseLayer::source_input_info_callback(pa_context *c UNUSED, const pa_sourc return; } - SFL_DBG("Source %u\n" + RING_DBG("Source %u\n" " Name: %s\n" " Driver: %s\n" " Description: %s\n" @@ -780,7 +780,7 @@ void PulseLayer::sink_input_info_callback(pa_context *c UNUSED, const pa_sink_in return; } - SFL_DBG("Sink %u\n" + RING_DBG("Sink %u\n" " Name: %s\n" " Driver: %s\n" " Description: %s\n" @@ -816,17 +816,17 @@ void PulseLayer::updatePreference(AudioPreference &preference, int index, Device switch (type) { case DeviceType::PLAYBACK: - SFL_DBG("setting %s for playback", devName.c_str()); + RING_DBG("setting %s for playback", devName.c_str()); preference.setPulseDevicePlayback(devName); break; case DeviceType::CAPTURE: - SFL_DBG("setting %s for capture", devName.c_str()); + RING_DBG("setting %s for capture", devName.c_str()); preference.setPulseDeviceRecord(devName); break; case DeviceType::RINGTONE: - SFL_DBG("setting %s for ringer", devName.c_str()); + RING_DBG("setting %s for ringer", devName.c_str()); preference.setPulseDeviceRingtone(devName); break; } diff --git a/daemon/src/audio/pulseaudio/pulselayer.h b/daemon/src/audio/pulseaudio/pulselayer.h index d8e8667e6d34e3ea4ad449fb0dffe98d71cbc2da..735f0d2bb37d56b0aee15dd27552606ab93b2fda 100644 --- a/daemon/src/audio/pulseaudio/pulselayer.h +++ b/daemon/src/audio/pulseaudio/pulselayer.h @@ -1,6 +1,6 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * Author: Ðндрей Лухнов <aol.nnov@gmail.com> @@ -47,7 +47,7 @@ class AudioPreference; -namespace sfl { +namespace ring { class AudioStream; class RingBuffer; diff --git a/daemon/src/audio/recordable.cpp b/daemon/src/audio/recordable.cpp index 26bd5614c800f04818d8d2558863099dce7d342b..ee953a62baede2e2b807e449a3fd7ce98395bc45 100644 --- a/daemon/src/audio/recordable.cpp +++ b/daemon/src/audio/recordable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -31,11 +31,11 @@ #include "manager.h" #include "logger.h" -namespace sfl { +namespace ring { Recordable::Recordable() : recAudio_(), recorder_(&recAudio_, Manager::instance().getRingBufferPool()) { - SFL_DBG("Set recording options: %s", Manager::instance().audioPreference.getRecordPath().c_str()); + RING_DBG("Set recording options: %s", Manager::instance().audioPreference.getRecordPath().c_str()); recAudio_.setRecordingOptions(AudioFormat::MONO(), Manager::instance().audioPreference.getRecordPath()); } diff --git a/daemon/src/audio/recordable.h b/daemon/src/audio/recordable.h index d47773a82b7850b0951794e7ffcfdb2df0e46f0d..dd32b3058e7e3a6f35c76e7d375a6187b6dffb42 100644 --- a/daemon/src/audio/recordable.h +++ b/daemon/src/audio/recordable.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -33,7 +33,7 @@ #include "audiorecord.h" #include "audiorecorder.h" -namespace sfl { +namespace ring { class Recordable { diff --git a/daemon/src/audio/resampler.cpp b/daemon/src/audio/resampler.cpp index 0a5dc09b02e4a35c69161449e1818751cacefa46..e7a2d745cb5c5b3d7053e7c2cd56e6fd9d791b05 100644 --- a/daemon/src/audio/resampler.cpp +++ b/daemon/src/audio/resampler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * @@ -34,7 +34,7 @@ #include <samplerate.h> -namespace sfl { +namespace ring { class SrcState { public: @@ -100,10 +100,10 @@ void Resampler::resample(const AudioBuffer &dataIn, AudioBuffer &dataOut) // change channel num if needed src_state_.reset(new SrcState(nbChans)); format_.nb_channels = nbChans; - SFL_DBG("SRC channel number changed."); + RING_DBG("SRC channel number changed."); } if (nbChans != dataOut.channels()) { - SFL_DBG("Output buffer had the wrong number of channels (in: %d, out: %d).", nbChans, dataOut.channels()); + RING_DBG("Output buffer had the wrong number of channels (in: %d, out: %d).", nbChans, dataOut.channels()); dataOut.setChannelNum(nbChans); } diff --git a/daemon/src/audio/resampler.h b/daemon/src/audio/resampler.h index 9118c88dab2dd32e0f750c6003d6ddf35f8e92f0..06a74620b500bf49e8926f1d8281b63ea9a8c495 100644 --- a/daemon/src/audio/resampler.h +++ b/daemon/src/audio/resampler.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * @@ -39,7 +39,7 @@ #include "sfl_types.h" #include "noncopyable.h" -namespace sfl { +namespace ring { struct SrcState; diff --git a/daemon/src/audio/ringbuffer.cpp b/daemon/src/audio/ringbuffer.cpp index 2eeb363257b5a0cf2dc171d1d39879dda88592a7..531bb2843c8c4d4246a6cb0ae699ca2c32745aee 100644 --- a/daemon/src/audio/ringbuffer.cpp +++ b/daemon/src/audio/ringbuffer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * Author: Yan Morin <yan.morin@savoirfairelinux.com> * Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com> @@ -41,7 +41,7 @@ #include <cstdlib> #include <cstring> -namespace sfl { +namespace ring { // corresponds to 160 ms (about 5 rtp packets) static const size_t MIN_BUFFER_SIZE = 1024; @@ -94,7 +94,7 @@ size_t RingBuffer::getLength(const std::string &call_id) const void RingBuffer::debug() { - SFL_DBG("Start=%d; End=%d; BufferSize=%d", getSmallestReadOffset(), endPos_, buffer_.frames()); + RING_DBG("Start=%d; End=%d; BufferSize=%d", getSmallestReadOffset(), endPos_, buffer_.frames()); } size_t RingBuffer::getReadOffset(const std::string &call_id) const @@ -124,7 +124,7 @@ RingBuffer::storeReadOffset(size_t offset, const std::string &call_id) if (iter != readoffsets_.end()) iter->second = offset; else - SFL_ERR("RingBuffer::storeReadOffset() failed: unknown call '%s'", call_id.c_str()); + RING_ERR("RingBuffer::storeReadOffset() failed: unknown call '%s'", call_id.c_str()); } @@ -230,7 +230,7 @@ size_t RingBuffer::get(AudioBuffer& buf, const std::string &call_id) const size_t sample_num = buf.frames(); size_t toCopy = std::min(sample_num, len); if (toCopy and toCopy != sample_num) { - SFL_DBG("Partial get: %d/%d", toCopy, sample_num); + RING_DBG("Partial get: %d/%d", toCopy, sample_num); } const size_t copied = toCopy; @@ -306,7 +306,7 @@ RingBuffer::discard(size_t toDiscard) for (auto & r : readoffsets_) { size_t dst = (r.second + buffer_size - endPos_) % buffer_size; if (dst < toDiscard) { - SFL_DBG("%s : discarding: %d frames", r.first.c_str(), toDiscard - dst); + RING_DBG("%s : discarding: %d frames", r.first.c_str(), toDiscard - dst); r.second = (r.second + toDiscard - dst) % buffer_size; } } diff --git a/daemon/src/audio/ringbuffer.h b/daemon/src/audio/ringbuffer.h index ed730f61af3e1e359466f2bfefd9f30295332065..c8d8bdcd1f6bb343318017dd84796b0ed28c783d 100644 --- a/daemon/src/audio/ringbuffer.h +++ b/daemon/src/audio/ringbuffer.h @@ -35,7 +35,7 @@ typedef std::map<std::string, size_t> ReadOffset; -namespace sfl { +namespace ring { /** * A ring buffer for mutichannel audio samples diff --git a/daemon/src/audio/ringbufferpool.cpp b/daemon/src/audio/ringbufferpool.cpp index f80c6dc07704e4371e53c0e04afb698dc85a4f56..9460eac29fdc900403a14f6db31d3baee926d635 100644 --- a/daemon/src/audio/ringbufferpool.cpp +++ b/daemon/src/audio/ringbufferpool.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2014 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * Author: Guillaume Roguez <guillaume.roguez@savoirfairelinux.com> * @@ -38,7 +38,7 @@ #include <utility> // for std::pair #include <cstring> -namespace sfl { +namespace ring { const char * const RingBufferPool::DEFAULT_ID = "audiolayer_id"; @@ -56,7 +56,7 @@ RingBufferPool::~RingBufferPool() for (const auto& item : ringBufferMap_) { const auto& weak = item.second; if (not weak.expired()) - SFL_WARN("Leaking RingBuffer '%s'", item.first.c_str()); + RING_WARN("Leaking RingBuffer '%s'", item.first.c_str()); } } @@ -116,12 +116,12 @@ RingBufferPool::createRingBuffer(const std::string& id) auto rbuf = getRingBuffer(id); if (rbuf) { - SFL_DBG("Ringbuffer already exists for id '%s'", id.c_str()); + RING_DBG("Ringbuffer already exists for id '%s'", id.c_str()); return rbuf; } rbuf.reset(new RingBuffer(id, SIZEBUF)); - SFL_DBG("Ringbuffer created with id '%s'", id.c_str()); + RING_DBG("Ringbuffer created with id '%s'", id.c_str()); ringBufferMap_.insert(std::make_pair(id, std::weak_ptr<RingBuffer>(rbuf))); return rbuf; } @@ -144,7 +144,7 @@ void RingBufferPool::removeReadBindings(const std::string& call_id) { if (not readBindingsMap_.erase(call_id)) - SFL_ERR("CallID set %s does not exist!", call_id.c_str()); + RING_ERR("CallID set %s does not exist!", call_id.c_str()); } /** @@ -155,11 +155,11 @@ RingBufferPool::addReaderToRingBuffer(std::shared_ptr<RingBuffer> rbuf, const std::string& call_id) { if (call_id != DEFAULT_ID and rbuf->id == call_id) - SFL_WARN("RingBuffer has a readoffset on itself"); + RING_WARN("RingBuffer has a readoffset on itself"); rbuf->createReadOffset(call_id); readBindingsMap_[call_id].insert(rbuf); // bindings list created if not existing - SFL_DBG("Bind rbuf '%s' to callid '%s'", rbuf->id.c_str(), call_id.c_str()); + RING_DBG("Bind rbuf '%s' to callid '%s'", rbuf->id.c_str(), call_id.c_str()); } void @@ -181,13 +181,13 @@ RingBufferPool::bindCallID(const std::string& call_id1, { const auto& rb_call1 = getRingBuffer(call_id1); if (not rb_call1) { - SFL_ERR("No ringbuffer associated to call '%s'", call_id1.c_str()); + RING_ERR("No ringbuffer associated to call '%s'", call_id1.c_str()); return; } const auto& rb_call2 = getRingBuffer(call_id2); if (not rb_call2) { - SFL_ERR("No ringbuffer associated to call '%s'", call_id2.c_str()); + RING_ERR("No ringbuffer associated to call '%s'", call_id2.c_str()); return; } @@ -216,13 +216,13 @@ RingBufferPool::unBindCallID(const std::string& call_id1, { const auto& rb_call1 = getRingBuffer(call_id1); if (not rb_call1) { - SFL_ERR("No ringbuffer associated to call '%s'", call_id1.c_str()); + RING_ERR("No ringbuffer associated to call '%s'", call_id1.c_str()); return; } const auto& rb_call2 = getRingBuffer(call_id2); if (not rb_call2) { - SFL_ERR("No ringbuffer associated to call '%s'", call_id2.c_str()); + RING_ERR("No ringbuffer associated to call '%s'", call_id2.c_str()); return; } @@ -247,7 +247,7 @@ RingBufferPool::unBindAll(const std::string& call_id) { const auto& rb_call = getRingBuffer(call_id); if (not rb_call) { - SFL_ERR("No ringbuffer associated to call '%s'", call_id.c_str()); + RING_ERR("No ringbuffer associated to call '%s'", call_id.c_str()); return; } diff --git a/daemon/src/audio/ringbufferpool.h b/daemon/src/audio/ringbufferpool.h index 09a70153b8a77dfa2258c71786e827ca60ddea96..e3ad68fd542cebc79cbb8fd9c40c2a94bd79a152 100644 --- a/daemon/src/audio/ringbufferpool.h +++ b/daemon/src/audio/ringbufferpool.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2014 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * Author: Guillaume Roguez <guillaume.roguez@savoirfairelinux.com> * @@ -41,7 +41,7 @@ #include <mutex> #include <memory> -namespace sfl { +namespace ring { class RingBuffer; diff --git a/daemon/src/audio/sound/audiofile.cpp b/daemon/src/audio/sound/audiofile.cpp index 4b8b253a85228781cf2213d1be1cf5460e3a9e01..07a00c8d0bf6a391bf27b00ea3d11d6282b28fe2 100644 --- a/daemon/src/audio/sound/audiofile.cpp +++ b/daemon/src/audio/sound/audiofile.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2004-2013 Savoir-Faire Linux Inc. +/* Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Yan Morin <yan.morin@savoirfairelinux.com> * * Inspired by tonegenerator of @@ -45,7 +45,7 @@ #include "logger.h" -namespace sfl { +namespace ring { void AudioFile::onBufferFinish() @@ -54,7 +54,7 @@ AudioFile::onBufferFinish() const int divisor = buffer_->getSampleRate() / 1000; if (divisor == 0) { - SFL_ERR("Error cannot update playback slider, sampling rate is 0"); + RING_ERR("Error cannot update playback slider, sampling rate is 0"); return; } @@ -87,7 +87,7 @@ AudioFile::AudioFile(const std::string &fileName, unsigned int sampleRate) : } else if (filepath_.find(".ogg") != std::string::npos) { format = SF_FORMAT_OGG; } else { - SFL_WARN("No file extension, guessing WAV"); + RING_WARN("No file extension, guessing WAV"); format = SF_FORMAT_WAV; } @@ -97,7 +97,7 @@ AudioFile::AudioFile(const std::string &fileName, unsigned int sampleRate) : if (!fileHandle) throw AudioFileException("File handle " + fileName + " could not be created"); if (fileHandle.error()) { - SFL_ERR("%s", fileHandle.strError()); + RING_ERR("%s", fileHandle.strError()); throw AudioFileException("File " + fileName + " doesn't exist"); } diff --git a/daemon/src/audio/sound/audiofile.h b/daemon/src/audio/sound/audiofile.h index f3ff5e5d0b6517356ddba77d2a85db4c65194b3d..63cf2fc639c012b2893001276fbe4b0d8ed3b85f 100644 --- a/daemon/src/audio/sound/audiofile.h +++ b/daemon/src/audio/sound/audiofile.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Yan Morin <yan.morin@savoirfairelinux.com> * * Inspired by tonegenerator of @@ -37,7 +37,7 @@ #include <stdexcept> #include "audio/audioloop.h" -namespace sfl { +namespace ring { class AudioFileException : public std::runtime_error { public: diff --git a/daemon/src/audio/sound/dtmf.cpp b/daemon/src/audio/sound/dtmf.cpp index f804d0cf2a223c066c607ac3abf2b9fad116f244..efba06deb5ac6537b1b2704a2237e0ded7d8410a 100644 --- a/daemon/src/audio/sound/dtmf.cpp +++ b/daemon/src/audio/sound/dtmf.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author : Yan Morin <yan.morin@savoirfairelinux.com> * Author : Laurielle Lea <laurielle.lea@savoirfairelinux.com> * @@ -34,7 +34,7 @@ #include "dtmf.h" -namespace sfl { +namespace ring { DTMF::DTMF(unsigned int sampleRate) : currentTone_(0), newTone_(0), dtmfgenerator_(sampleRate) diff --git a/daemon/src/audio/sound/dtmf.h b/daemon/src/audio/sound/dtmf.h index dedb3c335c2741da9fd64a943334f9161e0b46b5..48c8b3adf4db4e45b672da2d8a35496d29805341 100644 --- a/daemon/src/audio/sound/dtmf.h +++ b/daemon/src/audio/sound/dtmf.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author : Yan Morin <yan.morin@savoirfairelinux.com> * Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com> * @@ -41,7 +41,7 @@ * @file dtmf.h * @brief DMTF library to generate a dtmf sample */ -namespace sfl { +namespace ring { class DTMF { public: diff --git a/daemon/src/audio/sound/dtmfgenerator.cpp b/daemon/src/audio/sound/dtmfgenerator.cpp index f94f468997d50e09e4b31ff8f09164fff9a99b3c..837978d2d10268c9035b606ccb5cc7b4fe5be7e2 100644 --- a/daemon/src/audio/sound/dtmfgenerator.cpp +++ b/daemon/src/audio/sound/dtmfgenerator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Yan Morin <yan.morin@savoirfairelinux.com> * Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com> * @@ -38,7 +38,7 @@ #include "dtmfgenerator.h" -namespace sfl { +namespace ring { /* * Tone frequencies diff --git a/daemon/src/audio/sound/dtmfgenerator.h b/daemon/src/audio/sound/dtmfgenerator.h index 49c47b726d7e867a3375ec71007874101f7ff7d4..273b926be095809ebd977d55226500a5594fdc13 100644 --- a/daemon/src/audio/sound/dtmfgenerator.h +++ b/daemon/src/audio/sound/dtmfgenerator.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Yan Morin <yan.morin@savoirfairelinux.com> * Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com> * @@ -49,7 +49,7 @@ * @brief DMTF Generator Exception */ -namespace sfl { +namespace ring { class DTMFException : public std::runtime_error { public: diff --git a/daemon/src/audio/sound/tone.cpp b/daemon/src/audio/sound/tone.cpp index 0e6b987bff1692b49537e6036975152f51b4e5e7..c6b9815428310bd2c4172b9327eec227dcad04ee 100644 --- a/daemon/src/audio/sound/tone.cpp +++ b/daemon/src/audio/sound/tone.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Yan Morin <yan.morin@savoirfairelinux.com> * * Inspired by tonegenerator of @@ -43,7 +43,7 @@ #include <cstring> #include <vector> -namespace sfl { +namespace ring { Tone::Tone(const std::string& definition, unsigned int sampleRate) : AudioLoop(sampleRate), xhigher_(0.0), xlower_(0.0) diff --git a/daemon/src/audio/sound/tone.h b/daemon/src/audio/sound/tone.h index 1605dfbac363e89bb6b311cef02deef4cc486cf6..d70b64114eb52369d490b92030e815c038d0f0ad 100644 --- a/daemon/src/audio/sound/tone.h +++ b/daemon/src/audio/sound/tone.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Yan Morin <yan.morin@savoirfairelinux.com> * * Inspired by tonegenerator of @@ -41,7 +41,7 @@ * @brief Tone sample (dial, busy, ring, congestion) */ -namespace sfl { +namespace ring { class Tone : public AudioLoop { public: diff --git a/daemon/src/audio/sound/tonelist.cpp b/daemon/src/audio/sound/tonelist.cpp index 0b9c15852b767c50a546060b5a0b0909a5fe199b..a425fc5816d694ee0c949da25491d9157ae6dcc0 100644 --- a/daemon/src/audio/sound/tonelist.cpp +++ b/daemon/src/audio/sound/tonelist.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Yan Morin <yan.morin@savoirfairelinux.com> * * Inspired by tonegenerator of @@ -32,7 +32,7 @@ */ #include "tonelist.h" -namespace sfl { +namespace ring { static const char *toneZone[TelephoneTone::ZID_COUNTRIES][Tone::TONE_NULL] = { { diff --git a/daemon/src/audio/sound/tonelist.h b/daemon/src/audio/sound/tonelist.h index eba4f05fe0119013c84fc01ae0cc0c161f6f37e5..aa8e8e002b6d015ae7ad5d833ea786c95ea11749 100644 --- a/daemon/src/audio/sound/tonelist.h +++ b/daemon/src/audio/sound/tonelist.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Yan Morin <yan.morin@savoirfairelinux.com> * * Inspired by tonegenerator of @@ -37,7 +37,7 @@ #include "tone.h" -namespace sfl { +namespace ring { class TelephoneTone { public: diff --git a/daemon/src/call.cpp b/daemon/src/call.cpp index 9b361cdb108d7ad3e93ff9c2fa066a6396fe7b9b..9b3b602f6eb6c53c4bd07abb37bce5cd9ddbb74e 100644 --- a/daemon/src/call.cpp +++ b/daemon/src/call.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2014 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Yan Morin <yan.morin@savoirfairelinux.com> * Author : Laurielle Lea <laurielle.lea@savoirfairelinux.com> * Author : Guillaume Roguez <guillaume.roguez@savoirfairelinux.com> @@ -122,9 +122,9 @@ Call::setState(CallState state) std::lock_guard<std::mutex> lock(callMutex_); if (not validTransition(state)) { static const char *states[] = {"INACTIVE", "ACTIVE", "HOLD", "BUSY", "ERROR"}; - assert(callState_ < SFL_ARRAYSIZE(states) and state < SFL_ARRAYSIZE(states)); + assert(callState_ < RING_ARRAYSIZE(states) and state < RING_ARRAYSIZE(states)); - SFL_ERR("Invalid call state transition from %s to %s", + RING_ERR("Invalid call state transition from %s to %s", states[callState_], states[state]); return false; } @@ -199,17 +199,17 @@ bool Call::toggleRecording() { const bool startRecording = Recordable::toggleRecording(); - sfl::RingBufferPool &rbPool = Manager::instance().getRingBufferPool(); + ring::RingBufferPool &rbPool = Manager::instance().getRingBufferPool(); std::string process_id = Recordable::recorder_.getRecorderID(); if (startRecording) { rbPool.bindHalfDuplexOut(process_id, id_); - rbPool.bindHalfDuplexOut(process_id, sfl::RingBufferPool::DEFAULT_ID); + rbPool.bindHalfDuplexOut(process_id, ring::RingBufferPool::DEFAULT_ID); Recordable::recorder_.start(); } else { rbPool.unBindHalfDuplexOut(process_id, id_); - rbPool.unBindHalfDuplexOut(process_id, sfl::RingBufferPool::DEFAULT_ID); + rbPool.unBindHalfDuplexOut(process_id, ring::RingBufferPool::DEFAULT_ID); } return startRecording; @@ -244,7 +244,7 @@ timestamp_to_string(const time_t ×tamp) std::map<std::string, std::string> Call::createHistoryEntry() const { - using sfl::HistoryItem; + using ring::HistoryItem; std::map<std::string, std::string> result; result[HistoryItem::ACCOUNT_ID_KEY] = getAccountId(); @@ -306,7 +306,7 @@ void Call::initIceTransport(bool master, unsigned channel_num) { auto& iceTransportFactory = Manager::instance().getIceTransportFactory(); - const auto& on_initdone = [this, master](sfl::IceTransport& iceTransport, bool done) { + const auto& on_initdone = [this, master](ring::IceTransport& iceTransport, bool done) { if (done) { if (master) iceTransport.setInitiatorSession(); @@ -321,7 +321,7 @@ Call::initIceTransport(bool master, unsigned channel_num) iceCV_.notify_one(); }; - const auto& on_negodone = [this, master](sfl::IceTransport& /*iceTransport*/, bool done) { + const auto& on_negodone = [this, master](ring::IceTransport& /*iceTransport*/, bool done) { { std::unique_lock<std::mutex> lk(callMutex_); iceTransportNegoDone_ = done; @@ -341,10 +341,10 @@ Call::waitForIceInitialization(unsigned timeout) std::unique_lock<std::mutex> lk(callMutex_); if (!iceCV_.wait_for(lk, std::chrono::seconds(timeout), [this]{ return iceTransportInitDone_; })) { - SFL_WARN("waitForIceInitialization: timeout"); + RING_WARN("waitForIceInitialization: timeout"); return -1; } - SFL_DBG("waitForIceInitialization: %u", iceTransportInitDone_); + RING_DBG("waitForIceInitialization: %u", iceTransportInitDone_); return iceTransportInitDone_; } @@ -354,10 +354,10 @@ Call::waitForIceNegotiation(unsigned timeout) std::unique_lock<std::mutex> lk(callMutex_); if (!iceCV_.wait_for(lk, std::chrono::seconds(timeout), [this]{ return iceTransportNegoDone_; })) { - SFL_WARN("waitForIceNegotiation: timeout"); + RING_WARN("waitForIceNegotiation: timeout"); return -1; } - SFL_DBG("waitForIceNegotiation: %u", iceTransportNegoDone_); + RING_DBG("waitForIceNegotiation: %u", iceTransportNegoDone_); return iceTransportNegoDone_; } @@ -375,8 +375,8 @@ Call::isIceRunning() const return iceTransportNegoDone_; } -sfl::IceSocket* +ring::IceSocket* Call::newIceSocket(unsigned compId) const { - return new sfl::IceSocket(iceTransport_, compId); + return new ring::IceSocket(iceTransport_, compId); } diff --git a/daemon/src/call.h b/daemon/src/call.h index d5f0105bec748f1f9211b5b7a991870ffa01effb..9ac046a2347da00ccb9f5ade0dbdeaac7df19166 100644 --- a/daemon/src/call.h +++ b/daemon/src/call.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2014 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * Author: Yan Morin <yan.morin@savoirfairelinux.com> * Author : Laurielle Lea <laurielle.lea@savoirfairelinux.com> @@ -57,7 +57,7 @@ template <class T> using CallMap = std::map<std::string, std::shared_ptr<T> >; * @brief A call is the base class for protocol-based calls */ -class Call : public sfl::Recordable, public std::enable_shared_from_this<Call> { +class Call : public ring::Recordable, public std::enable_shared_from_this<Call> { public: static const char * const DEFAULT_ID; @@ -310,8 +310,8 @@ class Call : public sfl::Recordable, public std::enable_shared_from_this<Call> { bool isIceUsed() const; bool isIceRunning() const; - sfl::IceSocket* newIceSocket(unsigned compId) const; - std::shared_ptr<sfl::IceTransport> getIceTransport() const { + ring::IceSocket* newIceSocket(unsigned compId) const; + std::shared_ptr<ring::IceTransport> getIceTransport() const { return iceTransport_; } @@ -323,7 +323,7 @@ class Call : public sfl::Recordable, public std::enable_shared_from_this<Call> { */ Call(Account& account, const std::string& id, Call::CallType type); - std::shared_ptr<sfl::IceTransport> iceTransport_ {}; + std::shared_ptr<ring::IceTransport> iceTransport_ {}; private: bool validTransition(CallState newState); diff --git a/daemon/src/call_factory.cpp b/daemon/src/call_factory.cpp index 1b2e190b3a063ae410a441c00bd0f91a51d435a5..694c2045b891494116c80a22fd337daac6d40d57 100644 --- a/daemon/src/call_factory.cpp +++ b/daemon/src/call_factory.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2014 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author : Guillaume Roguez <guillaume.roguez@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -44,11 +44,11 @@ CallFactory::removeCall(Call& call) std::lock_guard<std::recursive_mutex> lk(callMapsMutex_); const auto& id = call.getCallId(); - SFL_DBG("Removing call %s", id.c_str()); + RING_DBG("Removing call %s", id.c_str()); const auto& account = call.getAccount(); auto& map = callMaps_.at(account.getAccountType()); map.erase(id); - SFL_DBG("Remaining %u %s call(s)", map.size(), account.getAccountType()); + RING_DBG("Remaining %u %s call(s)", map.size(), account.getAccountType()); } void @@ -59,7 +59,7 @@ CallFactory::removeCall(const std::string& id) if (auto call = getCall(id)) { removeCall(*call); } else - SFL_ERR("No call with ID %s", id.c_str()); + RING_ERR("No call with ID %s", id.c_str()); } //============================================================================== diff --git a/daemon/src/call_factory.h b/daemon/src/call_factory.h index ac5fd38dc9d9cadc99ee4c411bfa7876dfa5c2a6..11f66ef6cfd7e22dd238a9cfca0b569fdfd4b074 100644 --- a/daemon/src/call_factory.h +++ b/daemon/src/call_factory.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2014 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author : Guillaume Roguez <guillaume.roguez@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -81,7 +81,7 @@ class CallFactory { template <class T, class A> std::shared_ptr<T> newCall(A& account, const std::string& id, Call::CallType type) { if (!allowNewCall_) { - SFL_WARN("newCall aborted : CallFactory in forbid state"); + RING_WARN("newCall aborted : CallFactory in forbid state"); return nullptr; } @@ -94,7 +94,7 @@ class CallFactory { }; if (hasCall(id)) { - SFL_ERR("Call %s is already created", id.c_str()); + RING_ERR("Call %s is already created", id.c_str()); return nullptr; } diff --git a/daemon/src/client/Makefile.am b/daemon/src/client/Makefile.am index e7770ebcb9ae760a003c566ed36cc00dc0076681..4eb5b4af493e26a08eb75a5ef9eaa6ccd4fdd16f 100644 --- a/daemon/src/client/Makefile.am +++ b/daemon/src/client/Makefile.am @@ -9,7 +9,7 @@ noinst_HEADERS = callmanager.h \ PRESENCE_SRC = presencemanager.cpp noinst_HEADERS += presencemanager.h -if SFL_VIDEO +if RING_VIDEO VIDEO_SRC = videomanager.cpp noinst_HEADERS += videomanager.h endif @@ -23,4 +23,4 @@ libclient_la_SOURCES = client.cpp \ libclient_la_CXXFLAGS = -I./ \ -I../ \ -DPREFIX=\"$(prefix)\" \ - -DPROGSHAREDIR=\"${datadir}/sflphone\" + -DPROGSHAREDIR=\"${datadir}/ring\" diff --git a/daemon/src/client/callmanager.cpp b/daemon/src/client/callmanager.cpp index 435dc29e31136270d1415a50d4634ecaf87bfb21..cf8329991e652e242e7868c6c482e5a5bb69103e 100644 --- a/daemon/src/client/callmanager.cpp +++ b/daemon/src/client/callmanager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com> * Author: Alexandre Bourget <alexandre.bourget@savoirfairelinux.com> * @@ -45,7 +45,7 @@ #include "logger.h" #include "manager.h" -void CallManager::registerEvHandlers(struct sflph_call_ev_handlers* evHandlers) +void CallManager::registerEvHandlers(struct ring_call_ev_handlers* evHandlers) { evHandlers_ = *evHandlers; } @@ -56,7 +56,7 @@ bool CallManager::placeCall(const std::string& accountID, { // Check if a destination number is available if (to.empty()) { - SFL_DBG("No number entered - Call stopped"); + RING_DBG("No number entered - Call stopped"); return false; } else { return Manager::instance().outgoingCall(accountID, callID, to); @@ -240,7 +240,7 @@ CallManager::getIsRecording(const std::string& callID) std::string CallManager::getCurrentAudioCodecName(const std::string& /*callID*/) { - SFL_WARN("Deprecated"); + RING_WARN("Deprecated"); return ""; } @@ -283,7 +283,7 @@ CallManager::startTone(int32_t start, int32_t type) // the right pointer for the given // callID. #if USE_CCRTP && HAVE_ZRTP -sfl::AudioZrtpSession * +ring::AudioZrtpSession * CallManager::getAudioZrtpSession(const std::string& callID) { // TODO: remove SIP dependency @@ -291,7 +291,7 @@ CallManager::getAudioZrtpSession(const std::string& callID) if (!call) throw CallManagerException("Call id " + callID + " is not valid"); - sfl::AudioZrtpSession * zSession = call->getAudioRtp().getAudioZrtpSession(); + ring::AudioZrtpSession * zSession = call->getAudioRtp().getAudioZrtpSession(); if (!zSession) throw CallManagerException("Failed to get AudioZrtpSession"); @@ -305,13 +305,13 @@ CallManager::setSASVerified(const std::string& callID) { #if USE_CCRTP && HAVE_ZRTP try { - sfl::AudioZrtpSession * zSession; + ring::AudioZrtpSession * zSession; zSession = getAudioZrtpSession(callID); zSession->SASVerified(); } catch (...) { } #else - SFL_ERR("No zrtp support for %s, please recompile SFLphone with zrtp", callID.c_str()); + RING_ERR("No zrtp support for %s, please recompile SFLphone with zrtp", callID.c_str()); #endif } @@ -320,13 +320,13 @@ CallManager::resetSASVerified(const std::string& callID) { #if USE_CCRTP && HAVE_ZRTP try { - sfl::AudioZrtpSession * zSession; + ring::AudioZrtpSession * zSession; zSession = getAudioZrtpSession(callID); zSession->resetSASVerified(); } catch (...) { } #else - SFL_ERR("No zrtp support for %s, please recompile SFLphone with zrtp", callID.c_str()); + RING_ERR("No zrtp support for %s, please recompile SFLphone with zrtp", callID.c_str()); #endif } @@ -335,13 +335,13 @@ CallManager::setConfirmGoClear(const std::string& callID) { #if USE_CCRTP && HAVE_ZRTP try { - sfl::AudioZrtpSession * zSession; + ring::AudioZrtpSession * zSession; zSession = getAudioZrtpSession(callID); zSession->goClearOk(); } catch (...) { } #else - SFL_ERR("No zrtp support for %s, please recompile SFLphone with zrtp", callID.c_str()); + RING_ERR("No zrtp support for %s, please recompile SFLphone with zrtp", callID.c_str()); #endif } @@ -350,13 +350,13 @@ CallManager::requestGoClear(const std::string& callID) { #if USE_CCRTP && HAVE_ZRTP try { - sfl::AudioZrtpSession * zSession; + ring::AudioZrtpSession * zSession; zSession = getAudioZrtpSession(callID); zSession->requestGoClear(); } catch (...) { } #else - SFL_ERR("No zrtp support for %s, please recompile SFLphone with zrtp", callID.c_str()); + RING_ERR("No zrtp support for %s, please recompile SFLphone with zrtp", callID.c_str()); #endif } @@ -365,13 +365,13 @@ CallManager::acceptEnrollment(const std::string& callID, bool accepted) { #if USE_CCRTP && HAVE_ZRTP try { - sfl::AudioZrtpSession * zSession; + ring::AudioZrtpSession * zSession; zSession = getAudioZrtpSession(callID); zSession->acceptEnrollment(accepted); } catch (...) { } #else - SFL_ERR("No zrtp support for %s, please recompile SFLphone with zrtp", callID.c_str()); + RING_ERR("No zrtp support for %s, please recompile SFLphone with zrtp", callID.c_str()); #endif } @@ -389,7 +389,7 @@ CallManager::sendTextMessage(const std::string& callID, const std::string& messa if (!Manager::instance().sendTextMessage(callID, message, "Me")) throw CallManagerException(); #else - SFL_ERR("Could not send \"%s\" text message to %s since SFLphone daemon does not support it, please recompile with instant messaging support", message.c_str(), callID.c_str()); + RING_ERR("Could not send \"%s\" text message to %s since SFLphone daemon does not support it, please recompile with instant messaging support", message.c_str(), callID.c_str()); #endif } diff --git a/daemon/src/client/callmanager.h b/daemon/src/client/callmanager.h index 81b345098698b015eb655fbf9ff958f94e4b6818..5990aabb86155f9b679827a560bc3ef853cfdbe9 100644 --- a/daemon/src/client/callmanager.h +++ b/daemon/src/client/callmanager.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -28,8 +28,8 @@ * as that of the covered work. */ -#ifndef __SFL_CALLMANAGER_H__ -#define __SFL_CALLMANAGER_H__ +#ifndef __RING_CALLMANAGER_H__ +#define __RING_CALLMANAGER_H__ #ifdef HAVE_CONFIG_H #include "config.h" @@ -40,7 +40,7 @@ #include <vector> #include <string> -#include "sflphone.h" +#include "ring.h" class CallManagerException: public std::runtime_error { public: @@ -48,14 +48,14 @@ class CallManagerException: public std::runtime_error { std::runtime_error("A CallManagerException occured: " + str) {} }; -namespace sfl { +namespace ring { class AudioZrtpSession; } class CallManager { public: - void registerEvHandlers(struct sflph_call_ev_handlers* evHandlers); + void registerEvHandlers(struct ring_call_ev_handlers* evHandlers); // Methods public: @@ -157,13 +157,13 @@ class CallManager private: #if USE_CCRTP && HAVE_ZRTP - sfl::AudioZrtpSession * getAudioZrtpSession(const std::string& callID); + ring::AudioZrtpSession * getAudioZrtpSession(const std::string& callID); #endif private: #pragma GCC diagnostic ignored "-Wmissing-field-initializers" // Event handlers; needed by the library API - sflph_call_ev_handlers evHandlers_{}; + ring_call_ev_handlers evHandlers_{}; #pragma GCC diagnostic warning "-Wmissing-field-initializers" }; diff --git a/daemon/src/client/client.cpp b/daemon/src/client/client.cpp index ccddf2887c84579f7c9eda28b9b83f8cfa3c76db..d2f72336fd5c1d385c2d18a5015e3b890944cd00 100644 --- a/daemon/src/client/client.cpp +++ b/daemon/src/client/client.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -37,15 +37,15 @@ #include "configurationmanager.h" #include "presencemanager.h" -#ifdef SFL_VIDEO +#ifdef RING_VIDEO #include "videomanager.h" -#endif // SFL_VIDEO +#endif // RING_VIDEO Client::Client() : callManager_(new CallManager) , configurationManager_(new ConfigurationManager) , presenceManager_(new PresenceManager) -#ifdef SFL_VIDEO +#ifdef RING_VIDEO , videoManager_(new VideoManager) #endif #ifdef USE_NETWORKMANAGER @@ -58,7 +58,7 @@ Client::~Client() #ifdef USE_NETWORKMANAGER delete networkManager_; #endif -#ifdef SFL_VIDEO +#ifdef RING_VIDEO delete videoManager_; #endif delete configurationManager_; @@ -81,7 +81,7 @@ PresenceManager * Client::getPresenceManager() return presenceManager_; } -#ifdef SFL_VIDEO +#ifdef RING_VIDEO VideoManager * Client::getVideoManager() { return videoManager_; diff --git a/daemon/src/client/client.h b/daemon/src/client/client.h index 436cd24803b384512dd298e536e03563f7f971fe..4eea3af2da3eec41c162a892e09a37c7691ef763 100644 --- a/daemon/src/client/client.h +++ b/daemon/src/client/client.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -43,7 +43,7 @@ class Instance; class PresenceManager; -#ifdef SFL_VIDEO +#ifdef RING_VIDEO class VideoManager; #endif @@ -58,7 +58,7 @@ class Client { PresenceManager * getPresenceManager(); -#ifdef SFL_VIDEO +#ifdef RING_VIDEO VideoManager* getVideoManager(); #endif @@ -67,7 +67,7 @@ class Client { CallManager* callManager_; ConfigurationManager* configurationManager_; PresenceManager* presenceManager_; -#ifdef SFL_VIDEO +#ifdef RING_VIDEO VideoManager *videoManager_; #endif #if USE_NETWORKMANAGER diff --git a/daemon/src/client/configurationmanager.cpp b/daemon/src/client/configurationmanager.cpp index a286ba063462b527d241a345c29ec754cfa131b4..7e27ae19acd68b24f4c32c0a171c8f9a40ede87a 100644 --- a/daemon/src/client/configurationmanager.cpp +++ b/daemon/src/client/configurationmanager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2014 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com> * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * Author: Guillaume Carmel-Archambault <guillaume.carmel-archambault@savoirfairelinux.com> @@ -55,7 +55,7 @@ #define CODECS_NOT_LOADED 0x1000 /** Codecs not found */ -void ConfigurationManager::registerEvHandlers(struct sflph_config_ev_handlers* evHandlers) +void ConfigurationManager::registerEvHandlers(struct ring_config_ev_handlers* evHandlers) { evHandlers_ = *evHandlers; } @@ -66,7 +66,7 @@ std::map<std::string, std::string> ConfigurationManager::getIp2IpDetails() const auto sipaccount = static_cast<SIPAccount *>(account.get()); if (!sipaccount) { - SFL_ERR("Could not find IP2IP account"); + RING_ERR("Could not find IP2IP account"); return std::map<std::string, std::string>(); } else return sipaccount->getIp2IpDetails(); @@ -128,7 +128,7 @@ void ConfigurationManager::setTlsSettings(const std::map<std::string, std::strin const auto sipaccount = static_cast<SIPAccount *>(account.get()); if (!sipaccount) { - SFL_DBG("No valid account in set TLS settings"); + RING_DBG("No valid account in set TLS settings"); return; } @@ -148,7 +148,7 @@ std::map<std::string, std::string> ConfigurationManager::validateCertificate(con TlsValidator validator(certificate,privateKey); return validator.getSerializedChecks(); #else - SFL_WARN("TLS not supported"); + RING_WARN("TLS not supported"); return std::map<std::string, std::string>(); #endif } @@ -159,7 +159,7 @@ std::map<std::string, std::string> ConfigurationManager::getCertificateDetails(c TlsValidator validator(certificate,""); return validator.getSerializedDetails(); #else - SFL_WARN("TLS not supported"); + RING_WARN("TLS not supported"); return std::map<std::string, std::string>(); #endif } @@ -240,7 +240,7 @@ std::vector<int32_t> ConfigurationManager::getActiveAudioCodecList(const std::st if (const auto acc = Manager::instance().getAccount(accountID)) return acc->getActiveAudioCodecs(); else { - SFL_ERR("Could not find account %s, returning default", accountID.c_str()); + RING_ERR("Could not find account %s, returning default", accountID.c_str()); return Account::getDefaultAudioCodecs(); } } @@ -251,7 +251,7 @@ void ConfigurationManager::setActiveAudioCodecList(const std::vector<std::string acc->setActiveAudioCodecs(list); Manager::instance().saveConfig(); } else { - SFL_ERR("Could not find account %s", accountID.c_str()); + RING_ERR("Could not find account %s", accountID.c_str()); } } @@ -282,17 +282,17 @@ std::vector<std::string> ConfigurationManager::getAudioInputDeviceList() void ConfigurationManager::setAudioOutputDevice(int32_t index) { - return Manager::instance().setAudioDevice(index, sfl::DeviceType::PLAYBACK); + return Manager::instance().setAudioDevice(index, ring::DeviceType::PLAYBACK); } void ConfigurationManager::setAudioInputDevice(int32_t index) { - return Manager::instance().setAudioDevice(index, sfl::DeviceType::CAPTURE); + return Manager::instance().setAudioDevice(index, ring::DeviceType::CAPTURE); } void ConfigurationManager::setAudioRingtoneDevice(int32_t index) { - return Manager::instance().setAudioDevice(index, sfl::DeviceType::RINGTONE); + return Manager::instance().setAudioDevice(index, ring::DeviceType::RINGTONE); } std::vector<std::string> ConfigurationManager::getCurrentAudioDevicesIndex() @@ -312,7 +312,7 @@ int32_t ConfigurationManager::getAudioOutputDeviceIndex(const std::string& name) std::string ConfigurationManager::getCurrentAudioOutputPlugin() { - SFL_DBG("Get audio plugin %s", Manager::instance().getCurrentAudioOutputPlugin().c_str()); + RING_DBG("Get audio plugin %s", Manager::instance().getCurrentAudioOutputPlugin().c_str()); return Manager::instance().getCurrentAudioOutputPlugin(); } @@ -345,7 +345,7 @@ std::map<std::string, std::string> ConfigurationManager::getRingtoneList() struct dirent **namelist; int n = scandir(r_path.c_str(), &namelist, 0, alphasort); if (n == -1) { - SFL_ERR("%s", strerror(errno)); + RING_ERR("%s", strerror(errno)); return ringToneList; } @@ -421,11 +421,11 @@ void ConfigurationManager::setVolume(const std::string& device, double value) auto audiolayer = Manager::instance().getAudioDriver(); if (!audiolayer) { - SFL_ERR("Audio layer not valid while updating volume"); + RING_ERR("Audio layer not valid while updating volume"); return; } - SFL_DBG("set volume for %s: %f", device.c_str(), value); + RING_DBG("set volume for %s: %f", device.c_str(), value); if (device == "speaker") { audiolayer->setPlaybackGain(value); @@ -442,7 +442,7 @@ ConfigurationManager::getVolume(const std::string& device) auto audiolayer = Manager::instance().getAudioDriver(); if (!audiolayer) { - SFL_ERR("Audio layer not valid while updating volume"); + RING_ERR("Audio layer not valid while updating volume"); return 0.0; } @@ -471,7 +471,7 @@ bool ConfigurationManager::isCaptureMuted() auto audiolayer = Manager::instance().getAudioDriver(); if (!audiolayer) { - SFL_ERR("Audio layer not valid"); + RING_ERR("Audio layer not valid"); return false; } @@ -483,7 +483,7 @@ void ConfigurationManager::muteCapture(bool mute) auto audiolayer = Manager::instance().getAudioDriver(); if (!audiolayer) { - SFL_ERR("Audio layer not valid"); + RING_ERR("Audio layer not valid"); return; } @@ -495,7 +495,7 @@ bool ConfigurationManager::isPlaybackMuted() auto audiolayer = Manager::instance().getAudioDriver(); if (!audiolayer) { - SFL_ERR("Audio layer not valid"); + RING_ERR("Audio layer not valid"); return false; } @@ -507,7 +507,7 @@ void ConfigurationManager::mutePlayback(bool mute) auto audiolayer = Manager::instance().getAudioDriver(); if (!audiolayer) { - SFL_ERR("Audio layer not valid"); + RING_ERR("Audio layer not valid"); return; } @@ -590,7 +590,7 @@ bool ConfigurationManager::checkForPrivateKey(const std::string& pemPath) #if HAVE_TLS && HAVE_DHT return containsPrivateKey(pemPath.c_str()) == 0; #else - SFL_WARN("TLS not supported"); + RING_WARN("TLS not supported"); return false; #endif } @@ -602,7 +602,7 @@ bool ConfigurationManager::checkCertificateValidity(const std::string& caPath, return certificateIsValid(caPath.size() > 0 ? caPath.c_str() : NULL, pemPath.c_str()) == 0; #else - SFL_WARN("TLS not supported"); + RING_WARN("TLS not supported"); return false; #endif } @@ -614,7 +614,7 @@ bool ConfigurationManager::checkHostnameCertificate(const std::string& host, return verifyHostnameCertificate(host.c_str(), strtol(port.c_str(), NULL, 10)) == 0; #else - SFL_WARN("TLS not supported"); + RING_WARN("TLS not supported"); return false; #endif } diff --git a/daemon/src/client/configurationmanager.h b/daemon/src/client/configurationmanager.h index fe27c6946f1770c9af48bcf0ecddcfa4cb057906..ffd05a3dc63a90edc03999512be310e8a0dda480 100644 --- a/daemon/src/client/configurationmanager.h +++ b/daemon/src/client/configurationmanager.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com> * Author: Alexandre Bourget <alexandre.bourget@savoirfairelinux.com> * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> @@ -42,12 +42,12 @@ #include <map> #include <string> -#include "sflphone.h" +#include "ring.h" class ConfigurationManager { public: - void registerEvHandlers(struct sflph_config_ev_handlers* evHandlers); + void registerEvHandlers(struct ring_config_ev_handlers* evHandlers); // Methods public: @@ -168,7 +168,7 @@ class ConfigurationManager private: #pragma GCC diagnostic ignored "-Wmissing-field-initializers" // Event handlers; needed by the library API - sflph_config_ev_handlers evHandlers_{}; + ring_config_ev_handlers evHandlers_{}; #pragma GCC diagnostic warning "-Wmissing-field-initializers" }; diff --git a/daemon/src/client/presencemanager.cpp b/daemon/src/client/presencemanager.cpp index 84a526d4d34e49b95d6d1fd2e61ee3f35b9995b7..a61f16e079c82c5f5e592a5b9ac3d2e345347b43 100644 --- a/daemon/src/client/presencemanager.cpp +++ b/daemon/src/client/presencemanager.cpp @@ -49,7 +49,7 @@ constexpr static const char* LINESTATUS_KEY = "LineStatus"; constexpr static const char* ONLINE_KEY = "Online"; constexpr static const char* OFFLINE_KEY = "Offline"; -void PresenceManager::registerEvHandlers(struct sflph_pres_ev_handlers* evHandlers) +void PresenceManager::registerEvHandlers(struct ring_pres_ev_handlers* evHandlers) { evHandlers_ = *evHandlers; } @@ -63,14 +63,14 @@ PresenceManager::subscribeBuddy(const std::string& accountID, const std::string& const auto sipaccount = Manager::instance().getAccount<SIPAccount>(accountID); if (!sipaccount) { - SFL_ERR("Could not find account %s", accountID.c_str()); + RING_ERR("Could not find account %s", accountID.c_str()); return; } auto pres = sipaccount->getPresence(); if (pres and pres->isEnabled() and pres->isSupported(PRESENCE_FUNCTION_SUBSCRIBE)) { - SFL_DBG("%subscribePresence (acc:%s, buddy:%s)", flag ? "S" : "Uns", + RING_DBG("%subscribePresence (acc:%s, buddy:%s)", flag ? "S" : "Uns", accountID.c_str(), uri.c_str()); pres->subscribeClient(uri, flag); } @@ -86,14 +86,14 @@ PresenceManager::publish(const std::string& accountID, bool status, const std::s const auto sipaccount = Manager::instance().getAccount<SIPAccount>(accountID); if (!sipaccount) { - SFL_ERR("Could not find account %s.", accountID.c_str()); + RING_ERR("Could not find account %s.", accountID.c_str()); return; } auto pres = sipaccount->getPresence(); if (pres and pres->isEnabled() and pres->isSupported(PRESENCE_FUNCTION_PUBLISH)) { - SFL_DBG("Send Presence (acc:%s, status %s).", accountID.c_str(), + RING_DBG("Send Presence (acc:%s, status %s).", accountID.c_str(), status ? "online" : "offline"); pres->sendPresence(status, note); } @@ -109,17 +109,17 @@ PresenceManager::answerServerRequest(const std::string& uri, bool flag) const auto sipaccount = static_cast<SIPAccount *>(account.get()); if (!sipaccount) { - SFL_ERR("Could not find account IP2IP"); + RING_ERR("Could not find account IP2IP"); return; } - SFL_DBG("Approve presence (acc:IP2IP, serv:%s, flag:%s)", uri.c_str(), + RING_DBG("Approve presence (acc:IP2IP, serv:%s, flag:%s)", uri.c_str(), flag ? "true" : "false"); auto pres = sipaccount->getPresence(); if (!pres) { - SFL_ERR("Presence not initialized"); + RING_ERR("Presence not initialized"); return; } @@ -139,7 +139,7 @@ PresenceManager::getSubscriptions(const std::string& accountID) const auto pres = sipaccount->getPresence(); if (!pres) { - SFL_ERR("Presence not initialized"); + RING_ERR("Presence not initialized"); return ret; } @@ -168,7 +168,7 @@ PresenceManager::setSubscriptions(const std::string& accountID, const std::vecto auto pres = sipaccount->getPresence(); if (!pres) { - SFL_ERR("Presence not initialized"); + RING_ERR("Presence not initialized"); return; } diff --git a/daemon/src/client/presencemanager.h b/daemon/src/client/presencemanager.h index b81752303bb25470a4191402da2f39305295c968..2fa04b614996ad2081fb5cef9d6a2b2dd9dd077f 100644 --- a/daemon/src/client/presencemanager.h +++ b/daemon/src/client/presencemanager.h @@ -38,12 +38,12 @@ #include <vector> #include <string> -#include "sflphone.h" +#include "ring.h" class PresenceManager { public: - void registerEvHandlers(struct sflph_pres_ev_handlers* evHandlers); + void registerEvHandlers(struct ring_pres_ev_handlers* evHandlers); // Methods public: @@ -65,7 +65,7 @@ class PresenceManager private: #pragma GCC diagnostic ignored "-Wmissing-field-initializers" // Event handlers; needed by the library API - sflph_pres_ev_handlers evHandlers_{}; + ring_pres_ev_handlers evHandlers_{}; #pragma GCC diagnostic warning "-Wmissing-field-initializers" }; diff --git a/daemon/src/client/videomanager.cpp b/daemon/src/client/videomanager.cpp index b3ad383cf1a56e5aab9748f67f63412196256f62..4922473a0d29b8e91415fdf2eacd650dd3427079 100644 --- a/daemon/src/client/videomanager.cpp +++ b/daemon/src/client/videomanager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com> * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * Author: Guillaume Carmel-Archambault <guillaume.carmel-archambault@savoirfairelinux.com> @@ -43,12 +43,12 @@ VideoManager::VideoManager() libav_utils::sfl_avcodec_init(); } -void VideoManager::registerEvHandlers(struct sflph_video_ev_handlers* evHandlers) +void VideoManager::registerEvHandlers(struct ring_video_ev_handlers* evHandlers) { evHandlers_ = *evHandlers; } -sfl_video::VideoDeviceMonitor & +ring::video::VideoDeviceMonitor & VideoManager::getVideoDeviceMonitor() { return videoDeviceMonitor_; @@ -79,7 +79,7 @@ VideoManager::getDeviceList() return videoDeviceMonitor_.getDeviceList(); } -sfl_video::VideoCapabilities +ring::video::VideoCapabilities VideoManager::getCapabilities(const std::string& name) { return videoDeviceMonitor_.getCapabilities(name); @@ -94,7 +94,7 @@ VideoManager::getDefaultDevice() void VideoManager::setDefaultDevice(const std::string &name) { - SFL_DBG("Setting device to %s", name.c_str()); + RING_DBG("Setting device to %s", name.c_str()); videoDeviceMonitor_.setDefaultDevice(name); } @@ -130,7 +130,7 @@ VideoManager::switchInput(const std::string &resource) { auto input = videoInput_.lock(); if (!input) { - SFL_WARN("Video input not initialized"); + RING_WARN("Video input not initialized"); return false; } return input->switchInput(resource); @@ -142,13 +142,13 @@ VideoManager::switchToCamera() return switchInput("v4l2://" + videoDeviceMonitor_.getDefaultDevice()); } -std::shared_ptr<sfl_video::VideoFrameActiveWriter> +std::shared_ptr<ring::video::VideoFrameActiveWriter> VideoManager::getVideoCamera() { auto input = videoInput_.lock(); if (!input) { started_ = false; - input.reset(new sfl_video::VideoInput()); + input.reset(new ring::video::VideoInput()); videoInput_ = input; } return input; diff --git a/daemon/src/client/videomanager.h b/daemon/src/client/videomanager.h index e83c374ca21476478544cf45b5262c0a279a153c..a455ae960ec2c4a8cea5217c27d6e92e5773e91f 100644 --- a/daemon/src/client/videomanager.h +++ b/daemon/src/client/videomanager.h @@ -43,7 +43,7 @@ #include "video/video_base.h" #include "video/video_input.h" -#include "sflphone.h" +#include "ring.h" class VideoManager { @@ -56,14 +56,14 @@ class VideoManager * this video input instance: this instance is destroyed when the last * external user has released its shared pointer. */ - std::weak_ptr<sfl_video::VideoInput> videoInput_ = {}; - std::shared_ptr<sfl_video::VideoFrameActiveWriter> videoPreview_ = nullptr; - sfl_video::VideoDeviceMonitor videoDeviceMonitor_ = {}; + std::weak_ptr<ring::video::VideoInput> videoInput_ = {}; + std::shared_ptr<ring::video::VideoFrameActiveWriter> videoPreview_ = nullptr; + ring::video::VideoDeviceMonitor videoDeviceMonitor_ = {}; public: VideoManager(); - void registerEvHandlers(struct sflph_video_ev_handlers* evHandlers); - sfl_video::VideoDeviceMonitor& getVideoDeviceMonitor(); + void registerEvHandlers(struct ring_video_ev_handlers* evHandlers); + ring::video::VideoDeviceMonitor& getVideoDeviceMonitor(); // Methods public: @@ -77,7 +77,7 @@ class VideoManager std::vector<std::string> getDeviceList(); - sfl_video::VideoCapabilities + ring::video::VideoCapabilities getCapabilities(const std::string& name); std::map<std::string, std::string> @@ -101,7 +101,7 @@ class VideoManager bool hasCameraStarted(); bool switchInput(const std::string& resource); bool switchToCamera(); - std::shared_ptr<sfl_video::VideoFrameActiveWriter> getVideoCamera(); + std::shared_ptr<ring::video::VideoFrameActiveWriter> getVideoCamera(); // Signals public: @@ -111,7 +111,7 @@ class VideoManager private: #pragma GCC diagnostic ignored "-Wmissing-field-initializers" - sflph_video_ev_handlers evHandlers_{}; + ring_video_ev_handlers evHandlers_{}; #pragma GCC diagnostic warning "-Wmissing-field-initializers" }; diff --git a/daemon/src/conference.cpp b/daemon/src/conference.cpp index 633322a30e943bc205e0161204225ded341ec2ca..a031df59fd8639f98963ed7370332dc0905dfc29 100644 --- a/daemon/src/conference.cpp +++ b/daemon/src/conference.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2014 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author : Alexandre Savard <alexandre.savard@savoirfairelinux.com> * Author : Guillaume Roguez <guillaume.roguez@savoirfairelinux.com> * @@ -36,7 +36,7 @@ #include "audio/audiolayer.h" #include "audio/ringbufferpool.h" -#ifdef SFL_VIDEO +#ifdef RING_VIDEO #include "sip/sipcall.h" #include "client/videomanager.h" #include "video/video_input.h" @@ -51,7 +51,7 @@ Conference::Conference() : id_(Manager::instance().getNewCallID()) , confState_(ACTIVE_ATTACHED) , participants_() -#ifdef SFL_VIDEO +#ifdef RING_VIDEO , videoMixer_(nullptr) #endif { @@ -60,12 +60,12 @@ Conference::Conference() Conference::~Conference() { -#ifdef SFL_VIDEO +#ifdef RING_VIDEO for (const auto &participant_id : participants_) { if (auto call = Manager::instance().callFactory.getCall<SIPCall>(participant_id)) call->getVideoRtp().exitConference(); } -#endif // SFL_VIDEO +#endif // RING_VIDEO } Conference::ConferenceState Conference::getState() const @@ -81,20 +81,20 @@ void Conference::setState(ConferenceState state) void Conference::add(const std::string &participant_id) { if (participants_.insert(participant_id).second) { -#ifdef SFL_VIDEO +#ifdef RING_VIDEO if (auto call = Manager::instance().callFactory.getCall<SIPCall>(participant_id)) call->getVideoRtp().enterConference(this); -#endif // SFL_VIDEO +#endif // RING_VIDEO } } void Conference::remove(const std::string &participant_id) { if (participants_.erase(participant_id)) { -#ifdef SFL_VIDEO +#ifdef RING_VIDEO if (auto call = Manager::instance().callFactory.getCall<SIPCall>(participant_id)) call->getVideoRtp().exitConference(); -#endif // SFL_VIDEO +#endif // RING_VIDEO } } @@ -108,8 +108,8 @@ void Conference::bindParticipant(const std::string &participant_id) rbPool.flush(item); } - rbPool.bindCallID(participant_id, sfl::RingBufferPool::DEFAULT_ID); - rbPool.flush(sfl::RingBufferPool::DEFAULT_ID); + rbPool.bindCallID(participant_id, ring::RingBufferPool::DEFAULT_ID); + rbPool.flush(ring::RingBufferPool::DEFAULT_ID); } std::string Conference::getStateStr() const @@ -162,14 +162,14 @@ bool Conference::toggleRecording() for (const auto &item : participants_) rbPool.bindHalfDuplexOut(process_id, item); - rbPool.bindHalfDuplexOut(process_id, sfl::RingBufferPool::DEFAULT_ID); + rbPool.bindHalfDuplexOut(process_id, ring::RingBufferPool::DEFAULT_ID); Recordable::recorder_.start(); } else { for (const auto &item : participants_) rbPool.unBindHalfDuplexOut(process_id, item); - rbPool.unBindHalfDuplexOut(process_id, sfl::RingBufferPool::DEFAULT_ID); + rbPool.unBindHalfDuplexOut(process_id, ring::RingBufferPool::DEFAULT_ID); } return startRecording; @@ -179,11 +179,11 @@ std::string Conference::getConfID() const { return id_; } -#ifdef SFL_VIDEO -std::shared_ptr<sfl_video::VideoMixer> Conference::getVideoMixer() +#ifdef RING_VIDEO +std::shared_ptr<ring::video::VideoMixer> Conference::getVideoMixer() { if (!videoMixer_) - videoMixer_.reset(new sfl_video::VideoMixer(id_)); + videoMixer_.reset(new ring::video::VideoMixer(id_)); return videoMixer_; } #endif diff --git a/daemon/src/conference.h b/daemon/src/conference.h index 294d2d94c20482efc4d005ff2fa83a25f0fbd5ec..c322af7f914f24261d5ab79319a507c7e4971710 100644 --- a/daemon/src/conference.h +++ b/daemon/src/conference.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -40,13 +40,13 @@ #include "audio/recordable.h" -#ifdef SFL_VIDEO +#ifdef RING_VIDEO #include "video/video_mixer.h" #endif typedef std::set<std::string> ParticipantSet; -class Conference : public sfl::Recordable { +class Conference : public ring::Recordable { public: enum ConferenceState {ACTIVE_ATTACHED, ACTIVE_DETACHED, ACTIVE_ATTACHED_REC, ACTIVE_DETACHED_REC, HOLD, HOLD_REC}; @@ -111,8 +111,8 @@ class Conference : public sfl::Recordable { */ virtual bool toggleRecording(); -#ifdef SFL_VIDEO - std::shared_ptr<sfl_video::VideoMixer> getVideoMixer(); +#ifdef RING_VIDEO + std::shared_ptr<ring::video::VideoMixer> getVideoMixer(); #endif private: @@ -120,8 +120,8 @@ class Conference : public sfl::Recordable { ConferenceState confState_; ParticipantSet participants_; -#ifdef SFL_VIDEO - std::shared_ptr<sfl_video::VideoMixer> videoMixer_; +#ifdef RING_VIDEO + std::shared_ptr<ring::video::VideoMixer> videoMixer_; #endif }; diff --git a/daemon/src/config/serializable.h b/daemon/src/config/serializable.h index 9f8ca024927ad17c6bae0924c0f6bf8db11c81ae..81e6dca46758dc0f69aeb77c594b279d07d495df 100644 --- a/daemon/src/config/serializable.h +++ b/daemon/src/config/serializable.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify diff --git a/daemon/src/config/yamlparser.cpp b/daemon/src/config/yamlparser.cpp index 4d66f380b61768983bc24fc8bb541cedd2874fe9..71f7b8cdcbb3e840d16ffe4a853b7eace71e573e 100644 --- a/daemon/src/config/yamlparser.cpp +++ b/daemon/src/config/yamlparser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify diff --git a/daemon/src/config/yamlparser.h b/daemon/src/config/yamlparser.h index 3c7c0fa96c937df8ca64b069bf96a63cbaf0102d..06920fa2b1666ada74d5718edb9b2f870d86bbc3 100644 --- a/daemon/src/config/yamlparser.h +++ b/daemon/src/config/yamlparser.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify diff --git a/daemon/src/enumclass_utils.h b/daemon/src/enumclass_utils.h index 97403af58960ff8d039c7816887834297d67027c..f67f38b3c910395a48e93b17bded1656c7a598bc 100644 --- a/daemon/src/enumclass_utils.h +++ b/daemon/src/enumclass_utils.h @@ -27,7 +27,7 @@ #include <vector> #include <cassert> -namespace sfl { +namespace ring { /** * This function adds a safe way to get an enum class size @@ -97,7 +97,7 @@ private: * This is useful to use enum class in C++11 foreach loops * * @usage - * for (const MyEnum& value : sfl::Matrix0D<MyEnum>()) { + * for (const MyEnum& value : ring::Matrix0D<MyEnum>()) { * std::cout << "Name: " << MyEnumNames[value] << std::endl; * } */ @@ -187,7 +187,7 @@ template<class Row, typename Value, typename Accessor> Value Matrix1D<Row,Value,Accessor>::operator[](Row v) { //ASSERT(size_t(v) >= size_t(Row::COUNT__),"State Machine Out of Bounds\n"); if (size_t(v) >= enum_class_size<Row>() || static_cast<int>(v) < 0) { - SFL_ERR("State Machine Out of Bounds %d\n", size_t(v)); + RING_ERR("State Machine Out of Bounds %d\n", size_t(v)); assert(false); throw v; } @@ -198,7 +198,7 @@ template<class Row, typename Value, typename Accessor> const Value Matrix1D<Row,Value,Accessor>::operator[](Row v) const { assert(size_t(v) <= enum_class_size<Row>()+1 && size_t(v)>=0); //COUNT__ is also valid if (size_t(v) >= enum_class_size<Row>()) { - SFL_ERR("State Machine Out of Bounds %d\n", size_t(v)); + RING_ERR("State Machine Out of Bounds %d\n", size_t(v)); assert(false); throw v; } @@ -210,7 +210,7 @@ template <class E, class T, class A> std::map<A,E> Matrix1D<E,T,A>::reverseMappi template<class Row, typename Value, typename Accessor> void Matrix1D<Row,Value,Accessor>::setReverseMapping(Matrix1D<Row,const char*> names) { - for ( const Row row : sfl::Matrix0D<Row>() ) + for ( const Row row : ring::Matrix0D<Row>() ) reverseMapping_[names[row]] = row; } diff --git a/daemon/src/fileutils.cpp b/daemon/src/fileutils.cpp index 6ac54b3086c612c749dff30643235a828788e0ac..ea96d4d1757cfeeb36d9610b41eebb38c3b4ef19 100644 --- a/daemon/src/fileutils.cpp +++ b/daemon/src/fileutils.cpp @@ -81,7 +81,7 @@ bool check_dir(const char *path) } #ifdef __ANDROID__ -static char *program_dir = "/data/data/org.sflphone"; +static char *program_dir = "/data/data/cx.ring"; #else static char *program_dir = NULL; #endif @@ -100,7 +100,7 @@ const char *get_program_dir() std::string get_ringtone_dir() { - return std::string(get_program_dir()) + "/../../share/sflphone/ringtones/"; + return std::string(get_program_dir()) + "/../../share/ring/ringtones/"; } /* Lock a file region */ @@ -131,23 +131,23 @@ create_pidfile() char buf[100]; f.fd = open(f.name.c_str(), O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); if (f.fd == -1) { - SFL_ERR("Could not open PID file %s", f.name.c_str()); + RING_ERR("Could not open PID file %s", f.name.c_str()); return f; } if (lockRegion(f.fd, F_WRLCK, SEEK_SET, 0, 0) == -1) { if (errno == EAGAIN or errno == EACCES) - SFL_ERR("PID file '%s' is locked; probably " + RING_ERR("PID file '%s' is locked; probably " "'%s' is already running", f.name.c_str(), PACKAGE_NAME); else - SFL_ERR("Unable to lock PID file '%s'", f.name.c_str()); + RING_ERR("Unable to lock PID file '%s'", f.name.c_str()); close(f.fd); f.fd = -1; return f; } if (ftruncate(f.fd, 0) == -1) { - SFL_ERR("Could not truncate PID file '%s'", f.name.c_str()); + RING_ERR("Could not truncate PID file '%s'", f.name.c_str()); close(f.fd); f.fd = -1; return f; @@ -157,7 +157,7 @@ create_pidfile() const int buf_strlen = strlen(buf); if (write(f.fd, buf, buf_strlen) != buf_strlen) { - SFL_ERR("Problem writing to PID file '%s'", f.name.c_str()); + RING_ERR("Problem writing to PID file '%s'", f.name.c_str()); close(f.fd); f.fd = -1; return f; @@ -170,7 +170,7 @@ std::string expand_path(const std::string &path) { #ifdef __ANDROID__ - SFL_ERR("Path expansion not implemented, returning original"); + RING_ERR("Path expansion not implemented, returning original"); return path; #else @@ -181,20 +181,20 @@ expand_path(const std::string &path) switch (ret) { case WRDE_BADCHAR: - SFL_ERR("Illegal occurrence of newline or one of |, &, ;, <, >, " + RING_ERR("Illegal occurrence of newline or one of |, &, ;, <, >, " "(, ), {, }."); return result; case WRDE_BADVAL: - SFL_ERR("An undefined shell variable was referenced"); + RING_ERR("An undefined shell variable was referenced"); return result; case WRDE_CMDSUB: - SFL_ERR("Command substitution occurred"); + RING_ERR("Command substitution occurred"); return result; case WRDE_SYNTAX: - SFL_ERR("Shell syntax error"); + RING_ERR("Shell syntax error"); return result; case WRDE_NOSPACE: - SFL_ERR("Out of memory."); + RING_ERR("Out of memory."); // This is the only error where we must call wordfree break; default: @@ -237,7 +237,7 @@ saveFile(const std::string& path, const std::vector<uint8_t>& data) { std::ofstream file(path, std::ios::trunc | std::ios::binary); if (!file.is_open()) { - SFL_ERR("Could not write data to %s", path.c_str()); + RING_ERR("Could not write data to %s", path.c_str()); return; } file.write((char*)data.data(), data.size()); @@ -271,7 +271,7 @@ readDirectory(const std::string& dir) { DIR *dp = opendir(dir.c_str()); if (!dp) { - SFL_ERR("Could not open %s", dir.c_str()); + RING_ERR("Could not open %s", dir.c_str()); return {}; } @@ -301,7 +301,7 @@ FileHandle::~FileHandle() if (fd != -1) { close(fd); if (unlink(name.c_str()) == -1) - SFL_ERR("%s", strerror(errno)); + RING_ERR("%s", strerror(errno)); } } diff --git a/daemon/src/fileutils.h b/daemon/src/fileutils.h index 5379f0d143299bd96e00ee36a7267246ec9d84c6..21486e982fc823b9804683e0b9c2fa5959ea36d2 100644 --- a/daemon/src/fileutils.h +++ b/daemon/src/fileutils.h @@ -41,7 +41,7 @@ #define XDG_CONFIG_HOME (PROTECTED_GETENV("XDG_CONFIG_HOME")) #define XDG_CACHE_HOME (PROTECTED_GETENV("XDG_CACHE_HOME")) -#define PIDFILE ".sfl.pid" +#define PIDFILE ".ring.pid" #define DIR_SEPARATOR_STR "/" // Directory separator char diff --git a/daemon/src/history/history.cpp b/daemon/src/history/history.cpp index e87e661b6b3c99c89c16d0c29254ce428c0b6142..2e79ed4d6d24c7b482c91b7b697d48752ad8255f 100644 --- a/daemon/src/history/history.cpp +++ b/daemon/src/history/history.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> @@ -41,7 +41,7 @@ #include "logger.h" #include "call.h" -namespace sfl { +namespace ring { History::History() : historyItemsMutex_(), items_(), path_() {} @@ -59,7 +59,7 @@ bool History::load(int limit) ensurePath(); std::ifstream infile(path_.c_str()); if (!infile) { - SFL_DBG("No history file to load"); + RING_DBG("No history file to load"); return false; } @@ -74,7 +74,7 @@ bool History::load(int limit) bool History::save() { std::lock_guard<std::mutex> lock(historyItemsMutex_); - SFL_DBG("Saving history in XDG directory: %s", path_.c_str()); + RING_DBG("Saving history in XDG directory: %s", path_.c_str()); ensurePath(); std::sort(items_.begin(), items_.end()); std::ofstream outfile(path_.c_str()); @@ -104,7 +104,7 @@ void History::ensurePath() if (path_.empty()) { const string userdata = fileutils::get_data_dir(); if (!fileutils::check_dir(userdata.c_str())) { - SFL_DBG("Cannot create directory: %s", userdata.c_str()); + RING_DBG("Cannot create directory: %s", userdata.c_str()); return; } path_ = userdata + DIR_SEPARATOR_STR + "history"; @@ -129,7 +129,7 @@ void History::setPath(const std::string &path) void History::addCall(Call *call, int limit) { if (!call) { - SFL_ERR("Call is NULL, ignoring"); + RING_ERR("Call is NULL, ignoring"); return; } call->time_stop(); diff --git a/daemon/src/history/history.h b/daemon/src/history/history.h index ed4ca3f7118159218d6cd1bf89c0b9664bfb8097..eefe97811ec290f3a316d2fa4f884c63a0536557 100644 --- a/daemon/src/history/history.h +++ b/daemon/src/history/history.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> @@ -39,7 +39,7 @@ class Call; -namespace sfl { +namespace ring { class History { diff --git a/daemon/src/history/historyitem.cpp b/daemon/src/history/historyitem.cpp index 94640695cd33aeba697df6cfb6a96cacf64a62fa..2ce05929932d8ff098acbd1e709bd66e86a6a500 100644 --- a/daemon/src/history/historyitem.cpp +++ b/daemon/src/history/historyitem.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> @@ -35,7 +35,7 @@ #include <cstdlib> #include <istream> -namespace sfl { +namespace ring { const char * const HistoryItem::ACCOUNT_ID_KEY = "accountid"; const char * const HistoryItem::CALLID_KEY = "callid"; diff --git a/daemon/src/history/historyitem.h b/daemon/src/history/historyitem.h index 28264a5c1b62e012a7532976b131b166f92be05d..17d2e7fecc99853985687e0c432e17ce92b8600f 100644 --- a/daemon/src/history/historyitem.h +++ b/daemon/src/history/historyitem.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * Author: Alexamdre Savard <alexandre.savard@savoirfairelinux.com> @@ -36,7 +36,7 @@ #include <string> #include <map> -namespace sfl { +namespace ring { class HistoryItem { public: diff --git a/daemon/src/hooks/urlhook.cpp b/daemon/src/hooks/urlhook.cpp index ba69a1edd8d500e15e041aefff991262ee8ec8ed..233fcaca98524fef8c8ecce369876209d2e1d916 100644 --- a/daemon/src/hooks/urlhook.cpp +++ b/daemon/src/hooks/urlhook.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify diff --git a/daemon/src/hooks/urlhook.h b/daemon/src/hooks/urlhook.h index 16519985235e531bbe6442f03e2d03008e276a50..8388c8cb1e47cb0d37e9ebc8b3da7101d63a6e1a 100644 --- a/daemon/src/hooks/urlhook.h +++ b/daemon/src/hooks/urlhook.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify diff --git a/daemon/src/iax/iaxaccount.cpp b/daemon/src/iax/iaxaccount.cpp index f9d85af99bd85df6178f209a91d128773306125d..f26f9c8c84ab5d1e8df1649771a04f7f578568b4 100644 --- a/daemon/src/iax/iaxaccount.cpp +++ b/daemon/src/iax/iaxaccount.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2014 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * Author: Alexandre Bourget <alexandre.bourget@savoirfairelinux.com> @@ -97,7 +97,7 @@ void IAXAccount::doRegister() link_->init(); sendRegister(); } catch (const VoipLinkException &e) { - SFL_ERR("IAXAccount: %s", e.what()); + RING_ERR("IAXAccount: %s", e.what()); } } @@ -108,7 +108,7 @@ IAXAccount::doUnregister(std::function<void(bool)> cb) sendUnregister(); link_->terminate(); } catch (const VoipLinkException &e) { - SFL_ERR("IAXAccount: %s", e.what()); + RING_ERR("IAXAccount: %s", e.what()); } if (cb) cb(true); @@ -176,7 +176,7 @@ void IAXAccount::sendRegister() { if (not isEnabled()) { - SFL_WARN("Account must be enabled to register, ignoring"); + RING_WARN("Account must be enabled to register, ignoring"); return; } @@ -194,7 +194,7 @@ IAXAccount::sendRegister() if (regSession_) { { std::lock_guard<std::mutex> lock(IAXVoIPLink::mutexIAX); - SFL_DBG("register IAXAccount %s", getHostname().c_str()); + RING_DBG("register IAXAccount %s", getHostname().c_str()); iax_register(regSession_.get(), getHostname().data(), getUsername().data(), getPassword().data(), 120); } @@ -207,7 +207,7 @@ IAXAccount::sendRegister() void IAXAccount::sendUnregister(std::function<void(bool)> cb) { - SFL_DBG("unregister IAXAccount %s", getHostname().c_str()); + RING_DBG("unregister IAXAccount %s", getHostname().c_str()); destroyRegSession(); nextRefreshStamp_ = 0; diff --git a/daemon/src/iax/iaxaccount.h b/daemon/src/iax/iaxaccount.h index f41a42fa3c3e8aa81d7baabbbea7ebf360962c27..1ca1e208a433632868fbc1cf8745612b35c78aa7 100644 --- a/daemon/src/iax/iaxaccount.h +++ b/daemon/src/iax/iaxaccount.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2014 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Alexandre Bourget <alexandre.bourget@savoirfairelinux.com> * Author: Yan Morin <yan.morin@savoirfairelinux.com> * Author: Guillaume Roguez <guillaume.roguez@savoirfairelinux.com> diff --git a/daemon/src/iax/iaxcall.cpp b/daemon/src/iax/iaxcall.cpp index e72627838e88adf6d4bd79a33290b65f57b71648..4f6a0eb195d0867ba006211ddf8f1d41b340fa78 100644 --- a/daemon/src/iax/iaxcall.cpp +++ b/daemon/src/iax/iaxcall.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2014 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Alexandre Bourget <alexandre.bourget@savoirfairelinux.com> * Author: Yan Morin <yan.morin@savoirfairelinux.com> * Author : Guillaume Roguez <guillaume.roguez@savoirfairelinux.com> @@ -66,7 +66,7 @@ codecToASTFormat(int c) return AST_FORMAT_SPEEX; default: - SFL_ERR("Codec %d not supported!", c); + RING_ERR("Codec %d not supported!", c); return 0; } } @@ -92,7 +92,7 @@ int IAXCall::getSupportedFormat(const std::string &accountID) const for (const auto &i : codecs) format_mask |= codecToASTFormat(i); } else - SFL_ERR("No IAx account could be found"); + RING_ERR("No IAx account could be found"); return format_mask; } @@ -113,7 +113,7 @@ int IAXCall::getFirstMatchingFormat(int needles, const std::string &accountID) c return format_mask; } } else - SFL_ERR("No IAx account could be found"); + RING_ERR("No IAx account could be found"); return 0; } @@ -132,7 +132,7 @@ int IAXCall::getAudioCodec() const case AST_FORMAT_SPEEX: return PAYLOAD_CODEC_SPEEX_8000; default: - SFL_ERR("IAX: Format %d not supported!", format); + RING_ERR("IAX: Format %d not supported!", format); return -1; } } @@ -239,12 +239,12 @@ void IAXCall::sendTextMessage(const std::string& message, const std::string& /*from*/) { std::lock_guard<std::mutex> lock(IAXVoIPLink::mutexIAX); - sfl::InstantMessaging::send_iax_message(session, getCallId(), message.c_str()); + ring::InstantMessaging::send_iax_message(session, getCallId(), message.c_str()); } #endif void -IAXCall::putAudioData(sfl::AudioBuffer& buf) +IAXCall::putAudioData(ring::AudioBuffer& buf) { ringbuffer_->put(buf); } diff --git a/daemon/src/iax/iaxcall.h b/daemon/src/iax/iaxcall.h index 0d2ab73dcd5bf0d156e0dfdb7de4973b2d7cd838..a910804b0c790f357778ff8a6fca7c22f6006a62 100644 --- a/daemon/src/iax/iaxcall.h +++ b/daemon/src/iax/iaxcall.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2014 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Alexandre Bourget <alexandre.bourget@savoirfairelinux.com> * Author: Yan Morin <yan.morin@savoirfairelinux.com> * Author : Guillaume Roguez <guillaume.roguez@savoirfairelinux.com> @@ -41,7 +41,7 @@ class IAXAccount; -namespace sfl { +namespace ring { class RingBuffer; class AudioBuffer; } @@ -114,13 +114,13 @@ class IAXCall : public Call const std::string& from); #endif - void putAudioData(sfl::AudioBuffer& buf); + void putAudioData(ring::AudioBuffer& buf); private: NON_COPYABLE(IAXCall); // Incoming audio ring buffer - std::shared_ptr<sfl::RingBuffer> ringbuffer_{}; + std::shared_ptr<ring::RingBuffer> ringbuffer_{}; }; #endif diff --git a/daemon/src/iax/iaxvoiplink.cpp b/daemon/src/iax/iaxvoiplink.cpp index 47ed7c7f3c6e5d96655b6f80bb4d89f495a09199..9c5961706c3659a5293e3f1fb47854d17f53edc5 100644 --- a/daemon/src/iax/iaxvoiplink.cpp +++ b/daemon/src/iax/iaxvoiplink.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2014 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Alexandre Bourget <alexandre.bourget@savoirfairelinux.com> * Author: Yan Morin <yan.morin@savoirfairelinux.com> * Author: Guillaume Roguez <guillaume.roguez@savoirfairelinux.com> @@ -48,7 +48,7 @@ #include "call_factory.h" #include "sfl_types.h" -using namespace sfl; +using namespace ring; std::mutex IAXVoIPLink::mutexIAX = {}; @@ -178,7 +178,7 @@ IAXVoIPLink::sendAudioFromMic() int compSize; unsigned int audioRate = audioCodec->getClockRate(); int outSamples; - sfl::AudioBuffer *in; + ring::AudioBuffer *in; if (audioRate != mainBufferSampleRate) { rawBuffer_.setSampleRate(audioRate); @@ -197,7 +197,7 @@ IAXVoIPLink::sendAudioFromMic() std::lock_guard<std::mutex> lock(mutexIAX); if (iax_send_voice(currentCall->session, currentCall->format, encodedData_, compSize, outSamples) == -1) - SFL_ERR("IAX: Error sending voice data."); + RING_ERR("IAX: Error sending voice data."); } } } @@ -350,7 +350,7 @@ IAXVoIPLink::iaxHandleVoiceEvent(iax_event* event, IAXCall& call) size = max; audioCodec->decode(rawBuffer_.getData(), data , size); - sfl::AudioBuffer *out = &rawBuffer_; + ring::AudioBuffer *out = &rawBuffer_; unsigned int audioRate = audioCodec->getClockRate(); if (audioRate != mainBufferSampleRate) { @@ -391,7 +391,7 @@ void IAXVoIPLink::iaxHandlePrecallEvent(iax_event* event) call = account_.newIncomingCall<IAXCall>(id); if (!call) { - SFL_ERR("failed to create an incoming IAXCall from account %s", + RING_ERR("failed to create an incoming IAXCall from account %s", accountID.c_str()); return; } diff --git a/daemon/src/iax/iaxvoiplink.h b/daemon/src/iax/iaxvoiplink.h index 94990a84a6e8608244997e6ac23629baa07d074a..625a232fbd503b4a87d83a283f7aa0eb46017417 100644 --- a/daemon/src/iax/iaxvoiplink.h +++ b/daemon/src/iax/iaxvoiplink.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2014 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * Author: Alexandre Bourget <alexandre.bourget@savoirfairelinux.com> * Author: Yan Morin <yan.morin@savoirfairelinux.com> @@ -51,7 +51,7 @@ class IAXCall; class AudioCodec; class AudioLayer; -namespace sfl { +namespace ring { class Resampler; } @@ -153,11 +153,11 @@ class IAXVoIPLink { IAXAccount& account_; /** encoder/decoder/resampler buffers */ - sfl::AudioBuffer rawBuffer_{RAW_BUFFER_SIZE, sfl::AudioFormat::MONO()}; - sfl::AudioBuffer resampledData_{RAW_BUFFER_SIZE * 4, sfl::AudioFormat::MONO()}; + ring::AudioBuffer rawBuffer_{RAW_BUFFER_SIZE, ring::AudioFormat::MONO()}; + ring::AudioBuffer resampledData_{RAW_BUFFER_SIZE * 4, ring::AudioFormat::MONO()}; unsigned char encodedData_[RAW_BUFFER_SIZE] = {}; - std::unique_ptr<sfl::Resampler> resampler_; + std::unique_ptr<ring::Resampler> resampler_; /** Whether init() was called already or not * This should be used in init() and terminate(), to diff --git a/daemon/src/ice_socket.h b/daemon/src/ice_socket.h index 0d29d9c45a81487b6409f9023c4d573d314389e3..bd47c2d28b41110b74b20dce54fd9f915c4c00bd 100644 --- a/daemon/src/ice_socket.h +++ b/daemon/src/ice_socket.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2014 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Guillaume Roguez <guillaume.roguez@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -31,7 +31,7 @@ #include <memory> -namespace sfl { +namespace ring { class IceTransport; diff --git a/daemon/src/ice_transport.cpp b/daemon/src/ice_transport.cpp index c9ba5a3d671ca9bd4a6d1bfdd8982965cc730a50..b471128487a4d32b3bcd613ef20c996e972a07af 100644 --- a/daemon/src/ice_transport.cpp +++ b/daemon/src/ice_transport.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2014 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Guillaume Roguez <guillaume.roguez@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -43,7 +43,7 @@ throw std::runtime_error(#ret " failed"); \ } while (0) -namespace sfl { +namespace ring { static void register_thread() @@ -57,7 +57,7 @@ register_thread() static __thread pj_thread_desc desc; static __thread pj_thread_t *this_thread; #endif - SFL_DBG("Registering thread"); + RING_DBG("Registering thread"); pj_thread_register(NULL, desc, &this_thread); } } @@ -79,7 +79,7 @@ IceTransport::cb_on_rx_data(pj_ice_strans* ice_st, if (auto tr = static_cast<IceTransport*>(pj_ice_strans_get_user_data(ice_st))) tr->onReceiveData(comp_id, pkt, size); else - SFL_WARN("null IceTransport"); + RING_WARN("null IceTransport"); } void @@ -90,7 +90,7 @@ IceTransport::cb_on_ice_complete(pj_ice_strans* ice_st, if (auto tr = static_cast<IceTransport*>(pj_ice_strans_get_user_data(ice_st))) tr->onComplete(ice_st, op, status); else - SFL_WARN("null IceTransport"); + RING_WARN("null IceTransport"); } IceTransport::IceTransport(const char* name, int component_count, @@ -139,9 +139,9 @@ IceTransport::onComplete(pj_ice_strans* ice_st, pj_ice_strans_op op, if (!done) { char errmsg[PJ_ERR_MSG_SIZE]; pj_strerror(status, errmsg, sizeof(errmsg)); - SFL_ERR("ICE %s failed: %s", opname, errmsg); + RING_ERR("ICE %s failed: %s", opname, errmsg); } - SFL_DBG("ICE %s with %s", opname, done?"success":"error"); + RING_DBG("ICE %s with %s", opname, done?"success":"error"); if (op == PJ_ICE_STRANS_OP_INIT and on_initdone_cb_) { on_initdone_cb_(*this, done); } else if (op == PJ_ICE_STRANS_OP_NEGOTIATION and on_negodone_cb_) { @@ -169,25 +169,25 @@ bool IceTransport::createIceSession(pj_ice_sess_role role) { if (pj_ice_strans_init_ice(icest_.get(), role, NULL, NULL) != PJ_SUCCESS) { - SFL_ERR("pj_ice_strans_init_ice() failed"); + RING_ERR("pj_ice_strans_init_ice() failed"); return false; } // Fetch some information on local configuration getUFragPwd(); getDefaultCanditates(); - SFL_DBG("ICE [local] ufrag=%s, pwd=%s", local_ufrag_.c_str(), local_pwd_.c_str()); + RING_DBG("ICE [local] ufrag=%s, pwd=%s", local_ufrag_.c_str(), local_pwd_.c_str()); return true; } bool IceTransport::setInitiatorSession() { - SFL_DBG("ICE as master"); + RING_DBG("ICE as master"); if (isInitialized()) { auto status = pj_ice_strans_change_role(icest_.get(), PJ_ICE_SESS_ROLE_CONTROLLING); if (status != PJ_SUCCESS) { - SFL_ERR("ICE role change failed"); + RING_ERR("ICE role change failed"); sip_utils::sip_strerror(status); return false; } @@ -199,11 +199,11 @@ IceTransport::setInitiatorSession() bool IceTransport::setSlaveSession() { - SFL_DBG("ICE as slave"); + RING_DBG("ICE as slave"); if (isInitialized()) { auto status = pj_ice_strans_change_role(icest_.get(), PJ_ICE_SESS_ROLE_CONTROLLED); if (status != PJ_SUCCESS) { - SFL_ERR("ICE role change failed"); + RING_ERR("ICE role change failed"); sip_utils::sip_strerror(status); return false; } @@ -217,14 +217,14 @@ IceTransport::start(const Attribute& rem_attrs, const std::vector<IceCandidate>& rem_candidates) { pj_str_t ufrag, pwd; - SFL_DBG("ICE negotiation starting (%u remote candidates)", rem_candidates.size()); + RING_DBG("ICE negotiation starting (%u remote candidates)", rem_candidates.size()); auto status = pj_ice_strans_start_ice(icest_.get(), pj_cstr(&ufrag, rem_attrs.ufrag.c_str()), pj_cstr(&pwd, rem_attrs.pwd.c_str()), rem_candidates.size(), rem_candidates.data()); if (status != PJ_SUCCESS) { - SFL_ERR("ICE start failed"); + RING_ERR("ICE start failed"); sip_utils::sip_strerror(status); return false; } @@ -264,7 +264,7 @@ IceTransport::start(const std::vector<uint8_t>& rem_data) auto rem_ufrag = unpackLine(begin, end); auto rem_pwd = unpackLine(begin, end); if (rem_pwd.empty() or rem_pwd.empty()) { - SFL_ERR("ICE remote attributes parsing error"); + RING_ERR("ICE remote attributes parsing error"); return false; } std::vector<IceCandidate> rem_candidates; @@ -278,7 +278,7 @@ IceTransport::start(const std::vector<uint8_t>& rem_data) rem_candidates.push_back(candidate); } } catch (std::exception& e) { - SFL_ERR("ICE remote candidates parsing error"); + RING_ERR("ICE remote candidates parsing error"); return false; } return start({rem_ufrag, rem_pwd}, rem_candidates); @@ -288,13 +288,13 @@ bool IceTransport::stop() { if (not pj_ice_strans_has_sess(icest_.get())) { - SFL_ERR("Session not created yet"); + RING_ERR("Session not created yet"); return false; } auto status = pj_ice_strans_stop_ice(icest_.get()); if (status != PJ_SUCCESS) { - SFL_ERR("ICE start failed"); + RING_ERR("ICE start failed"); sip_utils::sip_strerror(status); return false; } @@ -350,7 +350,7 @@ IceTransport::getLocalCandidates(unsigned comp_id) const unsigned cand_cnt = PJ_ARRAY_SIZE(cand); if (pj_ice_strans_enum_cands(icest_.get(), comp_id+1, &cand_cnt, cand) != PJ_SUCCESS) { - SFL_ERR("pj_ice_strans_enum_cands() failed"); + RING_ERR("pj_ice_strans_enum_cands() failed"); return res; } @@ -390,7 +390,7 @@ void IceTransport::onReceiveData(unsigned comp_id, void *pkt, pj_size_t size) { if (!comp_id or comp_id > component_count_) { - SFL_ERR("rx: invalid comp_id (%u)", comp_id); + RING_ERR("rx: invalid comp_id (%u)", comp_id); return; } if (!size) @@ -421,7 +421,7 @@ IceTransport::getCandidateFromSDP(const std::string& line, IceCandidate& cand) type); if (cnt != 7) { - SFL_WARN("ICE: invalid remote candidate line"); + RING_WARN("ICE: invalid remote candidate line"); return false; } @@ -434,7 +434,7 @@ IceTransport::getCandidateFromSDP(const std::string& line, IceCandidate& cand) else if (strcmp(type, "relay")==0) cand.type = PJ_ICE_CAND_TYPE_RELAYED; else { - SFL_WARN("ICE: invalid remote candidate type '%s'", type); + RING_WARN("ICE: invalid remote candidate type '%s'", type); return false; } @@ -450,7 +450,7 @@ IceTransport::getCandidateFromSDP(const std::string& line, IceCandidate& cand) pj_sockaddr_init(af, &cand.addr, NULL, 0); auto status = pj_sockaddr_set_str_addr(af, &cand.addr, &tmpaddr); if (status != PJ_SUCCESS) { - SFL_ERR("ICE: invalid remote IP address '%s'", ipaddr); + RING_ERR("ICE: invalid remote IP address '%s'", ipaddr); return false; } @@ -499,13 +499,13 @@ IceTransport::send(int comp_id, const unsigned char* buf, size_t len) register_thread(); auto remote = getRemoteAddress(comp_id); if (!remote) { - SFL_ERR("Can't find remote address for component %d", comp_id); + RING_ERR("Can't find remote address for component %d", comp_id); return -1; } auto status = pj_ice_strans_sendto(icest_.get(), comp_id+1, buf, len, remote.pjPtr(), remote.getLength()); if (status != PJ_SUCCESS) { sip_utils::sip_strerror(status); - SFL_ERR("send failed"); + RING_ERR("send failed"); return -1; } return len; diff --git a/daemon/src/ice_transport.h b/daemon/src/ice_transport.h index 61d4ef3ec62a72e093baad99cb9338ef310d82b3..51693e7b3b96ab3591aa22507404b7de99f17af1 100644 --- a/daemon/src/ice_transport.h +++ b/daemon/src/ice_transport.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2014 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Guillaume Roguez <guillaume.roguez@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -46,7 +46,7 @@ #include <mutex> #include <condition_variable> -namespace sfl { +namespace ring { class IceTransport; diff --git a/daemon/src/im/instant_messaging.cpp b/daemon/src/im/instant_messaging.cpp index 6262db73ad0678f08d300336852c43d41c06b007..47680df8367a4d79b8bf089b05bb05f69c2c8571 100644 --- a/daemon/src/im/instant_messaging.cpp +++ b/daemon/src/im/instant_messaging.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * @@ -39,19 +39,19 @@ startElementCallback(void *userData, const char *name, const char **atts) if (strcmp(name, "entry")) return; - sfl::InstantMessaging::UriEntry entry = sfl::InstantMessaging::UriEntry(); + ring::InstantMessaging::UriEntry entry = ring::InstantMessaging::UriEntry(); for (const char **att = atts; *att; att += 2) entry.insert(std::pair<std::string, std::string> (*att, *(att+1))); - static_cast<sfl::InstantMessaging::UriList *>(userData)->push_back(entry); + static_cast<ring::InstantMessaging::UriList *>(userData)->push_back(entry); } static void XMLCALL endElementCallback(void * /*userData*/, const char * /*name*/) {} -namespace sfl { +namespace ring { bool InstantMessaging::saveMessage(const std::string &message, const std::string &author, const std::string &id, int mode) { std::ofstream File; @@ -135,7 +135,7 @@ std::string InstantMessaging::generateXmlUriList(UriList &list) "<list>"; for (auto &item : list) - xmlbuffer += "<entry uri=" + item[sfl::IM_XML_URI] + " cp:copyControl=\"to\" />"; + xmlbuffer += "<entry uri=" + item[ring::IM_XML_URI] + " cp:copyControl=\"to\" />"; return xmlbuffer + "</list></resource-lists>"; } @@ -151,7 +151,7 @@ InstantMessaging::parseXmlUriList(const std::string &urilist) XML_SetElementHandler(parser, startElementCallback, endElementCallback); if (XML_Parse(parser, urilist.c_str(), urilist.size(), 1) == XML_STATUS_ERROR) { - SFL_ERR("%s at line %lu\n", XML_ErrorString(XML_GetErrorCode(parser)), + RING_ERR("%s at line %lu\n", XML_ErrorString(XML_GetErrorCode(parser)), XML_GetCurrentLineNumber(parser)); throw InstantMessageException("Error while parsing uri-list xml content"); } diff --git a/daemon/src/im/instant_messaging.h b/daemon/src/im/instant_messaging.h index 35000b85b8749a91b270619c642c80582cca308b..632bcd3bbd4c1aef40f18b3e4ccba4df9a270907 100644 --- a/daemon/src/im/instant_messaging.h +++ b/daemon/src/im/instant_messaging.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * @@ -57,7 +57,7 @@ #define MODE_APPEND std::ios::out || std::ios::app #define MODE_TEST std::ios::out -namespace sfl { +namespace ring { const std::string IM_XML_URI("uri"); const std::string BOUNDARY("--boundary"); diff --git a/daemon/src/intrin.h b/daemon/src/intrin.h index 4ce0d484bf4f0c98f2099ee4ff57b99321b0ae99..1757794a50d5404c285d79f217ab9ddf35749d4a 100644 --- a/daemon/src/intrin.h +++ b/daemon/src/intrin.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * Author: Yan Morin <yan.morin@savoirfairelinux.com> * Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com> diff --git a/daemon/src/ip_utils.cpp b/daemon/src/ip_utils.cpp index 9d61df95aebf7487d8c7fc79d4467b09579383fe..d01dfa1586e6c8e46c3e7cb4de9de1d7630d06f9 100644 --- a/daemon/src/ip_utils.cpp +++ b/daemon/src/ip_utils.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * * Author: Adrien Béraud <adrien.beraud@savoirfairelinux.com> * @@ -62,7 +62,7 @@ ip_utils::getAddrList(const std::string &name, pj_uint16_t family) pj_cstr(&pjname, name.c_str()); auto status = pj_getaddrinfo(family, &pjname, &addr_num, res); if (status != PJ_SUCCESS) { - SFL_ERR("Error resolving %s :", name.c_str()); + RING_ERR("Error resolving %s :", name.c_str()); sip_utils::sip_strerror(status); return ipList; } @@ -121,12 +121,12 @@ ip_utils::getLocalAddr(pj_uint16_t family) return ip_addr; } #if HAVE_IPV6 - SFL_WARN("Could not get preferred address familly (%s)", (family == pj_AF_INET6()) ? "IPv6" : "IPv4"); + RING_WARN("Could not get preferred address familly (%s)", (family == pj_AF_INET6()) ? "IPv6" : "IPv4"); family = (family == pj_AF_INET()) ? pj_AF_INET6() : pj_AF_INET(); status = pj_gethostip(family, ip_addr); if (status == PJ_SUCCESS) return ip_addr; #endif - SFL_ERR("Could not get local IP"); + RING_ERR("Could not get local IP"); return ip_addr; } @@ -141,14 +141,14 @@ ip_utils::getInterfaceAddr(const std::string &interface, pj_uint16_t family) int fd = socket(unix_family, SOCK_DGRAM, 0); if (fd < 0) { - SFL_ERR("Could not open socket: %m"); + RING_ERR("Could not open socket: %m"); return addr; } if (unix_family == AF_INET6) { int val = family != pj_AF_UNSPEC(); if (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, (void *) &val, sizeof(val)) < 0) { - SFL_ERR("Could not setsockopt: %m"); + RING_ERR("Could not setsockopt: %m"); close(fd); return addr; } diff --git a/daemon/src/ip_utils.h b/daemon/src/ip_utils.h index fe5f53a53b3d71132620e8fde3351024fe64eea7..7d9e459845c8de924b2176e883323b2c2a8f5abe 100644 --- a/daemon/src/ip_utils.h +++ b/daemon/src/ip_utils.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * * Author: Adrien Béraud <adrien.beraud@savoirfairelinux.com> * diff --git a/daemon/src/logger.c b/daemon/src/logger.c index 4817f0441f84bbafd5a0cedca0005830e15abf41..9dd07e0cb45a3c755e84b4f2146cfaf5b6ec6f5e 100644 --- a/daemon/src/logger.c +++ b/daemon/src/logger.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Julien Bonjean <julien.bonjean@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -92,7 +92,7 @@ int getDebugMode(void) void strErr(void) { #ifdef __GLIBC__ - SFL_ERR("%m"); + RING_ERR("%m"); #else char buf[1000]; const char *errstr; @@ -109,6 +109,6 @@ void strErr(void) break; } - SFL_ERR("%s", errstr); + RING_ERR("%s", errstr); #endif } diff --git a/daemon/src/logger.h b/daemon/src/logger.h index 4a78abe18fea2a7c377b92381fe08069059bc4a0..379d9d7a1156ef34028fab1934fc9275940949d6 100644 --- a/daemon/src/logger.h +++ b/daemon/src/logger.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Julien Bonjean <julien.bonjean@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -82,7 +82,7 @@ void strErr(); #include <android/log.h> #ifndef APP_NAME -#define APP_NAME "libsflphone" +#define APP_NAME "libdring" #endif /* APP_NAME */ // Avoid printing whole path on android @@ -117,10 +117,10 @@ void strErr(); #endif /* __ANDROID__ _WIN32 */ -#define SFL_ERR(M, ...) LOGGER(M, LOG_ERR, ##__VA_ARGS__) -#define SFL_WARN(M, ...) LOGGER(M, LOG_WARNING, ##__VA_ARGS__) -#define SFL_INFO(M, ...) LOGGER(M, LOG_INFO, ##__VA_ARGS__) -#define SFL_DBG(M, ...) LOGGER(M, LOG_DEBUG, ##__VA_ARGS__) +#define RING_ERR(M, ...) LOGGER(M, LOG_ERR, ##__VA_ARGS__) +#define RING_WARN(M, ...) LOGGER(M, LOG_WARNING, ##__VA_ARGS__) +#define RING_INFO(M, ...) LOGGER(M, LOG_INFO, ##__VA_ARGS__) +#define RING_DBG(M, ...) LOGGER(M, LOG_DEBUG, ##__VA_ARGS__) #define BLACK "\033[22;30m" diff --git a/daemon/src/manager.cpp b/daemon/src/manager.cpp index 18ce2177da129cf365ab99bcef8996309d902385..8c35ac9fd49a64574a52376692b05b5263743e88 100644 --- a/daemon/src/manager.cpp +++ b/daemon/src/manager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author : Tristan Matthews <tristan.matthews@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -39,7 +39,7 @@ ManagerImpl& Manager::instance() // This will give a warning that can be ignored the first time instance() // is called...subsequent warnings are more serious if (not ManagerImpl::initialized) - SFL_WARN("Not initialized"); + RING_WARN("Not initialized"); return instance_; } diff --git a/daemon/src/manager.h b/daemon/src/manager.h index eb822d05bb0e9f9edadbc414c14547e31c866a1d..d5da6a023d147526dbca61b45e8dc3b537612712 100644 --- a/daemon/src/manager.h +++ b/daemon/src/manager.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author : Jean-Philippe Barrette-LaPierre * <jean-philippe.barrette-lapierre@savoirfairelinux.com> * diff --git a/daemon/src/managerimpl.cpp b/daemon/src/managerimpl.cpp index 760bcf170b108eebd4a4daf50f1dbd5b6a1e5fd6..e66723fd4de0f87afff1ffaa8c446b99baae9662 100644 --- a/daemon/src/managerimpl.cpp +++ b/daemon/src/managerimpl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2014 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Alexandre Bourget <alexandre.bourget@savoirfairelinux.com> * Author: Yan Morin <yan.morin@savoirfairelinux.com> * Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com> @@ -74,7 +74,7 @@ #include "client/configurationmanager.h" #include "client/callmanager.h" -#ifdef SFL_VIDEO +#ifdef RING_VIDEO #include "client/videomanager.h" #endif @@ -92,11 +92,11 @@ #include <sys/stat.h> // mkdir(2) #include <memory> -using namespace sfl; +using namespace ring; std::atomic_bool ManagerImpl::initialized = {false}; -using namespace sfl; +using namespace ring; static void copy_over(const std::string &srcPath, const std::string &destPath) @@ -135,10 +135,10 @@ ManagerImpl::ManagerImpl() : , preferences(), voipPreferences(), hookPreference(), audioPreference(), shortcutPreferences(), hasTriedToRegister_(false), audioCodecFactory(*pluginManager_), client_(), - currentCallMutex_(), dtmfKey_(), dtmfBuf_(0, sfl::AudioFormat::MONO()), + currentCallMutex_(), dtmfKey_(), dtmfBuf_(0, ring::AudioFormat::MONO()), toneMutex_(), telephoneTone_(), audiofile_(), audioLayerMutex_(), waitingCalls_(), waitingCallsMutex_(), path_() - , ringbufferpool_(new sfl::RingBufferPool) + , ringbufferpool_(new ring::RingBufferPool) , callFactory(), conferenceMap_(), history_(), finished_(false), accountFactory_(), ice_tf_() { @@ -162,11 +162,11 @@ ManagerImpl::parseConfiguration() const int error_count = loadAccountMap(parsedFile); if (error_count > 0) { - SFL_WARN("Errors while parsing %s", path_.c_str()); + RING_WARN("Errors while parsing %s", path_.c_str()); result = false; } } catch (const YAML::BadFile &e) { - SFL_WARN("Could not open config file: creating default account map"); + RING_WARN("Could not open config file: creating default account map"); loadDefaultAccountMap(); } @@ -194,7 +194,7 @@ ManagerImpl::init(const std::string &config_file) ice_tf_.reset(new IceTransportFactory()); path_ = config_file.empty() ? retrieveConfigPath() : config_file; - SFL_DBG("Configuration file path: %s", path_.c_str()); + RING_DBG("Configuration file path: %s", path_.c_str()); bool no_errors = true; @@ -204,7 +204,7 @@ ManagerImpl::init(const std::string &config_file) try { no_errors = parseConfiguration(); } catch (const YAML::Exception &e) { - SFL_ERR("%s", e.what()); + RING_ERR("%s", e.what()); no_errors = false; } @@ -213,7 +213,7 @@ ManagerImpl::init(const std::string &config_file) make_backup(path_); } else { // restore previous configuration - SFL_WARN("Restoring last working configuration"); + RING_WARN("Restoring last working configuration"); try { // remove accounts from broken configuration @@ -221,8 +221,8 @@ ManagerImpl::init(const std::string &config_file) restore_backup(path_); parseConfiguration(); } catch (const YAML::Exception &e) { - SFL_ERR("%s", e.what()); - SFL_WARN("Restoring backup failed, creating default account map"); + RING_ERR("%s", e.what()); + RING_WARN("Restoring backup failed, creating default account map"); loadDefaultAccountMap(); } } @@ -235,9 +235,9 @@ ManagerImpl::init(const std::string &config_file) if (audiodriver_) { { std::lock_guard<std::mutex> toneLock(toneMutex_); - telephoneTone_.reset(new sfl::TelephoneTone(preferences.getZoneToneChoice(), audiodriver_->getSampleRate())); + telephoneTone_.reset(new ring::TelephoneTone(preferences.getZoneToneChoice(), audiodriver_->getSampleRate())); } - dtmfKey_.reset(new sfl::DTMF(getRingBufferPool().getInternalSamplingRate())); + dtmfKey_.reset(new ring::DTMF(getRingBufferPool().getInternalSamplingRate())); } } @@ -264,7 +264,7 @@ ManagerImpl::finish() callFactory.forbid(); // Hangup all remaining active calls - SFL_DBG("Hangup %zu remaining call(s)", callFactory.callCount()); + RING_DBG("Hangup %zu remaining call(s)", callFactory.callCount()); for (const auto call : callFactory.getAllCalls()) hangupCall(call->getCallId()); callFactory.clear(); @@ -286,7 +286,7 @@ ManagerImpl::finish() ice_tf_.reset(); pj_shutdown(); } catch (const VoipLinkException &err) { - SFL_ERR("%s", err.what()); + RING_ERR("%s", err.what()); } } @@ -331,7 +331,7 @@ void ManagerImpl::switchCall(std::shared_ptr<Call> call) { std::lock_guard<std::mutex> m(currentCallMutex_); - SFL_DBG("----- Switch current call id to '%s' -----", + RING_DBG("----- Switch current call id to '%s' -----", call ? call->getCallId().c_str() : "<nullptr>"); currentCall_ = call; } @@ -348,17 +348,17 @@ ManagerImpl::outgoingCall(const std::string& preferred_account_id, const std::string& conf_id) { if (call_id.empty()) { - SFL_DBG("New outgoing call abort, missing callid"); + RING_DBG("New outgoing call abort, missing callid"); return false; } // Call ID must be unique if (isValidCall(call_id)) { - SFL_ERR("Call id already exists in outgoing call"); + RING_ERR("Call id already exists in outgoing call"); return false; } - SFL_DBG("New outgoing call %s to %s", call_id.c_str(), to.c_str()); + RING_DBG("New outgoing call %s to %s", call_id.c_str(), to.c_str()); stopTone(); @@ -370,28 +370,28 @@ ManagerImpl::outgoingCall(const std::string& preferred_account_id, // in any cases we have to detach from current communication if (hasCurrentCall()) { - SFL_DBG("Has current call (%s) put it onhold", current_call_id.c_str()); + RING_DBG("Has current call (%s) put it onhold", current_call_id.c_str()); // if this is not a conference and this and is not a conference participant if (not isConference(current_call_id) and not isConferenceParticipant(current_call_id)) onHoldCall(current_call_id); else if (isConference(current_call_id) and not isConferenceParticipant(call_id)) - detachParticipant(sfl::RingBufferPool::DEFAULT_ID); + detachParticipant(ring::RingBufferPool::DEFAULT_ID); } std::shared_ptr<Call> call; try { - /* SFL_WARN: after this call the account_id is obsolete + /* RING_WARN: after this call the account_id is obsolete * as the factory may decide to use another account (like IP2IP). */ - SFL_DBG("New outgoing call to %s", to_cleaned.c_str()); + RING_DBG("New outgoing call to %s", to_cleaned.c_str()); call = newOutgoingCall(call_id, to_cleaned, preferred_account_id); } catch (ost::Socket *) { - SFL_ERR("Could not bind socket"); + RING_ERR("Could not bind socket"); return false; } catch (const std::exception &e) { - SFL_ERR("%s", e.what()); + RING_ERR("%s", e.what()); return false; } @@ -419,11 +419,11 @@ ManagerImpl::answerCall(const std::string& call_id) auto call = getCallFromCallID(call_id); if (!call) { - SFL_ERR("Call %s is NULL", call_id.c_str()); + RING_ERR("Call %s is NULL", call_id.c_str()); return false; } - // If sflphone is ringing + // If ring is ringing stopTone(); // store the current call id @@ -432,22 +432,22 @@ ManagerImpl::answerCall(const std::string& call_id) // in any cases we have to detach from current communication if (hasCurrentCall()) { - SFL_DBG("Currently conversing with %s", current_call_id.c_str()); + RING_DBG("Currently conversing with %s", current_call_id.c_str()); if (not isConference(current_call_id) and not isConferenceParticipant(current_call_id)) { - SFL_DBG("Answer call: Put the current call (%s) on hold", current_call_id.c_str()); + RING_DBG("Answer call: Put the current call (%s) on hold", current_call_id.c_str()); onHoldCall(current_call_id); } else if (isConference(current_call_id) and not isConferenceParticipant(call_id)) { // if we are talking to a conference and we are answering an incoming call - SFL_DBG("Detach main participant from conference"); - detachParticipant(sfl::RingBufferPool::DEFAULT_ID); + RING_DBG("Detach main participant from conference"); + detachParticipant(ring::RingBufferPool::DEFAULT_ID); } } try { call->answer(); } catch (const std::runtime_error &e) { - SFL_ERR("%s", e.what()); + RING_ERR("%s", e.what()); result = false; } @@ -491,13 +491,13 @@ ManagerImpl::hangupCall(const std::string& callId) stopTone(); - SFL_DBG("Send call state change (HUNGUP) for id %s", callId.c_str()); + RING_DBG("Send call state change (HUNGUP) for id %s", callId.c_str()); client_.getCallManager()->callStateChanged(callId, "HUNGUP"); /* We often get here when the call was hungup before being created */ auto call = getCallFromCallID(callId); if (not call) { - SFL_WARN("Could not hang up non-existant call %s", callId.c_str()); + RING_WARN("Could not hang up non-existant call %s", callId.c_str()); checkAudio(); return false; } @@ -519,7 +519,7 @@ ManagerImpl::hangupCall(const std::string& callId) checkAudio(); saveHistory(); } catch (const VoipLinkException &e) { - SFL_ERR("%s", e.what()); + RING_ERR("%s", e.what()); return false; } @@ -529,7 +529,7 @@ ManagerImpl::hangupCall(const std::string& callId) bool ManagerImpl::hangupConference(const std::string& id) { - SFL_DBG("Hangup conference %s", id.c_str()); + RING_DBG("Hangup conference %s", id.c_str()); ConferenceMap::iterator iter_conf = conferenceMap_.find(id); @@ -542,7 +542,7 @@ ManagerImpl::hangupConference(const std::string& id) for (const auto &item : participants) hangupCall(item); } else { - SFL_ERR("No such conference %s", id.c_str()); + RING_ERR("No such conference %s", id.c_str()); return false; } } @@ -567,11 +567,11 @@ ManagerImpl::onHoldCall(const std::string& callId) call->onhold(); removeStream(*call); // Unbind calls in main buffer } catch (const VoipLinkException &e) { - SFL_ERR("%s", e.what()); + RING_ERR("%s", e.what()); result = false; } } else { - SFL_DBG("CallID %s doesn't exist in call onHold", callId.c_str()); + RING_DBG("CallID %s doesn't exist in call onHold", callId.c_str()); return false; } @@ -601,12 +601,12 @@ ManagerImpl::offHoldCall(const std::string& callId) // Place current call on hold if it isn't if (hasCurrentCall()) { if (not isConference(currentCallId) and not isConferenceParticipant(currentCallId)) { - SFL_DBG("Has current call (%s), put on hold", currentCallId.c_str()); + RING_DBG("Has current call (%s), put on hold", currentCallId.c_str()); onHoldCall(currentCallId); } else if (isConference(currentCallId) && callId != currentCallId) { holdConference(currentCallId); } else if (isConference(currentCallId) and not isConferenceParticipant(callId)) - detachParticipant(sfl::RingBufferPool::DEFAULT_ID); + detachParticipant(ring::RingBufferPool::DEFAULT_ID); } std::shared_ptr<Call> call; @@ -617,7 +617,7 @@ ManagerImpl::offHoldCall(const std::string& callId) else result = false; } catch (const VoipLinkException &e) { - SFL_ERR("%s", e.what()); + RING_ERR("%s", e.what()); return false; } @@ -707,7 +707,7 @@ ManagerImpl::refuseCall(const std::string& id) std::shared_ptr<Conference> ManagerImpl::createConference(const std::string& id1, const std::string& id2) { - SFL_DBG("Create conference with call %s and %s", id1.c_str(), id2.c_str()); + RING_DBG("Create conference with call %s and %s", id1.c_str(), id2.c_str()); auto conf = std::make_shared<Conference>(); @@ -725,8 +725,8 @@ ManagerImpl::createConference(const std::string& id1, const std::string& id2) void ManagerImpl::removeConference(const std::string& conference_id) { - SFL_DBG("Remove conference %s", conference_id.c_str()); - SFL_DBG("number of participants: %u", conferenceMap_.size()); + RING_DBG("Remove conference %s", conference_id.c_str()); + RING_DBG("number of participants: %u", conferenceMap_.size()); ConferenceMap::iterator iter = conferenceMap_.find(conference_id); std::shared_ptr<Conference> conf; @@ -735,7 +735,7 @@ ManagerImpl::removeConference(const std::string& conference_id) conf = iter->second; if (not conf) { - SFL_ERR("Conference not found"); + RING_ERR("Conference not found"); return; } @@ -744,7 +744,7 @@ ManagerImpl::removeConference(const std::string& conference_id) // We now need to bind the audio to the remain participant // Unbind main participant audio from conference - getRingBufferPool().unBindAll(sfl::RingBufferPool::DEFAULT_ID); + getRingBufferPool().unBindAll(ring::RingBufferPool::DEFAULT_ID); ParticipantSet participants(conf->getParticipantList()); @@ -752,13 +752,13 @@ ManagerImpl::removeConference(const std::string& conference_id) ParticipantSet::iterator iter_p = participants.begin(); if (iter_p != participants.end()) - getRingBufferPool().bindCallID(*iter_p, sfl::RingBufferPool::DEFAULT_ID); + getRingBufferPool().bindCallID(*iter_p, ring::RingBufferPool::DEFAULT_ID); // Then remove the conference from the conference map if (conferenceMap_.erase(conference_id)) - SFL_DBG("Conference %s removed successfully", conference_id.c_str()); + RING_DBG("Conference %s removed successfully", conference_id.c_str()); else - SFL_ERR("Cannot remove conference: %s", conference_id.c_str()); + RING_ERR("Cannot remove conference: %s", conference_id.c_str()); } std::shared_ptr<Conference> @@ -854,17 +854,17 @@ bool ManagerImpl::addParticipant(const std::string& callId, const std::string& conferenceId) { - SFL_DBG("Add participant %s to %s", callId.c_str(), conferenceId.c_str()); + RING_DBG("Add participant %s to %s", callId.c_str(), conferenceId.c_str()); ConferenceMap::iterator iter = conferenceMap_.find(conferenceId); if (iter == conferenceMap_.end()) { - SFL_ERR("Conference id is not valid"); + RING_ERR("Conference id is not valid"); return false; } auto call = getCallFromCallID(callId); if (!call) { - SFL_ERR("Call id %s is not valid", callId.c_str()); + RING_ERR("Call id %s is not valid", callId.c_str()); return false; } @@ -878,7 +878,7 @@ ManagerImpl::addParticipant(const std::string& callId, // detach from prior communication and switch to this conference if (current_call_id != callId) { if (isConference(current_call_id)) - detachParticipant(sfl::RingBufferPool::DEFAULT_ID); + detachParticipant(ring::RingBufferPool::DEFAULT_ID); else onHoldCall(current_call_id); } @@ -916,7 +916,7 @@ ManagerImpl::addParticipant(const std::string& callId, ParticipantSet participants(conf->getParticipantList()); if (participants.empty()) - SFL_ERR("Participant list is empty for this conference"); + RING_ERR("Participant list is empty for this conference"); // Connect stream addStream(*call); @@ -930,7 +930,7 @@ ManagerImpl::addMainParticipant(const std::string& conference_id) std::string current_call_id(getCurrentCallId()); if (isConference(current_call_id)) - detachParticipant(sfl::RingBufferPool::DEFAULT_ID); + detachParticipant(ring::RingBufferPool::DEFAULT_ID); else onHoldCall(current_call_id); } @@ -948,19 +948,19 @@ ManagerImpl::addMainParticipant(const std::string& conference_id) ParticipantSet participants(conf->getParticipantList()); for (const auto &item_p : participants) { - getRingBufferPool().bindCallID(item_p, sfl::RingBufferPool::DEFAULT_ID); + getRingBufferPool().bindCallID(item_p, ring::RingBufferPool::DEFAULT_ID); // Reset ringbuffer's readpointers getRingBufferPool().flush(item_p); } - getRingBufferPool().flush(sfl::RingBufferPool::DEFAULT_ID); + getRingBufferPool().flush(ring::RingBufferPool::DEFAULT_ID); if (conf->getState() == Conference::ACTIVE_DETACHED) conf->setState(Conference::ACTIVE_ATTACHED); else if (conf->getState() == Conference::ACTIVE_DETACHED_REC) conf->setState(Conference::ACTIVE_ATTACHED_REC); else - SFL_WARN("Invalid conference state while adding main participant"); + RING_WARN("Invalid conference state while adding main participant"); client_.getCallManager()->conferenceChanged(conference_id, conf->getStateStr()); } @@ -980,21 +980,21 @@ ManagerImpl::joinParticipant(const std::string& callId1, const std::string& callId2) { if (callId1 == callId2) { - SFL_ERR("Cannot join participant %s to itself", callId1.c_str()); + RING_ERR("Cannot join participant %s to itself", callId1.c_str()); return false; } // Set corresponding conference ids for call 1 auto call1 = getCallFromCallID(callId1); if (!call1) { - SFL_ERR("Could not find call %s", callId1.c_str()); + RING_ERR("Could not find call %s", callId1.c_str()); return false; } // Set corresponding conderence details auto call2 = getCallFromCallID(callId2); if (!call2) { - SFL_ERR("Could not find call %s", callId2.c_str()); + RING_ERR("Could not find call %s", callId2.c_str()); return false; } @@ -1008,13 +1008,13 @@ ManagerImpl::joinParticipant(const std::string& callId1, std::map<std::string, std::string> call2Details(getCallDetails(callId2)); std::string current_call_id(getCurrentCallId()); - SFL_DBG("Current Call ID %s", current_call_id.c_str()); + RING_DBG("Current Call ID %s", current_call_id.c_str()); // detach from the conference and switch to this conference if ((current_call_id != callId1) and (current_call_id != callId2)) { // If currently in a conference if (isConference(current_call_id)) - detachParticipant(sfl::RingBufferPool::DEFAULT_ID); + detachParticipant(ring::RingBufferPool::DEFAULT_ID); else onHoldCall(current_call_id); // currently in a call } @@ -1030,7 +1030,7 @@ ManagerImpl::joinParticipant(const std::string& callId1, // Process call1 according to its state std::string call1_state_str(call1Details.find("CALL_STATE")->second); - SFL_DBG("Process call %s state: %s", callId1.c_str(), call1_state_str.c_str()); + RING_DBG("Process call %s state: %s", callId1.c_str(), call1_state_str.c_str()); if (call1_state_str == "HOLD") { conf->bindParticipant(callId1); @@ -1044,11 +1044,11 @@ ManagerImpl::joinParticipant(const std::string& callId1, conf->bindParticipant(callId1); answerCall(callId1); } else - SFL_WARN("Call state not recognized"); + RING_WARN("Call state not recognized"); // Process call2 according to its state std::string call2_state_str(call2Details.find("CALL_STATE")->second); - SFL_DBG("Process call %s state: %s", callId2.c_str(), call2_state_str.c_str()); + RING_DBG("Process call %s state: %s", callId2.c_str(), call2_state_str.c_str()); if (call2_state_str == "HOLD") { conf->bindParticipant(callId2); @@ -1062,7 +1062,7 @@ ManagerImpl::joinParticipant(const std::string& callId1, conf->bindParticipant(callId2); answerCall(callId2); } else - SFL_WARN("Call state not recognized"); + RING_WARN("Call state not recognized"); // Switch current call id to this conference switchCall(getCallFromCallID(conf->getConfID())); @@ -1079,7 +1079,7 @@ ManagerImpl::createConfFromParticipantList(const std::vector< std::string > &par { // we must at least have 2 participant for a conference if (participantList.size() <= 1) { - SFL_ERR("Participant number must be higher or equal to 2"); + RING_ERR("Participant number must be higher or equal to 2"); return; } @@ -1124,17 +1124,17 @@ ManagerImpl::detachParticipant(const std::string& call_id) { const std::string current_call_id(getCurrentCallId()); - if (call_id != sfl::RingBufferPool::DEFAULT_ID) { + if (call_id != ring::RingBufferPool::DEFAULT_ID) { auto call = getCallFromCallID(call_id); if (!call) { - SFL_ERR("Could not find call %s", call_id.c_str()); + RING_ERR("Could not find call %s", call_id.c_str()); return false; } auto conf = getConferenceFromCallID(call_id); if (conf == nullptr) { - SFL_ERR("Call is not conferencing, cannot detach"); + RING_ERR("Call is not conferencing, cannot detach"); return false; } @@ -1142,7 +1142,7 @@ ManagerImpl::detachParticipant(const std::string& call_id) std::map<std::string, std::string>::iterator iter_details(call_details.find("CALL_STATE")); if (iter_details == call_details.end()) { - SFL_ERR("Could not find CALL_STATE"); + RING_ERR("Could not find CALL_STATE"); return false; } @@ -1153,11 +1153,11 @@ ManagerImpl::detachParticipant(const std::string& call_id) removeParticipant(call_id); } else { - SFL_DBG("Unbind main participant from conference %d"); - getRingBufferPool().unBindAll(sfl::RingBufferPool::DEFAULT_ID); + RING_DBG("Unbind main participant from conference %d"); + getRingBufferPool().unBindAll(ring::RingBufferPool::DEFAULT_ID); if (not isConference(current_call_id)) { - SFL_ERR("Current call id (%s) is not a conference", current_call_id.c_str()); + RING_ERR("Current call id (%s) is not a conference", current_call_id.c_str()); return false; } @@ -1165,7 +1165,7 @@ ManagerImpl::detachParticipant(const std::string& call_id) auto conf = iter->second; if (iter == conferenceMap_.end() or conf == 0) { - SFL_DBG("Conference is NULL"); + RING_DBG("Conference is NULL"); return false; } @@ -1174,7 +1174,7 @@ ManagerImpl::detachParticipant(const std::string& call_id) else if (conf->getState() == Conference::ACTIVE_ATTACHED_REC) conf->setState(Conference::ACTIVE_DETACHED_REC); else - SFL_WARN("Undefined behavior, invalid conference state in detach participant"); + RING_WARN("Undefined behavior, invalid conference state in detach participant"); client_.getCallManager()->conferenceChanged(conf->getConfID(), conf->getStateStr()); @@ -1188,12 +1188,12 @@ ManagerImpl::detachParticipant(const std::string& call_id) void ManagerImpl::removeParticipant(const std::string& call_id) { - SFL_DBG("Remove participant %s", call_id.c_str()); + RING_DBG("Remove participant %s", call_id.c_str()); // this call is no longer a conference participant auto call = getCallFromCallID(call_id); if (!call) { - SFL_ERR("Call not found"); + RING_ERR("Call not found"); return; } @@ -1201,7 +1201,7 @@ ManagerImpl::removeParticipant(const std::string& call_id) auto conf = iter->second; if (iter == conferenceMap_.end() or conf == 0) { - SFL_ERR("No conference with id %s, cannot remove participant", call->getConfId().c_str()); + RING_ERR("No conference with id %s, cannot remove participant", call->getConfId().c_str()); return; } @@ -1221,7 +1221,7 @@ ManagerImpl::processRemainingParticipants(Conference &conf) const std::string current_call_id(getCurrentCallId()); ParticipantSet participants(conf.getParticipantList()); const size_t n = participants.size(); - SFL_DBG("Process remaining %d participant(s) from conference %s", + RING_DBG("Process remaining %d participant(s) from conference %s", n, conf.getConfID().c_str()); if (n > 1) { @@ -1229,7 +1229,7 @@ ManagerImpl::processRemainingParticipants(Conference &conf) for (const auto &p : participants) getRingBufferPool().flush(p); - getRingBufferPool().flush(sfl::RingBufferPool::DEFAULT_ID); + getRingBufferPool().flush(ring::RingBufferPool::DEFAULT_ID); } else if (n == 1) { // this call is the last participant, hence // the conference is over @@ -1244,10 +1244,10 @@ ManagerImpl::processRemainingParticipants(Conference &conf) switchCall(call); } - SFL_DBG("No remaining participants, remove conference"); + RING_DBG("No remaining participants, remove conference"); removeConference(conf.getConfID()); } else { - SFL_DBG("No remaining participants, remove conference"); + RING_DBG("No remaining participants, remove conference"); removeConference(conf.getConfID()); unsetCurrentCall(); } @@ -1258,12 +1258,12 @@ ManagerImpl::joinConference(const std::string& conf_id1, const std::string& conf_id2) { if (conferenceMap_.find(conf_id1) == conferenceMap_.end()) { - SFL_ERR("Not a valid conference ID: %s", conf_id1.c_str()); + RING_ERR("Not a valid conference ID: %s", conf_id1.c_str()); return false; } if (conferenceMap_.find(conf_id2) == conferenceMap_.end()) { - SFL_ERR("Not a valid conference ID: %s", conf_id2.c_str()); + RING_ERR("Not a valid conference ID: %s", conf_id2.c_str()); return false; } @@ -1280,10 +1280,10 @@ void ManagerImpl::addStream(Call& call) { const auto call_id = call.getCallId(); - SFL_DBG("Add audio stream %s", call_id.c_str()); + RING_DBG("Add audio stream %s", call_id.c_str()); if (isConferenceParticipant(call_id)) { - SFL_DBG("Add stream to conference"); + RING_DBG("Add stream to conference"); // bind to conference participant ConferenceMap::iterator iter = conferenceMap_.find(call_id); @@ -1292,14 +1292,14 @@ ManagerImpl::addStream(Call& call) conf->bindParticipant(call_id); } } else { - SFL_DBG("Add stream to call"); + RING_DBG("Add stream to call"); // bind to main - getRingBufferPool().bindCallID(call_id, sfl::RingBufferPool::DEFAULT_ID); + getRingBufferPool().bindCallID(call_id, ring::RingBufferPool::DEFAULT_ID); std::lock_guard<std::mutex> lock(audioLayerMutex_); if (!audiodriver_) { - SFL_ERR("Audio driver not initialized"); + RING_ERR("Audio driver not initialized"); return; } audiodriver_->flushUrgent(); @@ -1311,7 +1311,7 @@ void ManagerImpl::removeStream(Call& call) { const auto call_id = call.getCallId(); - SFL_DBG("Remove audio stream %s", call_id.c_str()); + RING_DBG("Remove audio stream %s", call_id.c_str()); getRingBufferPool().unBindAll(call_id); } @@ -1343,7 +1343,7 @@ void ManagerImpl::pollEvents() void ManagerImpl::saveConfig() { - SFL_DBG("Saving Configuration to XDG directory %s", path_.c_str()); + RING_DBG("Saving Configuration to XDG directory %s", path_.c_str()); if (audiodriver_) { audioPreference.setVolumemic(audiodriver_->getCaptureGain()); @@ -1370,7 +1370,7 @@ ManagerImpl::saveConfig() voipPreferences.serialize(out); hookPreference.serialize(out); audioPreference.serialize(out); -#ifdef SFL_VIDEO +#ifdef RING_VIDEO getVideoManager()->getVideoDeviceMonitor().serialize(out); #endif shortcutPreferences.serialize(out); @@ -1378,9 +1378,9 @@ ManagerImpl::saveConfig() std::ofstream fout(path_); fout << out.c_str(); } catch (const YAML::Exception &e) { - SFL_ERR("%s", e.what()); + RING_ERR("%s", e.what()); } catch (const std::runtime_error &e) { - SFL_ERR("%s", e.what()); + RING_ERR("%s", e.what()); } } @@ -1391,7 +1391,7 @@ ManagerImpl::playDtmf(char code) stopTone(); if (not voipPreferences.getPlayDtmf()) { - SFL_DBG("Do not have to play a tone..."); + RING_DBG("Do not have to play a tone..."); return; } @@ -1399,7 +1399,7 @@ ManagerImpl::playDtmf(char code) int pulselen = voipPreferences.getPulseLength(); if (pulselen == 0) { - SFL_DBG("Pulse length is not set..."); + RING_DBG("Pulse length is not set..."); return; } @@ -1410,7 +1410,7 @@ ManagerImpl::playDtmf(char code) // fast return, no sound, so no dtmf if (not audiodriver_ or not dtmfKey_) { - SFL_DBG("No audio layer..."); + RING_DBG("No audio layer..."); return; } @@ -1435,7 +1435,7 @@ ManagerImpl::playDtmf(char code) // FIXME: do real synchronization int tries = 10; while (not audiodriver_->isStarted() and tries--) { - SFL_WARN("Audio layer not ready yet"); + RING_WARN("Audio layer not ready yet"); usleep(10000); } audiodriver_->putUrgent(dtmfBuf_); @@ -1521,12 +1521,12 @@ ManagerImpl::incomingMessage(const std::string& callID, if (item_p == callID) continue; - SFL_DBG("Send message to %s", item_p.c_str()); + RING_DBG("Send message to %s", item_p.c_str()); if (auto call = getCallFromCallID(item_p)) { call->sendTextMessage(message, from); } else { - SFL_ERR("Failed to get call while sending instant message"); + RING_ERR("Failed to get call while sending instant message"); return; } } @@ -1545,7 +1545,7 @@ ManagerImpl::sendTextMessage(const std::string& callID, const std::string& from) { if (isConference(callID)) { - SFL_DBG("Is a conference, send instant message to everyone"); + RING_DBG("Is a conference, send instant message to everyone"); ConferenceMap::iterator it = conferenceMap_.find(callID); if (it == conferenceMap_.end()) @@ -1563,7 +1563,7 @@ ManagerImpl::sendTextMessage(const std::string& callID, if (auto call = getCallFromCallID(participant_id)) { call->sendTextMessage(message, from); } else { - SFL_ERR("Failed to get call while sending instant message"); + RING_ERR("Failed to get call while sending instant message"); return false; } } @@ -1572,7 +1572,7 @@ ManagerImpl::sendTextMessage(const std::string& callID, } if (isConferenceParticipant(callID)) { - SFL_DBG("Call is participant in a conference, send instant message to everyone"); + RING_DBG("Call is participant in a conference, send instant message to everyone"); auto conf = getConferenceFromCallID(callID); if (!conf) @@ -1585,7 +1585,7 @@ ManagerImpl::sendTextMessage(const std::string& callID, if (auto call = getCallFromCallID(participant_id)) { call->sendTextMessage(message, from); } else { - SFL_ERR("Failed to get call while sending instant message"); + RING_ERR("Failed to get call while sending instant message"); return false; } } @@ -1593,7 +1593,7 @@ ManagerImpl::sendTextMessage(const std::string& callID, if (auto call = getCallFromCallID(callID)) { call->sendTextMessage(message, from); } else { - SFL_ERR("Failed to get call while sending instant message"); + RING_ERR("Failed to get call while sending instant message"); return false; } } @@ -1606,7 +1606,7 @@ void ManagerImpl::peerAnsweredCall(Call& call) { const auto call_id = call.getCallId(); - SFL_DBG("Peer answered call %s", call_id.c_str()); + RING_DBG("Peer answered call %s", call_id.c_str()); // The if statement is usefull only if we sent two calls at the same time. if (isCurrentCall(call)) @@ -1632,7 +1632,7 @@ void ManagerImpl::peerRingingCall(Call& call) { const auto call_id = call.getCallId(); - SFL_DBG("Peer call %s ringing", call_id.c_str()); + RING_DBG("Peer call %s ringing", call_id.c_str()); if (isCurrentCall(call)) ringback(); @@ -1645,7 +1645,7 @@ void ManagerImpl::peerHungupCall(Call& call) { const auto call_id = call.getCallId(); - SFL_DBG("Peer hungup call %s", call_id.c_str()); + RING_DBG("Peer hungup call %s", call_id.c_str()); if (isConferenceParticipant(call_id)) { removeParticipant(call_id); @@ -1677,7 +1677,7 @@ ManagerImpl::callBusy(Call& call) client_.getCallManager()->callStateChanged(call_id, "BUSY"); if (isCurrentCall(call)) { - playATone(sfl::Tone::TONE_BUSY); + playATone(ring::Tone::TONE_BUSY); unsetCurrentCall(); } @@ -1699,7 +1699,7 @@ ManagerImpl::callFailure(Call& call) } if (isConferenceParticipant(call_id)) { - SFL_DBG("Call %s participating in a conference failed", call_id.c_str()); + RING_DBG("Call %s participating in a conference failed", call_id.c_str()); // remove this participant removeParticipant(call_id); } @@ -1729,7 +1729,7 @@ ManagerImpl::playATone(Tone::TONEID toneId) std::lock_guard<std::mutex> lock(audioLayerMutex_); if (not audiodriver_) { - SFL_ERR("Audio layer not initialized"); + RING_ERR("Audio layer not initialized"); return; } @@ -1817,7 +1817,7 @@ ManagerImpl::playRingtone(const std::string& accountID) const auto account = getAccount(accountID); if (!account) { - SFL_WARN("Invalid account in ringtone"); + RING_WARN("Invalid account in ringtone"); return; } @@ -1840,7 +1840,7 @@ ManagerImpl::playRingtone(const std::string& accountID) std::lock_guard<std::mutex> lock(audioLayerMutex_); if (not audiodriver_) { - SFL_ERR("no audio layer in ringtone"); + RING_ERR("no audio layer in ringtone"); return; } @@ -1860,7 +1860,7 @@ ManagerImpl::playRingtone(const std::string& accountID) try { updateAudioFile(ringchoice, audioLayerSmplr); } catch (const AudioFileException &e) { - SFL_WARN("Ringtone error: %s", e.what()); + RING_WARN("Ringtone error: %s", e.what()); doFallback = true; // do ringback once lock is out of scope } } // leave mutex @@ -1902,7 +1902,7 @@ std::string ManagerImpl::retrieveConfigPath() const { #ifdef __ANDROID__ - std::string configdir = "/data/data/org.sflphone"; + std::string configdir = "/data/data/cx.ring"; #else std::string configdir = fileutils::get_home_dir() + DIR_SEPARATOR_STR + ".config" + DIR_SEPARATOR_STR + PACKAGE; @@ -1915,10 +1915,10 @@ ManagerImpl::retrieveConfigPath() const if (mkdir(configdir.data(), 0700) != 0) { // If directory creation failed if (errno != EEXIST) - SFL_DBG("Cannot create directory: %s!", configdir.c_str()); + RING_DBG("Cannot create directory: %s!", configdir.c_str()); } - static const char * const PROGNAME = "sflphoned"; + static const char * const PROGNAME = "dring"; return configdir + DIR_SEPARATOR_STR + PROGNAME + ".yml"; } @@ -1940,7 +1940,7 @@ ManagerImpl::setAudioPlugin(const std::string& audioPlugin) if (audiodriver_ and wasStarted) audiodriver_->startStream(); else - SFL_ERR("No audio layer created, possibly built without audio support"); + RING_ERR("No audio layer created, possibly built without audio support"); } /** @@ -1952,7 +1952,7 @@ ManagerImpl::setAudioDevice(int index, DeviceType type) std::lock_guard<std::mutex> lock(audioLayerMutex_); if (not audiodriver_) { - SFL_ERR("Audio driver not initialized"); + RING_ERR("Audio driver not initialized"); return ; } @@ -2013,7 +2013,7 @@ ManagerImpl::isRingtoneEnabled(const std::string& id) const auto account = getAccount(id); if (!account) { - SFL_WARN("Invalid account in ringtone enabled"); + RING_WARN("Invalid account in ringtone enabled"); return 0; } @@ -2026,7 +2026,7 @@ ManagerImpl::ringtoneEnabled(const std::string& id) const auto account = getAccount(id); if (!account) { - SFL_WARN("Invalid account in ringtone enabled"); + RING_WARN("Invalid account in ringtone enabled"); return; } @@ -2052,10 +2052,10 @@ ManagerImpl::toggleRecordingCall(const std::string& id) ConferenceMap::const_iterator it(conferenceMap_.find(id)); if (it == conferenceMap_.end()) { - SFL_DBG("toggle recording for call %s", id.c_str()); + RING_DBG("toggle recording for call %s", id.c_str()); rec = getCallFromCallID(id); } else { - SFL_DBG("toggle recording for conference %s", id.c_str()); + RING_DBG("toggle recording for conference %s", id.c_str()); auto conf = it->second; if (conf) { rec = conf; @@ -2067,7 +2067,7 @@ ManagerImpl::toggleRecordingCall(const std::string& id) } if (!rec) { - SFL_ERR("Could not find recordable instance %s", id.c_str()); + RING_ERR("Could not find recordable instance %s", id.c_str()); return false; } @@ -2087,14 +2087,14 @@ ManagerImpl::isRecording(const std::string& id) bool ManagerImpl::startRecordedFilePlayback(const std::string& filepath) { - SFL_DBG("Start recorded file playback %s", filepath.c_str()); + RING_DBG("Start recorded file playback %s", filepath.c_str()); int sampleRate; { std::lock_guard<std::mutex> lock(audioLayerMutex_); if (not audiodriver_) { - SFL_ERR("No audio layer in start recorded file playback"); + RING_ERR("No audio layer in start recorded file playback"); return false; } @@ -2114,7 +2114,7 @@ ManagerImpl::startRecordedFilePlayback(const std::string& filepath) if (not audiofile_) return false; } catch (const AudioFileException &e) { - SFL_WARN("Audio file error: %s", e.what()); + RING_WARN("Audio file error: %s", e.what()); return false; } } // release toneMutex @@ -2136,7 +2136,7 @@ void ManagerImpl::recordingPlaybackSeek(const double value) void ManagerImpl::stopRecordedFilePlayback(const std::string& filepath) { - SFL_DBG("Stop recorded file playback %s", filepath.c_str()); + RING_DBG("Stop recorded file playback %s", filepath.c_str()); checkAudio(); @@ -2149,7 +2149,7 @@ void ManagerImpl::stopRecordedFilePlayback(const std::string& filepath) void ManagerImpl::setHistoryLimit(int days) { - SFL_DBG("Set history limit"); + RING_DBG("Set history limit"); preferences.setHistoryLimit(days); saveConfig(); } @@ -2170,7 +2170,7 @@ ManagerImpl::setAudioManager(const std::string &api) return false; if (api == audioPreference.getAudioApi()) { - SFL_DBG("Audio manager chosen already in use. No changes made. "); + RING_DBG("Audio manager chosen already in use. No changes made. "); return true; } } @@ -2204,7 +2204,7 @@ ManagerImpl::getAudioInputDeviceIndex(const std::string &name) std::lock_guard<std::mutex> lock(audioLayerMutex_); if (not audiodriver_) { - SFL_ERR("Audio layer not initialized"); + RING_ERR("Audio layer not initialized"); return 0; } @@ -2217,7 +2217,7 @@ ManagerImpl::getAudioOutputDeviceIndex(const std::string &name) std::lock_guard<std::mutex> lock(audioLayerMutex_); if (not audiodriver_) { - SFL_ERR("Audio layer not initialized"); + RING_ERR("Audio layer not initialized"); return 0; } @@ -2280,7 +2280,7 @@ ManagerImpl::audioFormatUsed(AudioFormat format) if (currentFormat == format) return; - SFL_DBG("Audio format changed: %s -> %s", currentFormat.toString().c_str(), format.toString().c_str()); + RING_DBG("Audio format changed: %s -> %s", currentFormat.toString().c_str(), format.toString().c_str()); ringbufferpool_->setInternalAudioFormat(format); @@ -2294,7 +2294,7 @@ ManagerImpl::audioFormatUsed(AudioFormat format) void ManagerImpl::setAccountsOrder(const std::string& order) { - SFL_DBG("Set accounts order : %s", order.c_str()); + RING_DBG("Set accounts order : %s", order.c_str()); // Set the new config preferences.setAccountOrder(order); @@ -2339,7 +2339,7 @@ ManagerImpl::getAccountList() const if (const auto& account = getIP2IPAccount()) v.push_back(account->getAccountID()); else - SFL_ERR("could not find IP2IP profile in getAccount list"); + RING_ERR("could not find IP2IP profile in getAccount list"); return v; } @@ -2352,7 +2352,7 @@ ManagerImpl::getAccountDetails(const std::string& accountID) const if (account) { return account->getAccountDetails(); } else { - SFL_ERR("Could not get account details on a non-existing accountID %s", accountID.c_str()); + RING_ERR("Could not get account details on a non-existing accountID %s", accountID.c_str()); // return an empty map since we can't throw an exception to D-Bus return std::map<std::string, std::string>(); } @@ -2366,7 +2366,7 @@ ManagerImpl::getVolatileAccountDetails(const std::string& accountID) const if (account) { return account->getVolatileAccountDetails(); } else { - SFL_ERR("Could not get volatile account details on a non-existing accountID %s", accountID.c_str()); + RING_ERR("Could not get volatile account details on a non-existing accountID %s", accountID.c_str()); return {{}}; } } @@ -2379,12 +2379,12 @@ void ManagerImpl::setAccountDetails(const std::string& accountID, const std::map<std::string, std::string>& details) { - SFL_DBG("Set account details for %s", accountID.c_str()); + RING_DBG("Set account details for %s", accountID.c_str()); const auto account = getAccount(accountID); if (account == nullptr) { - SFL_ERR("Could not find account %s", accountID.c_str()); + RING_ERR("Could not find account %s", accountID.c_str()); return; } @@ -2432,11 +2432,11 @@ ManagerImpl::addAccount(const std::map<std::string, std::string>& details) else accountType = AccountFactory::DEFAULT_ACCOUNT_TYPE; - SFL_DBG("Adding account %s", newAccountID.c_str()); + RING_DBG("Adding account %s", newAccountID.c_str()); auto newAccount = accountFactory_.createAccount(accountType, newAccountID); if (!newAccount) { - SFL_ERR("Unknown %s param when calling addAccount(): %s", + RING_ERR("Unknown %s param when calling addAccount(): %s", CONFIG_ACCOUNT_TYPE, accountType); return ""; } @@ -2522,7 +2522,7 @@ ManagerImpl::loadAccount(const YAML::Node &node, int &errorCount, if (!accountid.empty() and !accountAlias.empty()) { const auto& ip2ipAccountID = getIP2IPAccount()->getAccountID(); if (not inAccountOrder(accountid) and accountid != ip2ipAccountID) { - SFL_WARN("Dropping account %s, which is not in account order", accountid.c_str()); + RING_WARN("Dropping account %s, which is not in account order", accountid.c_str()); } else if (accountFactory_.isSupportedType(accountType.c_str())) { std::shared_ptr<Account> a; if (accountid != ip2ipAccountID) @@ -2532,11 +2532,11 @@ ManagerImpl::loadAccount(const YAML::Node &node, int &errorCount, if (a) { a->unserialize(node); } else { - SFL_ERR("Failed to create account type \"%s\"", accountType.c_str()); + RING_ERR("Failed to create account type \"%s\"", accountType.c_str()); ++errorCount; } } else { - SFL_WARN("Ignoring unknown account type \"%s\"", accountType.c_str()); + RING_WARN("Ignoring unknown account type \"%s\"", accountType.c_str()); } } } @@ -2557,12 +2557,12 @@ ManagerImpl::loadAccountMap(const YAML::Node &node) int errorCount = 0; try { -#ifdef SFL_VIDEO +#ifdef RING_VIDEO VideoManager *controls(getVideoManager()); controls->getVideoDeviceMonitor().unserialize(node); #endif } catch (const YAML::Exception &e) { - SFL_ERR("%s: No video node in config file", e.what()); + RING_ERR("%s: No video node in config file", e.what()); ++errorCount; } @@ -2584,7 +2584,7 @@ ManagerImpl::getCallDetails(const std::string &callID) if (auto call = getCallFromCallID(callID)) { return call->getDetails(); } else { - SFL_ERR("Call is NULL"); + RING_ERR("Call is NULL"); // FIXME: is this even useful? return Call::getNullDetails(); } @@ -2634,7 +2634,7 @@ ManagerImpl::getDisplayNames(const std::string& confID) const if (iter_conf != conferenceMap_.end()) { return iter_conf->second->getDisplayNames(); } else { - SFL_WARN("Did not find conference %s", confID.c_str()); + RING_WARN("Did not find conference %s", confID.c_str()); } return v; @@ -2650,7 +2650,7 @@ ManagerImpl::getParticipantList(const std::string& confID) const const ParticipantSet participants(iter_conf->second->getParticipantList()); std::copy(participants.begin(), participants.end(), std::back_inserter(v));; } else - SFL_WARN("Did not find conference %s", confID.c_str()); + RING_WARN("Did not find conference %s", confID.c_str()); return v; } @@ -2661,7 +2661,7 @@ ManagerImpl::getConferenceId(const std::string& callID) if (auto call = getCallFromCallID(callID)) return call->getConfId(); - SFL_ERR("Call is NULL"); + RING_ERR("Call is NULL"); return ""; } @@ -2669,7 +2669,7 @@ void ManagerImpl::saveHistory() { if (!history_.save()) - SFL_ERR("Could not save history!"); + RING_ERR("Could not save history!"); else client_.getConfigurationManager()->historyChanged(); } @@ -2685,7 +2685,7 @@ ManagerImpl::startAudioDriverStream() { std::lock_guard<std::mutex> lock(audioLayerMutex_); if (!audiodriver_) { - SFL_ERR("Audio driver not initialized"); + RING_ERR("Audio driver not initialized"); return; } audiodriver_->startStream(); @@ -2748,7 +2748,7 @@ ManagerImpl::getClient() return &client_; } -#ifdef SFL_VIDEO +#ifdef RING_VIDEO VideoManager * ManagerImpl::getVideoManager() { @@ -2766,7 +2766,7 @@ ManagerImpl::newOutgoingCall(const std::string& id, #if HAVE_DHT if (toUrl.find("ring:") != std::string::npos) { - SFL_WARN("Ring DHT call detected"); + RING_WARN("Ring DHT call detected"); auto dhtAcc = getAllAccounts<RingAccount>(); if (not dhtAcc.empty()) return dhtAcc.front()->newOutgoingCall(id, finalToUrl); @@ -2781,13 +2781,13 @@ ManagerImpl::newOutgoingCall(const std::string& id, if (account) finalToUrl = toUrl; else - SFL_WARN("Preferred account %s doesn't exist, using IP2IP account", + RING_WARN("Preferred account %s doesn't exist, using IP2IP account", preferredAccountId.c_str()); } else - SFL_WARN("IP Url detected, using IP2IP account"); + RING_WARN("IP Url detected, using IP2IP account"); if (!account) { - SFL_ERR("No suitable account found to create outgoing call"); + RING_ERR("No suitable account found to create outgoing call"); return nullptr; } diff --git a/daemon/src/managerimpl.h b/daemon/src/managerimpl.h index 5dfa2cb4d095facda2bf2939bc35ae1ff4325d52..c93d576f60f5671f684d236e293b26908c0238f1 100644 --- a/daemon/src/managerimpl.h +++ b/daemon/src/managerimpl.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Yan Morin <yan.morin@savoirfairelinux.com> * Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com> * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> @@ -68,7 +68,7 @@ namespace Conf { class YamlEmitter; } -namespace sfl { +namespace ring { class AudioFile; class AudioLayer; class RingBufferPool; @@ -148,7 +148,7 @@ class ManagerImpl { * it's multi-thread and use mutex internally * @return AudioLayer* The audio layer object */ - std::shared_ptr<sfl::AudioLayer> getAudioDriver(); + std::shared_ptr<ring::AudioLayer> getAudioDriver(); void startAudioDriverStream(); @@ -513,7 +513,7 @@ class ManagerImpl { * @param index The index of the soundcard * @param the type of stream, either PLAYBACK, CAPTURE, RINGTONE */ - void setAudioDevice(int index, sfl::DeviceType streamType); + void setAudioDevice(int index, ring::DeviceType streamType); /** * Get list of supported audio output device @@ -657,14 +657,14 @@ class ManagerImpl { * Callback called when the audio layer initialised with its * preferred format. */ - void hardwareAudioFormatChanged(sfl::AudioFormat format); + void hardwareAudioFormatChanged(ring::AudioFormat format); /** * Should be called by any component dealing with an external * audio source, indicating the format used so the mixer format * can be eventually adapted. */ - void audioFormatUsed(sfl::AudioFormat format); + void audioFormatUsed(ring::AudioFormat format); /** * Handle audio sounds heard by a caller while they wait for their @@ -702,13 +702,13 @@ class ManagerImpl { * Retrieve the current telephone tone * @return AudioLoop* The audio tone or 0 if no tone (init before calling this function) */ - sfl::AudioLoop* getTelephoneTone(); + ring::AudioLoop* getTelephoneTone(); /** * Retrieve the current telephone file * @return AudioLoop* The audio file or 0 if the wav is stopped */ - sfl::AudioLoop* getTelephoneFile(); + ring::AudioLoop* getTelephoneFile(); /** * @return true is there is one or many incoming call waiting @@ -744,7 +744,7 @@ class ManagerImpl { void initAudioDriver(); /** - * Load the accounts order set by the user from the sflphonedrc config file + * Load the accounts order set by the user from the dringrc config file * @return std::vector<std::string> A vector containing the account ID's */ std::vector<std::string> loadAccountOrder() const; @@ -786,7 +786,7 @@ class ManagerImpl { * Play one tone * @return false if the driver is uninitialize */ - void playATone(sfl::Tone::TONEID toneId); + void playATone(ring::Tone::TONEID toneId); Client client_; @@ -797,20 +797,20 @@ class ManagerImpl { std::mutex currentCallMutex_; /** Audio layer */ - std::shared_ptr<sfl::AudioLayer> audiodriver_{nullptr}; + std::shared_ptr<ring::AudioLayer> audiodriver_{nullptr}; // Main thread - std::unique_ptr<sfl::DTMF> dtmfKey_; + std::unique_ptr<ring::DTMF> dtmfKey_; /** Buffer to generate DTMF */ - sfl::AudioBuffer dtmfBuf_; + ring::AudioBuffer dtmfBuf_; ///////////////////// // Protected by Mutex ///////////////////// std::mutex toneMutex_; - std::unique_ptr<sfl::TelephoneTone> telephoneTone_; - std::unique_ptr<sfl::AudioFile> audiofile_; + std::unique_ptr<ring::TelephoneTone> telephoneTone_; + std::unique_ptr<ring::AudioFile> audiofile_; // To handle volume control // short speakerVolume_; @@ -861,14 +861,14 @@ class ManagerImpl { * Audio instances must be registered into the RingBufferMananger and bound together via the ManagerImpl. * */ - std::unique_ptr<sfl::RingBufferPool> ringbufferpool_; + std::unique_ptr<ring::RingBufferPool> ringbufferpool_; public: /** * Return a pointer to the instance of the RingBufferPool */ - sfl::RingBufferPool& getRingBufferPool() { return *ringbufferpool_; } + ring::RingBufferPool& getRingBufferPool() { return *ringbufferpool_; } /** * Tell if there is a current call processed @@ -881,7 +881,7 @@ class ManagerImpl { * @return A pointer to the Client instance */ Client* getClient(); -#ifdef SFL_VIDEO +#ifdef RING_VIDEO VideoManager * getVideoManager(); #endif @@ -967,7 +967,7 @@ class ManagerImpl { */ void unregisterEventHandler(uintptr_t handlerId); - sfl::IceTransportFactory& getIceTransportFactory() { return *ice_tf_; } + ring::IceTransportFactory& getIceTransportFactory() { return *ice_tf_; } private: NON_COPYABLE(ManagerImpl); @@ -995,7 +995,7 @@ class ManagerImpl { * To handle the persistent history * TODO: move this to ConfigurationManager */ - sfl::History history_; + ring::History history_; bool finished_; AccountFactory accountFactory_; @@ -1008,7 +1008,7 @@ class ManagerImpl { const std::string &accountOrder); /* ICE support */ - std::unique_ptr<sfl::IceTransportFactory> ice_tf_; + std::unique_ptr<ring::IceTransportFactory> ice_tf_; }; #endif // MANAGER_IMPL_H_ diff --git a/daemon/src/numbercleaner.cpp b/daemon/src/numbercleaner.cpp index fb97c724da2cc36a3a1ba84f08871ec8326a5990..a79b6780cf6dedbd551fd0aac8915fca04264434 100644 --- a/daemon/src/numbercleaner.cpp +++ b/daemon/src/numbercleaner.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * diff --git a/daemon/src/numbercleaner.h b/daemon/src/numbercleaner.h index f2f3966544567a236549736200d1d45e152ff5c6..ee395eac5865bdf5aa629853e87ce117bfa9205c 100644 --- a/daemon/src/numbercleaner.h +++ b/daemon/src/numbercleaner.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * diff --git a/daemon/src/plugin_loader.h b/daemon/src/plugin_loader.h index 076d24b23943f53191a4d4232fc18b7c99268b90..f27bb67196b314277110620da0cbc656ca301cd4 100644 --- a/daemon/src/plugin_loader.h +++ b/daemon/src/plugin_loader.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Guillaume Roguez <guillaume.roguez@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify diff --git a/daemon/src/plugin_loader_dl.cpp b/daemon/src/plugin_loader_dl.cpp index 3824855b85b09ea5ace572728d3c73be785a8261..8bc6612ab626b12e84d62d7c302673bafe849bc7 100644 --- a/daemon/src/plugin_loader_dl.cpp +++ b/daemon/src/plugin_loader_dl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Guillaume Roguez <guillaume.roguez@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify diff --git a/daemon/src/plugin_manager.cpp b/daemon/src/plugin_manager.cpp index c39f63a045508a4768595f6d390392e5b4844383..767816e0755d0d1d6d38c750c92de79b817a761a 100644 --- a/daemon/src/plugin_manager.cpp +++ b/daemon/src/plugin_manager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Guillaume Roguez <guillaume.roguez@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -45,7 +45,7 @@ PluginManager::~PluginManager() try { (*func)(); } catch (...) { - SFL_WARN("Exception caught during plugin exit"); + RING_WARN("Exception caught during plugin exit"); } } @@ -62,20 +62,20 @@ PluginManager::load(const std::string& path) // Don't load the same dynamic library twice if (dynPluginMap_.find(path) != dynPluginMap_.end()) { - SFL_WARN("plugin: already loaded"); + RING_WARN("plugin: already loaded"); return true; } std::string error; std::unique_ptr<Plugin> plugin(Plugin::load(path, error)); if (!plugin) { - SFL_ERR("plugin: %s", error.c_str()); + RING_ERR("plugin: %s", error.c_str()); return false; } const auto& init_func = plugin->getInitFunction(); if (!init_func) { - SFL_ERR("plugin: no init symbol"); + RING_ERR("plugin: no init symbol"); return false; } @@ -94,13 +94,13 @@ PluginManager::registerPlugin(RING_PluginInitFunc initFunc) try { exitFunc = initFunc(&pluginApi_); } catch (const std::runtime_error& e) { - SFL_ERR("%s", e.what()); + RING_ERR("%s", e.what()); } if (!exitFunc) { tempExactMatchMap_.clear(); tempWildCardVec_.clear(); - SFL_ERR("plugin: init failed"); + RING_ERR("plugin: init failed"); return false; } @@ -132,7 +132,7 @@ PluginManager::invokeService(const std::string& name, void* data) { const auto& iterFunc = services_.find(name); if (iterFunc == services_.cend()) { - SFL_ERR("Services not found: %s", name.c_str()); + RING_ERR("Services not found: %s", name.c_str()); return -1; } @@ -141,7 +141,7 @@ PluginManager::invokeService(const std::string& name, void* data) try { return func(data); } catch (const std::runtime_error &e) { - SFL_ERR("%s", e.what()); + RING_ERR("%s", e.what()); return -1; } } @@ -214,7 +214,7 @@ PluginManager::createObject(const std::string& type) // (but keep also wildcard registration for other object types) int32_t res = registerObjectFactory(op.type, factory.data); if (res < 0) { - SFL_ERR("failed to register object %s", op.type); + RING_ERR("failed to register object %s", op.type); return {nullptr, nullptr}; } @@ -232,12 +232,12 @@ PluginManager::registerObjectFactory_(const RING_PluginAPI* api, { auto manager = reinterpret_cast<PluginManager*>(api->context); if (!manager) { - SFL_ERR("registerObjectFactory called with null plugin API"); + RING_ERR("registerObjectFactory called with null plugin API"); return -1; } if (!data) { - SFL_ERR("registerObjectFactory called with null factory data"); + RING_ERR("registerObjectFactory called with null factory data"); return -1; } @@ -252,7 +252,7 @@ PluginManager::invokeService_(const RING_PluginAPI* api, const char* name, { auto manager = reinterpret_cast<PluginManager*>(api->context); if (!manager) { - SFL_ERR("invokeService called with null plugin API"); + RING_ERR("invokeService called with null plugin API"); return -1; } diff --git a/daemon/src/plugin_manager.h b/daemon/src/plugin_manager.h index 6d0a9b6b9a0082ee7ee90b35569dfca7b903c364..a94bc297aa3590907f74e0e3a0f884990f0b68c7 100644 --- a/daemon/src/plugin_manager.h +++ b/daemon/src/plugin_manager.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Guillaume Roguez <guillaume.roguez@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify diff --git a/daemon/src/preferences.cpp b/daemon/src/preferences.cpp index 9cd0ef1477356dcebe590e22685d18af1535f192..3ce9dea63170a35cba5e91bec8256a50eda1c7c7 100644 --- a/daemon/src/preferences.cpp +++ b/daemon/src/preferences.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -150,7 +150,7 @@ void Preferences::verifyAccountOrder(const std::vector<std::string> &accountIDs) if (find(accountIDs.begin(), accountIDs.end(), token) != accountIDs.end()) tokens.push_back(token); else { - SFL_DBG("Dropping nonexistent account %s", token.c_str()); + RING_DBG("Dropping nonexistent account %s", token.c_str()); drop = true; } token.clear(); @@ -328,30 +328,30 @@ AudioPreference::AudioPreference() : static const int ALSA_DFT_CARD_ID = 0; // Index of the default soundcard static void -checkSoundCard(int &card, sfl::DeviceType type) +checkSoundCard(int &card, ring::DeviceType type) { - if (not sfl::AlsaLayer::soundCardIndexExists(card, type)) { - SFL_WARN(" Card with index %d doesn't exist or is unusable.", card); + if (not ring::AlsaLayer::soundCardIndexExists(card, type)) { + RING_WARN(" Card with index %d doesn't exist or is unusable.", card); card = ALSA_DFT_CARD_ID; } } #endif -sfl::AudioLayer* AudioPreference::createAudioLayer() +ring::AudioLayer* AudioPreference::createAudioLayer() { #if HAVE_OPENSL - return new sfl::OpenSLLayer(*this); + return new ring::OpenSLLayer(*this); #else #if HAVE_JACK if (audioApi_ == JACK_API_STR) { if (system("jack_lsp > /dev/null") == 0) { try { - return new sfl::JackLayer(*this); + return new ring::JackLayer(*this); } catch (const std::runtime_error &e) { - SFL_ERR("%s", e.what()); + RING_ERR("%s", e.what()); #if HAVE_PULSE - SFL_WARN("falling back to pulseaudio"); + RING_WARN("falling back to pulseaudio"); audioApi_ = PULSEAUDIO_API_STR; #elif HAVE_ALSA audioApi_ = ALSA_API_STR; @@ -369,9 +369,9 @@ sfl::AudioLayer* AudioPreference::createAudioLayer() if (audioApi_ == PULSEAUDIO_API_STR) { try { - return new sfl::PulseLayer(*this); + return new ring::PulseLayer(*this); } catch (const std::runtime_error &e) { - SFL_WARN("Could not create pulseaudio layer, falling back to ALSA"); + RING_WARN("Could not create pulseaudio layer, falling back to ALSA"); } } @@ -380,19 +380,19 @@ sfl::AudioLayer* AudioPreference::createAudioLayer() #if HAVE_ALSA audioApi_ = ALSA_API_STR; - checkSoundCard(alsaCardin_, sfl::DeviceType::CAPTURE); - checkSoundCard(alsaCardout_, sfl::DeviceType::PLAYBACK); - checkSoundCard(alsaCardring_, sfl::DeviceType::RINGTONE); + checkSoundCard(alsaCardin_, ring::DeviceType::CAPTURE); + checkSoundCard(alsaCardout_, ring::DeviceType::PLAYBACK); + checkSoundCard(alsaCardring_, ring::DeviceType::RINGTONE); - return new sfl::AlsaLayer(*this); + return new ring::AlsaLayer(*this); #endif #if HAVE_COREAUDIO audioApi_ = COREAUDIO_API_STR; try { - return new sfl::CoreLayer(*this); + return new ring::CoreLayer(*this); } catch (const std::runtime_error &e) { - SFL_WARN("Could not create coreaudio layer. There will be no sound."); + RING_WARN("Could not create coreaudio layer. There will be no sound."); } return NULL; #endif @@ -443,7 +443,7 @@ AudioPreference::setRecordPath(const std::string &r) recordpath_ = path; return true; } else { - SFL_ERR("%s is not writable, cannot be the recording path", path.c_str()); + RING_ERR("%s is not writable, cannot be the recording path", path.c_str()); return false; } } diff --git a/daemon/src/preferences.h b/daemon/src/preferences.h index cbebe0b312882682130081a0d78fb5ba565a35c3..a3e081a99e3a1d4782a9185471c77a333c300bdf 100644 --- a/daemon/src/preferences.h +++ b/daemon/src/preferences.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -36,7 +36,7 @@ #include <map> #include <vector> -namespace sfl { +namespace ring { class AudioLayer; } @@ -226,8 +226,8 @@ class HookPreference : public Serializable { class AudioPreference : public Serializable { public: AudioPreference(); - sfl::AudioLayer *createAudioLayer(); - sfl::AudioLayer *switchAndCreateAudioLayer(); + ring::AudioLayer *createAudioLayer(); + ring::AudioLayer *switchAndCreateAudioLayer(); std::string getAudioApi() const { return audioApi_; diff --git a/daemon/src/registration_states.h b/daemon/src/registration_states.h index 9071d469ba97d14c21648e013352b926dca7a324..fd4ed74c978176599b5c4045ef2edbf28a67d89f 100644 --- a/daemon/src/registration_states.h +++ b/daemon/src/registration_states.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * Author: Yan Morin <yan.morin@savoirfairelinux.com> * diff --git a/daemon/src/ring.h b/daemon/src/ring.h new file mode 100644 index 0000000000000000000000000000000000000000..d734d0461976772d26456bb3a1d8f2912f739980 --- /dev/null +++ b/daemon/src/ring.h @@ -0,0 +1,291 @@ +/* + * Copyright (C) 2014 Savoir-Faire Linux Inc. + * Author: Philippe Proulx <philippe.proulx@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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Additional permission under GNU GPL version 3 section 7: + * + * If you modify this program, or any covered work, by linking or + * combining it with the OpenSSL project's OpenSSL library (or a + * modified version of that library), containing parts covered by the + * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc. + * grants you additional permission to convey the resulting work. + * Corresponding Source for a non-source form of such a combination + * shall include the source code for the parts of OpenSSL used as well + * as that of the covered work. + */ +#ifndef RING_H +#define RING_H + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <vector> +#include <functional> +#include <string> +#include <map> + +const char * +ring_version(); + +/* presence events */ +struct ring_pres_ev_handlers +{ + std::function<void (const std::string& /*remote*/)> on_new_server_subscription_request; + std::function<void (const std::string& /*account_id*/, const std::string& /*error*/, const std::string& /*msg*/)> on_server_error; + std::function<void (const std::string& /*account_id*/, const std::string& /*buddy_uri*/, int /*status*/, const std::string& /*line_status*/)> on_new_buddy_notification; + std::function<void (const std::string& /*account_id*/, const std::string& /*buddy_uri*/, int /*state*/)> on_subscription_state_change; +}; + +/* configuration events */ +struct ring_config_ev_handlers +{ + std::function<void (const std::string& /*device*/, double /*value*/)> on_volume_change; + std::function<void ()> on_accounts_change; + std::function<void ()> on_history_change; + std::function<void (const std::string& /*account_id*/)> on_stun_status_fail; + std::function<void (const std::string& /*account_id*/, int /*state*/)> on_registration_state_change; + std::function<void (const std::string& /*account_id*/, const std::string& /*state*/, int /*code*/)> on_sip_registration_state_change; + std::function<void (const std::string& /*account_id*/, const std::map<std::string, std::string>& /* details */)> on_volatile_details_change; + std::function<void (int /*alert*/)> on_error; +}; + +/* call events */ +struct ring_call_ev_handlers +{ + std::function<void (const std::string& /*call_id*/, const std::string& /*state*/)> on_state_change; + std::function<void ()> on_transfer_fail; + std::function<void ()> on_transfer_success; + std::function<void (const std::string& /*path*/)> on_record_playback_stopped; + std::function<void (const std::string& /*call_id*/, int /*nd_msg*/)> on_voice_mail_notify; + std::function<void (const std::string& /*id*/, const std::string& /*from*/, const std::string& /*msg*/)> on_incoming_message; + std::function<void (const std::string& /*account_id*/, const std::string& /*call_id*/, const std::string& /*from*/)> on_incoming_call; + std::function<void (const std::string& /*id*/, const std::string& /*filename*/)> on_record_playback_filepath; + std::function<void (const std::string& /*conf_id*/)> on_conference_created; + std::function<void (const std::string& /*conf_id*/, const std::string& /*state*/)> on_conference_changed; + std::function<void (const std::string& /*filepath*/, int /*position*/, int /*scale*/)> on_update_playback_scale; + std::function<void (const std::string& /*conf_id*/)> on_conference_remove; + std::function<void (const std::string& /*account_id*/, const std::string& /*call_id*/, const std::string& /*to*/)> on_new_call; + std::function<void (const std::string& /*call_id*/, const std::string& /*state*/, int /*code*/)> on_sip_call_state_change; + std::function<void (const std::string& /*call_id*/, int /*state*/)> on_record_state_change; + std::function<void (const std::string& /*call_id*/)> on_secure_sdes_on; + std::function<void (const std::string& /*call_id*/)> on_secure_sdes_off; + std::function<void (const std::string& /*call_id*/, const std::string& /*cipher*/)> on_secure_zrtp_on; + std::function<void (const std::string& /*call_id*/)> on_secure_zrtp_off; + std::function<void (const std::string& /*call_id*/, const std::string& /*sas*/, int /*verified*/)> on_show_sas; + std::function<void (const std::string& /*call_id*/)> on_zrtp_not_supp_other; + std::function<void (const std::string& /*call_id*/, const std::string& /*reason*/, const std::string& /*severity*/)> on_zrtp_negotiation_fail; + std::function<void (const std::string& /*call_id*/, const std::map<std::string, int>& /*stats*/)> on_rtcp_receive_report; +}; + +/* video events */ +#ifdef RING_VIDEO +struct ring_video_ev_handlers +{ + std::function<void ()> on_device_event; + std::function<void (const std::string& /*id*/, const std::string& /*shm_path*/, int /*w*/, int /*h*/, bool /*is_mixer*/)> on_start_decoding; + std::function<void (const std::string& /*id*/, const std::string& /*shm_path*/, bool /*is_mixer*/)> on_stop_decoding; +}; +#endif /* RING_VIDEO */ + +#pragma GCC diagnostic ignored "-Wmissing-field-initializers" + +/* all handlers */ +struct ring_ev_handlers +{ + ring_call_ev_handlers call_ev_handlers; + ring_config_ev_handlers config_ev_handlers; + ring_pres_ev_handlers pres_ev_handlers; + +#ifdef RING_VIDEO + ring_video_ev_handlers video_ev_handlers; +#endif /* RING_VIDEO */ +}; + +#pragma GCC diagnostic warning "-Wmissing-field-initializers" + +/* error codes returned by functions of this API */ +enum ring_error { + RING_ERR_MANAGER_INIT, + RING_ERR_UNKNOWN, +}; + +/* flags for initialization */ +enum ring_init_flag { + RING_FLAG_DEBUG = 1, + RING_FLAG_CONSOLE_LOG = 2, +}; + +/** + * Initializes libring. + * + * @param ev_handlers Event handlers + * @param flags Flags to customize this initialization + * @returns 0 if successful or a negative error code + */ +int ring_init(struct ring_ev_handlers* ev_handlers, enum ring_init_flag flags); + +/** + * Finalizes libring, freeing any resource allocated by the library. + */ +void ring_fini(void); + +/** + * Poll for SIP/IAX events + */ +void ring_poll_events(void); + +/* call API */ +bool ring_call_place(const std::string& account_id, const std::string& call_id, const std::string& to); +bool ring_call_refuse(const std::string& call_id); +bool ring_call_accept(const std::string& call_id); +bool ring_call_hang_up(const std::string& call_id); +bool ring_call_hold(const std::string& call_id); +bool ring_call_unhold(const std::string& call_id); +bool ring_call_transfer(const std::string& call_id, const std::string& to); +bool ring_call_attended_transfer(const std::string& transfer_id, const std::string& target_id); +std::map<std::string, std::string> ring_call_get_call_details(const std::string& call_id); +std::vector<std::string> ring_call_get_call_list(void); +void ring_call_remove_conference(const std::string& conf_id); +bool ring_call_join_participant(const std::string& sel_call_id, const std::string& drag_call_id); +void ring_call_create_conf_from_participant_list(const std::vector<std::string>& participants); +bool ring_call_is_conference_participant(const std::string& call_id); +bool ring_call_add_participant(const std::string& call_id, const std::string& conf_id); +bool ring_call_add_main_participant(const std::string& conf_id); +bool ring_call_detach_participant(const std::string& call_id); +bool ring_call_join_conference(const std::string& sel_conf_id, const std::string& drag_conf_id); +bool ring_call_hang_up_conference(const std::string& conf_id); +bool ring_call_hold_conference(const std::string& conf_id); +bool ring_call_unhold_conference(const std::string& conf_id); +std::vector<std::string> ring_call_get_conference_list(void); +std::vector<std::string> ring_call_get_participant_list(const std::string& conf_id); +std::vector<std::string> ring_call_get_display_names(const std::string& conf_id); +std::string ring_call_get_conference_id(const std::string& call_id); +std::map<std::string, std::string> ring_call_get_conference_details(const std::string& call_id); +bool ring_call_play_recorded_file(const std::string& path); +void ring_call_stop_recorded_file(const std::string& path); +bool ring_call_toggle_recording(const std::string& call_id); +void ring_call_set_recording(const std::string& call_id); +void ring_call_record_playback_seek(double pos); +bool ring_call_is_recording(const std::string& call_id); +std::string ring_call_get_current_audio_codec_name(const std::string& call_id); +void ring_call_play_dtmf(const std::string& key); +void ring_call_start_tone(int start, int type); +void ring_call_set_sas_verified(const std::string& call_id); +void ring_call_reset_sas_verified(const std::string& call_id); +void ring_call_set_confirm_go_clear(const std::string& call_id); +void ring_call_request_go_clear(const std::string& call_id); +void ring_call_accept_enrollment(const std::string& call_id, bool accepted); +void ring_call_send_text_message(const std::string& call_id, const std::string& message); + +/* configuration API */ +std::map<std::string, std::string> ring_config_get_account_details(const std::string& account_id); +std::map<std::string, std::string> ring_config_get_volatile_account_details(const std::string& account_id); +void ring_config_set_account_details(const std::string& account_id, const std::map<std::string, std::string>& details); +std::map<std::string, std::string> ring_config_get_account_template(void); +std::string ring_config_add_account(const std::map<std::string, std::string>& details); +void ring_config_remove_account(const std::string& account_id); +std::vector<std::string> ring_config_get_account_list(void); +void ring_config_send_register(const std::string& account_id, bool enable); +void ring_config_register_all_accounts(void); +std::map<std::string, std::string> ring_config_get_tls_default_settings(void); +std::vector<int> ring_config_get_audio_codec_list(void); +std::vector<std::string> ring_config_get_supported_tls_method(void); +std::vector<std::string> ring_config_get_audio_codec_details(int payload); +std::vector<int> ring_config_get_active_audio_codec_list(const std::string& account_id); +void ring_config_set_active_audio_codec_list(const std::vector<std::string>& list, const std::string& account_id); +std::vector<std::string> ring_config_get_audio_plugin_list(void); +void ring_config_set_audio_plugin(const std::string& audio_plugin); +std::vector<std::string> ring_config_get_audio_output_device_list(); +void ring_config_set_audio_output_device(int index); +void ring_config_set_audio_input_device(int index); +void ring_config_set_audio_ringtone_device(int index); +std::vector<std::string> ring_config_get_audio_input_device_list(void); +std::vector<std::string> ring_config_get_current_audio_devices_index(void); +int ring_config_get_audio_input_device_index(const std::string& name); +int ring_config_get_audio_output_device_index(const std::string& name); +std::string ring_config_get_current_audio_output_plugin(void); +bool ring_config_get_noise_suppress_state(void); +void ring_config_set_noise_suppress_state(bool state); +bool ring_config_is_agc_enabled(void); +void ring_config_enable_agc(bool enabled); +void ring_config_mute_dtmf(bool mute); +bool ring_config_is_dtmf_muted(void); +bool ring_config_is_capture_muted(void); +void ring_config_mute_capture(bool mute); +bool ring_config_is_playback_muted(void); +void ring_config_mute_playback(int mute); +std::map<std::string, std::string> ring_config_get_ringtone_list(void); +std::string ring_config_get_audio_manager(void); +bool ring_config_set_audio_manager(const std::string& api); +std::vector<std::string> ring_config_get_supported_audio_managers(void); +int ring_config_is_iax2_enabled(void); +std::string ring_config_get_record_path(void); +void ring_config_set_record_path(const std::string& path); +bool ring_config_is_always_recording(void); +void ring_config_set_always_recording(bool rec); +void ring_config_set_history_limit(int days); +int ring_config_get_history_limit(void); +void ring_config_clear_history(void); +void ring_config_set_accounts_order(const std::string& order); +std::map<std::string, std::string> ring_config_get_hook_settings(void); +void ring_config_set_hook_settings(const std::map<std::string, std::string>& settings); +std::vector<std::map<std::string, std::string>> ring_config_get_history(void); +std::map<std::string, std::string> ring_config_get_tls_settings(); +std::map<std::string, std::string> ring_config_validate_certificate(const std::string& accountId, + const std::string& certificate, const std::string& private_key); +std::map<std::string, std::string> ring_config_get_certificate_details(const std::string& certificate); +void ring_config_set_tls_settings(const std::map< std::string, std::string >& settings); +std::map<std::string, std::string> ring_config_get_ip2ip_details(void); +std::vector<std::map<std::string, std::string>> ring_config_get_credentials(const std::string& account_id); +void ring_config_set_credentials(const std::string& account_id, const std::vector<std::map<std::string, std::string>>& details); +std::string ring_config_get_addr_from_interface_name(const std::string& interface); +std::vector<std::string> ring_config_get_all_ip_interface(void); +std::vector<std::string> ring_config_get_all_ip_interface_by_name(void); +std::map<std::string, std::string> ring_config_get_shortcuts(); +void ring_config_set_shortcuts(const std::map<std::string, std::string>& shortcuts); +void ring_config_set_volume(const std::string& device, double value); +double ring_config_get_volume(const std::string& device); +bool ring_config_check_for_private_key(const std::string& pem_path); +bool ring_config_check_certificate_validity(const std::string& ca_path, const std::string& pem_path); +bool ring_config_check_hostname_certificate(const std::string& host, const std::string& port); + +/* presence API */ +void ring_pres_publish(const std::string& account_id, int status, const std::string& note); +void ring_pres_answer_server_request(const std::string& uri, int flag); +void ring_pres_subscribe_buddy(const std::string& account_id, const std::string& uri, int flag); +std::vector<std::map<std::string, std::string>> ring_pres_get_subscriptions(const std::string& account_id); +void ring_pres_set_subscriptions(const std::string& account_id, const std::vector<std::string>& uris); + +/* video API */ +#ifdef RING_VIDEO +std::vector<std::map<std::string, std::string>> ring_video_get_codecs(const std::string& account_id); +void ring_video_set_codecs(const std::string& account_id, const std::vector<std::map<std::string, std::string>>& details); +std::vector<std::string> ring_video_get_device_list(void); +std::map<std::string, std::map<std::string, std::vector<std::string>>> ring_video_get_capabilities(const std::string& name); +std::map<std::string, std::string> ring_video_get_settings(const std::string& name); +void ring_video_set_default_device(const std::string& dev); +std::string ring_video_get_default_device(void); +std::string ring_video_get_current_codec_name(const std::string& call_id); +void ring_video_start_camera(void); +void ring_video_stop_camera(void); +bool ring_video_switch_input(const std::string& resource); +bool ring_video_is_camera_started(void); +void ring_video_apply_settings(const std::string& name, const std::map<std::string, std::string>& settings); +#endif /* RING_VIDEO */ + +#endif /* RING_H */ diff --git a/daemon/src/sflphone_api.cpp b/daemon/src/ring_api.cpp similarity index 54% rename from daemon/src/sflphone_api.cpp rename to daemon/src/ring_api.cpp index 2f72699ca7326c97708f33f0cc5453dd69a133bb..d0592e02201543a913fcca1f5910165b597ecacf 100644 --- a/daemon/src/sflphone_api.cpp +++ b/daemon/src/ring_api.cpp @@ -39,14 +39,14 @@ #include "manager.h" #include "managerimpl.h" #include "logger.h" -#include "sflphone.h" +#include "ring.h" #include "client/callmanager.h" #include "client/configurationmanager.h" #include "client/presencemanager.h" -#ifdef SFL_VIDEO +#ifdef RING_VIDEO #include "client/videomanager.h" -#endif // SFL_VIDEO +#endif // RING_VIDEO static CallManager* getCallManager() { @@ -63,31 +63,31 @@ static PresenceManager* getPresenceManager() return Manager::instance().getClient()->getPresenceManager(); } -#ifdef SFL_VIDEO +#ifdef RING_VIDEO static VideoManager* getVideoManager() { return Manager::instance().getClient()->getVideoManager(); } -#endif // SFL_VIDEO +#endif // RING_VIDEO const char * -sflph_version() +ring_version() { return PACKAGE_VERSION; } -int sflph_init(sflph_ev_handlers* ev_handlers, enum sflph_init_flag flags) +int ring_init(ring_ev_handlers* ev_handlers, enum ring_init_flag flags) { // User handlers of library events // FIXME: static evil - static sflph_ev_handlers evHandlers_; + static ring_ev_handlers evHandlers_; // Copy user event handlers evHandlers_ = *ev_handlers; // Handle flags - setDebugMode(flags & SFLPH_FLAG_DEBUG); - setConsoleLog(flags & SFLPH_FLAG_CONSOLE_LOG); + setDebugMode(flags & RING_FLAG_DEBUG); + setConsoleLog(flags & RING_FLAG_CONSOLE_LOG); // Create manager try { @@ -97,7 +97,7 @@ int sflph_init(sflph_ev_handlers* ev_handlers, enum sflph_init_flag flags) assert(!manager); manager = &(Manager::instance()); } catch (...) { - return -SFLPH_ERR_MANAGER_INIT; + return -RING_ERR_MANAGER_INIT; } // Register user event handlers @@ -105,432 +105,432 @@ int sflph_init(sflph_ev_handlers* ev_handlers, enum sflph_init_flag flags) getConfigurationManager()->registerEvHandlers(&evHandlers_.config_ev_handlers); getPresenceManager()->registerEvHandlers(&evHandlers_.pres_ev_handlers); -#ifdef SFL_VIDEO +#ifdef RING_VIDEO getVideoManager()->registerEvHandlers(&evHandlers_.video_ev_handlers); -#endif // SFL_VIDEO +#endif // RING_VIDEO // Initialize manager now try { Manager::instance().init(""); } catch (...) { - return -SFLPH_ERR_MANAGER_INIT; + return -RING_ERR_MANAGER_INIT; } return 0; } -void sflph_fini(void) +void ring_fini(void) { // Finish manager Manager::instance().finish(); } -void sflph_poll_events() +void ring_poll_events() { Manager::instance().pollEvents(); } -bool sflph_call_place(const std::string& account_id, const std::string& call_id, const std::string& to) +bool ring_call_place(const std::string& account_id, const std::string& call_id, const std::string& to) { return getCallManager()->placeCall(account_id, call_id, to); } -bool sflph_call_refuse(const std::string& call_id) +bool ring_call_refuse(const std::string& call_id) { return getCallManager()->refuse(call_id); } -bool sflph_call_accept(const std::string& call_id) +bool ring_call_accept(const std::string& call_id) { return getCallManager()->accept(call_id); } -bool sflph_call_hang_up(const std::string& call_id) +bool ring_call_hang_up(const std::string& call_id) { return getCallManager()->hangUp(call_id); } -bool sflph_call_hold(const std::string& call_id) +bool ring_call_hold(const std::string& call_id) { return getCallManager()->hold(call_id); } -bool sflph_call_unhold(const std::string& call_id) +bool ring_call_unhold(const std::string& call_id) { return getCallManager()->unhold(call_id); } -bool sflph_call_transfer(const std::string& call_id, const std::string& to) +bool ring_call_transfer(const std::string& call_id, const std::string& to) { return getCallManager()->transfer(call_id, to); } -bool sflph_call_attended_transfer(const std::string& transfer_id, const std::string& target_id) +bool ring_call_attended_transfer(const std::string& transfer_id, const std::string& target_id) { return getCallManager()->attendedTransfer(transfer_id, target_id); } -std::map<std::string, std::string> sflph_call_get_call_details(const std::string& call_id) +std::map<std::string, std::string> ring_call_get_call_details(const std::string& call_id) { return getCallManager()->getCallDetails(call_id); } -std::vector<std::string> sflph_call_get_call_list(void) +std::vector<std::string> ring_call_get_call_list(void) { return getCallManager()->getCallList(); } -void sflph_call_remove_conference(const std::string& conf_id) +void ring_call_remove_conference(const std::string& conf_id) { getCallManager()->removeConference(conf_id); } -bool sflph_call_join_participant(const std::string& sel_call_id, const std::string& drag_call_id) +bool ring_call_join_participant(const std::string& sel_call_id, const std::string& drag_call_id) { return getCallManager()->joinParticipant(sel_call_id, drag_call_id); } -void sflph_call_create_conf_from_participant_list(const std::vector<std::string>& participants) +void ring_call_create_conf_from_participant_list(const std::vector<std::string>& participants) { getCallManager()->createConfFromParticipantList(participants); } -bool sflph_call_is_conference_participant(const std::string& call_id) +bool ring_call_is_conference_participant(const std::string& call_id) { return getCallManager()->isConferenceParticipant(call_id); } -bool sflph_call_add_participant(const std::string& call_id, const std::string& conf_id) +bool ring_call_add_participant(const std::string& call_id, const std::string& conf_id) { return getCallManager()->addParticipant(call_id, conf_id); } -bool sflph_call_add_main_participant(const std::string& conf_id) +bool ring_call_add_main_participant(const std::string& conf_id) { return getCallManager()->addMainParticipant(conf_id); } -bool sflph_call_detach_participant(const std::string& call_id) +bool ring_call_detach_participant(const std::string& call_id) { return getCallManager()->detachParticipant(call_id); } -bool sflph_call_join_conference(const std::string& sel_conf_id, const std::string& drag_conf_id) +bool ring_call_join_conference(const std::string& sel_conf_id, const std::string& drag_conf_id) { return getCallManager()->joinConference(sel_conf_id, drag_conf_id); } -bool sflph_call_hang_up_conference(const std::string& conf_id) +bool ring_call_hang_up_conference(const std::string& conf_id) { return getCallManager()->hangUpConference(conf_id); } -bool sflph_call_hold_conference(const std::string& conf_id) +bool ring_call_hold_conference(const std::string& conf_id) { return getCallManager()->holdConference(conf_id); } -bool sflph_call_unhold_conference(const std::string& conf_id) +bool ring_call_unhold_conference(const std::string& conf_id) { return getCallManager()->unholdConference(conf_id); } -std::vector<std::string> sflph_call_get_conference_list(void) +std::vector<std::string> ring_call_get_conference_list(void) { return getCallManager()->getConferenceList(); } -std::vector<std::string> sflph_call_get_participant_list(const std::string& conf_id) +std::vector<std::string> ring_call_get_participant_list(const std::string& conf_id) { return getCallManager()->getParticipantList(conf_id); } -std::vector<std::string> sflph_call_get_display_names(const std::string& conf_id) +std::vector<std::string> ring_call_get_display_names(const std::string& conf_id) { return getCallManager()->getDisplayNames(conf_id); } -std::string sflph_call_get_conference_id(const std::string& call_id) +std::string ring_call_get_conference_id(const std::string& call_id) { return getCallManager()->getConferenceId(call_id); } -std::map<std::string, std::string> sflph_call_get_conference_details(const std::string& call_id) +std::map<std::string, std::string> ring_call_get_conference_details(const std::string& call_id) { return getCallManager()->getConferenceDetails(call_id); } -bool sflph_call_play_recorded_file(const std::string& path) +bool ring_call_play_recorded_file(const std::string& path) { return getCallManager()->startRecordedFilePlayback(path); } -void sflph_call_stop_recorded_file(const std::string& path) +void ring_call_stop_recorded_file(const std::string& path) { getCallManager()->stopRecordedFilePlayback(path); } -bool sflph_call_toggle_recording(const std::string& call_id) +bool ring_call_toggle_recording(const std::string& call_id) { return getCallManager()->toggleRecording(call_id); } -void sflph_call_set_recording(const std::string& call_id) +void ring_call_set_recording(const std::string& call_id) { getCallManager()->setRecording(call_id); } -void sflph_call_record_playback_seek(double pos) +void ring_call_record_playback_seek(double pos) { getCallManager()->recordPlaybackSeek(pos); } -bool sflph_call_is_recording(const std::string& call_id) +bool ring_call_is_recording(const std::string& call_id) { return getCallManager()->getIsRecording(call_id); } -std::string sflph_call_get_current_audio_codec_name(const std::string& call_id) +std::string ring_call_get_current_audio_codec_name(const std::string& call_id) { return getCallManager()->getCurrentAudioCodecName(call_id); } -void sflph_call_play_dtmf(const std::string& key) +void ring_call_play_dtmf(const std::string& key) { getCallManager()->playDTMF(key); } -void sflph_call_start_tone(int start, int type) +void ring_call_start_tone(int start, int type) { getCallManager()->startTone(start, type); } -void sflph_call_set_sas_verified(const std::string& call_id) +void ring_call_set_sas_verified(const std::string& call_id) { getCallManager()->setSASVerified(call_id); } -void sflph_call_reset_sas_verified(const std::string& call_id) +void ring_call_reset_sas_verified(const std::string& call_id) { getCallManager()->resetSASVerified(call_id); } -void sflph_call_set_confirm_go_clear(const std::string& call_id) +void ring_call_set_confirm_go_clear(const std::string& call_id) { getCallManager()->setConfirmGoClear(call_id); } -void sflph_call_request_go_clear(const std::string& call_id) +void ring_call_request_go_clear(const std::string& call_id) { getCallManager()->requestGoClear(call_id); } -void sflph_call_accept_enrollment(const std::string& call_id, bool accepted) +void ring_call_accept_enrollment(const std::string& call_id, bool accepted) { getCallManager()->acceptEnrollment(call_id, accepted); } -void sflph_call_send_text_message(const std::string& call_id, const std::string& message) +void ring_call_send_text_message(const std::string& call_id, const std::string& message) { getCallManager()->sendTextMessage(call_id, message); } -std::map<std::string, std::string> sflph_config_get_account_details(const std::string& account_id) +std::map<std::string, std::string> ring_config_get_account_details(const std::string& account_id) { return getConfigurationManager()->getAccountDetails(account_id); } -std::map<std::string, std::string> sflph_config_get_volatile_account_details(const std::string& account_id) +std::map<std::string, std::string> ring_config_get_volatile_account_details(const std::string& account_id) { return getConfigurationManager()->getVolatileAccountDetails(account_id); } -void sflph_config_set_account_details(const std::string& account_id, const std::map<std::string, std::string>& details) +void ring_config_set_account_details(const std::string& account_id, const std::map<std::string, std::string>& details) { getConfigurationManager()->setAccountDetails(account_id, details); } -std::map<std::string, std::string> sflph_config_get_account_template(void) +std::map<std::string, std::string> ring_config_get_account_template(void) { return getConfigurationManager()->getAccountTemplate(); } -std::string sflph_config_add_account(const std::map<std::string, std::string>& details) +std::string ring_config_add_account(const std::map<std::string, std::string>& details) { return getConfigurationManager()->addAccount(details); } -void sflph_config_remove_account(const std::string& account_id) +void ring_config_remove_account(const std::string& account_id) { getConfigurationManager()->removeAccount(account_id); } -std::vector<std::string> sflph_config_get_account_list(void) +std::vector<std::string> ring_config_get_account_list(void) { return getConfigurationManager()->getAccountList(); } -void sflph_config_send_register(const std::string& account_id, bool enable) +void ring_config_send_register(const std::string& account_id, bool enable) { getConfigurationManager()->sendRegister(account_id, enable); } -void sflph_config_register_all_accounts(void) +void ring_config_register_all_accounts(void) { getConfigurationManager()->registerAllAccounts(); } -std::map<std::string, std::string> sflph_config_get_tls_default_settings(void) +std::map<std::string, std::string> ring_config_get_tls_default_settings(void) { return getConfigurationManager()->getTlsSettingsDefault(); } -std::vector<int> sflph_config_get_audio_codec_list(void) +std::vector<int> ring_config_get_audio_codec_list(void) { return getConfigurationManager()->getAudioCodecList(); } -std::vector<std::string> sflph_config_get_supported_tls_method(void) +std::vector<std::string> ring_config_get_supported_tls_method(void) { return getConfigurationManager()->getSupportedTlsMethod(); } -std::vector<std::string> sflph_config_get_audio_codec_details(int payload) +std::vector<std::string> ring_config_get_audio_codec_details(int payload) { return getConfigurationManager()->getAudioCodecDetails(payload); } -std::vector<int> sflph_config_get_active_audio_codec_list(const std::string& account_id) +std::vector<int> ring_config_get_active_audio_codec_list(const std::string& account_id) { return getConfigurationManager()->getActiveAudioCodecList(account_id); } -void sflph_config_set_active_audio_codec_list(const std::vector<std::string>& list, const std::string& account_id) +void ring_config_set_active_audio_codec_list(const std::vector<std::string>& list, const std::string& account_id) { getConfigurationManager()->setActiveAudioCodecList(list, account_id); } -std::vector<std::string> sflph_config_get_audio_plugin_list(void) +std::vector<std::string> ring_config_get_audio_plugin_list(void) { return getConfigurationManager()->getAudioPluginList(); } -void sflph_config_set_audio_plugin(const std::string& audio_plugin) +void ring_config_set_audio_plugin(const std::string& audio_plugin) { getConfigurationManager()->setAudioPlugin(audio_plugin); } -std::vector<std::string> sflph_config_get_audio_output_device_list() +std::vector<std::string> ring_config_get_audio_output_device_list() { return getConfigurationManager()->getAudioOutputDeviceList(); } -void sflph_config_set_audio_output_device(int index) +void ring_config_set_audio_output_device(int index) { getConfigurationManager()->setAudioOutputDevice(index); } -void sflph_config_set_audio_input_device(int index) +void ring_config_set_audio_input_device(int index) { getConfigurationManager()->setAudioInputDevice(index); } -void sflph_config_set_audio_ringtone_device(int index) +void ring_config_set_audio_ringtone_device(int index) { getConfigurationManager()->setAudioRingtoneDevice(index); } -std::vector<std::string> sflph_config_get_audio_input_device_list(void) +std::vector<std::string> ring_config_get_audio_input_device_list(void) { return getConfigurationManager()->getAudioInputDeviceList(); } -std::vector<std::string> sflph_config_get_current_audio_devices_index(void) +std::vector<std::string> ring_config_get_current_audio_devices_index(void) { return getConfigurationManager()->getCurrentAudioDevicesIndex(); } -int sflph_config_get_audio_input_device_index(const std::string& name) +int ring_config_get_audio_input_device_index(const std::string& name) { return getConfigurationManager()->getAudioInputDeviceIndex(name); } -int sflph_config_get_audio_output_device_index(const std::string& name) +int ring_config_get_audio_output_device_index(const std::string& name) { return getConfigurationManager()->getAudioOutputDeviceIndex(name); } -std::string sflph_config_get_current_audio_output_plugin(void) +std::string ring_config_get_current_audio_output_plugin(void) { return getConfigurationManager()->getCurrentAudioOutputPlugin(); } -bool sflph_config_get_noise_suppress_state(void) +bool ring_config_get_noise_suppress_state(void) { return getConfigurationManager()->getNoiseSuppressState(); } -void sflph_config_set_noise_suppress_state(bool state) +void ring_config_set_noise_suppress_state(bool state) { getConfigurationManager()->setNoiseSuppressState(state); } -bool sflph_config_is_agc_enabled(void) +bool ring_config_is_agc_enabled(void) { return getConfigurationManager()->isAgcEnabled(); } -void sflph_config_enable_agc(bool enabled) +void ring_config_enable_agc(bool enabled) { getConfigurationManager()->setAgcState(enabled); } -void sflph_config_mute_dtmf(bool mute) +void ring_config_mute_dtmf(bool mute) { getConfigurationManager()->muteDtmf(mute); } -bool sflph_config_is_dtmf_muted(void) +bool ring_config_is_dtmf_muted(void) { return getConfigurationManager()->isDtmfMuted(); } -bool sflph_config_is_capture_muted(void) +bool ring_config_is_capture_muted(void) { return getConfigurationManager()->isCaptureMuted(); } -void sflph_config_mute_capture(bool mute) +void ring_config_mute_capture(bool mute) { getConfigurationManager()->muteCapture(mute); } -bool sflph_config_is_playback_muted(void) +bool ring_config_is_playback_muted(void) { return getConfigurationManager()->isPlaybackMuted(); } -void sflph_config_mute_playback(int mute) +void ring_config_mute_playback(int mute) { getConfigurationManager()->mutePlayback(mute); } -std::map<std::string, std::string> sflph_config_get_ringtone_list(void) +std::map<std::string, std::string> ring_config_get_ringtone_list(void) { return getConfigurationManager()->getRingtoneList(); } -std::string sflph_config_get_audio_manager(void) +std::string ring_config_get_audio_manager(void) { return getConfigurationManager()->getAudioManager(); } -bool sflph_config_set_audio_manager(const std::string& api) +bool ring_config_set_audio_manager(const std::string& api) { return getConfigurationManager()->setAudioManager(api); } -std::vector<std::string> sflph_config_get_supported_audio_managers(void) +std::vector<std::string> ring_config_get_supported_audio_managers(void) { return { #if HAVE_ALSA @@ -545,240 +545,240 @@ std::vector<std::string> sflph_config_get_supported_audio_managers(void) }; } -int sflph_config_is_iax2_enabled(void) +int ring_config_is_iax2_enabled(void) { return getConfigurationManager()->isIax2Enabled(); } -std::string sflph_config_get_record_path(void) +std::string ring_config_get_record_path(void) { return getConfigurationManager()->getRecordPath(); } -void sflph_config_set_record_path(const std::string& path) +void ring_config_set_record_path(const std::string& path) { getConfigurationManager()->setRecordPath(path); } -bool sflph_config_is_always_recording(void) +bool ring_config_is_always_recording(void) { return getConfigurationManager()->getIsAlwaysRecording(); } -void sflph_config_set_always_recording(bool rec) +void ring_config_set_always_recording(bool rec) { getConfigurationManager()->setIsAlwaysRecording(rec); } -void sflph_config_set_history_limit(int days) +void ring_config_set_history_limit(int days) { getConfigurationManager()->setHistoryLimit(days); } -int sflph_config_get_history_limit(void) +int ring_config_get_history_limit(void) { return getConfigurationManager()->getHistoryLimit(); } -void sflph_config_clear_history(void) +void ring_config_clear_history(void) { getConfigurationManager()->clearHistory(); } -void sflph_config_set_accounts_order(const std::string& order) +void ring_config_set_accounts_order(const std::string& order) { getConfigurationManager()->setAccountsOrder(order); } -std::map<std::string, std::string> sflph_config_get_hook_settings(void) +std::map<std::string, std::string> ring_config_get_hook_settings(void) { return getConfigurationManager()->getHookSettings(); } -void sflph_config_set_hook_settings(const std::map<std::string, std::string>& settings) +void ring_config_set_hook_settings(const std::map<std::string, std::string>& settings) { getConfigurationManager()->setHookSettings(settings); } -std::vector<std::map<std::string, std::string>> sflph_config_get_history(void) +std::vector<std::map<std::string, std::string>> ring_config_get_history(void) { return getConfigurationManager()->getHistory(); } -std::map<std::string, std::string> sflph_config_get_tls_settings() +std::map<std::string, std::string> ring_config_get_tls_settings() { return getConfigurationManager()->getTlsSettings(); } -void sflph_config_set_tls_settings(const std::map< std::string, std::string >& settings) +void ring_config_set_tls_settings(const std::map< std::string, std::string >& settings) { getConfigurationManager()->setTlsSettings(settings); } -std::map<std::string, std::string> sflph_config_get_ip2ip_details(void) +std::map<std::string, std::string> ring_config_get_ip2ip_details(void) { return getConfigurationManager()->getIp2IpDetails(); } -std::vector<std::map<std::string, std::string>> sflph_config_get_credentials(const std::string& account_id) +std::vector<std::map<std::string, std::string>> ring_config_get_credentials(const std::string& account_id) { return getConfigurationManager()->getCredentials(account_id); } -void sflph_config_set_credentials(const std::string& account_id, const std::vector<std::map<std::string, std::string>>& details) +void ring_config_set_credentials(const std::string& account_id, const std::vector<std::map<std::string, std::string>>& details) { getConfigurationManager()->setCredentials(account_id, details); } -std::string sflph_config_get_addr_from_interface_name(const std::string& interface) +std::string ring_config_get_addr_from_interface_name(const std::string& interface) { return getConfigurationManager()->getAddrFromInterfaceName(interface); } -std::vector<std::string> sflph_config_get_all_ip_interface(void) +std::vector<std::string> ring_config_get_all_ip_interface(void) { return getConfigurationManager()->getAllIpInterface(); } -std::vector<std::string> sflph_config_get_all_ip_interface_by_name(void) +std::vector<std::string> ring_config_get_all_ip_interface_by_name(void) { return getConfigurationManager()->getAllIpInterfaceByName(); } -std::map<std::string, std::string> sflph_config_get_shortcuts() +std::map<std::string, std::string> ring_config_get_shortcuts() { return getConfigurationManager()->getShortcuts(); } -void sflph_config_set_shortcuts(const std::map<std::string, std::string>& shortcuts) +void ring_config_set_shortcuts(const std::map<std::string, std::string>& shortcuts) { getConfigurationManager()->setShortcuts(shortcuts); } -void sflph_config_set_volume(const std::string& device, double value) +void ring_config_set_volume(const std::string& device, double value) { getConfigurationManager()->setVolume(device, value); } -double sflph_config_get_volume(const std::string& device) +double ring_config_get_volume(const std::string& device) { return getConfigurationManager()->getVolume(device); } -bool sflph_config_check_for_private_key(const std::string& pem_path) +bool ring_config_check_for_private_key(const std::string& pem_path) { return getConfigurationManager()->checkForPrivateKey(pem_path); } -bool sflph_config_check_certificate_validity(const std::string& ca_path, const std::string& pem_path) +bool ring_config_check_certificate_validity(const std::string& ca_path, const std::string& pem_path) { return getConfigurationManager()->checkCertificateValidity(ca_path, pem_path); } -bool sflph_config_check_hostname_certificate(const std::string& host, const std::string& port) +bool ring_config_check_hostname_certificate(const std::string& host, const std::string& port) { return getConfigurationManager()->checkHostnameCertificate(host, port); } -std::map<std::string, std::string> sflph_config_validate_certificate(const std::string& accountId, const std::string& certificate, const std::string& private_key) +std::map<std::string, std::string> ring_config_validate_certificate(const std::string& accountId, const std::string& certificate, const std::string& private_key) { return getConfigurationManager()->validateCertificate(accountId,certificate,private_key); } -std::map<std::string, std::string> sflph_config_get_certificate_details(const std::string& certificate) +std::map<std::string, std::string> ring_config_get_certificate_details(const std::string& certificate) { return getConfigurationManager()->getCertificateDetails(certificate); } -void sflph_pres_publish(const std::string& account_id, int status, const std::string& note) +void ring_pres_publish(const std::string& account_id, int status, const std::string& note) { getPresenceManager()->publish(account_id, status, note); } -void sflph_pres_answer_server_request(const std::string& uri, int flag) +void ring_pres_answer_server_request(const std::string& uri, int flag) { getPresenceManager()->answerServerRequest(uri, flag); } -void sflph_pres_subscribe_buddy(const std::string& account_id, const std::string& uri, int flag) +void ring_pres_subscribe_buddy(const std::string& account_id, const std::string& uri, int flag) { getPresenceManager()->subscribeBuddy(account_id, uri, flag); } -std::vector<std::map<std::string, std::string>> sflph_pres_get_subscriptions(const std::string& account_id) +std::vector<std::map<std::string, std::string>> ring_pres_get_subscriptions(const std::string& account_id) { return getPresenceManager()->getSubscriptions(account_id); } -void sflph_pres_set_subscriptions(const std::string& account_id, const std::vector<std::string>& uris) +void ring_pres_set_subscriptions(const std::string& account_id, const std::vector<std::string>& uris) { getPresenceManager()->setSubscriptions(account_id, uris); } -#ifdef SFL_VIDEO -std::vector<std::map<std::string, std::string>> sflph_video_get_codecs(const std::string& account_id) +#ifdef RING_VIDEO +std::vector<std::map<std::string, std::string>> ring_video_get_codecs(const std::string& account_id) { return getVideoManager()->getCodecs(account_id); } -void sflph_video_set_codecs(const std::string& account_id, const std::vector<std::map<std::string, std::string>>& details) +void ring_video_set_codecs(const std::string& account_id, const std::vector<std::map<std::string, std::string>>& details) { getVideoManager()->setCodecs(account_id, details); } -std::vector<std::string> sflph_video_get_device_list(void) +std::vector<std::string> ring_video_get_device_list(void) { return getVideoManager()->getDeviceList(); } -std::map<std::string, std::string> sflph_video_get_settings(const std::string& name) +std::map<std::string, std::string> ring_video_get_settings(const std::string& name) { return getVideoManager()->getSettings(name); } -void sflph_video_set_default_device(const std::string& dev) +void ring_video_set_default_device(const std::string& dev) { getVideoManager()->setDefaultDevice(dev); } -std::string sflph_video_get_default_device(void) +std::string ring_video_get_default_device(void) { return getVideoManager()->getDefaultDevice(); } -std::string sflph_video_get_current_codec_name(const std::string& call_id) +std::string ring_video_get_current_codec_name(const std::string& call_id) { return getVideoManager()->getCurrentCodecName(call_id); } -void sflph_video_start_camera(void) +void ring_video_start_camera(void) { getVideoManager()->startCamera(); } -void sflph_video_stop_camera(void) +void ring_video_stop_camera(void) { getVideoManager()->stopCamera(); } -bool sflph_video_switch_input(const std::string& resource) +bool ring_video_switch_input(const std::string& resource) { return getVideoManager()->switchInput(resource); } -bool sflph_video_is_camera_started(void) +bool ring_video_is_camera_started(void) { return getVideoManager()->hasCameraStarted(); } -void sflph_video_apply_settings(const std::string& name, const std::map<std::string, std::string>& settings) +void ring_video_apply_settings(const std::string& name, const std::map<std::string, std::string>& settings) { getVideoManager()->applySettings(name, settings); } -std::map<std::string, std::map<std::string, std::vector<std::string>>> sflph_video_get_capabilities(const std::string& name) +std::map<std::string, std::map<std::string, std::vector<std::string>>> ring_video_get_capabilities(const std::string& name) { return getVideoManager()->getCapabilities(name); } -#endif // SFL_VIDEO +#endif // RING_VIDEO diff --git a/daemon/src/ring_plugin.h b/daemon/src/ring_plugin.h index 8eaa895c3e151f0de8e3575080d8861105a07139..c3a011d835db4bce1526662047231dff003eb01a 100644 --- a/daemon/src/ring_plugin.h +++ b/daemon/src/ring_plugin.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Guillaume Roguez <guillaume.roguez@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify diff --git a/daemon/src/ringdht/ringaccount.cpp b/daemon/src/ringdht/ringaccount.cpp index fcb01f2fa049166d945c63d5ef583a5fdbcd74b0..5e1b3b14002fe9fecfd196078dc22c834cd68e70 100644 --- a/daemon/src/ringdht/ringaccount.cpp +++ b/daemon/src/ringdht/ringaccount.cpp @@ -53,7 +53,7 @@ #include "logger.h" #include "manager.h" -#ifdef SFL_VIDEO +#ifdef RING_VIDEO #include "video/libav_utils.h" #endif #include "fileutils.h" @@ -93,7 +93,7 @@ RingAccount::RingAccount(const std::string& accountID, bool /* presenceEnabled * int rc = gnutls_global_init(); if (rc != GNUTLS_E_SUCCESS) { - SFL_ERR("Error initializing GnuTLS : %s", gnutls_strerror(rc)); + RING_ERR("Error initializing GnuTLS : %s", gnutls_strerror(rc)); throw VoipLinkException("Can't initialize GnuTLS."); } } @@ -111,11 +111,11 @@ RingAccount::newIncomingCall(const std::string& from) { for (auto& c : pendingCalls_) { if (c->getPeerNumber() == from) { - SFL_WARN("Found matching call for %s", from.c_str()); + RING_WARN("Found matching call for %s", from.c_str()); return c; } } - SFL_ERR("Can't find matching call for %s", from.c_str()); + RING_ERR("Can't find matching call for %s", from.c_str()); return nullptr; } @@ -136,7 +136,7 @@ RingAccount::newOutgoingCall(const std::string& id, const std::string& toUrl) if (std::find_if_not(toUri.cbegin(), toUri.cend(), ::isxdigit) != toUri.cend()) throw std::invalid_argument("id must be a ring infohash"); - SFL_DBG("Calling DHT peer %s", toUri.c_str()); + RING_DBG("Calling DHT peer %s", toUri.c_str()); auto call = Manager::instance().callFactory.newCall<SIPCall, RingAccount>(*this, id, Call::OUTGOING); call->setIPToIP(true); @@ -178,18 +178,18 @@ RingAccount::newOutgoingCall(const std::string& id, const std::string& toUrl) dht_.listen( callkey, [shared, call, callkey, ice, toUri, replyvid] (const std::vector<std::shared_ptr<dht::Value>>& vals) { - SFL_WARN("Got a DHT reply from %s !", toUri.c_str()); + RING_WARN("Got a DHT reply from %s !", toUri.c_str()); auto& this_ = *std::static_pointer_cast<RingAccount>(shared).get(); for (const auto& v : vals) { if (v->recipient != this_.dht_.getId() || v->type != this_.ICE_ANNOUCEMENT_TYPE.id) { - SFL_WARN("Ignoring non encrypted or bad type value %s.", v->toString().c_str()); + RING_WARN("Ignoring non encrypted or bad type value %s.", v->toString().c_str()); continue; } if (v->id != replyvid) { - SFL_WARN("Ignoring value ID %llx (expected %llx)", v->id, replyvid); + RING_WARN("Ignoring value ID %llx (expected %llx)", v->id, replyvid); continue; } - SFL_WARN("Performing ICE negotiation."); + RING_WARN("Performing ICE negotiation."); ice->start(v->data); if (call->waitForIceNegotiation(ICE_NEGOTIATION_TIMEOUT) <= 0) { call->setConnectionState(Call::DISCONNECTED); @@ -210,7 +210,7 @@ RingAccount::newOutgoingCall(const std::string& id, const std::string& toUrl) void RingAccount::createOutgoingCall(const std::shared_ptr<SIPCall>& call, const std::string& to_id, IpAddr target) { - SFL_WARN("RingAccount::createOutgoingCall to: %s target: %s tlsListener: %d", to_id.c_str(), target.toString(true).c_str(), tlsListener_?1:0); + RING_WARN("RingAccount::createOutgoingCall to: %s target: %s tlsListener: %d", to_id.c_str(), target.toString(true).c_str(), tlsListener_?1:0); auto t = link_->sipTransport->getIceTransport(call->getIceTransport(), ICE_COMP_SIP_TRANSPORT); setTransport(t); call->setTransport(t); @@ -228,11 +228,11 @@ RingAccount::createOutgoingCall(const std::shared_ptr<SIPCall>& call, const std: // Initialize the session using ULAW as default codec in case of early media // The session should be ready to receive media once the first INVITE is sent, before // the session initialization is completed - sfl::AudioCodec* ac = Manager::instance().audioCodecFactory.instantiateCodec(PAYLOAD_CODEC_ULAW); + ring::AudioCodec* ac = Manager::instance().audioCodecFactory.instantiateCodec(PAYLOAD_CODEC_ULAW); if (!ac) throw VoipLinkException("Could not instantiate codec for early media"); - std::vector<sfl::AudioCodec *> audioCodecs; + std::vector<ring::AudioCodec *> audioCodecs; audioCodecs.push_back(ac); #if USE_CCRTP @@ -291,12 +291,12 @@ RingAccount::SIPStartCall(const std::shared_ptr<SIPCall>& call, IpAddr target) pjContact = getContactHeader(transport ? transport->get() : nullptr); } - SFL_DBG("contact header: %.*s / %s -> %s / %.*s", + RING_DBG("contact header: %.*s / %s -> %s / %.*s", pjContact.slen, pjContact.ptr, from.c_str(), toUri.c_str(), pjTarget.slen, pjTarget.ptr); pjsip_dialog *dialog = NULL; if (pjsip_dlg_create_uac(pjsip_ua_instance(), &pjFrom, &pjContact, &pjTo, &pjTarget, &dialog) != PJ_SUCCESS) { - SFL_ERR("Unable to create SIP dialogs for user agent client when " + RING_ERR("Unable to create SIP dialogs for user agent client when " "calling %s", toUri.c_str()); return false; } @@ -308,12 +308,12 @@ RingAccount::SIPStartCall(const std::shared_ptr<SIPCall>& call, IpAddr target) pjsip_inv_session* inv = nullptr; if (pjsip_inv_create_uac(dialog, call->getSDP().getLocalSdpSession(), 0, &inv) != PJ_SUCCESS) { - SFL_ERR("Unable to create invite session for user agent client"); + RING_ERR("Unable to create invite session for user agent client"); return false; } if (!inv) { - SFL_ERR("Call invite is not initialized"); + RING_ERR("Call invite is not initialized"); return PJ_FALSE; } @@ -329,20 +329,20 @@ RingAccount::SIPStartCall(const std::shared_ptr<SIPCall>& call, IpAddr target) pjsip_tx_data *tdata; if (pjsip_inv_invite(call->inv.get(), &tdata) != PJ_SUCCESS) { - SFL_ERR("Could not initialize invite messager for this call"); + RING_ERR("Could not initialize invite messager for this call"); return false; } //const pjsip_tpselector tp_sel = getTransportSelector(); const pjsip_tpselector tp_sel = {PJSIP_TPSELECTOR_TRANSPORT, {call->getTransport()->get()}}; if (pjsip_dlg_set_transport(dialog, &tp_sel) != PJ_SUCCESS) { - SFL_ERR("Unable to associate transport for invite session dialog"); + RING_ERR("Unable to associate transport for invite session dialog"); return false; } if (pjsip_inv_send_msg(call->inv.get(), tdata) != PJ_SUCCESS) { call->inv.reset(); - SFL_ERR("Unable to send invite message for this call"); + RING_ERR("Unable to send invite message for this call"); return false; } @@ -419,7 +419,7 @@ saveFile(const std::string& path, const std::vector<uint8_t>& data) { std::ofstream file(path, std::ios::trunc | std::ios::binary); if (!file.is_open()) { - SFL_ERR("Could not write data to %s", path.c_str()); + RING_ERR("Could not write data to %s", path.c_str()); return; } file.write((char*)data.data(), data.size()); @@ -439,7 +439,7 @@ RingAccount::loadIdentity() dht_key = dht::crypto::PrivateKey(fileutils::loadFile(privkeyPath_)); } catch (const std::exception& e) { - SFL_ERR("Error loading identity: %s", e.what()); + RING_ERR("Error loading identity: %s", e.what()); auto ca = dht::crypto::generateIdentity("Ring CA"); if (!ca.first || !ca.second) { throw VoipLinkException("Can't generate CA for this account."); @@ -485,7 +485,7 @@ parseInt(const std::map<std::string, std::string> &details, const char *key, T & { const auto iter = details.find(key); if (iter == details.end()) { - SFL_ERR("Couldn't find key %s", key); + RING_ERR("Couldn't find key %s", key); return; } i = atoi(iter->second.c_str()); @@ -517,19 +517,19 @@ std::map<std::string, std::string> RingAccount::getAccountDetails() const void RingAccount::doRegister() { if (not isEnabled()) { - SFL_WARN("Account must be enabled to register, ignoring"); + RING_WARN("Account must be enabled to register, ignoring"); return; } try { loadTreatedCalls(); if (dht_.isRunning()) { - SFL_ERR("DHT already running (stopping it first)."); + RING_ERR("DHT already running (stopping it first)."); dht_.join(); } auto identity = loadIdentity(); dht_.run(dhtPort_, identity.second, false, [=](dht::Dht::Status s4, dht::Dht::Status s6) { - SFL_WARN("Dht status : %d %d", (int)s4, (int)s6); + RING_WARN("Dht status : %d %d", (int)s4, (int)s6); auto status = std::max(s4, s6); switch(status) { case dht::Dht::Status::Connecting: @@ -542,7 +542,7 @@ void RingAccount::doRegister() getTlsSetting()); if (!tlsListener_) { setRegistrationState(RegistrationState::ERROR_GENERIC); - SFL_ERR("Error creating TLS listener."); + RING_ERR("Error creating TLS listener."); return; } }*/ @@ -602,14 +602,14 @@ void RingAccount::doRegister() } } for (auto ip : bootstrap) - SFL_DBG("Bootstrap node: %s", IpAddr(ip).toString(true).c_str()); + RING_DBG("Bootstrap node: %s", IpAddr(ip).toString(true).c_str()); dht_.bootstrap(bootstrap); } // Listen for incoming calls auto shared = shared_from_this(); auto listenKey = "callto:"+dht_.getId().toString(); - SFL_WARN("Listening on %s : %s", listenKey.c_str(), dht::InfoHash::get(listenKey).toString().c_str()); + RING_WARN("Listening on %s : %s", listenKey.c_str(), dht::InfoHash::get(listenKey).toString().c_str()); dht_.listen ( listenKey, [shared,listenKey] (const std::vector<std::shared_ptr<dht::Value>>& vals) { @@ -617,7 +617,7 @@ void RingAccount::doRegister() for (const auto& v : vals) { try { if (v->recipient != this_.dht_.getId() || v->type != this_.ICE_ANNOUCEMENT_TYPE.id) { - SFL_DBG("Ignoring non encrypted or bad type value %s.", v->toString().c_str()); + RING_DBG("Ignoring non encrypted or bad type value %s.", v->toString().c_str()); continue; } if (v->owner.getId() == this_.dht_.getId()) @@ -629,7 +629,7 @@ void RingAccount::doRegister() auto from = v->owner.getId().toString(); auto from_vid = v->id; auto reply_vid = from_vid+1; - SFL_WARN("Received incomming DHT call request from %s (vid %llx) !!", from.c_str(), from_vid); + RING_WARN("Received incomming DHT call request from %s (vid %llx) !!", from.c_str(), from_vid); auto call = Manager::instance().callFactory.newCall<SIPCall, RingAccount>(this_, Manager::instance().getNewCallID(), Call::INCOMING); call->initIceTransport(false, ICE_COMPONENTS); if (call->waitForIceInitialization(ICE_INIT_TIMEOUT) <= 0) @@ -643,16 +643,16 @@ void RingAccount::doRegister() reply_vid }, [call,shared,listenKey,reply_vid](bool ok) { - SFL_WARN("ICE exchange put %d", ok); + RING_WARN("ICE exchange put %d", ok); auto& this_ = *std::static_pointer_cast<RingAccount>(shared).get(); this_.dht_.cancelPut(listenKey, reply_vid); - SFL_WARN("waitForIceNegociation"); + RING_WARN("waitForIceNegociation"); if (!ok || call->waitForIceNegotiation(ICE_NEGOTIATION_TIMEOUT) <= 0) { - SFL_WARN("nego failed"); + RING_WARN("nego failed"); call->setConnectionState(Call::DISCONNECTED); Manager::instance().callFailure(*call); } else { - SFL_WARN("nego succeeded"); + RING_WARN("nego succeeded"); call->setConnectionState(Call::PROGRESSING); auto t = this_.link_->sipTransport->getIceTransport(call->getIceTransport(), ICE_COMP_SIP_TRANSPORT); this_.setTransport(t); @@ -666,7 +666,7 @@ void RingAccount::doRegister() this_.pendingCalls_.push_back(call); return true; } catch (const std::exception& e) { - SFL_ERR("ICE/DHT error: %s", e.what()); + RING_ERR("ICE/DHT error: %s", e.what()); } } return true; @@ -675,7 +675,7 @@ void RingAccount::doRegister() } catch (const std::exception& e) { - SFL_ERR("Error registering DHT account: %s", e.what()); + RING_ERR("Error registering DHT account: %s", e.what()); setRegistrationState(RegistrationState::ERROR_GENERIC); } } @@ -722,7 +722,7 @@ RingAccount::loadTreatedCalls() { std::ifstream file(treatedcallPath); if (!file.is_open()) { - SFL_WARN("Could not load treated calls from %s", treatedcallPath.c_str()); + RING_WARN("Could not load treated calls from %s", treatedcallPath.c_str()); return; } std::string line; @@ -743,7 +743,7 @@ RingAccount::saveTreatedCalls() const { std::ofstream file(treatedcallPath, std::ios::trunc); if (!file.is_open()) { - SFL_ERR("Could not save treated calls to %s", treatedcallPath.c_str()); + RING_ERR("Could not save treated calls to %s", treatedcallPath.c_str()); return; } for (auto& c : treatedCalls_) @@ -762,7 +762,7 @@ RingAccount::regenerateCAList() { std::ofstream list(caListPath_, std::ios::trunc | std::ios::binary); if (!list.is_open()) { - SFL_ERR("Could write CA list"); + RING_ERR("Could write CA list"); return; } auto cas = getRegistredCAs(); @@ -787,7 +787,7 @@ void RingAccount::saveNodes(const std::vector<dht::Dht::NodeExport>& nodes) cons { std::ofstream file(nodesPath, std::ios::trunc); if (!file.is_open()) { - SFL_ERR("Could not save nodes to %s", nodesPath.c_str()); + RING_ERR("Could not save nodes to %s", nodesPath.c_str()); return; } for (auto& n : nodes) @@ -813,7 +813,7 @@ RingAccount::loadNodes() const { std::ifstream file(nodesPath); if (!file.is_open()) { - SFL_ERR("Could not load nodes from %s", nodesPath.c_str()); + RING_ERR("Could not load nodes from %s", nodesPath.c_str()); return nodes; } std::string line; @@ -841,7 +841,7 @@ RingAccount::loadValues() const std::istreambuf_iterator<char> begin(ifs), end; values.push_back({{fname}, std::vector<uint8_t>{begin, end}}); } catch (const std::exception& e) { - SFL_ERR("Error reading value: %s", e.what()); + RING_ERR("Error reading value: %s", e.what()); continue; } } @@ -871,7 +871,7 @@ void RingAccount::initTlsConfiguration() void RingAccount::loadConfig() { - SFL_WARN("RingAccount::loadConfig()"); + RING_WARN("RingAccount::loadConfig()"); initTlsConfiguration(); transportType_ = PJSIP_TRANSPORT_TLS; } @@ -881,10 +881,10 @@ RingAccount::matches(const std::string &userName, const std::string &server) con { auto dhtId = dht_.getId().toString(); if (userName == dhtId || server == dhtId) { - SFL_DBG("Matching account id in request with username %s", userName.c_str()); + RING_DBG("Matching account id in request with username %s", userName.c_str()); return MatchRank::FULL; } else { - SFL_DBG("No match for account %s in request with username %s", dht_.getId().toString().c_str(), userName.c_str()); + RING_DBG("No match for account %s in request with username %s", dht_.getId().toString().c_str(), userName.c_str()); return MatchRank::NONE; } } @@ -907,7 +907,7 @@ RingAccount::getContactHeader(pjsip_transport* t) if (!t && transport_) t = transport_->get(); if (!t) { - SFL_ERR("Transport not created yet"); + RING_ERR("Transport not created yet"); pj_cstr(&contact_, "<sip:>"); return contact_; } @@ -941,7 +941,7 @@ RingAccount::getContactHeader(pjsip_transport* t) } #endif */ - SFL_WARN("getContactHeader %s@%s", username_.c_str(), address.toString(true).c_str()); + RING_WARN("getContactHeader %s@%s", username_.c_str(), address.toString(true).c_str()); contact_.slen = pj_ansi_snprintf(contact_.ptr, PJSIP_MAX_URL_SIZE, "<sip:%s%s%s>", username_.c_str(), diff --git a/daemon/src/ringdht/sip_transport_ice.cpp b/daemon/src/ringdht/sip_transport_ice.cpp index 593d217bce4154c0cc5a4b4d47ff0eaba8032e4d..28391c78a70f923d8514e7fd8e270f8c6b429f03 100644 --- a/daemon/src/ringdht/sip_transport_ice.cpp +++ b/daemon/src/ringdht/sip_transport_ice.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2014 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * * Author: Adrien Béraud <adrien.beraud@savoirfairelinux.com> * @@ -56,7 +56,7 @@ sockaddr_to_host_port(pj_pool_t* pool, SipIceTransport::SipIceTransport(pjsip_endpoint* endpt, pj_pool_t& /* pool */, long /* t_type */, - const std::shared_ptr<sfl::IceTransport>& ice, + const std::shared_ptr<ring::IceTransport>& ice, int comp_id, std::function<int()> destroy_cb) : base() , pool_(nullptr, pj_pool_release) @@ -69,7 +69,7 @@ SipIceTransport::SipIceTransport(pjsip_endpoint* endpt, pj_pool_t& /* pool */, if (not ice->isCompleted()) throw std::logic_error("ice transport must be completed"); - SFL_DBG("Creating SipIceTransport"); + RING_DBG("Creating SipIceTransport"); pool_.reset(pjsip_endpt_create_pool(endpt, "SipIceTransport.pool", POOL_TP_INIT, POOL_TP_INC)); if (not pool_) @@ -92,7 +92,7 @@ SipIceTransport::SipIceTransport(pjsip_endpoint* endpt, pj_pool_t& /* pool */, throw std::runtime_error("Can't create PJSIP mutex."); auto remote = ice->getRemoteAddress(comp_id); - SFL_DBG("SipIceTransport: remote is %s", remote.toString(true).c_str()); + RING_DBG("SipIceTransport: remote is %s", remote.toString(true).c_str()); pj_sockaddr_cp(&base.key.rem_addr, remote.pjPtr()); base.key.type = PJSIP_TRANSPORT_UDP;//t_type; base.type_name = (char*)pjsip_transport_get_type_name((pjsip_transport_type_e)base.key.type); @@ -241,7 +241,7 @@ SipIceTransport::onRecv() pj_status_t SipIceTransport::shutdown() { - SFL_WARN("SIP transport ICE: shutdown"); + RING_WARN("SIP transport ICE: shutdown"); } pj_status_t @@ -249,6 +249,6 @@ SipIceTransport::destroy() { if (not is_registered_ or not destroy_cb_) return PJ_SUCCESS; - SFL_WARN("SIP transport ICE: destroy"); + RING_WARN("SIP transport ICE: destroy"); return destroy_cb_(); } diff --git a/daemon/src/ringdht/sip_transport_ice.h b/daemon/src/ringdht/sip_transport_ice.h index 8c891861814345ca05e464ecfb66ef7e71b60b92..07ff5d3f7828161636995d4763e7e63445e7fd0d 100644 --- a/daemon/src/ringdht/sip_transport_ice.h +++ b/daemon/src/ringdht/sip_transport_ice.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2014 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * * Author: Adrien Béraud <adrien.beraud@savoirfairelinux.com> * @@ -37,14 +37,14 @@ #include <pj/pool.h> #include <memory> -namespace sfl { +namespace ring { class IceTransport; } struct SipIceTransport { SipIceTransport(pjsip_endpoint* endpt, pj_pool_t& pool, long t_type, - const std::shared_ptr<sfl::IceTransport>& ice, + const std::shared_ptr<ring::IceTransport>& ice, int comp_id, std::function<int()> destroy_cb); ~SipIceTransport(); @@ -55,7 +55,7 @@ struct SipIceTransport IpAddr getLocalAddress() const; - std::shared_ptr<sfl::IceTransport> getIceTransport() const { + std::shared_ptr<ring::IceTransport> getIceTransport() const { return ice_; } @@ -67,7 +67,7 @@ struct SipIceTransport pjsip_rx_data rdata; bool is_registered_ {false}; - const std::shared_ptr<sfl::IceTransport> ice_; + const std::shared_ptr<ring::IceTransport> ice_; const int comp_id_; std::function<int()> destroy_cb_ {}; diff --git a/daemon/src/rw_mutex.h b/daemon/src/rw_mutex.h index 61a5ea2d89229e7a7e834dc4cc72626b1de95f11..e346a235424d9e15ee89eff8270bd3357be9923d 100644 --- a/daemon/src/rw_mutex.h +++ b/daemon/src/rw_mutex.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * * Author: Adrien Béraud <adrien.beraud@savoirfairelinux.com> * @@ -40,7 +40,7 @@ #include <string> #include <sstream> -namespace sfl { +namespace ring { /** * rw_mutex is a shared mutex meant to protect diff --git a/daemon/src/sfl_types.h b/daemon/src/sfl_types.h index 0facd8afceaa1850d04e759354336ceb6f65773c..e7fbe829ec0c883011924a11d1877b00abf0af24 100644 --- a/daemon/src/sfl_types.h +++ b/daemon/src/sfl_types.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Tristan Matthews <tristan.matthews@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -28,8 +28,8 @@ * as that of the covered work. */ -#ifndef SFL_TYPES_H_ -#define SFL_TYPES_H_ +#ifndef RING_TYPES_H_ +#define RING_TYPES_H_ #include <cstddef> // for size_t #include <stdint.h> @@ -37,7 +37,7 @@ #include <memory> typedef int16_t SFLAudioSample; -#define SFL_DATA_FORMAT_MAX SHRT_MAX +#define RING_DATA_FORMAT_MAX SHRT_MAX static const size_t SIZEBUF = 32000; /** About 1s of buffering at 48kHz */ @@ -69,4 +69,4 @@ getGlobalInstance() return wlink.lock(); } -#endif // SFL_TYPES_H_ +#endif // RING_TYPES_H_ diff --git a/daemon/src/sflphone.h b/daemon/src/sflphone.h deleted file mode 100644 index c35ffe695270f9916d8755a4fc55e031ff2dca8b..0000000000000000000000000000000000000000 --- a/daemon/src/sflphone.h +++ /dev/null @@ -1,291 +0,0 @@ -/* - * Copyright (C) 2014 Savoir-Faire Linux Inc. - * Author: Philippe Proulx <philippe.proulx@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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Additional permission under GNU GPL version 3 section 7: - * - * If you modify this program, or any covered work, by linking or - * combining it with the OpenSSL project's OpenSSL library (or a - * modified version of that library), containing parts covered by the - * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc. - * grants you additional permission to convey the resulting work. - * Corresponding Source for a non-source form of such a combination - * shall include the source code for the parts of OpenSSL used as well - * as that of the covered work. - */ -#ifndef SFLPHONE_H -#define SFLPHONE_H - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <vector> -#include <functional> -#include <string> -#include <map> - -const char * -sflph_version(); - -/* presence events */ -struct sflph_pres_ev_handlers -{ - std::function<void (const std::string& /*remote*/)> on_new_server_subscription_request; - std::function<void (const std::string& /*account_id*/, const std::string& /*error*/, const std::string& /*msg*/)> on_server_error; - std::function<void (const std::string& /*account_id*/, const std::string& /*buddy_uri*/, int /*status*/, const std::string& /*line_status*/)> on_new_buddy_notification; - std::function<void (const std::string& /*account_id*/, const std::string& /*buddy_uri*/, int /*state*/)> on_subscription_state_change; -}; - -/* configuration events */ -struct sflph_config_ev_handlers -{ - std::function<void (const std::string& /*device*/, double /*value*/)> on_volume_change; - std::function<void ()> on_accounts_change; - std::function<void ()> on_history_change; - std::function<void (const std::string& /*account_id*/)> on_stun_status_fail; - std::function<void (const std::string& /*account_id*/, int /*state*/)> on_registration_state_change; - std::function<void (const std::string& /*account_id*/, const std::string& /*state*/, int /*code*/)> on_sip_registration_state_change; - std::function<void (const std::string& /*account_id*/, const std::map<std::string, std::string>& /* details */)> on_volatile_details_change; - std::function<void (int /*alert*/)> on_error; -}; - -/* call events */ -struct sflph_call_ev_handlers -{ - std::function<void (const std::string& /*call_id*/, const std::string& /*state*/)> on_state_change; - std::function<void ()> on_transfer_fail; - std::function<void ()> on_transfer_success; - std::function<void (const std::string& /*path*/)> on_record_playback_stopped; - std::function<void (const std::string& /*call_id*/, int /*nd_msg*/)> on_voice_mail_notify; - std::function<void (const std::string& /*id*/, const std::string& /*from*/, const std::string& /*msg*/)> on_incoming_message; - std::function<void (const std::string& /*account_id*/, const std::string& /*call_id*/, const std::string& /*from*/)> on_incoming_call; - std::function<void (const std::string& /*id*/, const std::string& /*filename*/)> on_record_playback_filepath; - std::function<void (const std::string& /*conf_id*/)> on_conference_created; - std::function<void (const std::string& /*conf_id*/, const std::string& /*state*/)> on_conference_changed; - std::function<void (const std::string& /*filepath*/, int /*position*/, int /*scale*/)> on_update_playback_scale; - std::function<void (const std::string& /*conf_id*/)> on_conference_remove; - std::function<void (const std::string& /*account_id*/, const std::string& /*call_id*/, const std::string& /*to*/)> on_new_call; - std::function<void (const std::string& /*call_id*/, const std::string& /*state*/, int /*code*/)> on_sip_call_state_change; - std::function<void (const std::string& /*call_id*/, int /*state*/)> on_record_state_change; - std::function<void (const std::string& /*call_id*/)> on_secure_sdes_on; - std::function<void (const std::string& /*call_id*/)> on_secure_sdes_off; - std::function<void (const std::string& /*call_id*/, const std::string& /*cipher*/)> on_secure_zrtp_on; - std::function<void (const std::string& /*call_id*/)> on_secure_zrtp_off; - std::function<void (const std::string& /*call_id*/, const std::string& /*sas*/, int /*verified*/)> on_show_sas; - std::function<void (const std::string& /*call_id*/)> on_zrtp_not_supp_other; - std::function<void (const std::string& /*call_id*/, const std::string& /*reason*/, const std::string& /*severity*/)> on_zrtp_negotiation_fail; - std::function<void (const std::string& /*call_id*/, const std::map<std::string, int>& /*stats*/)> on_rtcp_receive_report; -}; - -/* video events */ -#ifdef SFL_VIDEO -struct sflph_video_ev_handlers -{ - std::function<void ()> on_device_event; - std::function<void (const std::string& /*id*/, const std::string& /*shm_path*/, int /*w*/, int /*h*/, bool /*is_mixer*/)> on_start_decoding; - std::function<void (const std::string& /*id*/, const std::string& /*shm_path*/, bool /*is_mixer*/)> on_stop_decoding; -}; -#endif /* SFL_VIDEO */ - -#pragma GCC diagnostic ignored "-Wmissing-field-initializers" - -/* all handlers */ -struct sflph_ev_handlers -{ - sflph_call_ev_handlers call_ev_handlers; - sflph_config_ev_handlers config_ev_handlers; - sflph_pres_ev_handlers pres_ev_handlers; - -#ifdef SFL_VIDEO - sflph_video_ev_handlers video_ev_handlers; -#endif /* SFL_VIDEO */ -}; - -#pragma GCC diagnostic warning "-Wmissing-field-initializers" - -/* error codes returned by functions of this API */ -enum sflph_error { - SFLPH_ERR_MANAGER_INIT, - SFLPH_ERR_UNKNOWN, -}; - -/* flags for initialization */ -enum sflph_init_flag { - SFLPH_FLAG_DEBUG = 1, - SFLPH_FLAG_CONSOLE_LOG = 2, -}; - -/** - * Initializes libsflphone. - * - * @param ev_handlers Event handlers - * @param flags Flags to customize this initialization - * @returns 0 if successful or a negative error code - */ -int sflph_init(struct sflph_ev_handlers* ev_handlers, enum sflph_init_flag flags); - -/** - * Finalizes libsflphone, freeing any resource allocated by the library. - */ -void sflph_fini(void); - -/** - * Poll for SIP/IAX events - */ -void sflph_poll_events(void); - -/* call API */ -bool sflph_call_place(const std::string& account_id, const std::string& call_id, const std::string& to); -bool sflph_call_refuse(const std::string& call_id); -bool sflph_call_accept(const std::string& call_id); -bool sflph_call_hang_up(const std::string& call_id); -bool sflph_call_hold(const std::string& call_id); -bool sflph_call_unhold(const std::string& call_id); -bool sflph_call_transfer(const std::string& call_id, const std::string& to); -bool sflph_call_attended_transfer(const std::string& transfer_id, const std::string& target_id); -std::map<std::string, std::string> sflph_call_get_call_details(const std::string& call_id); -std::vector<std::string> sflph_call_get_call_list(void); -void sflph_call_remove_conference(const std::string& conf_id); -bool sflph_call_join_participant(const std::string& sel_call_id, const std::string& drag_call_id); -void sflph_call_create_conf_from_participant_list(const std::vector<std::string>& participants); -bool sflph_call_is_conference_participant(const std::string& call_id); -bool sflph_call_add_participant(const std::string& call_id, const std::string& conf_id); -bool sflph_call_add_main_participant(const std::string& conf_id); -bool sflph_call_detach_participant(const std::string& call_id); -bool sflph_call_join_conference(const std::string& sel_conf_id, const std::string& drag_conf_id); -bool sflph_call_hang_up_conference(const std::string& conf_id); -bool sflph_call_hold_conference(const std::string& conf_id); -bool sflph_call_unhold_conference(const std::string& conf_id); -std::vector<std::string> sflph_call_get_conference_list(void); -std::vector<std::string> sflph_call_get_participant_list(const std::string& conf_id); -std::vector<std::string> sflph_call_get_display_names(const std::string& conf_id); -std::string sflph_call_get_conference_id(const std::string& call_id); -std::map<std::string, std::string> sflph_call_get_conference_details(const std::string& call_id); -bool sflph_call_play_recorded_file(const std::string& path); -void sflph_call_stop_recorded_file(const std::string& path); -bool sflph_call_toggle_recording(const std::string& call_id); -void sflph_call_set_recording(const std::string& call_id); -void sflph_call_record_playback_seek(double pos); -bool sflph_call_is_recording(const std::string& call_id); -std::string sflph_call_get_current_audio_codec_name(const std::string& call_id); -void sflph_call_play_dtmf(const std::string& key); -void sflph_call_start_tone(int start, int type); -void sflph_call_set_sas_verified(const std::string& call_id); -void sflph_call_reset_sas_verified(const std::string& call_id); -void sflph_call_set_confirm_go_clear(const std::string& call_id); -void sflph_call_request_go_clear(const std::string& call_id); -void sflph_call_accept_enrollment(const std::string& call_id, bool accepted); -void sflph_call_send_text_message(const std::string& call_id, const std::string& message); - -/* configuration API */ -std::map<std::string, std::string> sflph_config_get_account_details(const std::string& account_id); -std::map<std::string, std::string> sflph_config_get_volatile_account_details(const std::string& account_id); -void sflph_config_set_account_details(const std::string& account_id, const std::map<std::string, std::string>& details); -std::map<std::string, std::string> sflph_config_get_account_template(void); -std::string sflph_config_add_account(const std::map<std::string, std::string>& details); -void sflph_config_remove_account(const std::string& account_id); -std::vector<std::string> sflph_config_get_account_list(void); -void sflph_config_send_register(const std::string& account_id, bool enable); -void sflph_config_register_all_accounts(void); -std::map<std::string, std::string> sflph_config_get_tls_default_settings(void); -std::vector<int> sflph_config_get_audio_codec_list(void); -std::vector<std::string> sflph_config_get_supported_tls_method(void); -std::vector<std::string> sflph_config_get_audio_codec_details(int payload); -std::vector<int> sflph_config_get_active_audio_codec_list(const std::string& account_id); -void sflph_config_set_active_audio_codec_list(const std::vector<std::string>& list, const std::string& account_id); -std::vector<std::string> sflph_config_get_audio_plugin_list(void); -void sflph_config_set_audio_plugin(const std::string& audio_plugin); -std::vector<std::string> sflph_config_get_audio_output_device_list(); -void sflph_config_set_audio_output_device(int index); -void sflph_config_set_audio_input_device(int index); -void sflph_config_set_audio_ringtone_device(int index); -std::vector<std::string> sflph_config_get_audio_input_device_list(void); -std::vector<std::string> sflph_config_get_current_audio_devices_index(void); -int sflph_config_get_audio_input_device_index(const std::string& name); -int sflph_config_get_audio_output_device_index(const std::string& name); -std::string sflph_config_get_current_audio_output_plugin(void); -bool sflph_config_get_noise_suppress_state(void); -void sflph_config_set_noise_suppress_state(bool state); -bool sflph_config_is_agc_enabled(void); -void sflph_config_enable_agc(bool enabled); -void sflph_config_mute_dtmf(bool mute); -bool sflph_config_is_dtmf_muted(void); -bool sflph_config_is_capture_muted(void); -void sflph_config_mute_capture(bool mute); -bool sflph_config_is_playback_muted(void); -void sflph_config_mute_playback(int mute); -std::map<std::string, std::string> sflph_config_get_ringtone_list(void); -std::string sflph_config_get_audio_manager(void); -bool sflph_config_set_audio_manager(const std::string& api); -std::vector<std::string> sflph_config_get_supported_audio_managers(void); -int sflph_config_is_iax2_enabled(void); -std::string sflph_config_get_record_path(void); -void sflph_config_set_record_path(const std::string& path); -bool sflph_config_is_always_recording(void); -void sflph_config_set_always_recording(bool rec); -void sflph_config_set_history_limit(int days); -int sflph_config_get_history_limit(void); -void sflph_config_clear_history(void); -void sflph_config_set_accounts_order(const std::string& order); -std::map<std::string, std::string> sflph_config_get_hook_settings(void); -void sflph_config_set_hook_settings(const std::map<std::string, std::string>& settings); -std::vector<std::map<std::string, std::string>> sflph_config_get_history(void); -std::map<std::string, std::string> sflph_config_get_tls_settings(); -std::map<std::string, std::string> sflph_config_validate_certificate(const std::string& accountId, - const std::string& certificate, const std::string& private_key); -std::map<std::string, std::string> sflph_config_get_certificate_details(const std::string& certificate); -void sflph_config_set_tls_settings(const std::map< std::string, std::string >& settings); -std::map<std::string, std::string> sflph_config_get_ip2ip_details(void); -std::vector<std::map<std::string, std::string>> sflph_config_get_credentials(const std::string& account_id); -void sflph_config_set_credentials(const std::string& account_id, const std::vector<std::map<std::string, std::string>>& details); -std::string sflph_config_get_addr_from_interface_name(const std::string& interface); -std::vector<std::string> sflph_config_get_all_ip_interface(void); -std::vector<std::string> sflph_config_get_all_ip_interface_by_name(void); -std::map<std::string, std::string> sflph_config_get_shortcuts(); -void sflph_config_set_shortcuts(const std::map<std::string, std::string>& shortcuts); -void sflph_config_set_volume(const std::string& device, double value); -double sflph_config_get_volume(const std::string& device); -bool sflph_config_check_for_private_key(const std::string& pem_path); -bool sflph_config_check_certificate_validity(const std::string& ca_path, const std::string& pem_path); -bool sflph_config_check_hostname_certificate(const std::string& host, const std::string& port); - -/* presence API */ -void sflph_pres_publish(const std::string& account_id, int status, const std::string& note); -void sflph_pres_answer_server_request(const std::string& uri, int flag); -void sflph_pres_subscribe_buddy(const std::string& account_id, const std::string& uri, int flag); -std::vector<std::map<std::string, std::string>> sflph_pres_get_subscriptions(const std::string& account_id); -void sflph_pres_set_subscriptions(const std::string& account_id, const std::vector<std::string>& uris); - -/* video API */ -#ifdef SFL_VIDEO -std::vector<std::map<std::string, std::string>> sflph_video_get_codecs(const std::string& account_id); -void sflph_video_set_codecs(const std::string& account_id, const std::vector<std::map<std::string, std::string>>& details); -std::vector<std::string> sflph_video_get_device_list(void); -std::map<std::string, std::map<std::string, std::vector<std::string>>> sflph_video_get_capabilities(const std::string& name); -std::map<std::string, std::string> sflph_video_get_settings(const std::string& name); -void sflph_video_set_default_device(const std::string& dev); -std::string sflph_video_get_default_device(void); -std::string sflph_video_get_current_codec_name(const std::string& call_id); -void sflph_video_start_camera(void); -void sflph_video_stop_camera(void); -bool sflph_video_switch_input(const std::string& resource); -bool sflph_video_is_camera_started(void); -void sflph_video_apply_settings(const std::string& name, const std::map<std::string, std::string>& settings); -#endif /* SFL_VIDEO */ - -#endif /* SFLPHONE_H */ diff --git a/daemon/src/sip/pattern.cpp b/daemon/src/sip/pattern.cpp index 8b40dfe61a6c2426c7f313150ae013f2746bbed9..46eb35f450836066bb23329acc513f06d94aec3d 100644 --- a/daemon/src/sip/pattern.cpp +++ b/daemon/src/sip/pattern.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Pierre-Luc Bacon <pierre-luc.bacon@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -31,7 +31,7 @@ #include <sstream> #include <cstdio> -namespace sfl { +namespace ring { Pattern::Pattern(const std::string& pattern, bool matchGlobally) : pattern_(pattern), diff --git a/daemon/src/sip/pattern.h b/daemon/src/sip/pattern.h index 6229b2ba167e754cdf62023935c6bb5600d1dda9..935eb9d141b5bfb337f48b67438b6fc71c8e7058 100644 --- a/daemon/src/sip/pattern.h +++ b/daemon/src/sip/pattern.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Pierre-Luc Bacon <pierre-luc.bacon@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -35,7 +35,7 @@ #include <pcre.h> #include "noncopyable.h" -namespace sfl { +namespace ring { /** * Exception object that is thrown when diff --git a/daemon/src/sip/pres_sub_client.cpp b/daemon/src/sip/pres_sub_client.cpp index c990c7c6f2be8fe002e5fc7d438518c68d1640d7..269285e6b2b5554510bf3cc6420ddbdb54f8e774 100644 --- a/daemon/src/sip/pres_sub_client.cpp +++ b/daemon/src/sip/pres_sub_client.cpp @@ -64,7 +64,7 @@ void PresSubClient::pres_client_timer_cb(pj_timer_heap_t * /*th*/, pj_timer_entry *entry) { PresSubClient *c = (PresSubClient *) entry->user_data; - SFL_DBG("timeout for %s", c->getURI().c_str()); + RING_DBG("timeout for %s", c->getURI().c_str()); } /* Callback called when *client* subscription state has changed. */ @@ -77,11 +77,11 @@ PresSubClient::pres_client_evsub_on_state(pjsip_evsub *sub, pjsip_event *event) /* No need to pres->lock() here since the client has a locked dialog*/ if (!pres_client) { - SFL_WARN("pres_client not found"); + RING_WARN("pres_client not found"); return; } - SFL_DBG("Subscription for pres_client '%s' is '%s'", pres_client->getURI().c_str(), + RING_DBG("Subscription for pres_client '%s' is '%s'", pres_client->getURI().c_str(), pjsip_evsub_get_state_name(sub) ? pjsip_evsub_get_state_name(sub) : "null"); pjsip_evsub_state state = pjsip_evsub_get_state(sub); @@ -256,7 +256,7 @@ PresSubClient::pres_client_evsub_on_tsx_state(pjsip_evsub *sub, pjsip_transactio /* No need to pres->lock() here since the client has a locked dialog*/ if (!pres_client) { - SFL_WARN("Couldn't find pres_client."); + RING_WARN("Couldn't find pres_client."); return; } @@ -299,7 +299,7 @@ PresSubClient::pres_client_evsub_on_rx_notify(pjsip_evsub *sub, pjsip_rx_data *r PresSubClient *pres_client = (PresSubClient *) pjsip_evsub_get_mod_data(sub, modId_); if (!pres_client) { - SFL_WARN("Couldn't find pres_client from ev_sub."); + RING_WARN("Couldn't find pres_client from ev_sub."); return; } /* No need to pres->lock() here since the client has a locked dialog*/ @@ -344,7 +344,7 @@ PresSubClient::PresSubClient(const std::string& uri, SIPPresence *pres) : PresSubClient::~PresSubClient() { - SFL_DBG("Destroying pres_client object with uri %.*s", uri_.slen, uri_.ptr); + RING_DBG("Destroying pres_client object with uri %.*s", uri_.slen, uri_.ptr); rescheduleTimer(PJ_FALSE, 0); unsubscribe(); pj_pool_release(pool_); @@ -392,7 +392,7 @@ void PresSubClient::rescheduleTimer(bool reschedule, unsigned msec) if (reschedule) { pj_time_val delay; - SFL_WARN("pres_client %.*s will resubscribe in %u ms (reason: %.*s)", + RING_WARN("pres_client %.*s will resubscribe in %u ms (reason: %.*s)", uri_.slen, uri_.ptr, msec, (int) term_reason_.slen, term_reason_.ptr); pj_timer_entry_init(&timer_, 0, this, &pres_client_timer_cb); delay.sec = 0; @@ -407,7 +407,7 @@ void PresSubClient::rescheduleTimer(bool reschedule, unsigned msec) void PresSubClient::enable(bool flag) { - SFL_DBG("pres_client %s is %s monitored.",getURI().c_str(), flag? "":"NOT"); + RING_DBG("pres_client %s is %s monitored.",getURI().c_str(), flag? "":"NOT"); if (flag and not monitored_) pres_->addPresSubClient(this); monitored_ = flag; @@ -447,7 +447,7 @@ bool PresSubClient::lock() if (lock_flag_ == 0) { - SFL_DBG("pres_client failed to lock : timeout"); + RING_DBG("pres_client failed to lock : timeout"); return false; } return true; @@ -473,20 +473,20 @@ bool PresSubClient::unsubscribe() pj_status_t retStatus; if (sub_ == NULL or dlg_ == NULL) { - SFL_WARN("PresSubClient already unsubscribed."); + RING_WARN("PresSubClient already unsubscribed."); unlock(); return false; } if (pjsip_evsub_get_state(sub_) == PJSIP_EVSUB_STATE_TERMINATED) { - SFL_WARN("pres_client already unsubscribed sub=TERMINATED."); + RING_WARN("pres_client already unsubscribed sub=TERMINATED."); sub_ = NULL; unlock(); return false; } /* Unsubscribe means send a subscribe with timeout=0s*/ - SFL_WARN("pres_client %.*s: unsubscribing..", uri_.slen, uri_.ptr); + RING_WARN("pres_client %.*s: unsubscribing..", uri_.slen, uri_.ptr); retStatus = pjsip_pres_initiate(sub_, 0, &tdata); if (retStatus == PJ_SUCCESS) { @@ -497,7 +497,7 @@ bool PresSubClient::unsubscribe() if (retStatus != PJ_SUCCESS and sub_) { pjsip_pres_terminate(sub_, PJ_FALSE); sub_ = NULL; - SFL_WARN("Unable to unsubscribe presence", retStatus); + RING_WARN("Unable to unsubscribe presence", retStatus); unlock(); return false; } @@ -514,7 +514,7 @@ bool PresSubClient::subscribe() if (sub_ and dlg_) { //do not bother if already subscribed pjsip_evsub_terminate(sub_, PJ_FALSE); - SFL_DBG("PreseSubClient %.*s: already subscribed. Refresh it.", uri_.slen, uri_.ptr); + RING_DBG("PreseSubClient %.*s: already subscribed. Refresh it.", uri_.slen, uri_.ptr); } //subscribe @@ -529,7 +529,7 @@ bool PresSubClient::subscribe() pres_callback.on_rx_notify = &pres_client_evsub_on_rx_notify; SIPAccount * acc = pres_->getAccount(); - SFL_DBG("PresSubClient %.*s: subscribing ", uri_.slen, uri_.ptr); + RING_DBG("PresSubClient %.*s: subscribing ", uri_.slen, uri_.ptr); /* Create UAC dialog */ @@ -537,13 +537,13 @@ bool PresSubClient::subscribe() status = pjsip_dlg_create_uac(pjsip_ua_instance(), &from, &contact_, &uri_, NULL, &dlg_); if (status != PJ_SUCCESS) { - SFL_ERR("Unable to create dialog \n"); + RING_ERR("Unable to create dialog \n"); return false; } /* Add credential for auth. */ if (acc->hasCredentials() and pjsip_auth_clt_set_credentials(&dlg_->auth_sess, acc->getCredentialCount(), acc->getCredInfo()) != PJ_SUCCESS) { - SFL_ERR("Could not initialize credentials for subscribe session authentication"); + RING_ERR("Could not initialize credentials for subscribe session authentication"); } /* Increment the dialog's lock otherwise when presence session creation @@ -555,7 +555,7 @@ bool PresSubClient::subscribe() if (status != PJ_SUCCESS) { sub_ = NULL; - SFL_WARN("Unable to create presence client", status); + RING_WARN("Unable to create presence client", status); /* This should destroy the dialog since there's no session * referencing it @@ -569,7 +569,7 @@ bool PresSubClient::subscribe() /* Add credential for authentication */ if (acc->hasCredentials() and pjsip_auth_clt_set_credentials(&dlg_->auth_sess, acc->getCredentialCount(), acc->getCredInfo()) != PJ_SUCCESS) { - SFL_ERR("Could not initialize credentials for invite session authentication"); + RING_ERR("Could not initialize credentials for invite session authentication"); return false; } @@ -588,7 +588,7 @@ bool PresSubClient::subscribe() if (sub_) pjsip_pres_terminate(sub_, PJ_FALSE); sub_ = NULL; - SFL_WARN("Unable to create initial SUBSCRIBE", status); + RING_WARN("Unable to create initial SUBSCRIBE", status); return false; } @@ -602,7 +602,7 @@ bool PresSubClient::subscribe() if (sub_) pjsip_pres_terminate(sub_, PJ_FALSE); sub_ = NULL; - SFL_WARN("Unable to send initial SUBSCRIBE", status); + RING_WARN("Unable to send initial SUBSCRIBE", status); return false; } diff --git a/daemon/src/sip/pres_sub_server.cpp b/daemon/src/sip/pres_sub_server.cpp index 84c8b1883358b885613c0b3045195355c9a96072..2a52c7feab15f0383f59afed4cbdf22f29bc0a54 100644 --- a/daemon/src/sip/pres_sub_server.cpp +++ b/daemon/src/sip/pres_sub_server.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * * Author: Patrick Keroulas <patrick.keroulas@savoirfairelinux.com> * @@ -47,7 +47,7 @@ PresSubServer::pres_evsub_on_srv_state(pjsip_evsub *sub, pjsip_event *event) pjsip_rx_data *rdata = event->body.rx_msg.rdata; if (!rdata) { - SFL_DBG("Presence_subscription_server estate has changed but no rdata."); + RING_DBG("Presence_subscription_server estate has changed but no rdata."); return; } @@ -55,14 +55,14 @@ PresSubServer::pres_evsub_on_srv_state(pjsip_evsub *sub, pjsip_event *event) auto sipaccount = static_cast<SIPAccount *>(account.get()); if (!sipaccount) { - SFL_ERR("Could not find account IP2IP"); + RING_ERR("Could not find account IP2IP"); return; } auto pres = sipaccount->getPresence(); if (!pres) { - SFL_ERR("Presence not initialized"); + RING_ERR("Presence not initialized"); return; } @@ -70,7 +70,7 @@ PresSubServer::pres_evsub_on_srv_state(pjsip_evsub *sub, pjsip_event *event) PresSubServer *presSubServer = static_cast<PresSubServer *>(pjsip_evsub_get_mod_data(sub, pres->getModId())); if (presSubServer) { - SFL_DBG("Presence_subscription_server to %s is %s", + RING_DBG("Presence_subscription_server to %s is %s", presSubServer->remote_, pjsip_evsub_get_state_name(sub)); pjsip_evsub_state state; @@ -114,7 +114,7 @@ PresSubServer::pres_on_rx_subscribe_request(pjsip_rx_data *rdata) /* debug msg */ std::string name(rdata->msg_info.to->name.ptr, rdata->msg_info.to->name.slen); std::string server(rdata->msg_info.from->name.ptr, rdata->msg_info.from->name.slen); - SFL_DBG("Incoming pres_on_rx_subscribe_request for %s, name:%s, server:%s." + RING_DBG("Incoming pres_on_rx_subscribe_request for %s, name:%s, server:%s." , request.c_str() , name.c_str() , server.c_str()); @@ -123,7 +123,7 @@ PresSubServer::pres_on_rx_subscribe_request(pjsip_rx_data *rdata) auto account = Manager::instance().getIP2IPAccount(); auto sipaccount = static_cast<SIPAccount *>(account.get()); if (!sipaccount) { - SFL_ERR("Could not find account IP2IP"); + RING_ERR("Could not find account IP2IP"); return PJ_FALSE; } @@ -138,7 +138,7 @@ PresSubServer::pres_on_rx_subscribe_request(pjsip_rx_data *rdata) if (status != PJ_SUCCESS) { char errmsg[PJ_ERR_MSG_SIZE]; pj_strerror(status, errmsg, sizeof(errmsg)); - SFL_WARN("Unable to create UAS dialog for subscription: %s [status=%d]", errmsg, status); + RING_WARN("Unable to create UAS dialog for subscription: %s [status=%d]", errmsg, status); pres->unlock(); pjsip_endpt_respond_stateless(endpt, rdata, 400, NULL, NULL, NULL); return PJ_TRUE; @@ -155,7 +155,7 @@ PresSubServer::pres_on_rx_subscribe_request(pjsip_rx_data *rdata) int code = PJSIP_ERRNO_TO_SIP_STATUS(status); pjsip_tx_data *tdata; - SFL_WARN("Unable to create server subscription %d", status); + RING_WARN("Unable to create server subscription %d", status); if (code == 599 || code > 699 || code < 300) { code = 400; @@ -209,7 +209,7 @@ PresSubServer::pres_on_rx_subscribe_request(pjsip_rx_data *rdata) status = pjsip_pres_accept(sub, rdata, st_code, &msg_data.hdr_list); if (status != PJ_SUCCESS) { - SFL_WARN("Unable to accept presence subscription %d", status); + RING_WARN("Unable to accept presence subscription %d", status); pjsip_pres_terminate(sub, PJ_FALSE); pres->unlock(); return PJ_FALSE; @@ -254,7 +254,7 @@ PresSubServer::pres_on_rx_subscribe_request(pjsip_rx_data *rdata) } if (status != PJ_SUCCESS) { - SFL_WARN("Unable to create/send NOTIFY %d", status); + RING_WARN("Unable to create/send NOTIFY %d", status); pjsip_pres_terminate(sub, PJ_FALSE); pres->unlock(); return status; @@ -316,7 +316,7 @@ bool PresSubServer::matches(const char *s) const void PresSubServer::approve(bool flag) { approved_ = flag; - SFL_DBG("Approve Presence_subscription_server for %s: %s.", remote_, flag ? "true" : "false"); + RING_DBG("Approve Presence_subscription_server for %s: %s.", remote_, flag ? "true" : "false"); // attach the real status data pjsip_pres_set_status(sub_, pres_->getStatus()); } @@ -331,7 +331,7 @@ void PresSubServer::notify() * the user accepted the request. */ if ((pjsip_evsub_get_state(sub_) == PJSIP_EVSUB_STATE_ACTIVE) && (approved_)) { - SFL_DBG("Notifying %s.", remote_); + RING_DBG("Notifying %s.", remote_); pjsip_tx_data *tdata; pjsip_pres_set_status(sub_, pres_->getStatus()); @@ -341,7 +341,7 @@ void PresSubServer::notify() pres_->fillDoc(tdata, NULL); pjsip_pres_send_request(sub_, tdata); } else { - SFL_WARN("Unable to create/send NOTIFY"); + RING_WARN("Unable to create/send NOTIFY"); pjsip_pres_terminate(sub_, PJ_FALSE); } } diff --git a/daemon/src/sip/pres_sub_server.h b/daemon/src/sip/pres_sub_server.h index 6fea25abffaddb3830b2c435c8bc7f3400ce0626..af3e848871016003d406be580f2cb2a7bb36f959 100644 --- a/daemon/src/sip/pres_sub_server.h +++ b/daemon/src/sip/pres_sub_server.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * * Author: Patrick Keroulas <patrick.keroulas@savoirfairelinux.com> * diff --git a/daemon/src/sip/sdes_negotiator.cpp b/daemon/src/sip/sdes_negotiator.cpp index 06e4e42432c7f7ede06f2901d1007f8ecad711d5..33076c4649feec1104080ab83b8de954f5a42d17 100644 --- a/daemon/src/sip/sdes_negotiator.cpp +++ b/daemon/src/sip/sdes_negotiator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Pierre-Luc Bacon <pierre-luc.bacon@savoirfairelinux.com> * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * @@ -38,7 +38,7 @@ #include <algorithm> #include <stdexcept> -using namespace sfl; +using namespace ring; SdesNegotiator::SdesNegotiator(const std::vector<CryptoSuiteDefinition>& localCapabilites, const std::vector<std::string>& remoteAttribute) : diff --git a/daemon/src/sip/sdes_negotiator.h b/daemon/src/sip/sdes_negotiator.h index 892f128dddecd736a31064140d754002dfc35773..d710b16cc95c81d09fb14df13a475e399cb4632d 100644 --- a/daemon/src/sip/sdes_negotiator.h +++ b/daemon/src/sip/sdes_negotiator.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Pierre-Luc Bacon <pierre-luc.bacon@savoirfairelinux.com> * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * @@ -34,7 +34,7 @@ #include <string> #include <vector> -namespace sfl { +namespace ring { /** * General exception object that is thrown when diff --git a/daemon/src/sip/sdp.cpp b/daemon/src/sip/sdp.cpp index 85f28d526c592a4ecaf2d5d57297a52a7534b14f..4bdaffe53c58b1c1b1581c6ae21e30455817b5e3 100644 --- a/daemon/src/sip/sdp.cpp +++ b/daemon/src/sip/sdp.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> @@ -41,7 +41,7 @@ #include "manager.h" #include "logger.h" -#ifdef SFL_VIDEO +#ifdef RING_VIDEO #include "video/libav_utils.h" #endif @@ -91,13 +91,13 @@ Sdp::Sdp(const std::string& id) Sdp::~Sdp() { SIPAccount::releasePort(localAudioDataPort_); -#ifdef SFL_VIDEO +#ifdef RING_VIDEO SIPAccount::releasePort(localVideoDataPort_); #endif } static bool -hasPayload(const std::vector<sfl::AudioCodec*> &codecs, int pt) +hasPayload(const std::vector<ring::AudioCodec*> &codecs, int pt) { for (const auto &i : codecs) if (i and i->getPayloadType() == pt) @@ -123,7 +123,7 @@ rtpmapToString(pjmedia_sdp_rtpmap *rtpmap) return os.str(); } -static sfl::AudioCodec * +static ring::AudioCodec * findCodecByName(const std::string &codec) { // try finding by name @@ -144,7 +144,7 @@ void Sdp::setActiveLocalSdpSession(const pjmedia_sdp_session *sdp) pjmedia_sdp_attr *rtpMapAttribute = pjmedia_sdp_media_find_attr(current, &STR_RTPMAP, ¤t->desc.fmt[fmt]); if (!rtpMapAttribute) { - SFL_ERR("Could not find rtpmap attribute"); + RING_ERR("Could not find rtpmap attribute"); break; } @@ -162,7 +162,7 @@ void Sdp::setActiveLocalSdpSession(const pjmedia_sdp_session *sdp) if (codec) sessionAudioMediaLocal_.push_back(codec); else - SFL_ERR("Could not get codec for name %.*s", rtpmap->enc_name.slen, rtpmap->enc_name.ptr); + RING_ERR("Could not get codec for name %.*s", rtpmap->enc_name.slen, rtpmap->enc_name.ptr); } } } else if (!pj_stricmp2(¤t->desc.media, "video")) { @@ -178,7 +178,7 @@ void Sdp::setActiveLocalSdpSession(const pjmedia_sdp_session *sdp) void Sdp::setActiveRemoteSdpSession(const pjmedia_sdp_session *sdp) { if (!sdp) { - SFL_ERR("Remote sdp is NULL"); + RING_ERR("Remote sdp is NULL"); return; } @@ -209,7 +209,7 @@ void Sdp::setActiveRemoteSdpSession(const pjmedia_sdp_session *sdp) pjmedia_sdp_attr *rtpMapAttribute = pjmedia_sdp_media_find_attr(r_media, &STR_RTPMAP, &r_media->desc.fmt[fmt]); if (!rtpMapAttribute) { - SFL_ERR("Could not find rtpmap attribute"); + RING_ERR("Could not find rtpmap attribute"); break; } @@ -220,7 +220,7 @@ void Sdp::setActiveRemoteSdpSession(const pjmedia_sdp_session *sdp) if (pt != telephoneEventPayload_ and not hasPayload(sessionAudioMediaRemote_, pt)) { auto codec = Manager::instance().audioCodecFactory.getCodec(pt).get(); if (codec) { - SFL_DBG("Adding codec with new payload type %d", pt); + RING_DBG("Adding codec with new payload type %d", pt); sessionAudioMediaRemote_.push_back(codec); } else { // Search by codec name, clock rate and param (channel count) @@ -228,7 +228,7 @@ void Sdp::setActiveRemoteSdpSession(const pjmedia_sdp_session *sdp) if (codec) sessionAudioMediaRemote_.push_back(codec); else - SFL_ERR("Could not get codec for name %.*s", rtpmap->enc_name.slen, rtpmap->enc_name.ptr); + RING_ERR("Could not get codec for name %.*s", rtpmap->enc_name.slen, rtpmap->enc_name.ptr); } } } @@ -239,23 +239,23 @@ void Sdp::setActiveRemoteSdpSession(const pjmedia_sdp_session *sdp) string Sdp::getSessionVideoCodec() const { if (sessionVideoMedia_.empty()) { - SFL_DBG("Session video media is empty"); + RING_DBG("Session video media is empty"); return ""; } return sessionVideoMedia_[0]; } -std::vector<sfl::AudioCodec*> +std::vector<ring::AudioCodec*> Sdp::getSessionAudioMedia() const { - vector<sfl::AudioCodec*> codecs; + vector<ring::AudioCodec*> codecs; // Common codecs first for (auto c : sessionAudioMediaLocal_) { if (std::find(sessionAudioMediaRemote_.begin(), sessionAudioMediaRemote_.end(), c) != sessionAudioMediaRemote_.end()) codecs.push_back(c); } - SFL_DBG("%u common audio codecs", codecs.size()); + RING_DBG("%u common audio codecs", codecs.size()); // Next, the other codecs we declared to be able to encode for (auto c : sessionAudioMediaLocal_) { @@ -267,7 +267,7 @@ Sdp::getSessionAudioMedia() const if (std::find(codecs.begin(), codecs.end(), c) == codecs.end()) codecs.push_back(c); } - SFL_DBG("Ready to decode %u audio codecs", codecs.size()); + RING_DBG("Ready to decode %u audio codecs", codecs.size()); return codecs; } @@ -295,7 +295,7 @@ Sdp::setMediaDescriptorLines(bool audio) const char *channels = ""; if (audio) { - sfl::AudioCodec *codec = audio_codec_list_[i]; + ring::AudioCodec *codec = audio_codec_list_[i]; payload = codec->getPayloadType(); enc_name = codec->getMimeSubtype(); clock_rate = codec->getSDPClockRate(); @@ -332,7 +332,7 @@ Sdp::setMediaDescriptorLines(bool audio) med->attr[med->attr_count++] = attr; -#ifdef SFL_VIDEO +#ifdef RING_VIDEO if (enc_name == "H264") { std::ostringstream os; // FIXME: this should not be hardcoded, it will determine what profile and level @@ -383,7 +383,7 @@ Sdp::setPublishedIP(const std::string &addr, pj_uint16_t addr_type) localSession_->origin.addr = pj_str((char*) publishedIpAddr_.c_str()); localSession_->conn->addr = localSession_->origin.addr; if (pjmedia_sdp_validate(localSession_) != PJ_SUCCESS) - SFL_ERR("Could not validate SDP"); + RING_ERR("Could not validate SDP"); } } @@ -417,7 +417,7 @@ Sdp::updatePorts(const std::vector<pj_sockaddr> &sockets) localSession_->media[1]->desc.port = localVideoDataPort_; if (not pjmedia_sdp_validate(localSession_)) - SFL_ERR("Could not validate SDP"); + RING_ERR("Could not validate SDP"); } } @@ -445,9 +445,9 @@ void Sdp::setTelephoneEventRtpmap(pjmedia_sdp_media *med) void Sdp::setLocalMediaVideoCapabilities(const vector<map<string, string> > &codecs) { video_codec_list_.clear(); -#ifdef SFL_VIDEO +#ifdef RING_VIDEO if (codecs.empty()) - SFL_WARN("No selected video codec while building local SDP offer"); + RING_WARN("No selected video codec while building local SDP offer"); else video_codec_list_ = codecs; #else @@ -458,7 +458,7 @@ void Sdp::setLocalMediaVideoCapabilities(const vector<map<string, string> > &cod void Sdp::setLocalMediaAudioCapabilities(const vector<int> &selectedCodecs) { if (selectedCodecs.empty()) - SFL_WARN("No selected codec while building local SDP offer"); + RING_WARN("No selected codec while building local SDP offer"); audio_codec_list_.clear(); for (const auto &i : selectedCodecs) { @@ -467,7 +467,7 @@ void Sdp::setLocalMediaAudioCapabilities(const vector<int> &selectedCodecs) if (codec) audio_codec_list_.push_back(codec); else - SFL_WARN("Couldn't find audio codec"); + RING_WARN("Couldn't find audio codec"); } } @@ -477,7 +477,7 @@ printSession(const pjmedia_sdp_session *session) char buffer[2048]; size_t size = pjmedia_sdp_print(session, buffer, sizeof(buffer)); string sessionStr(buffer, std::min(size, sizeof(buffer))); - SFL_DBG("%s", sessionStr.c_str()); + RING_DBG("%s", sessionStr.c_str()); } int Sdp::createLocalSession(const vector<int> &selectedAudioCodecs, const vector<map<string, string> > &selectedVideoCodecs) @@ -527,7 +527,7 @@ int Sdp::createLocalSession(const vector<int> &selectedAudioCodecs, const vector if (!srtpCrypto_.empty()) addSdesAttribute(srtpCrypto_); - SFL_DBG("SDP: Local SDP Session:"); + RING_DBG("SDP: Local SDP Session:"); printSession(localSession_); return pjmedia_sdp_validate(localSession_); @@ -538,12 +538,12 @@ Sdp::createOffer(const vector<int> &selectedCodecs, const vector<map<string, string> > &videoCodecs) { if (createLocalSession(selectedCodecs, videoCodecs) != PJ_SUCCESS) { - SFL_ERR("Failed to create initial offer"); + RING_ERR("Failed to create initial offer"); return false; } if (pjmedia_sdp_neg_create_w_local_offer(memPool_.get(), localSession_, &negotiator_) != PJ_SUCCESS) { - SFL_ERR("Failed to create an initial SDP negotiator"); + RING_ERR("Failed to create an initial SDP negotiator"); return false; } return true; @@ -554,15 +554,15 @@ void Sdp::receiveOffer(const pjmedia_sdp_session* remote, const vector<map<string, string> > &videoCodecs) { if (!remote) { - SFL_ERR("Remote session is NULL"); + RING_ERR("Remote session is NULL"); return; } - SFL_DBG("Remote SDP Session:"); + RING_DBG("Remote SDP Session:"); printSession(remote); if (!localSession_ and createLocalSession(selectedCodecs, videoCodecs) != PJ_SUCCESS) { - SFL_ERR("Failed to create initial offer"); + RING_ERR("Failed to create initial offer"); return; } @@ -570,13 +570,13 @@ void Sdp::receiveOffer(const pjmedia_sdp_session* remote, if (pjmedia_sdp_neg_create_w_remote_offer(memPool_.get(), localSession_, remoteSession_, &negotiator_) != PJ_SUCCESS) - SFL_ERR("Failed to initialize negotiator"); + RING_ERR("Failed to initialize negotiator"); } void Sdp::startNegotiation() { if (negotiator_ == NULL) { - SFL_ERR("Can't start negotiation with invalid negotiator"); + RING_ERR("Can't start negotiation with invalid negotiator"); return; } @@ -584,7 +584,7 @@ void Sdp::startNegotiation() const pjmedia_sdp_session *active_remote; if (pjmedia_sdp_neg_get_state(negotiator_) != PJMEDIA_SDP_NEG_STATE_WAIT_NEGO) { - SFL_WARN("Negotiator not in right state for negotiation"); + RING_WARN("Negotiator not in right state for negotiation"); return; } @@ -592,12 +592,12 @@ void Sdp::startNegotiation() return; if (pjmedia_sdp_neg_get_active_local(negotiator_, &active_local) != PJ_SUCCESS) - SFL_ERR("Could not retrieve local active session"); + RING_ERR("Could not retrieve local active session"); else setActiveLocalSdpSession(active_local); if (pjmedia_sdp_neg_get_active_remote(negotiator_, &active_remote) != PJ_SUCCESS) - SFL_ERR("Could not retrieve remote active session"); + RING_ERR("Could not retrieve remote active session"); else setActiveRemoteSdpSession(active_remote); } @@ -645,7 +645,7 @@ remove_line_with_token(std::string& text, const std::string& token) { const auto tokenPos = text.find(token); if (tokenPos == std::string::npos) { - SFL_ERR("Couldn't find %s", token.c_str()); + RING_ERR("Couldn't find %s", token.c_str()); return; } @@ -663,7 +663,7 @@ string Sdp::getIncomingVideoDescription() const { pjmedia_sdp_session *videoSession = pjmedia_sdp_session_clone(memPool_.get(), activeLocalSession_); if (!videoSession) { - SFL_ERR("Could not clone SDP"); + RING_ERR("Could not clone SDP"); return ""; } @@ -672,13 +672,13 @@ string Sdp::getIncomingVideoDescription() const for (unsigned i = 0; i < videoSession->media_count; i++) if (pj_stricmp2(&videoSession->media[i]->desc.media, "video")) { if (pjmedia_sdp_media_deactivate(memPool_.get(), videoSession->media[i]) != PJ_SUCCESS) - SFL_ERR("Could not deactivate media"); + RING_ERR("Could not deactivate media"); } else { hasVideo = true; } if (not hasVideo) { - SFL_DBG("No video present in active local SDP"); + RING_DBG("No video present in active local SDP"); return ""; } @@ -731,7 +731,7 @@ std::string Sdp::getIncomingAudioDescription() const { pjmedia_sdp_session *audioSession = pjmedia_sdp_session_clone(memPool_.get(), activeLocalSession_); if (!audioSession) { - SFL_ERR("Could not clone SDP"); + RING_ERR("Could not clone SDP"); return ""; } @@ -740,13 +740,13 @@ std::string Sdp::getIncomingAudioDescription() const for (unsigned i = 0; i < audioSession->media_count; i++) if (pj_stricmp2(&audioSession->media[i]->desc.media, "audio")) { if (pjmedia_sdp_media_deactivate(memPool_.get(), audioSession->media[i]) != PJ_SUCCESS) - SFL_ERR("Could not deactivate media"); + RING_ERR("Could not deactivate media"); } else { hasAudio = true; } if (not hasAudio) { - SFL_DBG("No audio present in active local SDP"); + RING_DBG("No audio present in active local SDP"); return ""; } @@ -766,7 +766,7 @@ std::string Sdp::getIncomingAudioDescription() const bool extra = false; for (const auto& p : payloads) { if (extra) { - SFL_WARN("Dropping payload %s", p.c_str()); + RING_WARN("Dropping payload %s", p.c_str()); remove_token(sessionStr, "m=audio", " " + p); remove_line_with_token(sessionStr, "a=rtpmap:" + p); remove_line_with_token(sessionStr, "a=fmtp:" + p); @@ -823,7 +823,7 @@ std::string Sdp::getOutgoingAudioRate() const return tmp; } else { const char *DEFAULT_RATE = "8000"; - SFL_ERR("No rate found in SDP, defaulting to %s", DEFAULT_RATE); + RING_ERR("No rate found in SDP, defaulting to %s", DEFAULT_RATE); return DEFAULT_RATE; } } @@ -843,7 +843,7 @@ std::string Sdp::getOutgoingAudioChannels() const return aCodecLine.substr(pos + 1); } else { const char *DEFAULT_CHANNELS = "1"; - SFL_ERR("No channels found in SDP, defaulting to %s", DEFAULT_CHANNELS); + RING_ERR("No channels found in SDP, defaulting to %s", DEFAULT_CHANNELS); return DEFAULT_CHANNELS; } } @@ -904,7 +904,7 @@ Sdp::getProfileLevelID(const pjmedia_sdp_session *session, const size_t pos = fmtpLine.find(needle); if (pos != std::string::npos and fmtpLine.size() >= (pos + needleLength)) { profile = fmtpLine.substr(pos, needleLength); - SFL_DBG("Using %s", profile.c_str()); + RING_DBG("Using %s", profile.c_str()); } } @@ -935,7 +935,7 @@ void Sdp::addIceCandidates(unsigned media_index, const std::vector<std::string>& cands) { if (media_index >= localSession_->media_count) { - SFL_ERR("addIceCandidates failed: cannot access media#%u (may be deactivated)", media_index); + RING_ERR("addIceCandidates failed: cannot access media#%u (may be deactivated)", media_index); return; } @@ -955,11 +955,11 @@ Sdp::getIceCandidates(unsigned media_index) const { auto session = remoteSession_ ? remoteSession_ : activeRemoteSession_; if (not session) { - SFL_ERR("getIceCandidates failed: no remote session"); + RING_ERR("getIceCandidates failed: no remote session"); return {}; } if (media_index >= session->media_count) { - SFL_ERR("getIceCandidates failed: cannot access media#%u (may be deactivated)", media_index); + RING_ERR("getIceCandidates failed: cannot access media#%u (may be deactivated)", media_index); return {}; } auto media = session->media[media_index]; @@ -975,7 +975,7 @@ Sdp::getIceCandidates(unsigned media_index) const } void -Sdp::addIceAttributes(const sfl::IceTransport::Attribute&& ice_attrs) +Sdp::addIceAttributes(const ring::IceTransport::Attribute&& ice_attrs) { pj_str_t value; pjmedia_sdp_attr *attr; @@ -993,10 +993,10 @@ Sdp::addIceAttributes(const sfl::IceTransport::Attribute&& ice_attrs) throw SdpException("Could not add ICE.pwd attribute to local SDP"); } -sfl::IceTransport::Attribute +ring::IceTransport::Attribute Sdp::getIceAttributes() const { - sfl::IceTransport::Attribute ice_attrs; + ring::IceTransport::Attribute ice_attrs; auto session = remoteSession_ ? remoteSession_ : activeRemoteSession_; assert(session); @@ -1015,7 +1015,7 @@ static int getIndexOfAttribute(const pjmedia_sdp_session * const session, const char * const type) { if (!session) { - SFL_ERR("Session is NULL when looking for \"%s\" attribute", type); + RING_ERR("Session is NULL when looking for \"%s\" attribute", type); return -1; } size_t i = 0; @@ -1074,14 +1074,14 @@ Sdp::updateRemoteIP(unsigned index) if (conn) remoteIpAddr_ = std::string(conn->addr.ptr, conn->addr.slen); else - SFL_ERR("Could not get remote IP from SDP or SDP Media"); + RING_ERR("Could not get remote IP from SDP or SDP Media"); } void Sdp::setMediaTransportInfoFromRemoteSdp() { if (!activeRemoteSession_) { - SFL_ERR("Remote sdp is NULL while parsing media"); + RING_ERR("Remote sdp is NULL while parsing media"); return; } @@ -1113,12 +1113,12 @@ void Sdp::getRemoteSdpCryptoFromOffer(const pjmedia_sdp_session* remote_sdp, Cry bool Sdp::getOutgoingVideoSettings(map<string, string> &args) const { -#ifdef SFL_VIDEO +#ifdef RING_VIDEO string codec(getOutgoingVideoCodec()); if (not codec.empty()) { const string encoder(libav_utils::encodersMap()[codec]); if (encoder.empty()) { - SFL_DBG("Couldn't find encoder for \"%s\"\n", codec.c_str()); + RING_DBG("Couldn't find encoder for \"%s\"\n", codec.c_str()); return false; } else { args["codec"] = encoder; @@ -1145,7 +1145,7 @@ bool Sdp::getOutgoingAudioSettings(map<string, string> &args) const if (not codec.empty()) { const string encoder(libav_utils::encodersMap()[codec]); if (encoder.empty()) { - SFL_DBG("Couldn't find encoder for \"%s\"\n", codec.c_str()); + RING_DBG("Couldn't find encoder for \"%s\"\n", codec.c_str()); return false; } else { args["codec"] = encoder; @@ -1157,7 +1157,7 @@ bool Sdp::getOutgoingAudioSettings(map<string, string> &args) const const string rate(getOutgoingAudioRate()); if (rate.empty()) { - SFL_DBG("Couldn't find rate for \"%s\"\n", codec.c_str()); + RING_DBG("Couldn't find rate for \"%s\"\n", codec.c_str()); return false; } else { // G722 requires G722/8000 media description even though it's @ 16000 Hz @@ -1170,7 +1170,7 @@ bool Sdp::getOutgoingAudioSettings(map<string, string> &args) const const string channels(getOutgoingAudioChannels()); if (channels.empty()) { - SFL_DBG("Couldn't find channels for \"%s\"\n", codec.c_str()); + RING_DBG("Couldn't find channels for \"%s\"\n", codec.c_str()); return false; } else { args["channels"] = channels; diff --git a/daemon/src/sip/sdp.h b/daemon/src/sip/sdp.h index 15f2ed90badfcbc56cefa87ff41e0d8482d959c1..18a4b0393906e6f6d61c504025350c99f66e16fb 100644 --- a/daemon/src/sip/sdp.h +++ b/daemon/src/sip/sdp.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * @@ -50,7 +50,7 @@ #include <string> #include <stdexcept> -namespace sfl { +namespace ring { class AudioCodec; } @@ -266,14 +266,14 @@ class Sdp { void setMediaTransportInfoFromRemoteSdp(); std::string getSessionVideoCodec() const; - std::vector<sfl::AudioCodec*> getSessionAudioMedia() const; + std::vector<ring::AudioCodec*> getSessionAudioMedia() const; // Sets @param settings with appropriate values and returns true if // we are sending video, false otherwise bool getOutgoingVideoSettings(std::map<std::string, std::string> &settings) const; bool getOutgoingAudioSettings(std::map<std::string, std::string> &settings) const; - void addIceAttributes(const sfl::IceTransport::Attribute&& ice_attrs); - sfl::IceTransport::Attribute getIceAttributes() const; + void addIceAttributes(const ring::IceTransport::Attribute&& ice_attrs); + ring::IceTransport::Attribute getIceAttributes() const; void addIceCandidates(unsigned media_index, const std::vector<std::string>& cands); @@ -331,14 +331,14 @@ class Sdp { /** * Codec Map used for offer */ - std::vector<sfl::AudioCodec *> audio_codec_list_; + std::vector<ring::AudioCodec *> audio_codec_list_; std::vector<std::map<std::string, std::string> > video_codec_list_; /** * The codecs that will be used by the session (after the SDP negotiation) */ - std::vector<sfl::AudioCodec *> sessionAudioMediaLocal_; - std::vector<sfl::AudioCodec *> sessionAudioMediaRemote_; + std::vector<ring::AudioCodec *> sessionAudioMediaLocal_; + std::vector<ring::AudioCodec *> sessionAudioMediaRemote_; std::vector<std::string> sessionVideoMedia_; std::string publishedIpAddr_; diff --git a/daemon/src/sip/sip_utils.cpp b/daemon/src/sip/sip_utils.cpp index b0b66a155afeb326865b9a8d048628d4f6137a0e..dbb4f4c2fcc79b8bafb710f19bc7b84907423f9c 100644 --- a/daemon/src/sip/sip_utils.cpp +++ b/daemon/src/sip/sip_utils.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * * Author: Tristan Matthews <tristan.matthews@savoirfairelinux.com> * @@ -91,7 +91,7 @@ sip_utils::createRouteSet(const std::string &route, pj_pool_t *hdr_pool) pj_strdup2(hdr_pool, &url->host, host.c_str()); url->port = port; - SFL_DBG("Adding route %s", host.c_str()); + RING_DBG("Adding route %s", host.c_str()); pj_list_push_back(route_set, pjsip_hdr_clone(hdr_pool, routing)); return route_set; @@ -206,5 +206,5 @@ sip_utils::sip_strerror(pj_status_t code) { char err_msg[PJ_ERR_MSG_SIZE]; pj_strerror(code, err_msg, sizeof err_msg); - SFL_ERR("%d: %s", code, err_msg); + RING_ERR("%d: %s", code, err_msg); } diff --git a/daemon/src/sip/sip_utils.h b/daemon/src/sip/sip_utils.h index 4a93765fb411e8d6b01f1ff5dc5a5e32da244f11..ed416dce6102c2345c7cdec518c7c3c01dc45575 100644 --- a/daemon/src/sip/sip_utils.h +++ b/daemon/src/sip/sip_utils.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * * Author: Tristan Matthews <tristan.matthews@savoirfairelinux.com> * diff --git a/daemon/src/sip/sipaccount.cpp b/daemon/src/sip/sipaccount.cpp index aa255f6c9013f3f8db00373c2b0379cf961436aa..be6d8046a80553bd002858a49af0974fa67d7f48 100644 --- a/daemon/src/sip/sipaccount.cpp +++ b/daemon/src/sip/sipaccount.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2014 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * Author: Pierre-Luc Bacon <pierre-luc.bacon@savoirfairelinux.com> @@ -57,7 +57,7 @@ #include "logger.h" #include "manager.h" -#ifdef SFL_VIDEO +#ifdef RING_VIDEO #include "video/libav_utils.h" #endif @@ -90,13 +90,13 @@ static void registration_cb(pjsip_regc_cbparam *param) { if (!param) { - SFL_ERR("registration callback parameter is null"); + RING_ERR("registration callback parameter is null"); return; } auto account = static_cast<SIPAccount *>(param->token); if (!account) { - SFL_ERR("account doesn't exist in registration callback"); + RING_ERR("account doesn't exist in registration callback"); return; } @@ -196,7 +196,7 @@ SIPAccount::newOutgoingCall(const std::string& id, const std::string& toUrl) setTransport(t); call->setTransport(t); - SFL_DBG("New %s IP to IP call to %s", ipv6?"IPv6":"IPv4", to.c_str()); + RING_DBG("New %s IP to IP call to %s", ipv6?"IPv6":"IPv4", to.c_str()); } else { to = toUrl; @@ -212,7 +212,7 @@ SIPAccount::newOutgoingCall(const std::string& id, const std::string& toUrl) // FIXME : for now, use the same address family as the SIP transport family = pjsip_transport_type_get_af(getTransportType()); - SFL_DBG("UserAgent: New registered account call to %s", toUrl.c_str()); + RING_DBG("UserAgent: New registered account call to %s", toUrl.c_str()); } call->initIceTransport(true); @@ -231,11 +231,11 @@ SIPAccount::newOutgoingCall(const std::string& id, const std::string& toUrl) // Initialize the session using ULAW as default codec in case of early media // The session should be ready to receive media once the first INVITE is sent, before // the session initialization is completed - sfl::AudioCodec* ac = Manager::instance().audioCodecFactory.instantiateCodec(PAYLOAD_CODEC_ULAW); + ring::AudioCodec* ac = Manager::instance().audioCodecFactory.instantiateCodec(PAYLOAD_CODEC_ULAW); if (!ac) throw VoipLinkException("Could not instantiate codec for early media"); - std::vector<sfl::AudioCodec *> audioCodecs; + std::vector<ring::AudioCodec *> audioCodecs; audioCodecs.push_back(ac); #if USE_CCRTP @@ -291,19 +291,19 @@ SIPAccount::SIPStartCall(std::shared_ptr<SIPCall>& call) auto transport = call->getTransport(); if (!transport) { - SFL_ERR("Unable to start call without transport"); + RING_ERR("Unable to start call without transport"); return false; } pj_str_t pjContact = getContactHeader(transport->get()); const std::string debugContactHeader(pj_strbuf(&pjContact), pj_strlen(&pjContact)); - SFL_DBG("contact header: %s / %s -> %s", + RING_DBG("contact header: %s / %s -> %s", debugContactHeader.c_str(), from.c_str(), toUri.c_str()); pjsip_dialog *dialog = NULL; if (pjsip_dlg_create_uac(pjsip_ua_instance(), &pjFrom, &pjContact, &pjTo, NULL, &dialog) != PJ_SUCCESS) { - SFL_ERR("Unable to create SIP dialogs for user agent client when " + RING_ERR("Unable to create SIP dialogs for user agent client when " "calling %s", toUri.c_str()); return false; } @@ -315,12 +315,12 @@ SIPAccount::SIPStartCall(std::shared_ptr<SIPCall>& call) pjsip_inv_session* inv = nullptr; if (pjsip_inv_create_uac(dialog, call->getSDP().getLocalSdpSession(), 0, &inv) != PJ_SUCCESS) { - SFL_ERR("Unable to create invite session for user agent client"); + RING_ERR("Unable to create invite session for user agent client"); return false; } if (!inv) { - SFL_ERR("Call invite is not initialized"); + RING_ERR("Call invite is not initialized"); return PJ_FALSE; } @@ -332,7 +332,7 @@ SIPAccount::SIPStartCall(std::shared_ptr<SIPCall>& call) pjsip_dlg_set_route_set(dialog, sip_utils::createRouteSet(getServiceRoute(), call->inv->pool)); if (hasCredentials() and pjsip_auth_clt_set_credentials(&dialog->auth_sess, getCredentialCount(), getCredInfo()) != PJ_SUCCESS) { - SFL_ERR("Could not initialize credentials for invite session authentication"); + RING_ERR("Could not initialize credentials for invite session authentication"); return false; } @@ -341,19 +341,19 @@ SIPAccount::SIPStartCall(std::shared_ptr<SIPCall>& call) pjsip_tx_data *tdata; if (pjsip_inv_invite(call->inv.get(), &tdata) != PJ_SUCCESS) { - SFL_ERR("Could not initialize invite messager for this call"); + RING_ERR("Could not initialize invite messager for this call"); return false; } const pjsip_tpselector tp_sel = SipTransportBroker::getTransportSelector(transport->get()); if (pjsip_dlg_set_transport(dialog, &tp_sel) != PJ_SUCCESS) { - SFL_ERR("Unable to associate transport for invite session dialog"); + RING_ERR("Unable to associate transport for invite session dialog"); return false; } if (pjsip_inv_send_msg(call->inv.get(), tdata) != PJ_SUCCESS) { call->inv.reset(); - SFL_ERR("Unable to send invite message for this call"); + RING_ERR("Unable to send invite message for this call"); return false; } @@ -435,7 +435,7 @@ validate(std::string &member, const std::string ¶m, const T& valid) if (find(begin, end, param) != end) member = param; else - SFL_ERR("Invalid parameter \"%s\"", param.c_str()); + RING_ERR("Invalid parameter \"%s\"", param.c_str()); } void SIPAccount::unserialize(const YAML::Node &node) @@ -522,7 +522,7 @@ parseInt(const std::map<std::string, std::string> &details, const char *key, T & { const auto iter = details.find(key); if (iter == details.end()) { - SFL_ERR("Couldn't find key %s", key); + RING_ERR("Couldn't find key %s", key); return; } i = atoi(iter->second.c_str()); @@ -586,7 +586,7 @@ void SIPAccount::setAccountDetails(const std::map<std::string, std::string> &det validate(srtpKeyExchange_, iter->second, VALID_SRTP_KEY_EXCHANGES); if (credentials_.empty()) { // credentials not set, construct 1 entry - SFL_WARN("No credentials set, inferring them..."); + RING_WARN("No credentials set, inferring them..."); std::vector<std::map<std::string, std::string> > v; std::map<std::string, std::string> map; map[CONFIG_ACCOUNT_USERNAME] = username_; @@ -711,11 +711,11 @@ std::map<std::string, std::string> SIPAccount::getVolatileAccountDetails() const void SIPAccount::doRegister() { if (not isEnabled()) { - SFL_WARN("Account must be enabled to register, ignoring"); + RING_WARN("Account must be enabled to register, ignoring"); return; } - SFL_DBG("doRegister %s", hostname_.c_str()); + RING_DBG("doRegister %s", hostname_.c_str()); if (hostname_.empty() || isIP2IP()) { doRegister_(); @@ -729,7 +729,7 @@ void SIPAccount::doRegister() [shared](std::vector<IpAddr> host_ips) { auto this_ = std::static_pointer_cast<SIPAccount>(shared).get(); if (host_ips.empty()) { - SFL_ERR("Can't resolve hostname for registration."); + RING_ERR("Can't resolve hostname for registration."); this_->setRegistrationState(RegistrationState::ERROR_GENERIC); return; } @@ -743,13 +743,13 @@ void SIPAccount::doRegister_() { bool ipv6 = false; if (isIP2IP()) { - SFL_DBG("doRegister isIP2IP."); + RING_DBG("doRegister isIP2IP."); #if HAVE_IPV6 ipv6 = ip_utils::getInterfaceAddr(interface_).isIpv6(); #endif } else if (!hostIp_) { setRegistrationState(RegistrationState::ERROR_GENERIC); - SFL_ERR("Hostname not resolved."); + RING_ERR("Hostname not resolved."); return; } #if HAVE_IPV6 @@ -760,7 +760,7 @@ void SIPAccount::doRegister_() #if HAVE_TLS // Init TLS settings if the user wants to use TLS if (tlsEnable_) { - SFL_DBG("TLS is enabled for account %s", accountID_.c_str()); + RING_DBG("TLS is enabled for account %s", accountID_.c_str()); // Dropping current calls already using the transport is currently required // with TLS. @@ -775,7 +775,7 @@ void SIPAccount::doRegister_() getTlsSetting()); if (!tlsListener_) { setRegistrationState(RegistrationState::ERROR_GENERIC); - SFL_ERR("Error creating TLS listener."); + RING_ERR("Error creating TLS listener."); return; } } @@ -806,7 +806,7 @@ void SIPAccount::doRegister_() } try { - SFL_WARN("Creating transport"); + RING_WARN("Creating transport"); transport_.reset(); #if HAVE_TLS if (isTlsEnabled()) { @@ -823,7 +823,7 @@ void SIPAccount::doRegister_() sendRegister(); } catch (const VoipLinkException &e) { - SFL_ERR("%s", e.what()); + RING_ERR("%s", e.what()); setRegistrationState(RegistrationState::ERROR_GENERIC); return; } @@ -846,7 +846,7 @@ void SIPAccount::doUnregister(std::function<void(bool)> released_cb) try { sendUnregister(); } catch (const VoipLinkException &e) { - SFL_ERR("doUnregister %s", e.what()); + RING_ERR("doUnregister %s", e.what()); } // remove the transport from the account @@ -867,7 +867,7 @@ void SIPAccount::startKeepAliveTimer() if (keepAliveTimerActive_) return; - SFL_DBG("Start keep alive timer for account %s", getAccountID().c_str()); + RING_DBG("Start keep alive timer for account %s", getAccountID().c_str()); // make sure here we have an entirely new timer memset(&keepAliveTimer_, 0, sizeof(pj_timer_entry)); @@ -879,10 +879,10 @@ void SIPAccount::startKeepAliveTimer() // expiration may be undetermined during the first registration request if (registrationExpire_ == 0) { - SFL_DBG("Registration Expire: 0, taking 60 instead"); + RING_DBG("Registration Expire: 0, taking 60 instead"); keepAliveDelay_.sec = 3600; } else { - SFL_DBG("Registration Expire: %d", registrationExpire_); + RING_DBG("Registration Expire: %d", registrationExpire_); keepAliveDelay_.sec = registrationExpire_ + MIN_REGISTRATION_TIME; } @@ -896,7 +896,7 @@ void SIPAccount::startKeepAliveTimer() void SIPAccount::stopKeepAliveTimer() { if (keepAliveTimerActive_) { - SFL_DBG("Stop keep alive timer %d for account %s", keepAliveTimer_.id, getAccountID().c_str()); + RING_DBG("Stop keep alive timer %d for account %s", keepAliveTimer_.id, getAccountID().c_str()); keepAliveTimerActive_ = false; link_->cancelKeepAliveTimer(keepAliveTimer_); } @@ -906,7 +906,7 @@ void SIPAccount::sendRegister() { if (not isEnabled()) { - SFL_WARN("Account must be enabled to register, ignoring"); + RING_WARN("Account must be enabled to register, ignoring"); return; } @@ -933,7 +933,7 @@ SIPAccount::sendRegister() if (transport_) { if (not getPublishedSameasLocal() or (not received.empty() and received != getPublishedAddress())) { pjsip_host_port *via = getViaAddr(); - SFL_DBG("Setting VIA sent-by to %.*s:%d", via->host.slen, via->host.ptr, via->port); + RING_DBG("Setting VIA sent-by to %.*s:%d", via->host.slen, via->host.ptr, via->port); if (pjsip_regc_set_via_sent_by(regc, via, transport_->get()) != PJ_SUCCESS) throw VoipLinkException("Unable to set the \"sent-by\" field"); @@ -945,7 +945,7 @@ SIPAccount::sendRegister() pj_status_t status; - //SFL_DBG("pjsip_regc_init from:%s, srv:%s, contact:%s", from.c_str(), srvUri.c_str(), std::string(pj_strbuf(&pjContact), pj_strlen(&pjContact)).c_str()); + //RING_DBG("pjsip_regc_init from:%s, srv:%s, contact:%s", from.c_str(), srvUri.c_str(), std::string(pj_strbuf(&pjContact), pj_strlen(&pjContact)).c_str()); if ((status = pjsip_regc_init(regc, &pjSrv, &pjFrom, &pjFrom, 1, &pjContact, getRegistrationExpire())) != PJ_SUCCESS) { sip_utils::sip_strerror(status); throw VoipLinkException("Unable to initialize account registration structure"); @@ -990,11 +990,11 @@ SIPAccount::onRegister(pjsip_regc_cbparam *param) return; if (param->status != PJ_SUCCESS) { - SFL_ERR("SIP registration error %d", param->status); + RING_ERR("SIP registration error %d", param->status); destroyRegistrationInfo(); stopKeepAliveTimer(); } else if (param->code < 0 || param->code >= 300) { - SFL_ERR("SIP registration failed, status=%d (%.*s)", + RING_ERR("SIP registration failed, status=%d (%.*s)", param->code, (int)param->reason.slen, param->reason.ptr); destroyRegistrationInfo(); stopKeepAliveTimer(); @@ -1023,7 +1023,7 @@ SIPAccount::onRegister(pjsip_regc_cbparam *param) destroyRegistrationInfo(); /* Stop keep-alive timer if any. */ stopKeepAliveTimer(); - SFL_DBG("Unregistration success"); + RING_DBG("Unregistration success"); setRegistrationState(RegistrationState::UNREGISTERED); } else { /* TODO Check and update SIP outbound status first, since the result @@ -1032,7 +1032,7 @@ SIPAccount::onRegister(pjsip_regc_cbparam *param) // update_rfc5626_status(acc, param->rdata); if (checkNATAddress(param, link_->getPool())) - SFL_WARN("Contact overwritten"); + RING_WARN("Contact overwritten"); /* TODO Check and update Service-Route header */ if (hasServiceRoute()) @@ -1153,7 +1153,7 @@ void SIPAccount::initTlsConfiguration() CipherArray avail_ciphers(256); unsigned cipherNum = avail_ciphers.size(); if (pj_ssl_cipher_get_availables(&avail_ciphers.front(), &cipherNum) != PJ_SUCCESS) - SFL_ERR("Could not determine cipher list on this system"); + RING_ERR("Could not determine cipher list on this system"); avail_ciphers.resize(cipherNum); ciphers_.clear(); @@ -1165,11 +1165,11 @@ void SIPAccount::initTlsConfiguration() if (item.empty()) continue; auto item_cid = pj_ssl_cipher_id(item.c_str()); if (item_cid != PJ_TLS_UNKNOWN_CIPHER) { - SFL_WARN("Valid cipher: %s", item.c_str()); + RING_WARN("Valid cipher: %s", item.c_str()); ciphers_.push_back(item_cid); } else - SFL_ERR("Invalid cipher: %s", item.c_str()); + RING_ERR("Invalid cipher: %s", item.c_str()); } } #endif @@ -1189,7 +1189,7 @@ void SIPAccount::initTlsConfiguration() pj_cstr(&tlsSetting_.privkey_file, tlsPrivateKeyFile_.c_str()); pj_cstr(&tlsSetting_.password, tlsPassword_.c_str()); - SFL_DBG("Using %u ciphers", ciphers_.size()); + RING_DBG("Using %u ciphers", ciphers_.size()); tlsSetting_.ciphers_num = ciphers_.size(); tlsSetting_.ciphers = &ciphers_.front(); @@ -1366,7 +1366,7 @@ SIPAccount::getContactHeader(pjsip_transport* t) if (!t && transport_) t = transport_->get(); if (!t) - SFL_ERR("Transport not created yet"); + RING_ERR("Transport not created yet"); if (contact_.slen and contactOverwritten_) return contact_; @@ -1390,7 +1390,7 @@ SIPAccount::getContactHeader(pjsip_transport* t) if (not publishedSameasLocal_) { address = publishedIpAddress_; port = publishedPort_; - SFL_DBG("Using published address %s and port %d", address.c_str(), port); + RING_DBG("Using published address %s and port %d", address.c_str(), port); } else if (stunEnabled_) { link_->sipTransport->findLocalAddressFromSTUN( t, @@ -1403,12 +1403,12 @@ SIPAccount::getContactHeader(pjsip_transport* t) } else { if (!receivedParameter_.empty()) { address = receivedParameter_; - SFL_DBG("Using received address %s", address.c_str()); + RING_DBG("Using received address %s", address.c_str()); } if (rPort_ != -1 and rPort_ != 0) { port = rPort_; - SFL_DBG("Using received port %d", port); + RING_DBG("Using received port %d", port); } } @@ -1464,11 +1464,11 @@ void SIPAccount::keepAliveRegistrationCb(UNUSED pj_timer_heap_t *th, pj_timer_en SIPAccount *sipAccount = static_cast<SIPAccount *>(te->user_data); if (sipAccount == nullptr) { - SFL_ERR("SIP account is nullptr while registering a new keep alive timer"); + RING_ERR("SIP account is nullptr while registering a new keep alive timer"); return; } - SFL_ERR("Keep alive registration callback for account %s", sipAccount->getAccountID().c_str()); + RING_ERR("Keep alive registration callback for account %s", sipAccount->getAccountID().c_str()); // IP2IP default does not require keep-alive if (sipAccount->isIP2IP()) @@ -1527,7 +1527,7 @@ void SIPAccount::setCredentials(const std::vector<std::map<std::string, std::str { // we can not authenticate without credentials if (creds.empty()) { - SFL_ERR("Cannot authenticate with empty credentials list"); + RING_ERR("Cannot authenticate with empty credentials list"); return; } @@ -1714,11 +1714,11 @@ void SIPAccount::enablePresence(const bool& enabled) { if (!presence_) { - SFL_ERR("Presence not initialized"); + RING_ERR("Presence not initialized"); return; } - SFL_DBG("Presence enabled for %s : %s.", + RING_DBG("Presence enabled for %s : %s.", accountID_.c_str(), enabled? TRUE_STR : FALSE_STR); @@ -1733,14 +1733,14 @@ void SIPAccount::supportPresence(int function, bool enabled) { if (!presence_) { - SFL_ERR("Presence not initialized"); + RING_ERR("Presence not initialized"); return; } if (presence_->isSupported(function) == enabled) return; - SFL_DBG("Presence support for %s (%s: %s).", accountID_.c_str(), + RING_DBG("Presence support for %s (%s: %s).", accountID_.c_str(), function == PRESENCE_FUNCTION_PUBLISH ? "publish" : "subscribe", enabled ? TRUE_STR : FALSE_STR); presence_->support(function, enabled); @@ -1759,16 +1759,16 @@ SIPAccount::matches(const std::string &userName, const std::string &server, pjsip_endpoint *endpt, pj_pool_t *pool) const { if (fullMatch(userName, server, endpt, pool)) { - SFL_DBG("Matching account id in request is a fullmatch %s@%s", userName.c_str(), server.c_str()); + RING_DBG("Matching account id in request is a fullmatch %s@%s", userName.c_str(), server.c_str()); return MatchRank::FULL; } else if (hostnameMatch(server, endpt, pool)) { - SFL_DBG("Matching account id in request with hostname %s", server.c_str()); + RING_DBG("Matching account id in request with hostname %s", server.c_str()); return MatchRank::PARTIAL; } else if (userMatch(userName)) { - SFL_DBG("Matching account id in request with username %s", userName.c_str()); + RING_DBG("Matching account id in request with username %s", userName.c_str()); return MatchRank::PARTIAL; } else if (proxyMatch(server, endpt, pool)) { - SFL_DBG("Matching account id in request with proxy %s", server.c_str()); + RING_DBG("Matching account id in request with proxy %s", server.c_str()); return MatchRank::PARTIAL; } else { return MatchRank::NONE; @@ -1907,7 +1907,7 @@ SIPAccount::checkNATAddress(pjsip_regc_cbparam *param, pj_pool_t *pool) via_addrstr = IpAddr(via_addrstr).toString(false, true); #endif - SFL_WARN("IP address change detected for account %s " + RING_WARN("IP address change detected for account %s " "(%.*s:%d --> %s:%d). Updating registration " "(using method %d)", accountID_.c_str(), @@ -1957,7 +1957,7 @@ SIPAccount::checkNATAddress(pjsip_regc_cbparam *param, pj_pool_t *pool) rport, transport_param); if (len < 1) { - SFL_ERR("URI too long"); + RING_ERR("URI too long"); return false; } @@ -1973,7 +1973,7 @@ SIPAccount::checkNATAddress(pjsip_regc_cbparam *param, pj_pool_t *pool) tmp_tp = transport_; sendUnregister(); } catch (const VoipLinkException &e) { - SFL_ERR("%s", e.what()); + RING_ERR("%s", e.what()); } pjsip_regc_update_contact(regc_, 1, &contact_); @@ -1982,7 +1982,7 @@ SIPAccount::checkNATAddress(pjsip_regc_cbparam *param, pj_pool_t *pool) try { sendRegister(); } catch (const VoipLinkException &e) { - SFL_ERR("%s", e.what()); + RING_ERR("%s", e.what()); } } @@ -2011,7 +2011,7 @@ SIPAccount::autoReregTimerCb(pj_timer_heap_t * /*th*/, pj_timer_entry *te) try { acc->sendRegister(); } catch (const VoipLinkException &e) { - SFL_ERR("%s", e.what()); + RING_ERR("%s", e.what()); acc->scheduleReregistration(endpt); } delete context; @@ -2057,7 +2057,7 @@ SIPAccount::scheduleReregistration(pjsip_endpoint *endpt) pj_time_val_normalize(&delay); - SFL_WARN("Scheduling re-registration retry in %u seconds..", delay.sec); + RING_WARN("Scheduling re-registration retry in %u seconds..", delay.sec); auto_rereg_.timer.id = PJ_TRUE; if (pjsip_endpt_schedule_timer(endpt, &auto_rereg_.timer, &delay) != PJ_SUCCESS) auto_rereg_.timer.id = PJ_FALSE; diff --git a/daemon/src/sip/sipaccount.h b/daemon/src/sip/sipaccount.h index 26fcfee0f958d759de0f839ae1b17eb535a51c11..4d22ed69853dd22e7a2dcc3b162d5bfb25a60457 100644 --- a/daemon/src/sip/sipaccount.h +++ b/daemon/src/sip/sipaccount.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * Author: Alexandre Bourget <alexandre.bourget@savoirfairelinux.com> diff --git a/daemon/src/sip/sipaccountbase.cpp b/daemon/src/sip/sipaccountbase.cpp index 49adcfa14786c3ca30f1b2584179cdd1b3d1ce14..042926fc18e12a5bb003c89bc594424b996610a0 100644 --- a/daemon/src/sip/sipaccountbase.cpp +++ b/daemon/src/sip/sipaccountbase.cpp @@ -32,7 +32,7 @@ #include "sipaccountbase.h" #include "sipvoiplink.h" -#ifdef SFL_VIDEO +#ifdef RING_VIDEO #include "video/libav_utils.h" #endif @@ -58,7 +58,7 @@ validate(std::string &member, const std::string ¶m, const T& valid) if (find(begin, end, param) != end) member = param; else - SFL_ERR("Invalid parameter \"%s\"", param.c_str()); + RING_ERR("Invalid parameter \"%s\"", param.c_str()); } static void @@ -86,7 +86,7 @@ parseInt(const std::map<std::string, std::string> &details, const char *key, T & { const auto iter = details.find(key); if (iter == details.end()) { - SFL_ERR("Couldn't find key %s", key); + RING_ERR("Couldn't find key %s", key); return; } i = atoi(iter->second.c_str()); @@ -129,10 +129,10 @@ void SIPAccountBase::unserialize(const YAML::Node &node) parseValue(node, VIDEO_ENABLED_KEY, videoEnabled_); const auto &vCodecNode = node[VIDEO_CODECS_KEY]; auto tmp = parseVectorMap(vCodecNode, {VIDEO_CODEC_BITRATE, VIDEO_CODEC_ENABLED, VIDEO_CODEC_NAME, VIDEO_CODEC_PARAMETERS}); -#ifdef SFL_VIDEO +#ifdef RING_VIDEO if (tmp.empty()) { // Video codecs are an empty list - SFL_WARN("Loading default video codecs"); + RING_WARN("Loading default video codecs"); tmp = libav_utils::getDefaultCodecs(); } #endif @@ -185,7 +185,7 @@ void SIPAccountBase::setAccountDetails(const std::map<std::string, std::string> int tmpMax = -1; parseInt(details, CONFIG_ACCOUNT_AUDIO_PORT_MAX, tmpMax); updateRange(tmpMin, tmpMax, audioPortRange_); -#ifdef SFL_VIDEO +#ifdef RING_VIDEO tmpMin = -1; parseInt(details, CONFIG_ACCOUNT_VIDEO_PORT_MIN, tmpMin); tmpMax = -1; @@ -209,7 +209,7 @@ SIPAccountBase::getAccountDetails() const // Add sip specific details addRangeToDetails(a, CONFIG_ACCOUNT_AUDIO_PORT_MIN, CONFIG_ACCOUNT_AUDIO_PORT_MAX, audioPortRange_); -#ifdef SFL_VIDEO +#ifdef RING_VIDEO addRangeToDetails(a, CONFIG_ACCOUNT_VIDEO_PORT_MIN, CONFIG_ACCOUNT_VIDEO_PORT_MAX, videoPortRange_); #endif @@ -248,7 +248,7 @@ void SIPAccountBase::onTransportStateChanged(pjsip_transport_state state, const pjsip_transport_state_info *info) { pj_status_t currentStatus = transportStatus_; - SFL_DBG("Transport state changed to %s for account %s !", SipTransport::stateToStr(state), accountID_.c_str()); + RING_DBG("Transport state changed to %s for account %s !", SipTransport::stateToStr(state), accountID_.c_str()); if (!SipTransport::isAlive(transport_, state)) { if (info) { char err_msg[128]; @@ -256,7 +256,7 @@ SIPAccountBase::onTransportStateChanged(pjsip_transport_state state, const pjsip pj_str_t descr = pj_strerror(info->status, err_msg, sizeof(err_msg)); transportStatus_ = info->status; transportError_ = std::string(descr.ptr, descr.slen); - SFL_ERR("Transport disconnected: %.*s", descr.slen, descr.ptr); + RING_ERR("Transport disconnected: %.*s", descr.slen, descr.ptr); } else { // This is already the generic error used by pjsip. @@ -284,7 +284,7 @@ SIPAccountBase::setTransport(const std::shared_ptr<SipTransport>& t) if (t == transport_) return; if (transport_) { - SFL_DBG("Removing transport from account"); + RING_DBG("Removing transport from account"); transport_->removeStateListener(reinterpret_cast<uintptr_t>(this)); } @@ -321,7 +321,7 @@ SIPAccountBase::generateAudioPort() const return getRandomEvenNumber(audioPortRange_); } -#ifdef SFL_VIDEO +#ifdef RING_VIDEO uint16_t SIPAccountBase::generateVideoPort() const { diff --git a/daemon/src/sip/sipaccountbase.h b/daemon/src/sip/sipaccountbase.h index a1ff7a0155f2afeb395d67afe76d73bfe7a2d29f..f7fda76fe951897f1632b27ea9eb97803ec1aa1a 100644 --- a/daemon/src/sip/sipaccountbase.h +++ b/daemon/src/sip/sipaccountbase.h @@ -246,7 +246,7 @@ public: virtual std::string getServerUri() const = 0; uint16_t generateAudioPort() const; -#ifdef SFL_VIDEO +#ifdef RING_VIDEO uint16_t generateVideoPort() const; #endif static void releasePort(uint16_t port); diff --git a/daemon/src/sip/sipcall.cpp b/daemon/src/sip/sipcall.cpp index 61fe782fd430bab40721fb8468546d9096e83509..0f5f8eee6a8939b2f51bea2a725b694e5146add3 100644 --- a/daemon/src/sip/sipcall.cpp +++ b/daemon/src/sip/sipcall.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2014 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * Author: Alexandre Bourget <alexandre.bourget@savoirfairelinux.com> * Author: Yan Morin <yan.morin@savoirfairelinux.com> @@ -43,7 +43,7 @@ #include "manager.h" #include "array_size.h" -using namespace sfl; +using namespace ring; #if USE_CCRTP #include "audio/audiortp/audio_rtp_factory.h" // for AudioRtpFactoryException @@ -57,13 +57,13 @@ using namespace sfl; #include "im/instant_messaging.h" #endif -#ifdef SFL_VIDEO +#ifdef RING_VIDEO #include "video/video_rtp_session.h" #include "client/videomanager.h" #include <chrono> -static sfl_video::VideoSettings +static ring::video::VideoSettings getSettings() { const auto videoman = Manager::instance().getClient()->getVideoManager(); @@ -100,7 +100,7 @@ dtmfSend(SIPCall &call, char code, const std::string &dtmf) #endif return; } else if (dtmf != SIPAccount::SIPINFO_STR) { - SFL_WARN("Unknown DTMF type %s, defaulting to %s instead", + RING_WARN("Unknown DTMF type %s, defaulting to %s instead", dtmf.c_str(), SIPAccount::SIPINFO_STR); } // else : dtmf == SIPINFO @@ -127,9 +127,9 @@ SIPCall::SIPCall(SIPAccountBase& account, const std::string& id, Call::CallType #if USE_CCRTP , audiortp_(this) #else - , avformatrtp_(new sfl::AVFormatRtpSession(id, /* FIXME: These are video! */ getSettings())) + , avformatrtp_(new ring::AVFormatRtpSession(id, /* FIXME: These are video! */ getSettings())) #endif -#ifdef SFL_VIDEO +#ifdef RING_VIDEO // The ID is used to associate video streams to calls , videortp_(id, getSettings()) #endif @@ -141,9 +141,9 @@ SIPCall::~SIPCall() const auto mod_ua_id = getSIPVoIPLink()->getModId(); // prevent this from getting accessed in callbacks - // SFL_WARN: this is not thread-safe! + // RING_WARN: this is not thread-safe! if (inv && inv->mod_data[mod_ua_id]) { - SFL_WARN("Call was not properly removed from invite callbacks"); + RING_WARN("Call was not properly removed from invite callbacks"); inv->mod_data[mod_ua_id] = nullptr; } } @@ -157,7 +157,7 @@ SIPCall::stopRtpIfCurrent() #else avformatrtp_->stop(); #endif -#ifdef SFL_VIDEO +#ifdef RING_VIDEO videortp_.stop(); #endif } @@ -184,7 +184,7 @@ SIPCall::setCallMediaLocal(const pj_sockaddr& localIP) setLocalIp(localIP); -#ifdef SFL_VIDEO +#ifdef RING_VIDEO if (getLocalVideoPort() == 0) { // https://projects.savoirfairelinux.com/issues/17498 const unsigned int callLocalVideoPort = account.generateVideoPort(); @@ -205,7 +205,7 @@ void SIPCall::setContactHeader(pj_str_t *contact) std::map<std::string, std::string> SIPCall::createHistoryEntry() const { - using sfl::HistoryItem; + using ring::HistoryItem; std::map<std::string, std::string> entry(Call::createHistoryEntry()); return entry; @@ -247,7 +247,7 @@ SIPCall::sendSIPInfo(const char *const body, const char *const subtype) pjsip_tx_data *tdata; if (pjsip_dlg_create_request(inv->dlg, &method, -1, &tdata) != PJ_SUCCESS) { - SFL_ERR("Could not create dialog"); + RING_ERR("Could not create dialog"); return; } @@ -283,7 +283,7 @@ SIPCall::updateSDPFromSTUN() sdp_->setPublishedIP(account.getPublishedAddress()); sdp_->updatePorts(stunPorts); } catch (const std::runtime_error &e) { - SFL_ERR("%s", e.what()); + RING_ERR("%s", e.what()); } #endif } @@ -296,7 +296,7 @@ void SIPCall::answer() throw VoipLinkException("No invite session for this call"); if (!inv->neg) { - SFL_WARN("Negotiator is NULL, we've received an INVITE without an SDP"); + RING_WARN("Negotiator is NULL, we've received an INVITE without an SDP"); pjmedia_sdp_session *dummy = 0; getSIPVoIPLink()->createSDPOffer(inv.get(), &dummy); @@ -317,7 +317,7 @@ void SIPCall::answer() // contactStr must stay in scope as long as tdata if (contactHeader_.slen) { - SFL_DBG("Answering with contact header: %.*s", contactHeader_.slen, contactHeader_.ptr); + RING_DBG("Answering with contact header: %.*s", contactHeader_.slen, contactHeader_.ptr); sip_utils::addContactHeader(&contactHeader_, tdata); } @@ -349,7 +349,7 @@ SIPCall::hangup(int reason) if (printed >= 0) { buf[printed] = '\0'; - SFL_DBG("Route header %s", buf); + RING_DBG("Route header %s", buf); } route = route->next; @@ -544,7 +544,7 @@ SIPCall::transfer(const std::string& to) toUri = account.getToUri(to); pj_cstr(&dst, toUri.c_str()); - SFL_DBG("Transferring to %.*s", dst.slen, dst.ptr); + RING_DBG("Transferring to %.*s", dst.slen, dst.ptr); if (!transferCommon(&dst)) throw VoipLinkException("Couldn't transfer"); @@ -595,7 +595,7 @@ SIPCall::onhold() #else avformatrtp_->stop(); #endif -#ifdef SFL_VIDEO +#ifdef RING_VIDEO videortp_.stop(); #endif @@ -603,14 +603,14 @@ SIPCall::onhold() sdp_->removeAttributeFromLocalAudioMedia("sendonly"); sdp_->addAttributeToLocalAudioMedia("sendonly"); -#ifdef SFL_VIDEO +#ifdef RING_VIDEO sdp_->removeAttributeFromLocalVideoMedia("sendrecv"); sdp_->removeAttributeFromLocalVideoMedia("inactive"); sdp_->addAttributeToLocalVideoMedia("inactive"); #endif if (SIPSessionReinvite() != PJ_SUCCESS) - SFL_WARN("Reinvite failed"); + RING_WARN("Reinvite failed"); } void @@ -625,7 +625,7 @@ SIPCall::offhold() internalOffHold([] {}); } catch (const SdpException &e) { - SFL_ERR("%s", e.what()); + RING_ERR("%s", e.what()); throw VoipLinkException("SDP issue in offhold"); } catch (const ost::Socket::Error &e) { throw VoipLinkException("Socket problem in offhold"); @@ -633,7 +633,7 @@ SIPCall::offhold() #if USE_CCRTP catch (const ost::Socket *) { throw VoipLinkException("Socket problem in offhold"); - } catch (const sfl::AudioRtpFactoryException &) { + } catch (const ring::AudioRtpFactoryException &) { throw VoipLinkException("Socket problem in offhold"); } #endif @@ -645,14 +645,14 @@ SIPCall::internalOffHold(const std::function<void()> &SDPUpdateFunc) if (not setState(Call::ACTIVE)) return; - std::vector<sfl::AudioCodec*> sessionMedia(sdp_->getSessionAudioMedia()); + std::vector<ring::AudioCodec*> sessionMedia(sdp_->getSessionAudioMedia()); if (sessionMedia.empty()) { - SFL_WARN("Session media is empty"); + RING_WARN("Session media is empty"); return; } - std::vector<sfl::AudioCodec*> audioCodecs; + std::vector<ring::AudioCodec*> audioCodecs; for (auto & i : sessionMedia) { @@ -660,10 +660,10 @@ SIPCall::internalOffHold(const std::function<void()> &SDPUpdateFunc) continue; // Create a new instance for this codec - sfl::AudioCodec* ac = Manager::instance().audioCodecFactory.instantiateCodec(i->getPayloadType()); + ring::AudioCodec* ac = Manager::instance().audioCodecFactory.instantiateCodec(i->getPayloadType()); if (ac == NULL) { - SFL_ERR("Could not instantiate codec %d", i->getPayloadType()); + RING_ERR("Could not instantiate codec %d", i->getPayloadType()); throw std::runtime_error("Could not instantiate codec"); } @@ -690,7 +690,7 @@ SIPCall::internalOffHold(const std::function<void()> &SDPUpdateFunc) sdp_->removeAttributeFromLocalAudioMedia("sendonly"); sdp_->addAttributeToLocalAudioMedia("sendrecv"); -#ifdef SFL_VIDEO +#ifdef RING_VIDEO sdp_->removeAttributeFromLocalVideoMedia("sendrecv"); sdp_->removeAttributeFromLocalVideoMedia("sendonly"); sdp_->removeAttributeFromLocalVideoMedia("inactive"); @@ -698,7 +698,7 @@ SIPCall::internalOffHold(const std::function<void()> &SDPUpdateFunc) #endif if (SIPSessionReinvite() != PJ_SUCCESS) { - SFL_WARN("Reinvite failed, resuming hold"); + RING_WARN("Reinvite failed, resuming hold"); onhold(); } } @@ -737,7 +737,7 @@ SIPCall::carryingDTMFdigits(char code) void SIPCall::sendTextMessage(const std::string &message, const std::string &from) { - using namespace sfl::InstantMessaging; + using namespace ring::InstantMessaging; if (not inv) throw VoipLinkException("No invite session for this call"); @@ -745,7 +745,7 @@ SIPCall::sendTextMessage(const std::string &message, const std::string &from) /* Send IM message */ UriList list; UriEntry entry; - entry[sfl::IM_XML_URI] = std::string("\"" + from + "\""); // add double quotes for xml formating + entry[ring::IM_XML_URI] = std::string("\"" + from + "\""); // add double quotes for xml formating list.push_front(entry); send_sip_message(inv.get(), getCallId(), appendUriList(message, list)); } @@ -783,7 +783,7 @@ void SIPCall::setupLocalSDPFromIce() { if (waitForIceInitialization(DEFAULT_ICE_INIT_TIMEOUT) <= 0) { - SFL_ERR("ICE init failed, ICE will not be used for medias"); + RING_ERR("ICE init failed, ICE will not be used for medias"); return; } @@ -792,19 +792,19 @@ SIPCall::setupLocalSDPFromIce() // Add video and audio channels sdp_->addIceCandidates(SDP_AUDIO_MEDIA_ID, iceTransport_->getLocalCandidates(ICE_AUDIO_RTP_COMPID)); sdp_->addIceCandidates(SDP_AUDIO_MEDIA_ID, iceTransport_->getLocalCandidates(ICE_AUDIO_RTCP_COMPID)); -#ifdef SFL_VIDEO +#ifdef RING_VIDEO sdp_->addIceCandidates(SDP_VIDEO_MEDIA_ID, iceTransport_->getLocalCandidates(ICE_VIDEO_RTP_COMPID)); sdp_->addIceCandidates(SDP_VIDEO_MEDIA_ID, iceTransport_->getLocalCandidates(ICE_VIDEO_RTCP_COMPID)); #endif } -std::vector<sfl::IceCandidate> +std::vector<ring::IceCandidate> SIPCall::getAllRemoteCandidates() { - std::vector<sfl::IceCandidate> rem_candidates; + std::vector<ring::IceCandidate> rem_candidates; auto addSDPCandidates = [this](unsigned sdpMediaId, - std::vector<sfl::IceCandidate>& out) { + std::vector<ring::IceCandidate>& out) { IceCandidate cand; for (auto& line : sdp_->getIceCandidates(sdpMediaId)) { if (iceTransport_->getCandidateFromSDP(line, cand)) @@ -813,7 +813,7 @@ SIPCall::getAllRemoteCandidates() }; addSDPCandidates(SDP_AUDIO_MEDIA_ID, rem_candidates); -#ifdef SFL_VIDEO +#ifdef RING_VIDEO addSDPCandidates(SDP_VIDEO_MEDIA_ID, rem_candidates); #endif @@ -827,7 +827,7 @@ SIPCall::startIce() return true; auto rem_ice_attrs = sdp_->getIceAttributes(); if (rem_ice_attrs.ufrag.empty() or rem_ice_attrs.pwd.empty()) { - SFL_ERR("ICE empty attributes"); + RING_ERR("ICE empty attributes"); return false; } return iceTransport_->start(rem_ice_attrs, getAllRemoteCandidates()); @@ -841,7 +841,7 @@ SIPCall::startAllMedia() try { audiortp_.updateDestinationIpAddress(); } catch (const AudioRtpFactoryException &e) { - SFL_ERR("%s", e.what()); + RING_ERR("%s", e.what()); } audiortp_.setDtmfPayloadType(sdp_->getTelephoneEventType()); @@ -849,8 +849,8 @@ SIPCall::startAllMedia() avformatrtp_->updateSDP(*sdp_); avformatrtp_->updateDestination(remoteIP, sdp_->getRemoteAudioPort()); if (isIceRunning()) { - std::unique_ptr<sfl::IceSocket> sockRTP(newIceSocket(0)); - std::unique_ptr<sfl::IceSocket> sockRTCP(newIceSocket(1)); + std::unique_ptr<ring::IceSocket> sockRTP(newIceSocket(0)); + std::unique_ptr<ring::IceSocket> sockRTCP(newIceSocket(1)); avformatrtp_->start(std::move(sockRTP), std::move(sockRTCP)); } else { const auto localAudioPort = sdp_->getLocalAudioPort(); @@ -858,24 +858,24 @@ SIPCall::startAllMedia() } #endif -#ifdef SFL_VIDEO +#ifdef RING_VIDEO auto remoteVideoPort = sdp_->getRemoteVideoPort(); videortp_.updateSDP(*sdp_); videortp_.updateDestination(remoteIP, remoteVideoPort); if (isIceRunning()) { - std::unique_ptr<sfl::IceSocket> sockRTP(newIceSocket(2)); - std::unique_ptr<sfl::IceSocket> sockRTCP(newIceSocket(3)); + std::unique_ptr<ring::IceSocket> sockRTP(newIceSocket(2)); + std::unique_ptr<ring::IceSocket> sockRTCP(newIceSocket(3)); try { videortp_.start(std::move(sockRTP), std::move(sockRTCP)); } catch (const std::runtime_error &e) { - SFL_ERR("videortp_.start() with ICE failed, %s", e.what()); + RING_ERR("videortp_.start() with ICE failed, %s", e.what()); } } else { const auto localVideoPort = sdp_->getLocalVideoPort(); try { videortp_.start(localVideoPort ? localVideoPort : remoteVideoPort); } catch (const std::runtime_error &e) { - SFL_ERR("videortp_.start() failed, %s", e.what()); + RING_ERR("videortp_.start() failed, %s", e.what()); } } #endif @@ -888,12 +888,12 @@ SIPCall::startAllMedia() bool nego_success = false; if (!crypto_offer.empty()) { - std::vector<sfl::CryptoSuiteDefinition> localCapabilities; + std::vector<ring::CryptoSuiteDefinition> localCapabilities; - for (size_t i = 0; i < SFL_ARRAYSIZE(sfl::CryptoSuites); ++i) - localCapabilities.push_back(sfl::CryptoSuites[i]); + for (size_t i = 0; i < RING_ARRAYSIZE(ring::CryptoSuites); ++i) + localCapabilities.push_back(ring::CryptoSuites[i]); - sfl::SdesNegotiator sdesnego(localCapabilities, crypto_offer); + ring::SdesNegotiator sdesnego(localCapabilities, crypto_offer); auto callMgr = Manager::instance().getClient()->getCallManager(); if (sdesnego.negotiate()) { @@ -903,20 +903,20 @@ SIPCall::startAllMedia() audiortp_.setRemoteCryptoInfo(sdesnego); callMgr->secureSdesOn(getCallId()); } catch (const AudioRtpFactoryException &e) { - SFL_ERR("%s", e.what()); + RING_ERR("%s", e.what()); callMgr->secureSdesOff(getCallId()); } } else { - SFL_ERR("SDES negotiation failure"); + RING_ERR("SDES negotiation failure"); callMgr->secureSdesOff(getCallId()); } } else { - SFL_DBG("No crypto offer available"); + RING_DBG("No crypto offer available"); } // We did not find any crypto context for this media, RTP fallback if (!nego_success && audiortp_.isSdesEnabled()) { - SFL_ERR("Negotiation failed but SRTP is enabled, fallback on RTP"); + RING_ERR("Negotiation failed but SRTP is enabled, fallback on RTP"); audiortp_.stop(); audiortp_.setSrtpEnabled(false); @@ -930,10 +930,10 @@ SIPCall::startAllMedia() } #endif // USE_CCRTP && HAVE_SDES - std::vector<sfl::AudioCodec*> sessionMedia(sdp_->getSessionAudioMedia()); + std::vector<ring::AudioCodec*> sessionMedia(sdp_->getSessionAudioMedia()); if (sessionMedia.empty()) { - SFL_WARN("Session media is empty"); + RING_WARN("Session media is empty"); return; } @@ -948,10 +948,10 @@ SIPCall::startAllMedia() const int pl = i->getPayloadType(); - sfl::AudioCodec *ac = Manager::instance().audioCodecFactory.instantiateCodec(pl); + ring::AudioCodec *ac = Manager::instance().audioCodecFactory.instantiateCodec(pl); if (!ac) { - SFL_ERR("Could not instantiate codec %d", pl); + RING_ERR("Could not instantiate codec %d", pl); } else { audioCodecs.push_back(ac); } @@ -962,8 +962,8 @@ SIPCall::startAllMedia() getAudioRtp().updateSessionMedia(audioCodecs); #endif } catch (const SdpException &e) { - SFL_ERR("%s", e.what()); + RING_ERR("%s", e.what()); } catch (const std::exception &rtpException) { - SFL_ERR("%s", rtpException.what()); + RING_ERR("%s", rtpException.what()); } } diff --git a/daemon/src/sip/sipcall.h b/daemon/src/sip/sipcall.h index 2fe6a312bee630d0a4b3c8181265087588471b24..b8b8f72d229aa63961a191ee162d5bbaf162c788 100644 --- a/daemon/src/sip/sipcall.h +++ b/daemon/src/sip/sipcall.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2014 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Alexandre Bourget <alexandre.bourget@savoirfairelinux.com> * Author: Yan Morin <yan.morin@savoirfairelinux.com> * Author : Laurielle Lea <laurielle.lea@savoirfairelinux.com> @@ -42,7 +42,7 @@ #if USE_CCRTP #include "audio/audiortp/audio_rtp_factory.h" #endif -#ifdef SFL_VIDEO +#ifdef RING_VIDEO #include "video/video_rtp_session.h" #endif @@ -59,7 +59,7 @@ class Sdp; class SIPAccountBase; class SipTransport; -namespace sfl { +namespace ring { class AVFormatRtpSession; } @@ -98,7 +98,7 @@ class SIPCall : public Call /** * Returns a pointer to the AudioRtp object */ - sfl::AudioRtpFactory& getAudioRtp() { + ring::AudioRtpFactory& getAudioRtp() { return audiortp_; } #else @@ -106,16 +106,16 @@ class SIPCall : public Call /** * Returns a pointer to the AVFormatRtpSession object */ - sfl::AVFormatRtpSession& getAVFormatRTP() const { + ring::AVFormatRtpSession& getAVFormatRTP() const { return *avformatrtp_; } #endif -#ifdef SFL_VIDEO +#ifdef RING_VIDEO /** * Returns a pointer to the VideoRtp object */ - sfl_video::VideoRtpSession& getVideoRtp () { + ring::video::VideoRtpSession& getVideoRtp () { return videortp_; } #endif @@ -209,22 +209,22 @@ class SIPCall : public Call int SIPSessionReinvite(); - std::vector<sfl::IceCandidate> getAllRemoteCandidates(); + std::vector<ring::IceCandidate> getAllRemoteCandidates(); #if USE_CCRTP /** * Audio Rtp Session factory */ - sfl::AudioRtpFactory audiortp_; + ring::AudioRtpFactory audiortp_; #else - std::unique_ptr<sfl::AVFormatRtpSession> avformatrtp_; + std::unique_ptr<ring::AVFormatRtpSession> avformatrtp_; #endif -#ifdef SFL_VIDEO +#ifdef RING_VIDEO /** * Video Rtp Session factory */ - sfl_video::VideoRtpSession videortp_; + ring::video::VideoRtpSession videortp_; #endif /** diff --git a/daemon/src/sip/sippresence.cpp b/daemon/src/sip/sippresence.cpp index 105885844b757cc0953a66a40d7f3cd02c37443c..5c5669a37a3a75961c7b22c091ea129dc7faaf15 100644 --- a/daemon/src/sip/sippresence.cpp +++ b/daemon/src/sip/sippresence.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * * Author: Patrick Keroulas <patrick.keroulas@savoirfairelinux.com> * @@ -93,7 +93,7 @@ SIPPresence::~SIPPresence() sub_server_list_.clear(); if (mutex_ and pj_mutex_destroy(mutex_) != PJ_SUCCESS) - SFL_ERR("Error destroying mutex"); + RING_ERR("Error destroying mutex"); pj_pool_release(pool_); pj_caching_pool_destroy(&cp_); @@ -160,7 +160,7 @@ void SIPPresence::updateStatus(bool status, const std::string ¬e) rpid.activity = PJRPID_ACTIVITY_BUSY; /* else // TODO: is there any other possibilities - SFL_DBG("Presence : no activity"); + RING_DBG("Presence : no activity"); */ pj_bzero(&status_data_, sizeof(status_data_)); @@ -196,7 +196,7 @@ void SIPPresence::reportPresSubClientNotification(const std::string& uri, pjsip_ const std::string acc_ID = acc_->getAccountID(); const std::string basic(status->info[0].basic_open ? "open" : "closed"); const std::string note(status->info[0].rpid.note.ptr, status->info[0].rpid.note.slen); - SFL_DBG(" Received status of PresSubClient %s(acc:%s): status=%s note=%s", uri.c_str(), acc_ID.c_str(), basic.c_str(), note.c_str()); + RING_DBG(" Received status of PresSubClient %s(acc:%s): status=%s note=%s", uri.c_str(), acc_ID.c_str(), basic.c_str(), note.c_str()); if (uri == acc_->getFromUri()) { // save the status of our own account @@ -222,7 +222,7 @@ void SIPPresence::subscribeClient(const std::string& uri, bool flag) /* Check if the buddy was already subscribed */ for (const auto & c : sub_client_list_) { if (c->getURI() == uri) { - //SFL_DBG("-PresSubClient:%s exists in the list. Replace it.", uri.c_str()); + //RING_DBG("-PresSubClient:%s exists in the list. Replace it.", uri.c_str()); if (flag) c->subscribe(); else @@ -232,14 +232,14 @@ void SIPPresence::subscribeClient(const std::string& uri, bool flag) } if (sub_client_list_.size() >= MAX_N_SUB_CLIENT) { - SFL_WARN("Can't add PresSubClient, max number reached."); + RING_WARN("Can't add PresSubClient, max number reached."); return; } if (flag) { PresSubClient *c = new PresSubClient(uri, this); if (!(c->subscribe())) { - SFL_WARN("Failed send subscribe."); + RING_WARN("Failed send subscribe."); delete c; } // the buddy has to be accepted before being added in the list @@ -250,16 +250,16 @@ void SIPPresence::addPresSubClient(PresSubClient *c) { if (sub_client_list_.size() < MAX_N_SUB_CLIENT) { sub_client_list_.push_back(c); - SFL_DBG("New Presence_subscription_client added (list[%i]).", sub_client_list_.size()); + RING_DBG("New Presence_subscription_client added (list[%i]).", sub_client_list_.size()); } else { - SFL_WARN("Max Presence_subscription_client is reach."); + RING_WARN("Max Presence_subscription_client is reach."); // let the client alive //delete c; } } void SIPPresence::removePresSubClient(PresSubClient *c) { - SFL_DBG("Remove Presence_subscription_client from the buddy list."); + RING_DBG("Remove Presence_subscription_client from the buddy list."); sub_client_list_.remove(c); } @@ -279,7 +279,7 @@ void SIPPresence::addPresSubServer(PresSubServer *s) if (sub_server_list_.size() < MAX_N_SUB_SERVER) { sub_server_list_.push_back(s); } else { - SFL_WARN("Max Presence_subscription_server is reach."); + RING_WARN("Max Presence_subscription_server is reach."); // let de server alive // delete s; } } @@ -287,12 +287,12 @@ void SIPPresence::addPresSubServer(PresSubServer *s) void SIPPresence::removePresSubServer(PresSubServer *s) { sub_server_list_.remove(s); - SFL_DBG("Presence_subscription_server removed"); + RING_DBG("Presence_subscription_server removed"); } void SIPPresence::notifyPresSubServer() { - SFL_DBG("Iterating through IP2IP Presence_subscription_server:"); + RING_DBG("Iterating through IP2IP Presence_subscription_server:"); for (const auto & s : sub_server_list_) s->notify(); @@ -344,7 +344,7 @@ void SIPPresence::fillDoc(pjsip_tx_data *tdata, const pres_msg_data *msg_data) while (hdr && hdr != &msg_data->hdr_list) { pjsip_hdr *new_hdr; new_hdr = (pjsip_hdr*) pjsip_hdr_clone(tdata->pool, hdr); - SFL_DBG("adding header", new_hdr->name.ptr); + RING_DBG("adding header", new_hdr->name.ptr); pjsip_msg_add_hdr(tdata->msg, new_hdr); hdr = hdr->next; } @@ -379,7 +379,7 @@ SIPPresence::publish_cb(struct pjsip_publishc_cbparam *param) if (param->status != PJ_SUCCESS) { char errmsg[PJ_ERR_MSG_SIZE]; pj_strerror(param->status, errmsg, sizeof(errmsg)); - SFL_ERR("Client (PUBLISH) failed, status=%d, msg=%s", param->status, errmsg); + RING_ERR("Client (PUBLISH) failed, status=%d, msg=%s", param->status, errmsg); Manager::instance().getClient()->getPresenceManager()->serverError( pres->getAccount()->getAccountID(), error, @@ -389,10 +389,10 @@ SIPPresence::publish_cb(struct pjsip_publishc_cbparam *param) /* 412 (Conditional Request Failed) * The PUBLISH refresh has failed, retry with new one. */ - SFL_WARN("Publish retry."); + RING_WARN("Publish retry."); publish(pres); } else if ((param->code == PJSIP_SC_BAD_EVENT) || (param->code == PJSIP_SC_NOT_IMPLEMENTED)){ //489 or 501 - SFL_WARN("Client (PUBLISH) failed (%s)",error.c_str()); + RING_WARN("Client (PUBLISH) failed (%s)",error.c_str()); Manager::instance().getClient()->getPresenceManager()->serverError( pres->getAccount()->getAccountID(), @@ -424,7 +424,7 @@ SIPPresence::send_publish(SIPPresence * pres) pjsip_tx_data *tdata; pj_status_t status; - SFL_DBG("Send PUBLISH (%s).", pres->getAccount()->getAccountID().c_str()); + RING_DBG("Send PUBLISH (%s).", pres->getAccount()->getAccountID().c_str()); SIPAccount * acc = pres->getAccount(); std::string contactWithAngles = acc->getFromUri(); @@ -442,7 +442,7 @@ SIPPresence::send_publish(SIPPresence * pres) pj_str_t from = pj_strdup3(pres->pool_, acc->getFromUri().c_str()); if (status != PJ_SUCCESS) { - SFL_ERR("Error creating PUBLISH request", status); + RING_ERR("Error creating PUBLISH request", status); goto on_error; } @@ -468,7 +468,7 @@ SIPPresence::send_publish(SIPPresence * pres) pres_msg_data msg_data; if (status != PJ_SUCCESS) { - SFL_ERR("Error creating PIDF for PUBLISH request"); + RING_ERR("Error creating PIDF for PUBLISH request"); pjsip_tx_data_dec_ref(tdata); goto on_error; } @@ -484,9 +484,9 @@ SIPPresence::send_publish(SIPPresence * pres) status = pjsip_publishc_send(pres->publish_sess_, tdata); if (status == PJ_EPENDING) { - SFL_WARN("Previous request is in progress, "); + RING_WARN("Previous request is in progress, "); } else if (status != PJ_SUCCESS) { - SFL_ERR("Error sending PUBLISH request"); + RING_ERR("Error sending PUBLISH request"); goto on_error; } @@ -521,7 +521,7 @@ SIPPresence::publish(SIPPresence *pres) if (status != PJ_SUCCESS) { pres->publish_sess_ = NULL; - SFL_ERR("Failed to create a publish seesion."); + RING_ERR("Failed to create a publish seesion."); return status; } @@ -530,14 +530,14 @@ SIPPresence::publish(SIPPresence *pres) status = pjsip_publishc_init(pres->publish_sess_, &STR_PRESENCE, &from, &from, &from, 0xFFFF); if (status != PJ_SUCCESS) { - SFL_ERR("Failed to init a publish session"); + RING_ERR("Failed to init a publish session"); pres->publish_sess_ = NULL; return status; } /* Add credential for authentication */ if (acc->hasCredentials() and pjsip_publishc_set_credentials(pres->publish_sess_, acc->getCredentialCount(), acc->getCredInfo()) != PJ_SUCCESS) { - SFL_ERR("Could not initialize credentials for invite session authentication"); + RING_ERR("Could not initialize credentials for invite session authentication"); return status; } diff --git a/daemon/src/sip/sippresence.h b/daemon/src/sip/sippresence.h index 1092703c715670486934c356756b88208d1e2529..1d22ee52873df6fef1a3eff991657cdffcac5fa3 100644 --- a/daemon/src/sip/sippresence.h +++ b/daemon/src/sip/sippresence.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * * Author: Patrick Keroulas <patrick.keroulas@savoirfairelinux.com> * diff --git a/daemon/src/sip/siptransport.cpp b/daemon/src/sip/siptransport.cpp index 5b657147cd063fd5eec3241a9b07fd08037bb2da..75891639dc538b40d1bf684a53ffeb33af6a04b5 100644 --- a/daemon/src/sip/siptransport.cpp +++ b/daemon/src/sip/siptransport.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * Author: Adrien Béraud <adrien.beraud@savoirfairelinux.com> @@ -55,7 +55,7 @@ #include <sstream> #include <algorithm> -#define RETURN_IF_FAIL(A, VAL, M, ...) if (!(A)) { SFL_ERR(M, ##__VA_ARGS__); return (VAL); } +#define RETURN_IF_FAIL(A, VAL, M, ...) if (!(A)) { RING_ERR(M, ##__VA_ARGS__); return (VAL); } // FIXME: remove this when pjsip_tp_state_callback gives us enough info static SipTransportBroker* instance = nullptr; @@ -63,7 +63,7 @@ static SipTransportBroker* instance = nullptr; constexpr const char* TRANSPORT_STATE_STR[] = { "CONNECTED", "DISCONNECTED", "SHUTDOWN", "DESTROY", "UNKNOWN STATE" }; -constexpr const size_t TRANSPORT_STATE_SZ = SFL_ARRAYSIZE(TRANSPORT_STATE_STR); +constexpr const size_t TRANSPORT_STATE_SZ = RING_ARRAYSIZE(TRANSPORT_STATE_STR); std::string SipTransportDescr::toString() const @@ -84,7 +84,7 @@ SipTransport::~SipTransport() if (transport) { pjsip_transport_shutdown(transport); pjsip_transport_dec_ref(transport); // ?? - SFL_DBG("Destroying transport (refcount: %u)", pj_atomic_get(transport->ref_cnt)); + RING_DBG("Destroying transport (refcount: %u)", pj_atomic_get(transport->ref_cnt)); transport = nullptr; } } @@ -152,7 +152,7 @@ cp_(cp), pool_(pool), endpt_(endpt) instance = this; auto status = pjsip_tpmgr_set_state_cb(pjsip_endpt_get_tpmgr(endpt_), SipTransportBroker::tp_state_callback); if (status != PJ_SUCCESS) { - SFL_ERR("Can't set transport callback"); + RING_ERR("Can't set transport callback"); sip_utils::sip_strerror(status); } @@ -165,7 +165,7 @@ cp_(cp), pool_(pool), endpt_(endpt) SipTransportBroker::~SipTransportBroker() { - SFL_DBG("Destroying SipTransportBroker"); + RING_DBG("Destroying SipTransportBroker"); Manager::instance().unregisterEventHandler((uintptr_t)this); { @@ -178,7 +178,7 @@ SipTransportBroker::~SipTransportBroker() { std::unique_lock<std::mutex> lock(iceMutex_); if (not iceTransports_.empty()) - SFL_WARN("Remaining %u registred ICE transports", iceTransports_.size()); + RING_WARN("Remaining %u registred ICE transports", iceTransports_.size()); } } @@ -187,7 +187,7 @@ void SipTransportBroker::tp_state_callback(pjsip_transport *tp, pjsip_transport_state state, const pjsip_transport_state_info* info) { if (!instance) { - SFL_ERR("Can't bubble event: SipTransportBroker instance is null !"); + RING_ERR("Can't bubble event: SipTransportBroker instance is null !"); return; } instance->transportStateChanged(tp, state, info); @@ -196,7 +196,7 @@ SipTransportBroker::tp_state_callback(pjsip_transport *tp, pjsip_transport_state void SipTransportBroker::transportStateChanged(pjsip_transport* tp, pjsip_transport_state state, const pjsip_transport_state_info* info) { - SFL_WARN("Transport %s -> %s", tp->info, SipTransport::stateToStr(state)); + RING_WARN("Transport %s -> %s", tp->info, SipTransport::stateToStr(state)); { std::shared_ptr<SipTransport> transport {}; { @@ -232,7 +232,7 @@ SipTransportBroker::transportStateChanged(pjsip_transport* tp, pjsip_transport_s return i.second == tp; }); if (transport_key != udpTransports_.end()) { - SFL_WARN("UDP transport destroy"); + RING_WARN("UDP transport destroy"); transports_.erase(transport_key->second); udpTransports_.erase(transport_key); transportDestroyedCv_.notify_all(); @@ -297,18 +297,18 @@ SipTransportBroker::getUdpTransport(const SipTransportDescr& descr) auto it = transports_.find(itp->second); if (it != transports_.end()) { if (auto spt = it->second.lock()) { - SFL_DBG("Reusing transport %s", descr.toString().c_str()); + RING_DBG("Reusing transport %s", descr.toString().c_str()); return spt; } else { // Transport still exists but have not been destroyed yet. - SFL_WARN("Recycling transport %s", descr.toString().c_str()); + RING_WARN("Recycling transport %s", descr.toString().c_str()); auto ret = std::make_shared<SipTransport>(itp->second); it->second = ret; return ret; } } else { - SFL_WARN("Cleaning up UDP transport %s", descr.toString().c_str()); + RING_WARN("Cleaning up UDP transport %s", descr.toString().c_str()); udpTransports_.erase(itp); } } @@ -337,14 +337,14 @@ SipTransportBroker::createUdpTransport(const SipTransportDescr& d) ? pjsip_udp_transport_start (endpt_, &static_cast<const pj_sockaddr_in&>(listeningAddress), nullptr, 1, &transport) : pjsip_udp_transport_start6(endpt_, &static_cast<const pj_sockaddr_in6&>(listeningAddress), nullptr, 1, &transport); if (status != PJ_SUCCESS) { - SFL_ERR("UDP IPv%s Transport did not start on %s", + RING_ERR("UDP IPv%s Transport did not start on %s", listeningAddress.isIpv4() ? "4" : "6", listeningAddress.toString(true).c_str()); sip_utils::sip_strerror(status); return nullptr; } - SFL_DBG("Created UDP transport on %s : %s", d.interface.c_str(), listeningAddress.toString(true).c_str()); + RING_DBG("Created UDP transport on %s : %s", d.interface.c_str(), listeningAddress.toString(true).c_str()); auto ret = std::make_shared<SipTransport>(transport); // dec ref because the refcount starts at 1 and SipTransport increments it ? // pjsip_transport_dec_ref(transport); @@ -364,19 +364,19 @@ SipTransportBroker::getTlsListener(const SipTransportDescr& d, const pjsip_tls_s listeningAddress.setPort(d.listenerPort); RETURN_IF_FAIL(listeningAddress, nullptr, "Could not determine IP address for this transport"); - SFL_DBG("Creating TLS listener %s on %s...", d.toString().c_str(), listeningAddress.toString(true).c_str()); + RING_DBG("Creating TLS listener %s on %s...", d.toString().c_str(), listeningAddress.toString(true).c_str()); #if 0 - SFL_DBG(" ca_list_file : %s", settings->ca_list_file.ptr); - SFL_DBG(" cert_file : %s", settings->cert_file.ptr); - SFL_DBG(" ciphers_num : %d", settings->ciphers_num); - SFL_DBG(" verify server %d client %d client_cert %d", settings->verify_server, settings->verify_client, settings->require_client_cert); - SFL_DBG(" reuse_addr : %d", settings->reuse_addr); + RING_DBG(" ca_list_file : %s", settings->ca_list_file.ptr); + RING_DBG(" cert_file : %s", settings->cert_file.ptr); + RING_DBG(" ciphers_num : %d", settings->ciphers_num); + RING_DBG(" verify server %d client %d client_cert %d", settings->verify_server, settings->verify_client, settings->require_client_cert); + RING_DBG(" reuse_addr : %d", settings->reuse_addr); #endif pjsip_tpfactory *listener = nullptr; const pj_status_t status = pjsip_tls_transport_start2(endpt_, settings, listeningAddress.pjPtr(), nullptr, 1, &listener); if (status != PJ_SUCCESS) { - SFL_ERR("TLS listener did not start"); + RING_ERR("TLS listener did not start"); sip_utils::sip_strerror(status); return nullptr; } @@ -392,7 +392,7 @@ SipTransportBroker::getTlsTransport(const std::shared_ptr<TlsListener>& l, const if (remoteAddr.getPort() == 0) remoteAddr.setPort(pjsip_transport_get_default_port_for_type(l->get()->type)); - SFL_DBG("Get new TLS transport to %s", remoteAddr.toString(true).c_str()); + RING_DBG("Get new TLS transport to %s", remoteAddr.toString(true).c_str()); pjsip_tpselector sel {PJSIP_TPSELECTOR_LISTENER, { .listener = l->get() }}; @@ -406,7 +406,7 @@ SipTransportBroker::getTlsTransport(const std::shared_ptr<TlsListener>& l, const &transport); if (!transport || status != PJ_SUCCESS) { - SFL_ERR("Could not get new TLS transport"); + RING_ERR("Could not get new TLS transport"); sip_utils::sip_strerror(status); return nullptr; } @@ -422,7 +422,7 @@ SipTransportBroker::getTlsTransport(const std::shared_ptr<TlsListener>& l, const #if HAVE_DHT std::shared_ptr<SipTransport> -SipTransportBroker::getIceTransport(const std::shared_ptr<sfl::IceTransport> ice, unsigned comp_id) +SipTransportBroker::getIceTransport(const std::shared_ptr<ring::IceTransport> ice, unsigned comp_id) { std::unique_lock<std::mutex> lock(iceMutex_); iceTransports_.emplace_front(endpt_, pool_, ice_pj_transport_type_, ice, comp_id, [=]() -> int { @@ -456,13 +456,13 @@ SipTransportBroker::getSTUNAddresses(const pj_str_t serverName, pj_uint16_t port &serverName, port, &serverName, port, ipv4); if (ret != PJ_SUCCESS) { - SFL_ERR("STUN query to server \"%.*s\" failed", serverName.slen, serverName.ptr); + RING_ERR("STUN query to server \"%.*s\" failed", serverName.slen, serverName.ptr); switch (ret) { case PJLIB_UTIL_ESTUNNOTRESPOND: - SFL_ERR("No response from STUN server(s)"); + RING_ERR("No response from STUN server(s)"); break; case PJLIB_UTIL_ESTUNSYMMETRIC: - SFL_ERR("Different mapped addresses are returned by servers."); + RING_ERR("Different mapped addresses are returned by servers."); break; default: break; @@ -473,12 +473,12 @@ SipTransportBroker::getSTUNAddresses(const pj_str_t serverName, pj_uint16_t port std::vector<pj_sockaddr> result(ip_num); for(size_t i=0; i<ip_num; i++) { result[i].ipv4 = ipv4[i]; - SFL_WARN("STUN PORTS: %ld", pj_sockaddr_get_port(&result[i])); + RING_WARN("STUN PORTS: %ld", pj_sockaddr_get_port(&result[i])); } return result; } -#define RETURN_IF_NULL(A, M, ...) if ((A) == NULL) { SFL_ERR(M, ##__VA_ARGS__); return; } +#define RETURN_IF_NULL(A, M, ...) if ((A) == NULL) { RING_ERR(M, ##__VA_ARGS__); return; } void SipTransportBroker::findLocalAddressFromTransport(pjsip_transport *transport, pjsip_transport_type_e transportType, const std::string &host, std::string &addr, pj_uint16_t &port) const @@ -502,7 +502,7 @@ SipTransportBroker::findLocalAddressFromTransport(pjsip_transport *transport, pj pjsip_tpselector tp_sel = getTransportSelector(transport); pjsip_tpmgr_fla2_param param = {transportType, &tp_sel, pjstring, PJ_FALSE, {nullptr, 0}, 0, nullptr}; if (pjsip_tpmgr_find_local_addr2(tpmgr, &pool_, ¶m) != PJ_SUCCESS) { - SFL_WARN("Could not retrieve local address and port from transport, using %s :%d", addr.c_str(), port); + RING_WARN("Could not retrieve local address and port from transport, using %s :%d", addr.c_str(), port); return; } @@ -536,10 +536,10 @@ SipTransportBroker::findLocalAddressFromSTUN(pjsip_transport *transport, switch (stunStatus) { case PJLIB_UTIL_ESTUNNOTRESPOND: - SFL_ERR("No response from STUN server %.*s", stunServerName->slen, stunServerName->ptr); + RING_ERR("No response from STUN server %.*s", stunServerName->slen, stunServerName->ptr); return; case PJLIB_UTIL_ESTUNSYMMETRIC: - SFL_ERR("Different mapped addresses are returned by servers."); + RING_ERR("Different mapped addresses are returned by servers."); return; case PJ_SUCCESS: port = mapped_addr.getPort(); @@ -548,7 +548,7 @@ SipTransportBroker::findLocalAddressFromSTUN(pjsip_transport *transport, break; } - SFL_WARN("Using address %s provided by STUN server %.*s", + RING_WARN("Using address %s provided by STUN server %.*s", IpAddr(mapped_addr).toString(true).c_str(), stunServerName->slen, stunServerName->ptr); } diff --git a/daemon/src/sip/siptransport.h b/daemon/src/sip/siptransport.h index 52f929b4bc2981401d9af6124329e515d16fa80f..23dbece6f2e79b0d73ea5bc3edf3d789644e5999 100644 --- a/daemon/src/sip/siptransport.h +++ b/daemon/src/sip/siptransport.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * Author: Adrien Béraud <adrien.beraud@savoirfairelinux.com> @@ -90,7 +90,7 @@ struct TlsListener TlsListener() {} TlsListener(pjsip_tpfactory* f) : listener(f) {} virtual ~TlsListener() { - SFL_DBG("Destroying listener"); + RING_DBG("Destroying listener"); listener->destroy(listener); } pjsip_tpfactory* get() { @@ -136,7 +136,7 @@ private: class IpAddr; class SipIceTransport; -namespace sfl { +namespace ring { class IceTransport; } /** @@ -157,7 +157,7 @@ public: #endif #if HAVE_DHT - std::shared_ptr<SipTransport> getIceTransport(const std::shared_ptr<sfl::IceTransport>, unsigned comp_id); + std::shared_ptr<SipTransport> getIceTransport(const std::shared_ptr<ring::IceTransport>, unsigned comp_id); #endif std::shared_ptr<SipTransport> findTransport(pjsip_transport*); diff --git a/daemon/src/sip/sipvoiplink.cpp b/daemon/src/sip/sipvoiplink.cpp index bfb43b57e5a41111cdc489dea122d7fad42185b6..bd6150e5875b5742226b6804d79459426e2366e5 100644 --- a/daemon/src/sip/sipvoiplink.cpp +++ b/daemon/src/sip/sipvoiplink.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2014 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * Author: Yun Liu <yun.liu@savoirfairelinux.com> * Author: Pierre-Luc Bacon <pierre-luc.bacon@savoirfairelinux.com> @@ -59,7 +59,7 @@ #include "audio/audiortp/avformat_rtp_session.h" #endif -#ifdef SFL_VIDEO +#ifdef RING_VIDEO #include "video/video_rtp_session.h" #include "client/videomanager.h" #endif @@ -85,7 +85,7 @@ #include <istream> #include <algorithm> -using namespace sfl; +using namespace ring; /** Environment variable used to set pjsip's logging level */ #define SIPLOGLEVEL "SIPLOGLEVEL" @@ -188,7 +188,7 @@ try_respond_stateless(pjsip_endpoint *endpt, pjsip_rx_data *rdata, int st_code, if (!pjsip_rdata_get_tsx(rdata)) return pjsip_endpt_respond_stateless(endpt, rdata, st_code, st_text, hdr_list, body); else - SFL_ERR("Transaction has been created for this request, send response " + RING_ERR("Transaction has been created for this request, send response " "statefully instead"); return !PJ_SUCCESS; @@ -198,14 +198,14 @@ static pj_bool_t transaction_request_cb(pjsip_rx_data *rdata) { if (!rdata or !rdata->msg_info.msg) { - SFL_ERR("rx_data is NULL"); + RING_ERR("rx_data is NULL"); return PJ_FALSE; } pjsip_method *method = &rdata->msg_info.msg->line.req.method; if (!method) { - SFL_ERR("method is NULL"); + RING_ERR("method is NULL"); return PJ_FALSE; } @@ -213,7 +213,7 @@ transaction_request_cb(pjsip_rx_data *rdata) return PJ_FALSE; if (!rdata->msg_info.to or !rdata->msg_info.from or !rdata->msg_info.via) { - SFL_ERR("Missing From, To or Via fields"); + RING_ERR("Missing From, To or Via fields"); return PJ_FALSE; } const pjsip_sip_uri *sip_to_uri = (pjsip_sip_uri *) pjsip_uri_get_uri(rdata->msg_info.to->uri); @@ -221,7 +221,7 @@ transaction_request_cb(pjsip_rx_data *rdata) const pjsip_host_port& sip_via = rdata->msg_info.via->sent_by; if (!sip_to_uri or !sip_from_uri or !sip_via.host.ptr) { - SFL_ERR("NULL uri"); + RING_ERR("NULL uri"); return PJ_FALSE; } std::string toUsername(sip_to_uri->user.ptr, sip_to_uri->user.slen); @@ -232,7 +232,7 @@ transaction_request_cb(pjsip_rx_data *rdata) auto account(getSIPVoIPLink()->guessAccount(toUsername, viaHostname, remote_hostname)); if (!account) { - SFL_ERR("NULL account"); + RING_ERR("NULL account"); return PJ_FALSE; } @@ -307,17 +307,17 @@ transaction_request_cb(pjsip_rx_data *rdata) if (not remote_user.empty() and not remote_hostname.empty()) peerNumber = remote_user + "@" + remote_hostname; - // SFL_DBG("transaction_request_cb viaHostname %s toUsername %s addrToUse %s addrSdp %s peerNumber: %s" , + // RING_DBG("transaction_request_cb viaHostname %s toUsername %s addrToUse %s addrSdp %s peerNumber: %s" , // viaHostname.c_str(), toUsername.c_str(), addrToUse.toString().c_str(), addrSdp.toString().c_str(), peerNumber.c_str()); auto transport = getSIPVoIPLink()->sipTransport->findTransport(rdata->tp_info.transport); if (!transport) { transport = account->getTransport(); if (!transport) { - SFL_ERR("No suitable transport to answer this call."); + RING_ERR("No suitable transport to answer this call."); return PJ_FALSE; } else { - SFL_WARN("Using transport from account."); + RING_WARN("Using transport from account."); } } call->setTransport(transport); @@ -333,7 +333,7 @@ transaction_request_cb(pjsip_rx_data *rdata) try { call->getAudioRtp().initSession(); } catch (const ost::Socket::Error &err) { - SFL_ERR("AudioRtp socket error"); + RING_ERR("AudioRtp socket error"); return PJ_FALSE; } #endif @@ -351,21 +351,21 @@ transaction_request_cb(pjsip_rx_data *rdata) CryptoOffer crypto_offer; crypto_offer.push_back(std::string(sdpOffer.substr(start, (sdpOffer.size() - start) - 1))); - const size_t size = SFL_ARRAYSIZE(sfl::CryptoSuites); - std::vector<sfl::CryptoSuiteDefinition> localCapabilities(size); + const size_t size = RING_ARRAYSIZE(ring::CryptoSuites); + std::vector<ring::CryptoSuiteDefinition> localCapabilities(size); - std::copy(sfl::CryptoSuites, sfl::CryptoSuites + size, + std::copy(ring::CryptoSuites, ring::CryptoSuites + size, localCapabilities.begin()); #if HAVE_SDES - sfl::SdesNegotiator sdesnego(localCapabilities, crypto_offer); + ring::SdesNegotiator sdesnego(localCapabilities, crypto_offer); if (sdesnego.negotiate()) { try { call->getAudioRtp().setRemoteCryptoInfo(sdesnego); call->getAudioRtp().initLocalCryptoInfo(); } catch (const AudioRtpFactoryException &e) { - SFL_ERR("%s", e.what()); + RING_ERR("%s", e.what()); return PJ_FALSE; } } @@ -377,19 +377,19 @@ transaction_request_cb(pjsip_rx_data *rdata) call->getSDP().receiveOffer(r_sdp, account->getActiveAudioCodecs(), account->getActiveVideoCodecs()); if (not call->getIceTransport()) { - SFL_DBG("Initializing ICE transport"); + RING_DBG("Initializing ICE transport"); call->initIceTransport(false); } call->setupLocalSDPFromIce(); - sfl::AudioCodec* ac = Manager::instance().audioCodecFactory.instantiateCodec(PAYLOAD_CODEC_ULAW); + ring::AudioCodec* ac = Manager::instance().audioCodecFactory.instantiateCodec(PAYLOAD_CODEC_ULAW); if (!ac) { - SFL_ERR("Could not instantiate codec"); + RING_ERR("Could not instantiate codec"); return PJ_FALSE; } - std::vector<sfl::AudioCodec *> audioCodecs; + std::vector<ring::AudioCodec *> audioCodecs; audioCodecs.push_back(ac); #if USE_CCRTP call->getAudioRtp().start(audioCodecs); @@ -398,7 +398,7 @@ transaction_request_cb(pjsip_rx_data *rdata) pjsip_dialog *dialog = 0; if (pjsip_dlg_create_uas(pjsip_ua_instance(), rdata, nullptr, &dialog) != PJ_SUCCESS) { - SFL_ERR("Could not create uas"); + RING_ERR("Could not create uas"); call.reset(); try_respond_stateless(endpt_, rdata, PJSIP_SC_INTERNAL_SERVER_ERROR, nullptr, nullptr, nullptr); return PJ_FALSE; @@ -406,7 +406,7 @@ transaction_request_cb(pjsip_rx_data *rdata) pjsip_tpselector tp_sel = SipTransportBroker::getTransportSelector(transport->get()); if (!dialog or pjsip_dlg_set_transport(dialog, &tp_sel) != PJ_SUCCESS) { - SFL_ERR("Could not set transport for dialog"); + RING_ERR("Could not set transport for dialog"); return PJ_FALSE; } @@ -414,7 +414,7 @@ transaction_request_cb(pjsip_rx_data *rdata) pjsip_inv_create_uas(dialog, rdata, call->getSDP().getLocalSdpSession(), 0, &inv); if (!inv) { - SFL_ERR("Call invite is not initialized"); + RING_ERR("Call invite is not initialized"); return PJ_FALSE; } @@ -426,7 +426,7 @@ transaction_request_cb(pjsip_rx_data *rdata) pjsip_tx_data *response; if (pjsip_replaces_verify_request(rdata, &replaced_dlg, PJ_FALSE, &response) != PJ_SUCCESS) { - SFL_ERR("Something wrong with Replaces request."); + RING_ERR("Something wrong with Replaces request."); call.reset(); // Something wrong with the Replaces header. @@ -463,12 +463,12 @@ transaction_request_cb(pjsip_rx_data *rdata) } } else { // Proceed with normal call flow if (pjsip_inv_initial_answer(call->inv.get(), rdata, PJSIP_SC_TRYING, NULL, NULL, &tdata) != PJ_SUCCESS) { - SFL_ERR("Could not answer invite"); + RING_ERR("Could not answer invite"); return PJ_FALSE; } if (pjsip_inv_send_msg(call->inv.get(), tdata) != PJ_SUCCESS) { - SFL_ERR("Could not send msg for invite"); + RING_ERR("Could not send msg for invite"); call->inv.reset(); return PJ_FALSE; } @@ -476,7 +476,7 @@ transaction_request_cb(pjsip_rx_data *rdata) call->setConnectionState(Call::TRYING); if (pjsip_inv_answer(call->inv.get(), PJSIP_SC_RINGING, NULL, NULL, &tdata) != PJ_SUCCESS) { - SFL_ERR("Could not answer invite"); + RING_ERR("Could not answer invite"); return PJ_FALSE; } @@ -485,7 +485,7 @@ transaction_request_cb(pjsip_rx_data *rdata) sip_utils::addContactHeader(&contactStr, tdata); if (pjsip_inv_send_msg(call->inv.get(), tdata) != PJ_SUCCESS) { - SFL_ERR("Could not send msg for invite"); + RING_ERR("Could not send msg for invite"); call->inv.reset(); return PJ_FALSE; } @@ -517,7 +517,7 @@ pj_pool_t* SIPVoIPLink::getPool() const SIPVoIPLink::SIPVoIPLink() { - SFL_DBG("creating SIPVoIPLink instance"); + RING_DBG("creating SIPVoIPLink instance"); #define TRY(ret) do { \ if (ret != PJ_SUCCESS) \ @@ -547,7 +547,7 @@ SIPVoIPLink::SIPVoIPLink() for (unsigned i=0, n=ns.size(); i<n; i++) { char hbuf[NI_MAXHOST]; getnameinfo((sockaddr*)&ns[i], ns[i].getLength(), hbuf, sizeof(hbuf), nullptr, 0, NI_NUMERICHOST); - SFL_DBG("Using SIP nameserver: %s", hbuf); + RING_DBG("Using SIP nameserver: %s", hbuf); pj_strdup2(pool_, &dns_nameservers[i], hbuf); } pj_dns_resolver* resv; @@ -611,7 +611,7 @@ SIPVoIPLink::SIPVoIPLink() static const pj_str_t accepted = CONST_PJ_STR("application/sdp"); pjsip_endpt_add_capability(endpt_, &mod_ua_, PJSIP_H_ACCEPT, nullptr, 1, &accepted); - SFL_DBG("pjsip version %s for %s initialized", pj_get_version(), PJ_OS_NAME); + RING_DBG("pjsip version %s for %s initialized", pj_get_version(), PJ_OS_NAME); TRY(pjsip_replaces_init_module(endpt_)); #undef TRY @@ -624,7 +624,7 @@ SIPVoIPLink::SIPVoIPLink() SIPVoIPLink::~SIPVoIPLink() { - SFL_DBG("destroying SIPVoIPLink instance"); + RING_DBG("destroying SIPVoIPLink instance"); const int MAX_TIMEOUT_ON_LEAVING = 5; @@ -637,7 +637,7 @@ SIPVoIPLink::~SIPVoIPLink() pjsip_endpt_handle_events(endpt_, &tv); if (!Manager::instance().callFactory.empty<SIPCall>()) - SFL_ERR("%d SIP calls remains!", + RING_ERR("%d SIP calls remains!", Manager::instance().callFactory.callCount<SIPCall>()); // destroy SIP transport before endpoint @@ -656,7 +656,7 @@ SIPVoIPLink::guessAccount(const std::string& userName, const std::string& server, const std::string& fromUri) const { - SFL_DBG("username = %s, server = %s, from = %s", userName.c_str(), server.c_str(), fromUri.c_str()); + RING_DBG("username = %s, server = %s, from = %s", userName.c_str(), server.c_str(), fromUri.c_str()); // Try to find the account id from username and server name by full match auto result = std::static_pointer_cast<SIPAccountBase>(Manager::instance().getIP2IPAccount()); // default result @@ -728,7 +728,7 @@ SIPVoIPLink::handleEvents() static __thread pj_thread_desc desc; static __thread pj_thread_t *this_thread; #endif - SFL_DBG("Registering thread"); + RING_DBG("Registering thread"); pj_thread_register(NULL, desc, &this_thread); } @@ -738,32 +738,32 @@ SIPVoIPLink::handleEvents() if ((ret = pjsip_endpt_handle_events(endpt_, &timeout)) != PJ_SUCCESS) sip_utils::sip_strerror(ret); -#ifdef SFL_VIDEO +#ifdef RING_VIDEO dequeKeyframeRequests(); #endif } void SIPVoIPLink::registerKeepAliveTimer(pj_timer_entry &timer, pj_time_val &delay) { - SFL_DBG("Register new keep alive timer %d with delay %d", timer.id, delay.sec); + RING_DBG("Register new keep alive timer %d with delay %d", timer.id, delay.sec); if (timer.id == -1) - SFL_WARN("Timer already scheduled"); + RING_WARN("Timer already scheduled"); switch (pjsip_endpt_schedule_timer(endpt_, &timer, &delay)) { case PJ_SUCCESS: break; default: - SFL_ERR("Could not schedule new timer in pjsip endpoint"); + RING_ERR("Could not schedule new timer in pjsip endpoint"); /* fallthrough */ case PJ_EINVAL: - SFL_ERR("Invalid timer or delay entry"); + RING_ERR("Invalid timer or delay entry"); break; case PJ_EINVALIDOP: - SFL_ERR("Invalid timer entry, maybe already scheduled"); + RING_ERR("Invalid timer entry, maybe already scheduled"); break; } } @@ -773,7 +773,7 @@ void SIPVoIPLink::cancelKeepAliveTimer(pj_timer_entry& timer) pjsip_endpt_cancel_timer(endpt_, &timer); } -#ifdef SFL_VIDEO +#ifdef RING_VIDEO // Called from a video thread void SIPVoIPLink::enqueueKeyframeRequest(const std::string &id) @@ -816,7 +816,7 @@ SIPVoIPLink::requestKeyframe(const std::string &callID) "<picture_fast_update/>" "</to_encoder></vc_primitive></media_control>"; - SFL_DBG("Sending video keyframe request via SIP INFO"); + RING_DBG("Sending video keyframe request via SIP INFO"); call->sendSIPInfo(BODY, "media_control+xml"); } #endif @@ -840,7 +840,7 @@ invite_session_state_changed_cb(pjsip_inv_session *inv, pjsip_event *ev) auto call_ptr = static_cast<SIPCall*>(inv->mod_data[mod_ua_.id]); if (!call_ptr) { - SFL_WARN("invite_session_state_changed_cb: can't find related call"); + RING_WARN("invite_session_state_changed_cb: can't find related call"); return; } auto call = std::static_pointer_cast<SIPCall>(call_ptr->shared_from_this()); @@ -889,7 +889,7 @@ invite_session_state_changed_cb(pjsip_inv_session *inv, pjsip_event *ev) case PJSIP_SC_REQUEST_PENDING: case PJSIP_SC_ADDRESS_INCOMPLETE: default: - SFL_WARN("PJSIP_INV_STATE_DISCONNECTED: %d %d", + RING_WARN("PJSIP_INV_STATE_DISCONNECTED: %d %d", inv->cause, ev ? ev->type : -1); call->onServerFailure(); break; @@ -952,11 +952,11 @@ dump_sdp_session(const pjmedia_sdp_session* sdp_session, const char* header) char buffer[4096] {}; if (pjmedia_sdp_print(sdp_session, buffer, sizeof buffer) == -1) { - SFL_ERR("%sSDP too big for dump", header); + RING_ERR("%sSDP too big for dump", header); return; } - SFL_DBG("%s%s", header, buffer); + RING_DBG("%s%s", header, buffer); } static const pjmedia_sdp_session* @@ -965,12 +965,12 @@ get_active_remote_sdp(pjsip_inv_session *inv) const pjmedia_sdp_session* sdp_session {}; if (pjmedia_sdp_neg_get_active_remote(inv->neg, &sdp_session) != PJ_SUCCESS) { - SFL_ERR("Active remote not present"); + RING_ERR("Active remote not present"); return nullptr; } if (pjmedia_sdp_validate(sdp_session) != PJ_SUCCESS) { - SFL_ERR("Invalid remote SDP session"); + RING_ERR("Invalid remote SDP session"); return nullptr; } @@ -984,12 +984,12 @@ get_active_local_sdp(pjsip_inv_session *inv) const pjmedia_sdp_session* sdp_session {}; if (pjmedia_sdp_neg_get_active_local(inv->neg, &sdp_session) != PJ_SUCCESS) { - SFL_ERR("Active local not present"); + RING_ERR("Active local not present"); return nullptr; } if (pjmedia_sdp_validate(sdp_session) != PJ_SUCCESS) { - SFL_ERR("Invalid local SDP session"); + RING_ERR("Invalid local SDP session"); return nullptr; } @@ -1006,7 +1006,7 @@ sdp_media_update_cb(pjsip_inv_session *inv, pj_status_t status) auto call_ptr = static_cast<SIPCall*>(inv->mod_data[mod_ua_.id]); if (!call_ptr) { - SFL_DBG("Call declined by peer, SDP negotiation stopped"); + RING_DBG("Call declined by peer, SDP negotiation stopped"); return; } auto call = std::static_pointer_cast<SIPCall>(call_ptr->shared_from_this()); @@ -1016,14 +1016,14 @@ sdp_media_update_cb(pjsip_inv_session *inv, pj_status_t status) inv->state != PJSIP_INV_STATE_CONFIRMED ? PJSIP_SC_UNSUPPORTED_MEDIA_TYPE : 0; - SFL_WARN("Could not negotiate offer"); + RING_WARN("Could not negotiate offer"); call->hangup(reason); Manager::instance().callFailure(*call); return; } if (!inv->neg) { - SFL_WARN("No negotiator for this session"); + RING_WARN("No negotiator for this session"); return; } @@ -1042,7 +1042,7 @@ sdp_media_update_cb(pjsip_inv_session *inv, pj_status_t status) // Handle possible ICE transport if (!call->startIce()) - SFL_WARN("ICE not started"); + RING_WARN("ICE not started"); } static void @@ -1069,8 +1069,8 @@ handle_media_control(pjsip_inv_session * inv, pjsip_transaction *tsx, pjsip_even const pj_str_t PICT_FAST_UPDATE = CONST_PJ_STR("picture_fast_update"); if (pj_strstr(&control_st, &PICT_FAST_UPDATE)) { -#ifdef SFL_VIDEO - SFL_DBG("handling picture fast update request"); +#ifdef RING_VIDEO + RING_DBG("handling picture fast update request"); auto call = static_cast<SIPCall*>(inv->mod_data[mod_ua_.id]); if (call) call->getVideoRtp().forceKeyFrame(); @@ -1132,7 +1132,7 @@ transaction_state_changed_cb(pjsip_inv_session * inv, pjsip_transaction *tsx, if (r_data->msg_info.msg->line.req.method.id == PJSIP_OTHER_METHOD) { std::string request(pjsip_rx_data_get_info(r_data)); - SFL_DBG("%s", request.c_str()); + RING_DBG("%s", request.c_str()); if (request.find("NOTIFY") == std::string::npos and request.find("INFO") != std::string::npos) { @@ -1144,17 +1144,17 @@ transaction_state_changed_cb(pjsip_inv_session * inv, pjsip_transaction *tsx, if (body and body->len > 0) { const std::string msg(static_cast<char *>(body->data), body->len); - SFL_DBG("%s", msg.c_str()); + RING_DBG("%s", msg.c_str()); if (msg.find("Not found") != std::string::npos) { - SFL_ERR("Received 404 Not found"); + RING_ERR("Received 404 Not found"); sendOK(inv->dlg, r_data, tsx); return; } else if (msg.find("Ringing") != std::string::npos and call) { if (call) makeCallRing(*call); else - SFL_WARN("Ringing state on non existing call"); + RING_WARN("Ringing state on non existing call"); sendOK(inv->dlg, r_data, tsx); return; } else if (msg.find("Ok") != std::string::npos) { @@ -1183,7 +1183,7 @@ transaction_state_changed_cb(pjsip_inv_session * inv, pjsip_transaction *tsx, std::string formattedMessage(formattedMsgPtr, strlen(formattedMsgPtr)); - using namespace sfl::InstantMessaging; + using namespace ring::InstantMessaging; try { // retreive the recipient-list of this message @@ -1211,8 +1211,8 @@ transaction_state_changed_cb(pjsip_inv_session * inv, pjsip_transaction *tsx, // Respond with a 200/OK sendOK(inv->dlg, r_data, tsx); - } catch (const sfl::InstantMessageException &except) { - SFL_ERR("%s", except.what()); + } catch (const ring::InstantMessageException &except) { + RING_ERR("%s", except.what()); } #endif } @@ -1241,7 +1241,7 @@ onCallTransfered(pjsip_inv_session *inv, pjsip_rx_data *rdata) currentCall->getAccountId()); Manager::instance().hangupCall(currentCall->getCallId()); } catch (const VoipLinkException &e) { - SFL_ERR("%s", e.what()); + RING_ERR("%s", e.what()); } } @@ -1257,7 +1257,7 @@ void SIPVoIPLink::resolveSrvName(const std::string &name, pjsip_transport_type_e type, SrvResolveCallback cb) { if (name.length() >= PJ_MAX_HOSTNAME) { - SFL_ERR("Hostname is too long"); + RING_ERR("Hostname is too long"); cb({}); return; } @@ -1266,7 +1266,7 @@ SIPVoIPLink::resolveSrvName(const std::string &name, pjsip_transport_type_e type 0, type, {{(char*)name.data(), (pj_ssize_t)name.size()}, 0}, }; - auto token = std::hash<std::string>()(name + sfl::to_string(type)); + auto token = std::hash<std::string>()(name + ring::to_string(type)); { std::lock_guard<std::mutex> lock(resolveMutex_); resolveCallbacks_[token] = [cb](pj_status_t s, const pjsip_server_addresses* r) { @@ -1282,7 +1282,7 @@ SIPVoIPLink::resolveSrvName(const std::string &name, pjsip_transport_type_e type cb(ips); } } catch (const std::exception& e) { - SFL_ERR("Error resolving address: %s", e.what()); + RING_ERR("Error resolving address: %s", e.what()); cb({}); } }; diff --git a/daemon/src/sip/sipvoiplink.h b/daemon/src/sip/sipvoiplink.h index 68991b26267e010e05071b8863f7f47c6850c158..547f9786533ac3dbf71efb95c46a136dc06e21b7 100644 --- a/daemon/src/sip/sipvoiplink.h +++ b/daemon/src/sip/sipvoiplink.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2014 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * Author: Yun Liu <yun.liu@savoirfairelinux.com> @@ -52,7 +52,7 @@ #include <pjnath.h> #include <pjnath/stun_config.h> -#ifdef SFL_VIDEO +#ifdef RING_VIDEO #include <queue> #endif #include <map> @@ -127,7 +127,7 @@ class SIPVoIPLink { */ std::unique_ptr<SipTransportBroker> sipTransport {}; -#ifdef SFL_VIDEO +#ifdef RING_VIDEO static void enqueueKeyframeRequest(const std::string &callID); #endif @@ -157,7 +157,7 @@ class SIPVoIPLink { NON_COPYABLE(SIPVoIPLink); -#ifdef SFL_VIDEO +#ifdef RING_VIDEO void dequeKeyframeRequests(); void requestKeyframe(const std::string &callID); std::mutex keyframeRequestsMutex_ {}; diff --git a/daemon/src/sip/tlsvalidation.c b/daemon/src/sip/tlsvalidation.c index 3d93ac5b7459f27761d550de55a6047bbc41cbeb..8e25028535cff85d6390206da167aed7a7189a6a 100644 --- a/daemon/src/sip/tlsvalidation.c +++ b/daemon/src/sip/tlsvalidation.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2014 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * * Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com> * Vittorio Giovara <vittorio.giovara@savoirfairelinux.com> @@ -71,24 +71,24 @@ static unsigned char *crypto_file_read(const char *path, size_t *out_len) fd = open(path, O_RDONLY); if (fd < 0) { - SFL_ERR("Failed to open file '%s'.", path); + RING_ERR("Failed to open file '%s'.", path); return NULL; } if (fstat(fd, &st) < 0) { - SFL_ERR("Failed to stat file '%s'.", path); + RING_ERR("Failed to stat file '%s'.", path); goto out; } if (st.st_size <= 0 || st.st_size > INT_MAX) { - SFL_ERR("Invalid file '%s' length %ld.", path, st.st_size); + RING_ERR("Invalid file '%s' length %ld.", path, st.st_size); goto out; } file_size = st.st_size; data = (unsigned char *)malloc(file_size); if (!data) { - SFL_ERR("Not enough memory to read file '%s'.", path); + RING_ERR("Not enough memory to read file '%s'.", path); goto out; } @@ -98,7 +98,7 @@ static unsigned char *crypto_file_read(const char *path, size_t *out_len) free(data); data = NULL; *out_len = 0; - SFL_ERR("Failed to read file '%s'.", path); + RING_ERR("Failed to read file '%s'.", path); goto out; } *out_len += bytes_read; @@ -119,21 +119,21 @@ static int crypto_cert_check_date(gnutls_x509_crt_t cert) activationTime = gnutls_x509_crt_get_activation_time(cert); if (activationTime == -1) { - SFL_ERR("Could not retrieve activation time."); + RING_ERR("Could not retrieve activation time."); return -1; } if (now < activationTime) { - SFL_ERR("Certificate not yet activated."); + RING_ERR("Certificate not yet activated."); return -1; } expirationTime = gnutls_x509_crt_get_expiration_time(cert); if (expirationTime == -1) { - SFL_ERR("Could not errrieve expiration time."); + RING_ERR("Could not errrieve expiration time."); return -2; } if (now > expirationTime) { - SFL_ERR("Certificate expired."); + RING_ERR("Certificate expired."); return -2; } @@ -157,7 +157,7 @@ static unsigned char *crypto_cert_read(const char *path, size_t *out_len) dt.size = (unsigned int) fsize; if (gnutls_x509_crt_init(&cert) != GNUTLS_E_SUCCESS) { - SFL_ERR("Not enough memory for certificate."); + RING_ERR("Not enough memory for certificate."); goto out; } @@ -165,7 +165,7 @@ static unsigned char *crypto_cert_read(const char *path, size_t *out_len) if (err != GNUTLS_E_SUCCESS) err = gnutls_x509_crt_import(cert, &dt, GNUTLS_X509_FMT_DER); if (err != GNUTLS_E_SUCCESS) { - SFL_ERR("Could not import certificate %s - %s", path, gnutls_strerror(err)); + RING_ERR("Could not import certificate %s - %s", path, gnutls_strerror(err)); goto out; } @@ -183,7 +183,7 @@ static unsigned char *crypto_cert_read(const char *path, size_t *out_len) free(data); data = NULL; *out_len = 0; - SFL_ERR("Certificate %s could not be exported - %s.\n", + RING_ERR("Certificate %s could not be exported - %s.\n", path, gnutls_strerror(err)); } @@ -210,22 +210,22 @@ static int crypto_cert_load_trusted(gnutls_certificate_credentials_t cred) trust_store = opendir("/etc/ssl/certs/"); if (!trust_store) { - SFL_ERR("Failed to open system trusted store."); + RING_ERR("Failed to open system trusted store."); goto out; } while ((trust_ca = readdir(trust_store)) != NULL) { /* Prepare the string and check it is a regular file. */ err = snprintf(ca_file, sizeof(ca_file), "/etc/ssl/certs/%s", trust_ca->d_name); if (err < 0) { - SFL_ERR("snprintf() error"); + RING_ERR("snprintf() error"); goto out; } else if (err >= sizeof(ca_file)) { - SFL_ERR("File name too long '%s'.", trust_ca->d_name); + RING_ERR("File name too long '%s'.", trust_ca->d_name); goto out; } err = stat(ca_file, &statbuf); if (err < 0) { - SFL_ERR("Failed to stat file '%s'.", ca_file); + RING_ERR("Failed to stat file '%s'.", ca_file); goto out; } if (!S_ISREG(statbuf.st_mode)) @@ -234,9 +234,9 @@ static int crypto_cert_load_trusted(gnutls_certificate_credentials_t cred) /* Load the root CA. */ err = gnutls_certificate_set_x509_trust_file(cred, ca_file, GNUTLS_X509_FMT_PEM); if (err == 0) { - SFL_WARN("No trusted certificates found - %s", gnutls_strerror(err)); + RING_WARN("No trusted certificates found - %s", gnutls_strerror(err)); } else if (err < 0) { - SFL_ERR("Could not load trusted certificates - %s", gnutls_strerror(err)); + RING_ERR("Could not load trusted certificates - %s", gnutls_strerror(err)); goto out; } } @@ -265,14 +265,14 @@ static int crypto_cert_print_issuer(gnutls_x509_crt_t cert, name_size = sizeof(name); gnutls_x509_crt_get_dn(cert, name, &name_size); - SFL_DBG("Subject: %s", name); - SFL_DBG("Issuer: %s", issuer_name); + RING_DBG("Subject: %s", name); + RING_DBG("Issuer: %s", issuer_name); if (issuer != NULL) { issuer_name_size = sizeof(issuer_name); gnutls_x509_crt_get_dn(issuer, issuer_name, &issuer_name_size); - SFL_DBG("Verified against: %s", issuer_name); + RING_DBG("Verified against: %s", issuer_name); } return 0; @@ -292,14 +292,14 @@ int containsPrivateKey(const char *pemPath) err = gnutls_global_init(); if (err != GNUTLS_E_SUCCESS) { - SFL_ERR("Could not init GnuTLS - %s", gnutls_strerror(err)); + RING_ERR("Could not init GnuTLS - %s", gnutls_strerror(err)); free(dt.data); return res; } err = gnutls_x509_privkey_init(&key); if (err != GNUTLS_E_SUCCESS) { - SFL_ERR("Could not init key - %s", gnutls_strerror(err)); + RING_ERR("Could not init key - %s", gnutls_strerror(err)); free(dt.data); gnutls_global_deinit(); return res; @@ -309,12 +309,12 @@ int containsPrivateKey(const char *pemPath) if (err != GNUTLS_E_SUCCESS) err = gnutls_x509_privkey_import(key, &dt, GNUTLS_X509_FMT_DER); if (err != GNUTLS_E_SUCCESS) { - SFL_ERR("Could not read key - %s", gnutls_strerror(err)); + RING_ERR("Could not read key - %s", gnutls_strerror(err)); goto out; } res = 0; - SFL_DBG("Key from %s seems valid.", pemPath); + RING_DBG("Key from %s seems valid.", pemPath); out: free(dt.data); gnutls_x509_privkey_deinit(key); @@ -334,7 +334,7 @@ int certificateIsValid(const char *caPath, const char *certPath) err = gnutls_global_init(); if (err != GNUTLS_E_SUCCESS) { - SFL_ERR("Could not init GnuTLS - %s", gnutls_strerror(err)); + RING_ERR("Could not init GnuTLS - %s", gnutls_strerror(err)); goto out; } @@ -345,7 +345,7 @@ int certificateIsValid(const char *caPath, const char *certPath) err = gnutls_x509_crt_init(&cert); if (err != GNUTLS_E_SUCCESS) { - SFL_ERR("Could not init certificate - %s", gnutls_strerror(err)); + RING_ERR("Could not init certificate - %s", gnutls_strerror(err)); goto out; } @@ -353,7 +353,7 @@ int certificateIsValid(const char *caPath, const char *certPath) if (err != GNUTLS_E_SUCCESS) err = gnutls_x509_crt_import(cert, &cert_dt, GNUTLS_X509_FMT_DER); if (err != GNUTLS_E_SUCCESS) { - SFL_ERR("Could not read certificate - %s", gnutls_strerror(err)); + RING_ERR("Could not read certificate - %s", gnutls_strerror(err)); goto out; } free(cert_dt.data); @@ -362,7 +362,7 @@ int certificateIsValid(const char *caPath, const char *certPath) /* check if cert is self signed */ self_signed = gnutls_x509_crt_check_issuer(cert, cert); if (!self_signed && !caPath) { - SFL_ERR("Certificate is not self-signed, and CA is not provided."); + RING_ERR("Certificate is not self-signed, and CA is not provided."); goto out; } if (caPath) { @@ -373,7 +373,7 @@ int certificateIsValid(const char *caPath, const char *certPath) err = gnutls_x509_crt_init(&ca); if (err != GNUTLS_E_SUCCESS) { - SFL_ERR("Could not init CA - %s", gnutls_strerror(err)); + RING_ERR("Could not init CA - %s", gnutls_strerror(err)); goto out; } @@ -381,7 +381,7 @@ int certificateIsValid(const char *caPath, const char *certPath) if (err != GNUTLS_E_SUCCESS) err = gnutls_x509_crt_import(ca, &ca_dt, GNUTLS_X509_FMT_DER); if (err != GNUTLS_E_SUCCESS) { - SFL_ERR("Could not read CA - %s", gnutls_strerror(err)); + RING_ERR("Could not read CA - %s", gnutls_strerror(err)); goto out; } free(ca_dt.data); @@ -390,33 +390,33 @@ int certificateIsValid(const char *caPath, const char *certPath) /* Check if the CA is the issuer of certificate. */ self_signed = gnutls_x509_crt_check_issuer(cert, ca); if (!self_signed) { - SFL_ERR("Certificate is not issued by the provided CA."); + RING_ERR("Certificate is not issued by the provided CA."); goto out; } /* Verify the certificate with its issuer. */ err = gnutls_x509_crt_verify(cert, &ca, 1, 0, &output); if (err < 0) { - SFL_ERR("Could not verify cert: %s", gnutls_strerror(err)); + RING_ERR("Could not verify cert: %s", gnutls_strerror(err)); goto out; } if (output & GNUTLS_CERT_INVALID) { - SFL_ERR("Verification failed."); + RING_ERR("Verification failed."); if (output & GNUTLS_CERT_SIGNER_NOT_FOUND) - SFL_ERR("The certificate hasn't got a known issuer."); + RING_ERR("The certificate hasn't got a known issuer."); if (output & GNUTLS_CERT_SIGNER_NOT_CA) - SFL_ERR("The certificate issuer is not a CA."); + RING_ERR("The certificate issuer is not a CA."); if (output & GNUTLS_CERT_REVOKED) - SFL_ERR("The certificate has been revoked."); + RING_ERR("The certificate has been revoked."); if (output & GNUTLS_CERT_EXPIRED) - SFL_ERR("The certificate has expired."); + RING_ERR("The certificate has expired."); if (output & GNUTLS_CERT_NOT_ACTIVATED) - SFL_ERR("The certificate is not yet activated."); + RING_ERR("The certificate is not yet activated."); goto out; } } - SFL_DBG("Certificate from %s seems valid.", certPath); + RING_DBG("Certificate from %s seems valid.", certPath); crypto_cert_print_issuer(cert, ca); res = 0; out: @@ -454,14 +454,14 @@ int verifyHostnameCertificate(const char *host, const uint16_t port) struct timeval tv; if (!host || !port) { - SFL_ERR("Wrong parameters used - host %s, port %d.", host, port); + RING_ERR("Wrong parameters used - host %s, port %d.", host, port); return res; } /* Create the socket. */ sockfd = socket (PF_INET, SOCK_STREAM, 0); if (sockfd < 0) { - SFL_ERR("Could not create socket."); + RING_ERR("Could not create socket."); return res; } /* Set non-blocking so we can dected timeouts. */ @@ -478,7 +478,7 @@ int verifyHostnameCertificate(const char *host, const uint16_t port) name.sin_port = htons(port); hostinfo = gethostbyname(host); if (hostinfo == NULL) { - SFL_ERR("Unknown host %s.", host); + RING_ERR("Unknown host %s.", host); goto out; } name.sin_addr = *(struct in_addr *)hostinfo->h_addr; @@ -494,7 +494,7 @@ int verifyHostnameCertificate(const char *host, const uint16_t port) tv.tv_usec = 0; err = select(sockfd + 1, NULL, &fdset, NULL, &tv); if (err < 0 && errno != EINTR) { - SFL_ERR("Could not connect to hostname %s at port %d", + RING_ERR("Could not connect to hostname %s at port %d", host, port); goto out; } else if (err > 0) { @@ -504,17 +504,17 @@ int verifyHostnameCertificate(const char *host, const uint16_t port) getsockopt(sockfd, SOL_SOCKET, SO_ERROR, &so_error, &len); if (so_error) { - SFL_ERR("Connection delayed."); + RING_ERR("Connection delayed."); goto out; } break; // exit do-while loop } else { - SFL_ERR("Connection timeout."); + RING_ERR("Connection timeout."); goto out; } } while(1); } else { - SFL_ERR("Could not connect to hostname %s at port %d", host, port); + RING_ERR("Could not connect to hostname %s at port %d", host, port); goto out; } } @@ -529,45 +529,45 @@ int verifyHostnameCertificate(const char *host, const uint16_t port) /* Disable Nagle algorithm that slows down the SSL handshake. */ err = setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, &one, sizeof(one)); if (err < 0) { - SFL_ERR("Could not set TCP_NODELAY."); + RING_ERR("Could not set TCP_NODELAY."); goto out; } err = gnutls_global_init(); if (err != GNUTLS_E_SUCCESS) { - SFL_ERR("Could not init GnuTLS - %s", gnutls_strerror(err)); + RING_ERR("Could not init GnuTLS - %s", gnutls_strerror(err)); goto out; } /* Load the trusted CA certificates. */ err = gnutls_certificate_allocate_credentials(&cred); if (err != GNUTLS_E_SUCCESS) { - SFL_ERR("Could not allocate credentials - %s", gnutls_strerror(err)); + RING_ERR("Could not allocate credentials - %s", gnutls_strerror(err)); goto out; } err = crypto_cert_load_trusted(cred); if (err != GNUTLS_E_SUCCESS) { - SFL_ERR("Could not load credentials."); + RING_ERR("Could not load credentials."); goto out; } /* Create the session object. */ err = gnutls_init(&session, GNUTLS_CLIENT); if (err != GNUTLS_E_SUCCESS) { - SFL_ERR("Could not init session -%s\n", gnutls_strerror(err)); + RING_ERR("Could not init session -%s\n", gnutls_strerror(err)); goto out; } /* Configure the cipher preferences. The default set should be good enough. */ err = gnutls_priority_set_direct(session, "NORMAL", &errptr); if (err != GNUTLS_E_SUCCESS) { - SFL_ERR("Could not set up ciphers - %s (%s)", gnutls_strerror(err), errptr); + RING_ERR("Could not set up ciphers - %s (%s)", gnutls_strerror(err), errptr); goto out; } /* Install the trusted certificates. */ err = gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, cred); if (err != GNUTLS_E_SUCCESS) { - SFL_ERR("Could not set up credentials - %s", gnutls_strerror(err)); + RING_ERR("Could not set up credentials - %s", gnutls_strerror(err)); goto out; } @@ -575,28 +575,28 @@ int verifyHostnameCertificate(const char *host, const uint16_t port) gnutls_transport_set_ptr(session, (gnutls_transport_ptr_t) (uintptr_t) sockfd); err = gnutls_server_name_set(session, GNUTLS_NAME_DNS, host, strlen(host)); if (err != GNUTLS_E_SUCCESS) { - SFL_ERR("Could not set server name - %s", gnutls_strerror(err)); + RING_ERR("Could not set server name - %s", gnutls_strerror(err)); goto out; } /* Establish the connection. */ err = gnutls_handshake(session); if (err != GNUTLS_E_SUCCESS) { - SFL_ERR("Handshake failed - %s", gnutls_strerror(err)); + RING_ERR("Handshake failed - %s", gnutls_strerror(err)); goto out; } /* Obtain the server certificate chain. The server certificate * itself is stored in the first element of the array. */ certs = gnutls_certificate_get_peers(session, &certslen); if (certs == NULL || certslen == 0) { - SFL_ERR("Could not obtain peer certificate - %s", gnutls_strerror(err)); + RING_ERR("Could not obtain peer certificate - %s", gnutls_strerror(err)); goto out; } /* Validate the certificate chain. */ err = gnutls_certificate_verify_peers2(session, &status); if (err != GNUTLS_E_SUCCESS) { - SFL_ERR("Could not verify the certificate chain - %s", gnutls_strerror(err)); + RING_ERR("Could not verify the certificate chain - %s", gnutls_strerror(err)); goto out; } if (status != 0) { @@ -608,11 +608,11 @@ int verifyHostnameCertificate(const char *host, const uint16_t port) err = -1; #endif if (err == 0) { - SFL_ERR("Certificate validation failed - %s\n", msg.data); + RING_ERR("Certificate validation failed - %s\n", msg.data); gnutls_free(msg.data); goto out; } else { - SFL_ERR("Certificate validation failed with code 0x%x.", status); + RING_ERR("Certificate validation failed with code 0x%x.", status); goto out; } } @@ -624,7 +624,7 @@ int verifyHostnameCertificate(const char *host, const uint16_t port) err = gnutls_x509_crt_init(&cert); if (err != GNUTLS_E_SUCCESS) { - SFL_ERR("Could not init certificate - %s", gnutls_strerror(err)); + RING_ERR("Could not init certificate - %s", gnutls_strerror(err)); goto out; } @@ -633,13 +633,13 @@ int verifyHostnameCertificate(const char *host, const uint16_t port) if (err != GNUTLS_E_SUCCESS) err = gnutls_x509_crt_import(cert, certs, GNUTLS_X509_FMT_DER); if (err != GNUTLS_E_SUCCESS) { - SFL_ERR("Could not read peer certificate - %s", gnutls_strerror(err)); + RING_ERR("Could not read peer certificate - %s", gnutls_strerror(err)); goto out; } /* Finally check if the hostnames match. */ err = gnutls_x509_crt_check_hostname(cert, host); if (err == 0) { - SFL_ERR("Hostname %s does not match certificate.", host); + RING_ERR("Hostname %s does not match certificate.", host); goto out; } @@ -647,16 +647,16 @@ int verifyHostnameCertificate(const char *host, const uint16_t port) snprintf(buf, sizeof(buf), "GET / HTTP/1.0\r\nHost: %s\r\n\r\n", host); err = gnutls_record_send(session, buf, strlen(buf)); if (err < 0) { - SFL_ERR("Send failed - %s", gnutls_strerror(err)); + RING_ERR("Send failed - %s", gnutls_strerror(err)); goto out; } err = gnutls_record_recv(session, buf, sizeof(buf)); if (err < 0) { - SFL_ERR("Recv failed - %s", gnutls_strerror(err)); + RING_ERR("Recv failed - %s", gnutls_strerror(err)); goto out; } - SFL_DBG("Hostname %s seems to point to a valid server.", host); + RING_DBG("Hostname %s seems to point to a valid server.", host); res = 0; out: if (session) { diff --git a/daemon/src/sip/tlsvalidation.h b/daemon/src/sip/tlsvalidation.h index 3b0a67eafdf3dd4d4829a9f54b958d8b791b164f..2549733f6399579389da6e1375dd2a0ec5d0bf0e 100644 --- a/daemon/src/sip/tlsvalidation.h +++ b/daemon/src/sip/tlsvalidation.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2014 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * * Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com> * Vittorio Giovara <vittorio.giovara@savoirfairelinux.com> diff --git a/daemon/src/sip/tlsvalidator.cpp b/daemon/src/sip/tlsvalidator.cpp index f7392ff642af3ad565a5a240e492b5c8b5bf4475..3549a960171bfe2c309e60d94d4818895ff9e74b 100644 --- a/daemon/src/sip/tlsvalidator.cpp +++ b/daemon/src/sip/tlsvalidator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2014 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * * Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com> * Vittorio Giovara <vittorio.giovara@savoirfairelinux.com> @@ -61,7 +61,7 @@ #include <gnutls/gnutls.h> #include <gnutls/x509.h> -const sfl::EnumClassNames<TlsValidator::CheckValues> TlsValidator::CheckValuesNames = {{ +const ring::EnumClassNames<TlsValidator::CheckValues> TlsValidator::CheckValuesNames = {{ /* CheckValues Name */ /* PASSED */ "PASSED" , /* FAILED */ "FAILED" , @@ -71,7 +71,7 @@ const sfl::EnumClassNames<TlsValidator::CheckValues> TlsValidator::CheckValuesNa /* CUSTOM */ "DATE" , }}; -const sfl::CallbackMatrix1D<TlsValidator::CertificateCheck, TlsValidator, TlsValidator::CheckResult> TlsValidator::checkCallback = {{ +const ring::CallbackMatrix1D<TlsValidator::CertificateCheck, TlsValidator, TlsValidator::CheckResult> TlsValidator::checkCallback = {{ /* CertificateCheck Callback */ /*HAS_PRIVATE_KEY */ &TlsValidator::hasPrivateKey , /*EXPIRED */ &TlsValidator::notExpired , @@ -98,7 +98,7 @@ const sfl::CallbackMatrix1D<TlsValidator::CertificateCheck, TlsValidator, TlsVal }}; -const sfl::CallbackMatrix1D<TlsValidator::CertificateDetails, TlsValidator, TlsValidator::CheckResult> TlsValidator::getterCallback = {{ +const ring::CallbackMatrix1D<TlsValidator::CertificateDetails, TlsValidator, TlsValidator::CheckResult> TlsValidator::getterCallback = {{ /* EXPIRATION_DATE */ &TlsValidator::getExpirationDate , /* ACTIVATION_DATE */ &TlsValidator::getActivationDate , /* REQUIRE_PRIVATE_KEY_PASSWORD */ &TlsValidator::requirePrivateKeyPassword , @@ -118,7 +118,7 @@ const sfl::CallbackMatrix1D<TlsValidator::CertificateDetails, TlsValidator, TlsV /* NEXT_EXPECTED_UPDATE_DATE */ &TlsValidator::getIssuerDN , // TODO }}; -const sfl::Matrix1D<TlsValidator::CertificateCheck, TlsValidator::CheckValuesType> TlsValidator::enforcedCheckType = {{ +const ring::Matrix1D<TlsValidator::CertificateCheck, TlsValidator::CheckValuesType> TlsValidator::enforcedCheckType = {{ /* CertificateCheck Callback */ /*HAS_PRIVATE_KEY */ CheckValuesType::BOOLEAN , /*EXPIRED */ CheckValuesType::BOOLEAN , @@ -147,7 +147,7 @@ const sfl::Matrix1D<TlsValidator::CertificateCheck, TlsValidator::CheckValuesTyp /*NOT_ACTIVATED */ CheckValuesType::BOOLEAN , }}; -const sfl::EnumClassNames<TlsValidator::CertificateCheck> TlsValidator::CertificateCheckNames = {{ +const ring::EnumClassNames<TlsValidator::CertificateCheck> TlsValidator::CertificateCheckNames = {{ /* CertificateCheck Name */ /*HAS_PRIVATE_KEY */ "HAS_PRIVATE_KEY" , /*EXPIRED */ "EXPIRED" , @@ -176,7 +176,7 @@ const sfl::EnumClassNames<TlsValidator::CertificateCheck> TlsValidator::Certific /*NOT_ACTIVATED */ "NOT_ACTIVATED" , }}; -const sfl::EnumClassNames<TlsValidator::CertificateDetails> TlsValidator::CertificateDetailsNames = {{ +const ring::EnumClassNames<TlsValidator::CertificateDetails> TlsValidator::CertificateDetailsNames = {{ /* EXPIRATION_DATE */ "EXPIRATION_DATE" , /* ACTIVATION_DATE */ "ACTIVATION_DATE" , /* REQUIRE_PRIVATE_KEY_PASSWORD */ "REQUIRE_PRIVATE_KEY_PASSWORD" , @@ -196,7 +196,7 @@ const sfl::EnumClassNames<TlsValidator::CertificateDetails> TlsValidator::Certif /* NEXT_EXPECTED_UPDATE_DATE */ "NEXT_EXPECTED_UPDATE_DATE" , }}; -const sfl::EnumClassNames<const TlsValidator::CheckValuesType> TlsValidator::CheckValuesTypeNames = {{ +const ring::EnumClassNames<const TlsValidator::CheckValuesType> TlsValidator::CheckValuesTypeNames = {{ /* Type Name */ /* BOOLEAN */ "BOOLEAN" , /* ISO_DATE */ "ISO_DATE" , @@ -204,7 +204,7 @@ const sfl::EnumClassNames<const TlsValidator::CheckValuesType> TlsValidator::Che /* NUMBER */ "NUMBER" , }}; -const sfl::Matrix2D<TlsValidator::CheckValuesType , TlsValidator::CheckValues , bool> TlsValidator::acceptedCheckValuesResult = {{ +const ring::Matrix2D<TlsValidator::CheckValuesType , TlsValidator::CheckValues , bool> TlsValidator::acceptedCheckValuesResult = {{ /* Type PASSED FAILED UNSUPPORTED ISO_DATE CUSTOM NUMBER */ /* BOOLEAN */ {{ true , true , true , false , false ,false }}, /* ISO_DATE */ {{ false , false , true , true , false , false }}, @@ -277,11 +277,11 @@ std::string TlsValidator::getStringValue(const TlsValidator::CertificateCheck ch */ bool TlsValidator::isValid(bool verbose) { - for (const CertificateCheck check : sfl::Matrix0D<CertificateCheck>()) { + for (const CertificateCheck check : ring::Matrix0D<CertificateCheck>()) { if (enforcedCheckType[check] == CheckValuesType::BOOLEAN) { if (((this->*(checkCallback[check]))()).first == CheckValues::FAILED) { if (verbose) - SFL_WARN("Check failed: %s", CertificateCheckNames[check]); + RING_WARN("Check failed: %s", CertificateCheckNames[check]); return false; } } @@ -301,7 +301,7 @@ std::map<std::string,std::string> TlsValidator::getSerializedChecks() = getStringValue(CertificateCheck::EXIST, exist()); } else { - for (const CertificateCheck check : sfl::Matrix0D<CertificateCheck>()) + for (const CertificateCheck check : ring::Matrix0D<CertificateCheck>()) ret[CertificateCheckNames[check]] = getStringValue(check,(this->*(checkCallback[check]))()); } @@ -315,7 +315,7 @@ std::map<std::string,std::string> TlsValidator::getSerializedDetails() { std::map<std::string,std::string> ret; if (certificateFound_) { - for (const CertificateDetails det : sfl::Matrix0D<CertificateDetails>()) { + for (const CertificateDetails det : ring::Matrix0D<CertificateDetails>()) { const CheckResult r = (this->*(getterCallback[det]))(); std::string val; // TODO move this to a fuction @@ -369,14 +369,14 @@ static int crypto_cert_print_issuer(gnutls_x509_crt_t cert, name_size = sizeof(name); gnutls_x509_crt_get_dn(cert, name, &name_size); - SFL_DBG("Subject: %s", name); - SFL_DBG("Issuer: %s", issuer_name); + RING_DBG("Subject: %s", name); + RING_DBG("Issuer: %s", issuer_name); if (issuer != nullptr) { issuer_name_size = sizeof(issuer_name); gnutls_x509_crt_get_dn(issuer, issuer_name, &issuer_name_size); - SFL_DBG("Verified against: %s", issuer_name); + RING_DBG("Verified against: %s", issuer_name); } return 0; @@ -482,14 +482,14 @@ int TlsValidator::verifyHostnameCertificate(const std::string& host, const uint1 struct timeval tv; if (!host.size() || !port) { - SFL_ERR("Wrong parameters used - host %s, port %d.", host.c_str(), port); + RING_ERR("Wrong parameters used - host %s, port %d.", host.c_str(), port); return res; } /* Create the socket. */ sockfd = socket (PF_INET, SOCK_STREAM, 0); if (sockfd < 0) { - SFL_ERR("Could not create socket."); + RING_ERR("Could not create socket."); return res; } /* Set non-blocking so we can dected timeouts. */ @@ -506,7 +506,7 @@ int TlsValidator::verifyHostnameCertificate(const std::string& host, const uint1 name.sin_port = htons(port); hostinfo = gethostbyname(host.c_str()); if (hostinfo == nullptr) { - SFL_ERR("Unknown host %s.", host.c_str()); + RING_ERR("Unknown host %s.", host.c_str()); goto out; } name.sin_addr = *(struct in_addr *)hostinfo->h_addr; @@ -522,7 +522,7 @@ int TlsValidator::verifyHostnameCertificate(const std::string& host, const uint1 tv.tv_usec = 0; err = select(sockfd + 1, nullptr, &fdset, nullptr, &tv); if (err < 0 && errno != EINTR) { - SFL_ERR("Could not connect to hostname %s at port %d", + RING_ERR("Could not connect to hostname %s at port %d", host.c_str(), port); goto out; } else if (err > 0) { @@ -532,17 +532,17 @@ int TlsValidator::verifyHostnameCertificate(const std::string& host, const uint1 getsockopt(sockfd, SOL_SOCKET, SO_ERROR, &so_error, &len); if (so_error) { - SFL_ERR("Connection delayed."); + RING_ERR("Connection delayed."); goto out; } break; // exit do-while loop } else { - SFL_ERR("Connection timeout."); + RING_ERR("Connection timeout."); goto out; } } while(1); } else { - SFL_ERR("Could not connect to hostname %s at port %d", host.c_str(), port); + RING_ERR("Could not connect to hostname %s at port %d", host.c_str(), port); goto out; } } @@ -557,7 +557,7 @@ int TlsValidator::verifyHostnameCertificate(const std::string& host, const uint1 /* Disable Nagle algorithm that slows down the SSL handshake. */ err = setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, &one, sizeof(one)); if (err < 0) { - SFL_ERR("Could not set TCP_NODELAY."); + RING_ERR("Could not set TCP_NODELAY."); goto out; } @@ -565,33 +565,33 @@ int TlsValidator::verifyHostnameCertificate(const std::string& host, const uint1 /* Load the trusted CA certificates. */ err = gnutls_certificate_allocate_credentials(&cred); if (err != GNUTLS_E_SUCCESS) { - SFL_ERR("Could not allocate credentials - %s", gnutls_strerror(err)); + RING_ERR("Could not allocate credentials - %s", gnutls_strerror(err)); goto out; } err = gnutls_certificate_set_x509_system_trust(cred); if (err != GNUTLS_E_SUCCESS) { - SFL_ERR("Could not load credentials."); + RING_ERR("Could not load credentials."); goto out; } /* Create the session object. */ err = gnutls_init(&session, GNUTLS_CLIENT); if (err != GNUTLS_E_SUCCESS) { - SFL_ERR("Could not init session -%s\n", gnutls_strerror(err)); + RING_ERR("Could not init session -%s\n", gnutls_strerror(err)); goto out; } /* Configure the cipher preferences. The default set should be good enough. */ err = gnutls_priority_set_direct(session, "NORMAL", &errptr); if (err != GNUTLS_E_SUCCESS) { - SFL_ERR("Could not set up ciphers - %s (%s)", gnutls_strerror(err), errptr); + RING_ERR("Could not set up ciphers - %s (%s)", gnutls_strerror(err), errptr); goto out; } /* Install the trusted certificates. */ err = gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, cred); if (err != GNUTLS_E_SUCCESS) { - SFL_ERR("Could not set up credentials - %s", gnutls_strerror(err)); + RING_ERR("Could not set up credentials - %s", gnutls_strerror(err)); goto out; } @@ -599,28 +599,28 @@ int TlsValidator::verifyHostnameCertificate(const std::string& host, const uint1 gnutls_transport_set_ptr(session, (gnutls_transport_ptr_t) (uintptr_t) sockfd); err = gnutls_server_name_set(session, GNUTLS_NAME_DNS, host.c_str(), host.size()); if (err != GNUTLS_E_SUCCESS) { - SFL_ERR("Could not set server name - %s", gnutls_strerror(err)); + RING_ERR("Could not set server name - %s", gnutls_strerror(err)); goto out; } /* Establish the connection. */ err = gnutls_handshake(session); if (err != GNUTLS_E_SUCCESS) { - SFL_ERR("Handshake failed - %s", gnutls_strerror(err)); + RING_ERR("Handshake failed - %s", gnutls_strerror(err)); goto out; } /* Obtain the server certificate chain. The server certificate * itself is stored in the first element of the array. */ certs = gnutls_certificate_get_peers(session, &certslen); if (certs == nullptr || certslen == 0) { - SFL_ERR("Could not obtain peer certificate - %s", gnutls_strerror(err)); + RING_ERR("Could not obtain peer certificate - %s", gnutls_strerror(err)); goto out; } /* Validate the certificate chain. */ err = gnutls_certificate_verify_peers2(session, &status); if (err != GNUTLS_E_SUCCESS) { - SFL_ERR("Could not verify the certificate chain - %s", gnutls_strerror(err)); + RING_ERR("Could not verify the certificate chain - %s", gnutls_strerror(err)); goto out; } if (status != 0) { @@ -632,11 +632,11 @@ int TlsValidator::verifyHostnameCertificate(const std::string& host, const uint1 err = -1; #endif if (err == 0) { - SFL_ERR("Certificate validation failed - %s\n", msg.data); + RING_ERR("Certificate validation failed - %s\n", msg.data); gnutls_free(msg.data); goto out; } else { - SFL_ERR("Certificate validation failed with code 0x%x.", status); + RING_ERR("Certificate validation failed with code 0x%x.", status); goto out; } } @@ -648,7 +648,7 @@ int TlsValidator::verifyHostnameCertificate(const std::string& host, const uint1 err = gnutls_x509_crt_init(&cert); if (err != GNUTLS_E_SUCCESS) { - SFL_ERR("Could not init certificate - %s", gnutls_strerror(err)); + RING_ERR("Could not init certificate - %s", gnutls_strerror(err)); goto out; } @@ -657,13 +657,13 @@ int TlsValidator::verifyHostnameCertificate(const std::string& host, const uint1 if (err != GNUTLS_E_SUCCESS) err = gnutls_x509_crt_import(cert, certs, GNUTLS_X509_FMT_DER); if (err != GNUTLS_E_SUCCESS) { - SFL_ERR("Could not read peer certificate - %s", gnutls_strerror(err)); + RING_ERR("Could not read peer certificate - %s", gnutls_strerror(err)); goto out; } /* Finally check if the hostnames match. */ err = gnutls_x509_crt_check_hostname(cert, host.c_str()); if (err == 0) { - SFL_ERR("Hostname %s does not match certificate.", host.c_str()); + RING_ERR("Hostname %s does not match certificate.", host.c_str()); goto out; } @@ -671,16 +671,16 @@ int TlsValidator::verifyHostnameCertificate(const std::string& host, const uint1 snprintf(buf, sizeof(buf), "GET / HTTP/1.0\r\nHost: %s\r\n\r\n", host.c_str()); err = gnutls_record_send(session, buf, strlen(buf)); if (err < 0) { - SFL_ERR("Send failed - %s", gnutls_strerror(err)); + RING_ERR("Send failed - %s", gnutls_strerror(err)); goto out; } err = gnutls_record_recv(session, buf, sizeof(buf)); if (err < 0) { - SFL_ERR("Recv failed - %s", gnutls_strerror(err)); + RING_ERR("Recv failed - %s", gnutls_strerror(err)); goto out; } - SFL_DBG("Hostname %s seems to point to a valid server.", host.c_str()); + RING_DBG("Hostname %s seems to point to a valid server.", host.c_str()); res = 0; out: if (session) { @@ -709,7 +709,7 @@ TlsValidator::CheckResult TlsValidator::hasPrivateKey() return CheckResult(CheckValues::FAILED, e.what()); } - SFL_DBG("Key from %s seems valid.", certificatePath_.c_str()); + RING_DBG("Key from %s seems valid.", certificatePath_.c_str()); return CheckResult(CheckValues::PASSED, ""); } diff --git a/daemon/src/sip/tlsvalidator.h b/daemon/src/sip/tlsvalidator.h index 9bb0c78324319ba5a7e926ea9b85f97311fc805f..3283d1b521845246deaedd7c072220fcd6070499 100644 --- a/daemon/src/sip/tlsvalidator.h +++ b/daemon/src/sip/tlsvalidator.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2014 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * * Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com> * Vittorio Giovara <vittorio.giovara@savoirfairelinux.com> @@ -197,30 +197,30 @@ public: private: // Enum class names - static const sfl::EnumClassNames<CertificateCheck> CertificateCheckNames; + static const ring::EnumClassNames<CertificateCheck> CertificateCheckNames; - static const sfl::EnumClassNames<CertificateDetails> CertificateDetailsNames; + static const ring::EnumClassNames<CertificateDetails> CertificateDetailsNames; - static const sfl::EnumClassNames<const CheckValuesType> CheckValuesTypeNames; + static const ring::EnumClassNames<const CheckValuesType> CheckValuesTypeNames; - static const sfl::EnumClassNames<CheckValues> CheckValuesNames; + static const ring::EnumClassNames<CheckValues> CheckValuesNames; /** * Map check to their check method */ - static const sfl::CallbackMatrix1D<CertificateCheck, TlsValidator, CheckResult> checkCallback; + static const ring::CallbackMatrix1D<CertificateCheck, TlsValidator, CheckResult> checkCallback; /** * Map check to their getter method */ - static const sfl::CallbackMatrix1D<CertificateDetails, TlsValidator, CheckResult> getterCallback; + static const ring::CallbackMatrix1D<CertificateDetails, TlsValidator, CheckResult> getterCallback; /** * Valid values for each categories */ - static const sfl::Matrix2D<CheckValuesType , CheckValues , bool> acceptedCheckValuesResult; + static const ring::Matrix2D<CheckValuesType , CheckValues , bool> acceptedCheckValuesResult; - static const sfl::Matrix1D<CertificateCheck, CheckValuesType> enforcedCheckType; + static const ring::Matrix1D<CertificateCheck, CheckValuesType> enforcedCheckType; std::string certificatePath_; std::string privateKeyPath_; diff --git a/daemon/src/string_utils.cpp b/daemon/src/string_utils.cpp index f25b9c1cc4ec35f8a47e7f7c57edb651c67b9e93..b9699a5cc486e945a311c39d2785c0309f0da271 100644 --- a/daemon/src/string_utils.cpp +++ b/daemon/src/string_utils.cpp @@ -32,7 +32,7 @@ #include "string_utils.h" #include <sstream> -namespace sfl { +namespace ring { std::vector<std::string> split_string(const std::string &s, char delim) diff --git a/daemon/src/string_utils.h b/daemon/src/string_utils.h index 811c6c1b35deec1b57d96a9f56d156480287344b..af5ae328c2f48f9ef8c49135b4b7eaaa378d3034 100644 --- a/daemon/src/string_utils.h +++ b/daemon/src/string_utils.h @@ -39,7 +39,7 @@ #include <sstream> #endif -namespace sfl { +namespace ring { #ifdef __ANDROID__ diff --git a/daemon/src/threadloop.cpp b/daemon/src/threadloop.cpp index f2950d3aba060046d9e7ccaed4a03e55dab5d740..0cfe1071b66a3b6d1cc6201a10236661559a62c2 100644 --- a/daemon/src/threadloop.cpp +++ b/daemon/src/threadloop.cpp @@ -40,10 +40,10 @@ void ThreadLoop::mainloop() process_(); cleanup_(); } else { - SFL_ERR("setup failed"); + RING_ERR("setup failed"); } } catch (const ThreadLoopException &e) { - SFL_ERR("%s", e.what()); + RING_ERR("%s", e.what()); } } @@ -56,7 +56,7 @@ ThreadLoop::ThreadLoop(const std::function<bool()> &setup, ThreadLoop::~ThreadLoop() { if (isRunning()) { - SFL_ERR("join() should be explicitly called in owner's destructor"); + RING_ERR("join() should be explicitly called in owner's destructor"); join(); } } @@ -69,7 +69,7 @@ void ThreadLoop::start() thread_.join(); thread_ = std::thread(&ThreadLoop::mainloop, this); } else { - SFL_ERR("Thread already started"); + RING_ERR("Thread already started"); } } diff --git a/daemon/src/threadloop.h b/daemon/src/threadloop.h index 80de6be579c79fdf3239575fc25f5ea5eaf915a3..c4f6d36e0ed4d58bb549f598e704e366ecbb6eca 100644 --- a/daemon/src/threadloop.h +++ b/daemon/src/threadloop.h @@ -40,7 +40,7 @@ // FIXME: this is ugly // If condition A is false, print the error message in M and exit thread #define EXIT_IF_FAIL(A, M, ...) if (!(A)) { \ - SFL_ERR(M, ##__VA_ARGS__); loop_.exit(); } + RING_ERR(M, ##__VA_ARGS__); loop_.exit(); } struct ThreadLoopException : public std::runtime_error { ThreadLoopException() : std::runtime_error("ThreadLoopException") {} diff --git a/daemon/src/video/libav_utils.cpp b/daemon/src/video/libav_utils.cpp index 8f82c4f28828de40755e0c87c8dacf7a30db0e68..d97eccd11d3d57d501b073b573493306dedb0160 100644 --- a/daemon/src/video/libav_utils.cpp +++ b/daemon/src/video/libav_utils.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Tristan Matthews <tristan.matthews@savoirfairelinux.com> * Author: Luca Barbato <lu_zero@gentoo.org> * Author: Guillaume Roguez <Guillaume.Roguez@savoirfairelinux.com> @@ -55,7 +55,7 @@ findInstalledVideoCodecs() if (std::find(libav_codecs.begin(), libav_codecs.end(), it.second) != libav_codecs.end()) installed_video_codecs_.push_back(it.first); else - SFL_ERR("Didn't find \"%s\" encoder", it.second.c_str()); + RING_ERR("Didn't find \"%s\" encoder", it.second.c_str()); } } diff --git a/daemon/src/video/libav_utils.h b/daemon/src/video/libav_utils.h index 884824d461454007cf394a762235e294b6533066..2327c086155b74cef652c063ceb363817e896e45 100644 --- a/daemon/src/video/libav_utils.h +++ b/daemon/src/video/libav_utils.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Tristan Matthews <tristan.matthews@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify diff --git a/daemon/src/video/shm_sink.cpp b/daemon/src/video/shm_sink.cpp index 0152e321e97057063894fb82bd989ae712369b4e..71baaf2dad6c5a0ad7686b3fc8b136a78510c92b 100644 --- a/daemon/src/video/shm_sink.cpp +++ b/daemon/src/video/shm_sink.cpp @@ -51,7 +51,7 @@ #include <cerrno> #include <cstring> -namespace sfl_video { +namespace ring { namespace video { SHMSink::SHMSink(const std::string &shm_name) : shm_name_(shm_name) @@ -73,7 +73,7 @@ SHMSink::~SHMSink() bool SHMSink::start() { if (fd_ != -1) { - SFL_ERR("fd must be -1"); + RING_ERR("fd must be -1"); return false; } @@ -83,7 +83,7 @@ bool SHMSink::start() if (not shm_name_.empty()) { fd_ = shm_open(shm_name_.c_str(), flags, perms); if (fd_ < 0) { - SFL_ERR("could not open shm area \"%s\"", shm_name_.c_str()); + RING_ERR("could not open shm area \"%s\"", shm_name_.c_str()); strErr(); return false; } @@ -100,13 +100,13 @@ bool SHMSink::start() } } - SFL_DBG("Using name %s", shm_name_.c_str()); + RING_DBG("Using name %s", shm_name_.c_str()); opened_name_ = shm_name_; shm_area_len_ = sizeof(SHMHeader); if (ftruncate(fd_, shm_area_len_)) { - SFL_ERR("Could not make shm area large enough for header"); + RING_ERR("Could not make shm area large enough for header"); strErr(); return false; } @@ -114,17 +114,17 @@ bool SHMSink::start() shm_area_ = static_cast<SHMHeader*>(mmap(NULL, shm_area_len_, PROT_READ | PROT_WRITE, MAP_SHARED, fd_, 0)); if (shm_area_ == MAP_FAILED) { - SFL_ERR("Could not map shm area, mmap failed"); + RING_ERR("Could not map shm area, mmap failed"); return false; } memset(shm_area_, 0, shm_area_len_); if (sem_init(&shm_area_->notification, 1, 0) != 0) { - SFL_ERR("sem_init: notification initialization failed"); + RING_ERR("sem_init: notification initialization failed"); return false; } if (sem_init(&shm_area_->mutex, 1, 1) != 0) { - SFL_ERR("sem_init: mutex initialization failed"); + RING_ERR("sem_init: mutex initialization failed"); return false; } return true; @@ -158,13 +158,13 @@ bool SHMSink::resize_area(size_t desired_length) shm_unlock(); if (munmap(shm_area_, shm_area_len_)) { - SFL_ERR("Could not unmap shared area"); + RING_ERR("Could not unmap shared area"); strErr(); return false; } if (ftruncate(fd_, desired_length)) { - SFL_ERR("Could not resize shared area"); + RING_ERR("Could not resize shared area"); strErr(); return false; } @@ -174,7 +174,7 @@ bool SHMSink::resize_area(size_t desired_length) if (shm_area_ == MAP_FAILED) { shm_area_ = 0; - SFL_ERR("Could not remap shared area"); + RING_ERR("Could not remap shared area"); return false; } @@ -209,7 +209,7 @@ void SHMSink::render_frame(VideoFrame& src) shm_lock(); if (!resize_area(sizeof(SHMHeader) + bytes)) { - SFL_ERR("Could not resize area"); + RING_ERR("Could not resize area"); return; } @@ -221,7 +221,7 @@ void SHMSink::render_frame(VideoFrame& src) const std::chrono::duration<double> seconds = currentTime - lastFrameDebug_; frameCount_++; if (seconds.count() > 1) { - SFL_DBG("%s: FPS %f", shm_name_.c_str(), frameCount_ / seconds.count()); + RING_DBG("%s: FPS %f", shm_name_.c_str(), frameCount_ / seconds.count()); frameCount_ = 0; lastFrameDebug_ = currentTime; } @@ -238,7 +238,7 @@ void SHMSink::render_callback(VideoProvider &provider, size_t bytes) shm_lock(); if (!resize_area(sizeof(SHMHeader) + bytes)) { - SFL_ERR("Could not resize area"); + RING_ERR("Could not resize area"); return; } @@ -261,4 +261,4 @@ void SHMSink::update(Observable<std::shared_ptr<VideoFrame> >* /*obs*/, std::sha render_frame(*f.get()); } -} +}} diff --git a/daemon/src/video/shm_sink.h b/daemon/src/video/shm_sink.h index 1ad9a690e38014be7db1081e9448ffc7ee7a1899..1951aebc36b3c9fa22df7f29fbe8c9ccba2c0ad2 100644 --- a/daemon/src/video/shm_sink.h +++ b/daemon/src/video/shm_sink.h @@ -45,7 +45,7 @@ class SHMHeader; -namespace sfl_video { +namespace ring { namespace video { class SHMSink : public VideoFramePassiveReader { @@ -82,6 +82,6 @@ private: #endif }; -} +}} #endif // SHM_SINK_H_ diff --git a/daemon/src/video/socket_pair.cpp b/daemon/src/video/socket_pair.cpp index 38f9fa15a3e2b77940233679a8489805d879a03b..9fd08d2e3f259074d92bb2290dae579e24e396de 100644 --- a/daemon/src/video/socket_pair.cpp +++ b/daemon/src/video/socket_pair.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Copyright (c) 2002 Fabrice Bellard * * Author: Tristan Matthews <tristan.matthews@savoirfairelinux.com> @@ -75,7 +75,7 @@ addrinfo* udp_resolve_host(const char *node, int service) hints.ai_flags = AI_PASSIVE; if ((error = getaddrinfo(node, sport, &hints, &res))) { res = NULL; - SFL_ERR("%s\n", gai_strerror(error)); + RING_ERR("%s\n", gai_strerror(error)); } return res; @@ -108,7 +108,7 @@ udp_socket_create(sockaddr_storage *addr, socklen_t *addr_len, int local_port) for (res = res0; res; res=res->ai_next) { udp_fd = socket(res->ai_family, SOCK_DGRAM | SOCK_NONBLOCK, 0); if (udp_fd != -1) break; - SFL_ERR("socket error"); + RING_ERR("socket error"); } if (udp_fd < 0) { @@ -122,7 +122,7 @@ udp_socket_create(sockaddr_storage *addr, socklen_t *addr_len, int local_port) // bind socket so that we send from and receive // on local port if (bind(udp_fd, reinterpret_cast<sockaddr*>(addr), *addr_len) < 0) { - SFL_ERR("Bind failed"); + RING_ERR("Bind failed"); strErr(); close(udp_fd); udp_fd = -1; @@ -133,7 +133,7 @@ udp_socket_create(sockaddr_storage *addr, socklen_t *addr_len, int local_port) return udp_fd; } -namespace sfl_video { +namespace ring { namespace video { static const int RTP_BUFFER_SIZE = 1472; @@ -149,8 +149,8 @@ SocketPair::SocketPair(const char *uri, int localPort) openSockets(uri, localPort); } -SocketPair::SocketPair(std::unique_ptr<sfl::IceSocket> rtp_sock, - std::unique_ptr<sfl::IceSocket> rtcp_sock) +SocketPair::SocketPair(std::unique_ptr<ring::IceSocket> rtp_sock, + std::unique_ptr<ring::IceSocket> rtcp_sock) : rtp_sock_(std::move(rtp_sock)) , rtcp_sock_(std::move(rtcp_sock)) , rtcpWriteMutex_() @@ -206,7 +206,7 @@ void SocketPair::openSockets(const char *uri, int local_rtp_port) throw std::runtime_error("Socket creation failed"); } - SFL_WARN("SocketPair: local{%d,%d}, remote{%d,%d}", + RING_WARN("SocketPair: local{%d,%d}, remote{%d,%d}", local_rtp_port, local_rtcp_port, rtp_port, rtcp_port); } @@ -324,7 +324,7 @@ int SocketPair::readCallback(void *opaque, uint8_t *buf, int buf_size) retry: if (context->interrupted_) { - SFL_ERR("interrupted"); + RING_ERR("interrupted"); return -EINTR; } @@ -384,4 +384,4 @@ retry: return ret < 0 ? errno : ret; } -} +}} diff --git a/daemon/src/video/socket_pair.h b/daemon/src/video/socket_pair.h index 6132635cc0b04f5f25f34aa6c53223a91176c307..c2614a3f2f236c3b704b442f43a2f841766733f5 100644 --- a/daemon/src/video/socket_pair.h +++ b/daemon/src/video/socket_pair.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Copyright (C) 2012 VLC authors and VideoLAN * Author: Tristan Matthews <tristan.matthews@savoirfairelinux.com> * @@ -38,17 +38,17 @@ #include <mutex> #include <stdint.h> -namespace sfl { +namespace ring { class IceSocket; }; -namespace sfl_video { +namespace ring { namespace video { class SocketPair { public: SocketPair(const char *uri, int localPort); - SocketPair(std::unique_ptr<sfl::IceSocket> rtp_sock, - std::unique_ptr<sfl::IceSocket> rtcp_sock); + SocketPair(std::unique_ptr<ring::IceSocket> rtp_sock, + std::unique_ptr<ring::IceSocket> rtcp_sock); ~SocketPair(); void interrupt(); @@ -68,8 +68,8 @@ class SocketPair { int writeRtpData(void *buf, int buf_size); int writeRtcpData(void *buf, int buf_size); - std::unique_ptr<sfl::IceSocket> rtp_sock_; - std::unique_ptr<sfl::IceSocket> rtcp_sock_; + std::unique_ptr<ring::IceSocket> rtp_sock_; + std::unique_ptr<ring::IceSocket> rtcp_sock_; std::mutex rtcpWriteMutex_; @@ -82,6 +82,6 @@ class SocketPair { bool interrupted_ {false}; }; -} +}} #endif // SOCKET_PAIR_H_ diff --git a/daemon/src/video/test/Makefile.am b/daemon/src/video/test/Makefile.am index 0bb6e7ae1cf0739aa1543be60deb781c1d01cc18..89f73dd88c769b70060f4429f7ca5f3d787f318a 100644 --- a/daemon/src/video/test/Makefile.am +++ b/daemon/src/video/test/Makefile.am @@ -4,16 +4,16 @@ TESTS=test_video_endpoint test_shm test_video_input test_video_rtp check_PROGRAMS=test_video_endpoint test_video_rtp test_video_input test_shm test_video_endpoint_SOURCES=test_video_endpoint.cpp test_video_endpoint.h -test_video_endpoint_LDADD=$(top_builddir)/src/libsflphone.la $(top_builddir)/src/video/libvideo.la $(YAML_LIBS) +test_video_endpoint_LDADD=$(top_builddir)/src/libring.la $(top_builddir)/src/video/libvideo.la $(YAML_LIBS) test_video_rtp_SOURCES=test_video_rtp.cpp -test_video_rtp_LDADD=$(top_builddir)/src/libsflphone.la $(top_builddir)/src/video/libvideo.la $(YAML_LIBS) +test_video_rtp_LDADD=$(top_builddir)/src/libring.la $(top_builddir)/src/video/libvideo.la $(YAML_LIBS) test_video_input_SOURCES=test_video_input.cpp test_video_input.h -test_video_input_LDADD=$(top_builddir)/src/libsflphone.la $(top_builddir)/src/video/libvideo.la $(YAML_LIBS) +test_video_input_LDADD=$(top_builddir)/src/libring.la $(top_builddir)/src/video/libvideo.la $(YAML_LIBS) test_shm_SOURCES=test_shm.cpp shm_src.cpp shm_src.h -test_shm_LDADD=$(top_builddir)/src/libsflphone.la $(top_builddir)/src/video/libvideo.la $(YAML_LIBS) -lrt +test_shm_LDADD=$(top_builddir)/src/libring.la $(top_builddir)/src/video/libvideo.la $(YAML_LIBS) -lrt test_shm_CXXFLAGS=$(AM_CXXFLAGS) AM_CXXFLAGS=-I$(top_srcdir)/src/video -I$(top_srcdir)/src diff --git a/daemon/src/video/test/test_shm.cpp b/daemon/src/video/test/test_shm.cpp index 312571024d2609c46036c8df614ff837d2981a2f..a65bed5d5a0cbd36df3c77e9148dfb990b039218 100644 --- a/daemon/src/video/test/test_shm.cpp +++ b/daemon/src/video/test/test_shm.cpp @@ -52,7 +52,7 @@ static const char test_data[] = "abcdefghijklmnopqrstuvwxyz"; static void sink_thread() { - sfl_video::SHMSink sink("bob");; + ring::video::SHMSink sink("bob");; if (!sink.start()) return; std::vector<unsigned char> test_vec(test_data, test_data + sizeof(test_data) / sizeof(test_data[0])); diff --git a/daemon/src/video/test/test_video_input.cpp b/daemon/src/video/test/test_video_input.cpp index f1260c38adb01da83c4076ef975b8463117f1e15..7ba8754d43175b045f6a33756681001f4076890d 100644 --- a/daemon/src/video/test/test_video_input.cpp +++ b/daemon/src/video/test/test_video_input.cpp @@ -39,7 +39,7 @@ using namespace std; void VideoInputTest::testInput() { string resource = "display://" + string(getenv("DISPLAY") ? : ":0.0"); - sfl_video::VideoInput video; + ring::video::VideoInput video; video.switchInput(resource); usleep(10000); } diff --git a/daemon/src/video/test/test_video_rtp.cpp b/daemon/src/video/test/test_video_rtp.cpp index 72551af2d81c61eb90755563d6cd79ef12075fdd..6718f7e47e916a526a426343998901332e44f7c0 100644 --- a/daemon/src/video/test/test_video_rtp.cpp +++ b/daemon/src/video/test/test_video_rtp.cpp @@ -38,8 +38,8 @@ int main () { - sfl_video::VideoDeviceMonitor monitor; - sfl_video::VideoRtpSession session("test", + ring::video::VideoDeviceMonitor monitor; + ring::video::VideoRtpSession session("test", monitor.getSettings(monitor.getDefaultDevice())); session.start(12345); sleep(5); diff --git a/daemon/src/video/v4l2/video_device_impl.cpp b/daemon/src/video/v4l2/video_device_impl.cpp index c75b75ff22a1dfe64ecf1ac03ac216a71b662983..8fdf3768d661079d3dd1659be51090b900e093c3 100644 --- a/daemon/src/video/v4l2/video_device_impl.cpp +++ b/daemon/src/video/v4l2/video_device_impl.cpp @@ -55,7 +55,7 @@ extern "C" { #define ZEROVAR(x) memset(&(x), 0, sizeof(x)) -namespace sfl_video { +namespace ring { namespace video { class VideoV4l2Size { public: @@ -238,7 +238,7 @@ void VideoV4l2Size::getFrameRates(int fd, unsigned int pixel_format) if (ioctl(fd, VIDIOC_ENUM_FRAMEINTERVALS, &frmival)) { rates_.push_back(25); - SFL_ERR("could not query frame interval for size"); + RING_ERR("could not query frame interval for size"); return; } @@ -254,12 +254,12 @@ void VideoV4l2Size::getFrameRates(int fd, unsigned int pixel_format) case V4L2_FRMIVAL_TYPE_CONTINUOUS: rates_.push_back(25); // TODO - SFL_ERR("Continuous Frame Intervals not supported"); + RING_ERR("Continuous Frame Intervals not supported"); break; case V4L2_FRMIVAL_TYPE_STEPWISE: rates_.push_back(25); // TODO - SFL_ERR("Stepwise Frame Intervals not supported"); + RING_ERR("Stepwise Frame Intervals not supported"); break; } } @@ -334,10 +334,10 @@ VideoV4l2Channel::getSizes(int fd, unsigned int pixelformat) // from 1x1 to 2000x2000 // We should limit to a list of known standard sizes case V4L2_FRMSIZE_TYPE_CONTINUOUS: - SFL_ERR("Continuous Frame sizes not supported"); + RING_ERR("Continuous Frame sizes not supported"); break; case V4L2_FRMSIZE_TYPE_STEPWISE: - SFL_ERR("Stepwise Frame sizes not supported"); + RING_ERR("Stepwise Frame sizes not supported"); break; } } @@ -582,4 +582,4 @@ VideoDevice::getCapabilities() const VideoDevice::~VideoDevice() {} -} // namespace sfl_video +}} // namespace ring // namespace video diff --git a/daemon/src/video/v4l2/video_device_monitor_impl.cpp b/daemon/src/video/v4l2/video_device_monitor_impl.cpp index ba094d58292cdf380764ae51576219e586d3692f..d98cfa97d1517ca963ac9b9a07ece956fc81236d 100644 --- a/daemon/src/video/v4l2/video_device_monitor_impl.cpp +++ b/daemon/src/video/v4l2/video_device_monitor_impl.cpp @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Rémi Denis-Courmont * - * Copyright (C) 2004-2014 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Rafaël Carré <rafael.carre@savoirfairelinux.com> * Author: Vivien Didelot <vivien.didelot@savoirfairelinux.com> * @@ -54,7 +54,7 @@ extern "C" { #include <sys/types.h> } -namespace sfl_video { +namespace ring { namespace video { using std::vector; using std::string; @@ -140,7 +140,7 @@ VideoDeviceMonitorImpl::VideoDeviceMonitorImpl(VideoDeviceMonitor* monitor) : try { monitor_->addDevice(string(devpath)); } catch (const std::runtime_error &e) { - SFL_ERR("%s", e.what()); + RING_ERR("%s", e.what()); } } } @@ -152,7 +152,7 @@ VideoDeviceMonitorImpl::VideoDeviceMonitorImpl(VideoDeviceMonitor* monitor) : udev_failed: - SFL_ERR("udev enumeration failed"); + RING_ERR("udev enumeration failed"); if (udev_mon_) udev_monitor_unref(udev_mon_); @@ -168,7 +168,7 @@ udev_failed: try { monitor_->addDevice(ss.str()); } catch (const std::runtime_error &e) { - SFL_ERR("%s", e.what()); + RING_ERR("%s", e.what()); return; } } @@ -220,14 +220,14 @@ void VideoDeviceMonitorImpl::run() const char *node = udev_device_get_devnode(dev); const char *action = udev_device_get_action(dev); if (!strcmp(action, "add")) { - SFL_DBG("udev: adding %s", node); + RING_DBG("udev: adding %s", node); try { monitor_->addDevice(node); } catch (const std::runtime_error &e) { - SFL_ERR("%s", e.what()); + RING_ERR("%s", e.what()); } } else if (!strcmp(action, "remove")) { - SFL_DBG("udev: removing %s", node); + RING_DBG("udev: removing %s", node); monitor_->removeDevice(string(node)); } udev_device_unref(dev); @@ -237,12 +237,12 @@ void VideoDeviceMonitorImpl::run() case -1: if (errno == EAGAIN) continue; - SFL_ERR("udev monitoring thread: select failed (%m)"); + RING_ERR("udev monitoring thread: select failed (%m)"); probing_ = false; return; default: - SFL_ERR("select() returned %d (%m)", ret); + RING_ERR("select() returned %d (%m)", ret); probing_ = false; return; } @@ -259,4 +259,4 @@ VideoDeviceMonitor::VideoDeviceMonitor() : VideoDeviceMonitor::~VideoDeviceMonitor() {} -} // namespace sfl_video +}} diff --git a/daemon/src/video/video_base.cpp b/daemon/src/video/video_base.cpp index e58d457e844bb16fdbecd90850802d6281374f39..eec2ccfd05635d58ce372cec857dfcbf892e468a 100644 --- a/daemon/src/video/video_base.cpp +++ b/daemon/src/video/video_base.cpp @@ -34,7 +34,7 @@ #include "video_base.h" #include "logger.h" -namespace sfl_video { +namespace ring { namespace video { /*=== VideoPacket ===========================================================*/ @@ -207,4 +207,4 @@ std::shared_ptr<VideoFrame> VideoGenerator::obtainLastFrame() return lastFrame_; } -} +}} diff --git a/daemon/src/video/video_base.h b/daemon/src/video/video_base.h index a85ef271ca49956be83078949e29904f5c0fd615..3a74eaa0758b546c8c3af76d4f0748025c3287b7 100644 --- a/daemon/src/video/video_base.h +++ b/daemon/src/video/video_base.h @@ -53,7 +53,7 @@ enum VideoPixelFormat { VIDEO_PIXFMT_YUV420P = -2, }; -namespace sfl_video { +namespace ring { namespace video { template <typename T> class Observer; template <typename T> class Observable; @@ -217,6 +217,6 @@ private: std::mutex mutex_ = {}; // lock writableFrame_/lastFrame_ access }; -} +}} #endif // __VIDEO_BASE_H__ diff --git a/daemon/src/video/video_decoder.cpp b/daemon/src/video/video_decoder.cpp index bd21a1dbd89f2ddb130659cc5c56ed3ae9dacfa0..aea85c6cff677120e5f90fb5d6a0a8d21a413c7d 100644 --- a/daemon/src/video/video_decoder.cpp +++ b/daemon/src/video/video_decoder.cpp @@ -40,7 +40,7 @@ #include <iostream> #include <unistd.h> -namespace sfl_video { +namespace ring { namespace video { using std::string; @@ -90,7 +90,7 @@ int VideoDecoder::openInput(const std::string &source_str, AVInputFormat *iformat = av_find_input_format(format_str.c_str()); if (!iformat) - SFL_WARN("Cannot find format \"%s\"", format_str.c_str()); + RING_WARN("Cannot find format \"%s\"", format_str.c_str()); int ret = avformat_open_input(&inputCtx_, source_str.c_str(), iformat, options_ ? &options_ : NULL); @@ -98,9 +98,9 @@ int VideoDecoder::openInput(const std::string &source_str, if (ret) { char errbuf[64]; av_strerror(ret, errbuf, sizeof(errbuf)); - SFL_ERR("avformat_open_input failed: %s", errbuf); + RING_ERR("avformat_open_input failed: %s", errbuf); } else { - SFL_DBG("Using format %s", format_str.c_str()); + RING_DBG("Using format %s", format_str.c_str()); } return ret; @@ -131,7 +131,7 @@ int VideoDecoder::setupFromAudioData() inputCtx_->max_analyze_duration = MAX_ANALYZE_DURATION * AV_TIME_BASE; - SFL_DBG("Finding stream info"); + RING_DBG("Finding stream info"); #if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(53, 8, 0) ret = av_find_stream_info(inputCtx_); #else @@ -149,7 +149,7 @@ int VideoDecoder::setupFromAudioData() errBuf[0] = '\0'; // always fail here - SFL_ERR("Could not find stream info: %s", errBuf); + RING_ERR("Could not find stream info: %s", errBuf); return -1; } @@ -159,29 +159,29 @@ int VideoDecoder::setupFromAudioData() streamIndex_ = i; if (streamIndex_ == -1) { - SFL_ERR("Could not find audio stream"); + RING_ERR("Could not find audio stream"); return -1; } // Get a pointer to the codec context for the video stream decoderCtx_ = inputCtx_->streams[streamIndex_]->codec; if (decoderCtx_ == 0) { - SFL_ERR("Decoder context is NULL"); + RING_ERR("Decoder context is NULL"); return -1; } // find the decoder for the video stream inputDecoder_ = avcodec_find_decoder(decoderCtx_->codec_id); if (!inputDecoder_) { - SFL_ERR("Unsupported codec"); + RING_ERR("Unsupported codec"); return -1; } - SFL_DBG("Using %s", inputDecoder_->name); + RING_DBG("Using %s", inputDecoder_->name); decoderCtx_->thread_count = 1; if (emulateRate_) { - SFL_DBG("Using framerate emulation"); + RING_DBG("Using framerate emulation"); startTime_ = av_gettime(); } @@ -190,7 +190,7 @@ int VideoDecoder::setupFromAudioData() #endif ret = avcodec_open2(decoderCtx_, inputDecoder_, NULL); if (ret) { - SFL_ERR("Could not open codec"); + RING_ERR("Could not open codec"); return -1; } @@ -209,7 +209,7 @@ int VideoDecoder::setupFromVideoData() inputCtx_->max_analyze_duration = MAX_ANALYZE_DURATION * AV_TIME_BASE; - SFL_DBG("Finding stream info"); + RING_DBG("Finding stream info"); #if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(53, 8, 0) ret = av_find_stream_info(inputCtx_); #else @@ -227,7 +227,7 @@ int VideoDecoder::setupFromVideoData() errBuf[0] = '\0'; // always fail here - SFL_ERR("Could not find stream info: %s", errBuf); + RING_ERR("Could not find stream info: %s", errBuf); return -1; } @@ -237,27 +237,27 @@ int VideoDecoder::setupFromVideoData() streamIndex_ = i; if (streamIndex_ == -1) { - SFL_ERR("Could not find video stream"); + RING_ERR("Could not find video stream"); return -1; } // Get a pointer to the codec context for the video stream decoderCtx_ = inputCtx_->streams[streamIndex_]->codec; if (decoderCtx_ == 0) { - SFL_ERR("Decoder context is NULL"); + RING_ERR("Decoder context is NULL"); return -1; } // find the decoder for the video stream inputDecoder_ = avcodec_find_decoder(decoderCtx_->codec_id); if (!inputDecoder_) { - SFL_ERR("Unsupported codec"); + RING_ERR("Unsupported codec"); return -1; } decoderCtx_->thread_count = 1; if (emulateRate_) { - SFL_DBG("Using framerate emulation"); + RING_DBG("Using framerate emulation"); startTime_ = av_gettime(); } @@ -270,7 +270,7 @@ int VideoDecoder::setupFromVideoData() ret = avcodec_open2(decoderCtx_, inputDecoder_, NULL); #endif if (ret) { - SFL_ERR("Could not open codec"); + RING_ERR("Could not open codec"); return -1; } @@ -289,7 +289,7 @@ VideoDecoder::decode(VideoFrame& result, VideoPacket& video_packet) } else if (ret < 0) { char errbuf[64]; av_strerror(ret, errbuf, sizeof(errbuf)); - SFL_ERR("Couldn't read frame: %s\n", errbuf); + RING_ERR("Couldn't read frame: %s\n", errbuf); return Status::ReadError; } @@ -346,7 +346,7 @@ VideoDecoder::decode_audio(AVFrame *decoded_frame) } else if (ret < 0) { char errbuf[64]; av_strerror(ret, errbuf, sizeof(errbuf)); - SFL_ERR("Couldn't read frame: %s\n", errbuf); + RING_ERR("Couldn't read frame: %s\n", errbuf); return Status::ReadError; } @@ -417,24 +417,24 @@ int VideoDecoder::getPixelFormat() const { return libav_utils::sfl_pixel_format(decoderCtx_->pix_fmt); } void VideoDecoder::writeToRingBuffer(AVFrame* decoded_frame, - sfl::RingBuffer& rb, - const sfl::AudioFormat outFormat) + ring::RingBuffer& rb, + const ring::AudioFormat outFormat) { - const sfl::AudioFormat decoderFormat = { + const ring::AudioFormat decoderFormat = { (unsigned) decoded_frame->sample_rate, (unsigned) decoderCtx_->channels }; - sfl::AudioBuffer out(decoded_frame->nb_samples, decoderFormat); + ring::AudioBuffer out(decoded_frame->nb_samples, decoderFormat); out.deinterleave(reinterpret_cast<const SFLAudioSample*>(decoded_frame->data[0]), decoded_frame->nb_samples, decoderCtx_->channels); if ((unsigned)decoded_frame->sample_rate != outFormat.sample_rate) { if (!resampler_) { - SFL_DBG("Creating audio resampler"); - resampler_.reset(new sfl::Resampler(outFormat)); + RING_DBG("Creating audio resampler"); + resampler_.reset(new ring::Resampler(outFormat)); } - sfl::AudioBuffer resampledData(decoded_frame->nb_samples, + ring::AudioBuffer resampledData(decoded_frame->nb_samples, {(unsigned) outFormat.sample_rate, (unsigned) decoderCtx_->channels}); resampler_->resample(out, resampledData); @@ -444,4 +444,4 @@ void VideoDecoder::writeToRingBuffer(AVFrame* decoded_frame, } } -} +}} diff --git a/daemon/src/video/video_decoder.h b/daemon/src/video/video_decoder.h index 6b2ad115781415a79375f2b772ab0741650bc593..c58713124af363c09998f8d0cf52a628a3935af9 100644 --- a/daemon/src/video/video_decoder.h +++ b/daemon/src/video/video_decoder.h @@ -40,7 +40,7 @@ #include <string> #include <memory> -namespace sfl { +namespace ring { class AudioBuffer; class AudioFormat; class RingBuffer; @@ -52,7 +52,7 @@ class AVStream; class AVFormatContext; class AVCodec; -namespace sfl_video { +namespace ring { namespace video { class VideoDecoder { public: @@ -76,8 +76,8 @@ namespace sfl_video { int setupFromAudioData(); Status decode(VideoFrame&, VideoPacket&); Status decode_audio(AVFrame* frame); - void writeToRingBuffer(AVFrame* frame, sfl::RingBuffer& rb, - const sfl::AudioFormat outFormat); + void writeToRingBuffer(AVFrame* frame, ring::RingBuffer& rb, + const ring::AudioFormat outFormat); Status flush(VideoFrame&); int getWidth() const; @@ -92,7 +92,7 @@ namespace sfl_video { AVCodec *inputDecoder_ = nullptr; AVCodecContext *decoderCtx_ = nullptr; AVFormatContext *inputCtx_ = nullptr; - std::unique_ptr<sfl::Resampler> resampler_; + std::unique_ptr<ring::Resampler> resampler_; int streamIndex_ = -1; bool emulateRate_ = false; int64_t startTime_; @@ -104,6 +104,6 @@ namespace sfl_video { protected: AVDictionary *options_ = nullptr; }; -} +}} #endif // __VIDEO_DECODER_H__ diff --git a/daemon/src/video/video_device.h b/daemon/src/video/video_device.h index 6caca5853f49f778c3d6a5fa613a52762169bf62..af7a9e6b10fff5ddf23c0247ca4c54226feb43ef 100644 --- a/daemon/src/video/video_device.h +++ b/daemon/src/video/video_device.h @@ -36,7 +36,7 @@ #include <string> #include <vector> -namespace sfl_video { +namespace ring { namespace video { typedef std::map<std::string, std::map<std::string, std::vector<std::string>>> VideoCapabilities; typedef std::map<std::string, std::string> VideoSettings; @@ -111,6 +111,6 @@ private: std::shared_ptr<VideoDeviceImpl> deviceImpl_; }; -} // namespace sfl_video +}} //namespace ring //namespace video #endif // __VIDEO_DEVICE_H__ diff --git a/daemon/src/video/video_device_monitor.cpp b/daemon/src/video/video_device_monitor.cpp index 5e938b3445f41f6a3f45a71f7f647ebf68c250df..b96862f7ce7c9379e201b60c5c47f643f0d35128 100644 --- a/daemon/src/video/video_device_monitor.cpp +++ b/daemon/src/video/video_device_monitor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2014 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * Author: Vivien Didelot <vivien.didelot@savoirfairelinux.com> * @@ -41,7 +41,7 @@ #include "logger.h" #include "video_device_monitor.h" -namespace sfl_video { +namespace ring { namespace video { constexpr const char * const VideoDeviceMonitor::CONFIG_LABEL; @@ -155,7 +155,7 @@ static void notify() { if (!ManagerImpl::initialized) { - SFL_WARN("Manager not initialized yet"); + RING_WARN("Manager not initialized yet"); return; } @@ -309,4 +309,4 @@ VideoDeviceMonitor::unserialize(const YAML::Node &in) defaultDevice_ = first; } -} // namespace sfl_video +}} //namespace ring //namespace video diff --git a/daemon/src/video/video_device_monitor.h b/daemon/src/video/video_device_monitor.h index eac3854b71a491db8da8a07beb0091d70e20eddf..d0a5c5808923b254c5551d57cd4e6dc1cd36fd6a 100644 --- a/daemon/src/video/video_device_monitor.h +++ b/daemon/src/video/video_device_monitor.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2014 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * Author: Vivien Didelot <vivien.didelot@savoirfairelinux.com> * @@ -46,7 +46,7 @@ namespace YAML { class Node; } -namespace sfl_video { +namespace ring { namespace video { class VideoDeviceMonitorImpl; @@ -102,6 +102,6 @@ class VideoDeviceMonitor : public Serializable constexpr static const char *CONFIG_LABEL = "video"; }; -} // namespace sfl_video +}} //namespace ring //namespace video #endif /* VIDEO_DEVICE_MONITOR_H__ */ diff --git a/daemon/src/video/video_encoder.cpp b/daemon/src/video/video_encoder.cpp index f584e985fdfc40fbd0ff22e027388b02b3b14325..63aa173adc58ff4dec385cbeb80d8ab2e3896e78 100644 --- a/daemon/src/video/video_encoder.cpp +++ b/daemon/src/video/video_encoder.cpp @@ -39,7 +39,7 @@ #include <algorithm> -namespace sfl_video { +namespace ring { namespace video { using std::string; @@ -123,7 +123,7 @@ VideoEncoder::openOutput(const char *enc_name, const char *short_name, AVOutputFormat *oformat = av_guess_format(short_name, filename, mime_type); if (!oformat) { - SFL_ERR("Unable to find a suitable output format for %s", filename); + RING_ERR("Unable to find a suitable output format for %s", filename); throw VideoEncoderException("No output format"); } @@ -135,7 +135,7 @@ VideoEncoder::openOutput(const char *enc_name, const char *short_name, /* find the video encoder */ outputEncoder_ = avcodec_find_encoder_by_name(enc_name); if (!outputEncoder_) { - SFL_ERR("Encoder \"%s\" not found!", enc_name); + RING_ERR("Encoder \"%s\" not found!", enc_name); throw VideoEncoderException("No output encoder"); } @@ -218,7 +218,7 @@ void VideoEncoder::startIO() { if (avformat_write_header(outputCtx_, options_ ? &options_ : NULL)) { - SFL_ERR("Could not write header for output file... check codec parameters"); + RING_ERR("Could not write header for output file... check codec parameters"); throw VideoEncoderException("Failed to write output file header"); } @@ -230,7 +230,7 @@ print_averror(const char *funcname, int err) { char errbuf[64]; av_strerror(err, errbuf, sizeof(errbuf)); - SFL_ERR("%s failed: %s", funcname, errbuf); + RING_ERR("%s failed: %s", funcname, errbuf); } int VideoEncoder::encode(VideoFrame &input, bool is_keyframe, int64_t frame_number) @@ -321,11 +321,11 @@ int VideoEncoder::encode(VideoFrame &input, bool is_keyframe, int64_t frame_numb return ret; } -int VideoEncoder::encode_audio(const sfl::AudioBuffer &buffer) +int VideoEncoder::encode_audio(const ring::AudioBuffer &buffer) { const int needed_bytes = av_samples_get_buffer_size(NULL, buffer.channels(), buffer.frames(), AV_SAMPLE_FMT_S16, 0); if (needed_bytes < 0) { - SFL_ERR("Couldn't calculate buffer size"); + RING_ERR("Couldn't calculate buffer size"); return -1; } @@ -363,7 +363,7 @@ int VideoEncoder::encode_audio(const sfl::AudioBuffer &buffer) if (err < 0) { char errbuf[128]; av_strerror(err, errbuf, sizeof(errbuf)); - SFL_ERR("Couldn't fill audio frame: %s: %d %d", errbuf, frame->nb_samples, buffer_size); + RING_ERR("Couldn't fill audio frame: %s: %d %d", errbuf, frame->nb_samples, buffer_size); av_freep(&sample_data); av_frame_free(&frame); return -1; @@ -404,7 +404,7 @@ int VideoEncoder::encode_audio(const sfl::AudioBuffer &buffer) av_frame_free(&frame); } - //SFL_WARN("%d", *std::max_element(sample_data, sample_data + needed_bytes / 2)); + //RING_WARN("%d", *std::max_element(sample_data, sample_data + needed_bytes / 2)); av_freep(&sample_data); @@ -424,7 +424,7 @@ int VideoEncoder::flush() ret = avcodec_encode_video2(encoderCtx_, &pkt, NULL, &got_packet); if (ret != 0) { - SFL_ERR("avcodec_encode_video failed"); + RING_ERR("avcodec_encode_video failed"); av_free_packet(&pkt); return -1; } @@ -433,13 +433,13 @@ int VideoEncoder::flush() // write the compressed frame ret = av_write_frame(outputCtx_, &pkt); if (ret < 0) - SFL_ERR("write_frame failed"); + RING_ERR("write_frame failed"); } #else ret = avcodec_encode_video(encoderCtx_, encoderBuffer_, encoderBufferSize_, NULL); if (ret < 0) { - SFL_ERR("avcodec_encode_video failed"); + RING_ERR("avcodec_encode_video failed"); av_free_packet(&pkt); return ret; } @@ -450,7 +450,7 @@ int VideoEncoder::flush() // write the compressed frame ret = av_write_frame(outputCtx_, &pkt); if (ret < 0) - SFL_ERR("write_frame failed"); + RING_ERR("write_frame failed"); #endif av_free_packet(&pkt); @@ -472,7 +472,7 @@ void VideoEncoder::print_sdp(std::string &sdp_) line = line.substr(0, line.length() - 1); sdp_ += line + "\n"; } - SFL_DBG("Sending SDP: \n%s", sdp_.c_str()); + RING_DBG("Sending SDP: \n%s", sdp_.c_str()); } void VideoEncoder::prepareEncoderContext(bool is_video) @@ -488,7 +488,7 @@ void VideoEncoder::prepareEncoderContext(bool is_video) // set some encoder settings here encoderCtx_->bit_rate = 1000 * atoi(av_dict_get(options_, "bitrate", NULL, 0)->value); - SFL_DBG("Using bitrate %d", encoderCtx_->bit_rate); + RING_DBG("Using bitrate %d", encoderCtx_->bit_rate); if (is_video) { // resolution must be a multiple of two @@ -520,7 +520,7 @@ void VideoEncoder::prepareEncoderContext(bool is_video) if (v) { encoderCtx_->sample_rate = atoi(v->value); } else { - SFL_WARN("No sample rate set"); + RING_WARN("No sample rate set"); encoderCtx_->sample_rate = 8000; } @@ -528,12 +528,12 @@ void VideoEncoder::prepareEncoderContext(bool is_video) if (v) { auto c = std::atoi(v->value); if (c > 2 or c < 1) { - SFL_WARN("Clamping invalid channel value %d", c); + RING_WARN("Clamping invalid channel value %d", c); c = 1; } encoderCtx_->channels = c; } else { - SFL_WARN("Channels not set"); + RING_WARN("Channels not set"); encoderCtx_->channels = 1; } @@ -542,9 +542,9 @@ void VideoEncoder::prepareEncoderContext(bool is_video) v = av_dict_get(options_, "frame_size", NULL, 0); if (v) { encoderCtx_->frame_size = atoi(v->value); - SFL_WARN("Frame size %d", encoderCtx_->frame_size); + RING_WARN("Frame size %d", encoderCtx_->frame_size); } else { - SFL_WARN("Frame size not set"); + RING_WARN("Frame size not set"); } } } @@ -553,10 +553,10 @@ void VideoEncoder::forcePresetX264() { const char *speedPreset = "ultrafast"; if (av_opt_set(encoderCtx_->priv_data, "preset", speedPreset, 0)) - SFL_WARN("Failed to set x264 preset '%s'", speedPreset); + RING_WARN("Failed to set x264 preset '%s'", speedPreset); const char *tune = "zerolatency"; if (av_opt_set(encoderCtx_->priv_data, "tune", tune, 0)) - SFL_WARN("Failed to set x264 tune '%s'", tune); + RING_WARN("Failed to set x264 tune '%s'", tune); } void VideoEncoder::extractProfileLevelID(const std::string ¶meters, @@ -604,7 +604,7 @@ void VideoEncoder::extractProfileLevelID(const std::string ¶meters, ctx->profile |= FF_PROFILE_H264_INTRA; break; } - SFL_DBG("Using profile %x and level %d", ctx->profile, ctx->level); + RING_DBG("Using profile %x and level %d", ctx->profile, ctx->level); } -} +}} diff --git a/daemon/src/video/video_encoder.h b/daemon/src/video/video_encoder.h index 92e0d58322a873b521927cfbd93c6101ef585e8f..524d45ae9508868bc5b08205d8c3e005bf8ba275 100644 --- a/daemon/src/video/video_encoder.h +++ b/daemon/src/video/video_encoder.h @@ -44,11 +44,11 @@ class AVStream; class AVFormatContext; class AVCodec; -namespace sfl { +namespace ring { class AudioBuffer; } -namespace sfl_video { +namespace ring { namespace video { class VideoEncoderException : public std::runtime_error { public: @@ -68,7 +68,7 @@ public: const char *filename, const char *mime_type, bool is_video); void startIO(); int encode(VideoFrame &input, bool is_keyframe, int64_t frame_number); - int encode_audio(const sfl::AudioBuffer &input); + int encode_audio(const ring::AudioBuffer &input); int flush(); void print_sdp(std::string &sdp_); @@ -106,6 +106,6 @@ protected: AVDictionary *options_ = nullptr; }; -} +}} #endif // __VIDEO_ENCODER_H__ diff --git a/daemon/src/video/video_input.cpp b/daemon/src/video/video_input.cpp index 713707b40fc824e6f6fd45f95ea87d7dcf7c05a9..ab245815f987232d1b0f44013ceb3305a36f56fb 100644 --- a/daemon/src/video/video_input.cpp +++ b/daemon/src/video/video_input.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2014 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Tristan Matthews <tristan.matthews@savoirfairelinux.com> * Author: Vivien Didelot <vivien.didelot@savoirfairelinux.com> * @@ -41,7 +41,7 @@ #include <cassert> #include <unistd.h> -namespace sfl_video { +namespace ring { namespace video { VideoInput::VideoInput() : VideoGenerator::VideoGenerator() @@ -60,11 +60,11 @@ bool VideoInput::setup() { /* Sink setup */ if (!sink_.start()) { - SFL_ERR("Cannot start shared memory sink"); + RING_ERR("Cannot start shared memory sink"); return false; } if (not attach(&sink_)) - SFL_WARN("Failed to attach sink"); + RING_WARN("Failed to attach sink"); return true; } @@ -90,7 +90,7 @@ void VideoInput::process() /* Signal the client about the new sink */ Manager::instance().getVideoManager()->startedDecoding(sinkID_, sink_.openedName(), decoder_->getWidth(), decoder_->getHeight(), false); - SFL_DBG("LOCAL: shm sink <%s> started: size = %dx%d", + RING_DBG("LOCAL: shm sink <%s> started: size = %dx%d", sink_.openedName().c_str(), decoder_->getWidth(), decoder_->getHeight()); } @@ -152,7 +152,7 @@ VideoInput::createDecoder() decoder_->setInterruptCallback(interruptCb, this); if (decoder_->openInput(input_, format_) < 0) { - SFL_ERR("Could not open input \"%s\"", input_.c_str()); + RING_ERR("Could not open input \"%s\"", input_.c_str()); delete decoder_; decoder_ = nullptr; return; @@ -160,7 +160,7 @@ VideoInput::createDecoder() /* Data available, finish the decoding */ if (decoder_->setupFromVideoData() < 0) { - SFL_ERR("decoder IO startup failed"); + RING_ERR("decoder IO startup failed"); delete decoder_; decoder_ = nullptr; return; @@ -228,7 +228,7 @@ VideoInput::initFile(std::string path) /* File exists? */ if (access(path.c_str(), R_OK) != 0) { - SFL_ERR("file '%s' unavailable\n", path.c_str()); + RING_ERR("file '%s' unavailable\n", path.c_str()); return false; } @@ -242,7 +242,7 @@ VideoInput::initFile(std::string path) format_ = "image2"; decOpts_["framerate"] = "1"; } else { - SFL_WARN("Guessing file type for %s", path.c_str()); + RING_WARN("Guessing file type for %s", path.c_str()); // FIXME: proper parsing of FPS etc. should be done in // VideoDecoder, not here. decOpts_["framerate"] = "25"; @@ -254,10 +254,10 @@ VideoInput::initFile(std::string path) bool VideoInput::switchInput(const std::string& resource) { - SFL_DBG("MRL: '%s'", resource.c_str()); + RING_DBG("MRL: '%s'", resource.c_str()); if (switchPending_) { - SFL_ERR("Video switch already requested"); + RING_ERR("Video switch already requested"); return false; } @@ -303,7 +303,7 @@ VideoInput::switchInput(const std::string& resource) loop_.start(); } else - SFL_ERR("Failed to init input for MRL '%s'\n", resource.c_str()); + RING_ERR("Failed to init input for MRL '%s'\n", resource.c_str()); return valid; } @@ -317,4 +317,4 @@ int VideoInput::getHeight() const int VideoInput::getPixelFormat() const { return decoder_->getPixelFormat(); } -} // end namespace sfl_video +}} //namespace ring //namespace video diff --git a/daemon/src/video/video_input.h b/daemon/src/video/video_input.h index 1c4783967cfa083ba6beb700a8aafc1f33c23d0c..149a4811a6cde44a95deacfadbd8a9535cb48934 100644 --- a/daemon/src/video/video_input.h +++ b/daemon/src/video/video_input.h @@ -43,7 +43,7 @@ #include <atomic> #include <string> -namespace sfl_video { +namespace ring { namespace video { class VideoInput : public VideoGenerator { @@ -97,6 +97,6 @@ private: bool captureFrame(); }; -} +}} #endif // __VIDEO_INPUT_H__ diff --git a/daemon/src/video/video_mixer.cpp b/daemon/src/video/video_mixer.cpp index 27c22e4764a57d5f6945f51e4109631302eab2b9..75234c5450cce1cfbc652cb4298d19bed6345ce0 100644 --- a/daemon/src/video/video_mixer.cpp +++ b/daemon/src/video/video_mixer.cpp @@ -41,7 +41,7 @@ static const double FRAME_DURATION = 1/30.; -namespace sfl_video { +namespace ring { namespace video { VideoMixer::VideoMixer(const std::string &id) : VideoGenerator::VideoGenerator() @@ -122,7 +122,7 @@ void VideoMixer::process() VideoFrame& output = getNewFrame(); if (!output.allocBuffer(width_, height_, VIDEO_PIXFMT_YUV420P)) { - SFL_ERR("VideoFrame::allocBuffer() failed"); + RING_ERR("VideoFrame::allocBuffer() failed"); return; } @@ -190,11 +190,11 @@ void VideoMixer::start_sink() if (sink_.start()) { if (this->attach(&sink_)) { Manager::instance().getVideoManager()->startedDecoding(id_, sink_.openedName(), width_, height_, true); - SFL_DBG("MX: shm sink <%s> started: size = %dx%d", + RING_DBG("MX: shm sink <%s> started: size = %dx%d", sink_.openedName().c_str(), width_, height_); } } else - SFL_WARN("MX: sink startup failed"); + RING_WARN("MX: sink startup failed"); } void VideoMixer::stop_sink() @@ -214,4 +214,4 @@ int VideoMixer::getHeight() const int VideoMixer::getPixelFormat() const { return VIDEO_PIXFMT_YUV420P; } -} // end namespace sfl_video +}} //namespace ring //namespace video diff --git a/daemon/src/video/video_mixer.h b/daemon/src/video/video_mixer.h index fc4b37aacbe092178cf30f83503a01aece9b9ca4..2a117ed202cd9fee7bc4c156b1b5ca6cbce1482e 100644 --- a/daemon/src/video/video_mixer.h +++ b/daemon/src/video/video_mixer.h @@ -43,7 +43,7 @@ #include <chrono> #include <memory> -namespace sfl_video { +namespace ring { namespace video { struct VideoMixerSource { Observable<std::shared_ptr<VideoFrame> >* source = nullptr; @@ -90,7 +90,7 @@ private: int width_ = 0; int height_ = 0; std::list<VideoMixerSource *> sources_ = {}; - sfl::rw_mutex rwMutex_ = {}; + ring::rw_mutex rwMutex_ = {}; SHMSink sink_; ThreadLoop loop_; std::chrono::time_point<std::chrono::system_clock> lastProcess_ = {}; @@ -98,6 +98,6 @@ private: VideoScaler scaler_ = {}; }; -} +}} #endif // __VIDEO_MIXER_H__ diff --git a/daemon/src/video/video_provider.h b/daemon/src/video/video_provider.h index d06620e5e610d47a7c7b2a7670d2fcaca98e5af0..37ad819e347445c9d71a293b414e70a553e8631d 100644 --- a/daemon/src/video/video_provider.h +++ b/daemon/src/video/video_provider.h @@ -31,7 +31,7 @@ #ifndef VIDEO_PROVIDER_H_ #define VIDEO_PROVIDER_H_ -namespace sfl_video { +namespace ring { namespace video { class VideoProvider { public: @@ -39,6 +39,6 @@ class VideoProvider { virtual ~VideoProvider() {} }; -} +}} #endif // VIDEO_PROVIDER_H_ diff --git a/daemon/src/video/video_receive_thread.cpp b/daemon/src/video/video_receive_thread.cpp index 123756612adf8c00887aed7515993a3e6131b3dc..edb262e21924d46bb5f685c53b16a867243107c6 100644 --- a/daemon/src/video/video_receive_thread.cpp +++ b/daemon/src/video/video_receive_thread.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * * Author: Tristan Matthews <tristan.matthews@savoirfairelinux.com> * Author: Guillaume Roguez <Guillaume.Roguez@savoirfairelinux.com> @@ -41,7 +41,7 @@ #include <unistd.h> #include <map> -namespace sfl_video { +namespace ring { namespace video { using std::string; @@ -190,15 +190,15 @@ bool VideoReceiveThread::decodeFrame() return true; case VideoDecoder::Status::DecodeError: - SFL_WARN("decoding failure, trying to reset decoder..."); + RING_WARN("decoding failure, trying to reset decoder..."); delete videoDecoder_; if (!setup()) { - SFL_ERR("fatal error, rx thread re-setup failed"); + RING_ERR("fatal error, rx thread re-setup failed"); loop_.stop(); break; } if (!videoDecoder_->setupFromVideoData()) { - SFL_ERR("fatal error, v-decoder setup failed"); + RING_ERR("fatal error, v-decoder setup failed"); loop_.stop(); break; } @@ -207,7 +207,7 @@ bool VideoReceiveThread::decodeFrame() break; case VideoDecoder::Status::ReadError: - SFL_ERR("fatal error, read failed"); + RING_ERR("fatal error, read failed"); loop_.stop(); default: @@ -225,7 +225,7 @@ void VideoReceiveThread::enterConference() if (detach(&sink_)) { Manager::instance().getVideoManager()->stoppedDecoding(id_, sink_.openedName(), false); - SFL_DBG("RX: shm sink <%s> detached", sink_.openedName().c_str()); + RING_DBG("RX: shm sink <%s> detached", sink_.openedName().c_str()); } } @@ -237,7 +237,7 @@ void VideoReceiveThread::exitConference() if (dstWidth_ > 0 && dstHeight_ > 0) { if (attach(&sink_)) { Manager::instance().getVideoManager()->startedDecoding(id_, sink_.openedName(), dstWidth_, dstHeight_, false); - SFL_DBG("RX: shm sink <%s> started: size = %dx%d", + RING_DBG("RX: shm sink <%s> started: size = %dx%d", sink_.openedName().c_str(), dstWidth_, dstHeight_); } } @@ -256,4 +256,4 @@ int VideoReceiveThread::getHeight() const int VideoReceiveThread::getPixelFormat() const { return videoDecoder_->getPixelFormat(); } -} // end namespace sfl_video +}} //namespace ring //namespace video diff --git a/daemon/src/video/video_receive_thread.h b/daemon/src/video/video_receive_thread.h index cfab33494c9feca804ebb5acf9f4b407e9cdec61..b03469ca0f727fcf2b9aa8adb7819d6a12100086 100644 --- a/daemon/src/video/video_receive_thread.h +++ b/daemon/src/video/video_receive_thread.h @@ -42,7 +42,7 @@ #include <sstream> #include <memory> -namespace sfl_video { +namespace ring { namespace video { class SocketPair; @@ -94,6 +94,7 @@ private: void process(); void cleanup(); }; -} + +}} #endif // _VIDEO_RECEIVE_THREAD_H_ diff --git a/daemon/src/video/video_rtp_session.cpp b/daemon/src/video/video_rtp_session.cpp index 6b9cf1111719ab398ddfb8e950d3f6aeaab03ad9..1d1b1127b1cbf9c855606ef1a1657eaa54ede8c7 100644 --- a/daemon/src/video/video_rtp_session.cpp +++ b/daemon/src/video/video_rtp_session.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2014 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Tristan Matthews <tristan.matthews@savoirfairelinux.com> * Author: Guillaume Roguez <Guillaume.Roguez@savoirfairelinux.com> * @@ -45,7 +45,7 @@ #include <map> #include <string> -namespace sfl_video { +namespace ring { namespace video { using std::map; using std::string; @@ -66,35 +66,35 @@ void VideoRtpSession::updateSDP(const Sdp &sdp) // if port has changed if (not desc.empty() and desc != rxArgs_["receiving_sdp"]) { rxArgs_["receiving_sdp"] = desc; - SFL_DBG("Updated incoming SDP to:\n%s", + RING_DBG("Updated incoming SDP to:\n%s", rxArgs_["receiving_sdp"].c_str()); } if (desc.empty()) { - SFL_DBG("Video is inactive"); + RING_DBG("Video is inactive"); receiving_ = false; sending_ = false; } else if (desc.find("sendrecv") != string::npos) { - SFL_DBG("Sending and receiving video"); + RING_DBG("Sending and receiving video"); receiving_ = true; sending_ = true; } else if (desc.find("inactive") != string::npos) { - SFL_DBG("Video is inactive"); + RING_DBG("Video is inactive"); receiving_ = false; sending_ = false; } else if (desc.find("sendonly") != string::npos) { - SFL_DBG("Receiving video disabled, video set to sendonly"); + RING_DBG("Receiving video disabled, video set to sendonly"); receiving_ = false; sending_ = true; } else if (desc.find("recvonly") != string::npos) { - SFL_DBG("Sending video disabled, video set to recvonly"); + RING_DBG("Sending video disabled, video set to recvonly"); sending_ = false; receiving_ = true; } // even if it says sendrecv or recvonly, our peer may disable video by // setting the port to 0 if (desc.find("m=video 0") != string::npos) { - SFL_DBG("Receiving video disabled, port was set to 0"); + RING_DBG("Receiving video disabled, port was set to 0"); receiving_ = false; } @@ -107,7 +107,7 @@ void VideoRtpSession::updateDestination(const string &destination, { std::lock_guard<std::recursive_mutex> lock(mutex_); if (destination.empty()) { - SFL_ERR("Destination is empty, ignoring"); + RING_ERR("Destination is empty, ignoring"); return; } @@ -116,15 +116,15 @@ void VideoRtpSession::updateDestination(const string &destination, // if destination has changed if (tmp.str() != txArgs_["destination"]) { if (sender_) { - SFL_ERR("Video is already being sent"); + RING_ERR("Video is already being sent"); return; } txArgs_["destination"] = tmp.str(); - SFL_DBG("updated dest to %s", txArgs_["destination"].c_str()); + RING_DBG("updated dest to %s", txArgs_["destination"].c_str()); } if (port == 0) { - SFL_DBG("Sending video disabled, port was set to 0"); + RING_DBG("Sending video disabled, port was set to 0"); sending_ = false; } } @@ -137,13 +137,13 @@ void VideoRtpSession::startSender() videoLocal_->detach(sender_.get()); if (videoMixer_) videoMixer_->detach(sender_.get()); - SFL_WARN("Restarting video sender"); + RING_WARN("Restarting video sender"); } try { sender_.reset(new VideoSender(txArgs_, *socketPair_)); } catch (const VideoEncoderException &e) { - SFL_ERR("%s", e.what()); + RING_ERR("%s", e.what()); sending_ = false; } } @@ -153,13 +153,13 @@ void VideoRtpSession::startReceiver() { if (receiving_) { if (receiveThread_) - SFL_WARN("restarting video receiver"); + RING_WARN("restarting video receiver"); receiveThread_.reset(new VideoReceiveThread(callID_, rxArgs_)); receiveThread_->setRequestKeyFrameCallback(&SIPVoIPLink::enqueueKeyframeRequest); receiveThread_->addIOContext(*socketPair_); receiveThread_->startLoop(); } else { - SFL_DBG("Video receiving disabled"); + RING_DBG("Video receiving disabled"); if (receiveThread_) receiveThread_->detach(videoMixer_.get()); receiveThread_.reset(); @@ -178,7 +178,7 @@ void VideoRtpSession::start(int localPort) try { socketPair_.reset(new SocketPair(txArgs_["destination"].c_str(), localPort)); } catch (const std::runtime_error &e) { - SFL_ERR("Socket creation failed on port %d: %s", localPort, e.what()); + RING_ERR("Socket creation failed on port %d: %s", localPort, e.what()); return; } @@ -198,8 +198,8 @@ void VideoRtpSession::start(int localPort) } } -void VideoRtpSession::start(std::unique_ptr<sfl::IceSocket> rtp_sock, - std::unique_ptr<sfl::IceSocket> rtcp_sock) +void VideoRtpSession::start(std::unique_ptr<ring::IceSocket> rtp_sock, + std::unique_ptr<ring::IceSocket> rtcp_sock) { std::lock_guard<std::recursive_mutex> lock(mutex_); @@ -312,4 +312,4 @@ void VideoRtpSession::exitConference() conference_ = nullptr; } -} // end namespace sfl_video +}} //namespace ring //namespace video diff --git a/daemon/src/video/video_rtp_session.h b/daemon/src/video/video_rtp_session.h index 4a4d9fe570d93cf861acf1fdd50c3afd1849e137..eaaa4a1ec382a394ad3605c1118e23f6feffdc5f 100644 --- a/daemon/src/video/video_rtp_session.h +++ b/daemon/src/video/video_rtp_session.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Tristan Matthews <tristan.matthews@savoirfairelinux.com> * Author: Guillaume Roguez <Guillaume.Roguez@savoirfairelinux.com> * @@ -47,11 +47,11 @@ class Sdp; class Conference; -namespace sfl { +namespace ring { class IceSocket; }; -namespace sfl_video { +namespace ring { namespace video { class VideoRtpSession { public: @@ -60,8 +60,8 @@ public: ~VideoRtpSession(); void start(int localPort); - void start(std::unique_ptr<sfl::IceSocket> rtp_sock, - std::unique_ptr<sfl::IceSocket> rtcp_sock); + void start(std::unique_ptr<ring::IceSocket> rtp_sock, + std::unique_ptr<ring::IceSocket> rtcp_sock); void stop(); void updateDestination(const std::string &destination, unsigned int port); @@ -95,6 +95,6 @@ private: std::shared_ptr<VideoFrameActiveWriter> videoLocal_ = nullptr; }; -} +}} #endif // __VIDEO_RTP_SESSION_H__ diff --git a/daemon/src/video/video_scaler.cpp b/daemon/src/video/video_scaler.cpp index c19ae6726fc692fe7478e3c94362fc8c662c5dab..79b4cf5cf5b7bb3f2d1821a0c9b339b2df727cc3 100644 --- a/daemon/src/video/video_scaler.cpp +++ b/daemon/src/video/video_scaler.cpp @@ -35,7 +35,7 @@ #include <cassert> -namespace sfl_video { +namespace ring { namespace video { VideoScaler::VideoScaler() : ctx_(0), mode_(SWS_FAST_BILINEAR), tmp_data_() {} @@ -56,7 +56,7 @@ void VideoScaler::scale(const VideoFrame &input, VideoFrame &output) mode_, NULL, NULL, NULL); if (!ctx_) { - SFL_ERR("Unable to create a scaler context"); + RING_ERR("Unable to create a scaler context"); return; } @@ -127,7 +127,7 @@ void VideoScaler::scale_and_pad(const VideoFrame &input, VideoFrame &output, mode_, NULL, NULL, NULL); if (!ctx_) { - SFL_ERR("Unable to create a scaler context"); + RING_ERR("Unable to create a scaler context"); return; } @@ -158,4 +158,4 @@ void VideoScaler::reset() } } -} +}} diff --git a/daemon/src/video/video_scaler.h b/daemon/src/video/video_scaler.h index 8ff7cca192523b6b088d5a72b1e2d7fd67bd6109..223ee27e0dbbbddef68f7afe81022c22925fe1f5 100644 --- a/daemon/src/video/video_scaler.h +++ b/daemon/src/video/video_scaler.h @@ -38,7 +38,7 @@ class SwsContext; -namespace sfl_video { +namespace ring { namespace video { class VideoScaler { public: @@ -59,6 +59,6 @@ private: uint8_t *tmp_data_[4]; // used by scale_and_pad }; -} +}} #endif // __VIDEO_SCALER_H__ diff --git a/daemon/src/video/video_sender.cpp b/daemon/src/video/video_sender.cpp index c109bd6cc97d856669802e0af40565983aff0338..9e7583ba207679e945a77d8efc6f4d0185436c58 100644 --- a/daemon/src/video/video_sender.cpp +++ b/daemon/src/video/video_sender.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Tristan Matthews <tristan.matthews@savoirfairelinux.com> * Author: Guillaume Roguez <Guillaume.Roguez@savoirfairelinux.com> * @@ -40,7 +40,7 @@ #include <unistd.h> -namespace sfl_video { +namespace ring { namespace video { using std::string; @@ -69,7 +69,7 @@ void VideoSender::encodeAndSendVideo(VideoFrame& input_frame) --forceKeyFrame_; if (videoEncoder_->encode(input_frame, is_keyframe, frameNumber_++) < 0) - SFL_ERR("encoding failed"); + RING_ERR("encoding failed"); } void VideoSender::update(Observable<std::shared_ptr<VideoFrame> >* /*obs*/, @@ -83,4 +83,4 @@ void VideoSender::forceKeyFrame() ++forceKeyFrame_; } -} // end namespace sfl_video +}} //namespace ring //namespace video diff --git a/daemon/src/video/video_sender.h b/daemon/src/video/video_sender.h index e2340422e4127cc71a2844592ca03f3b6a5ca932..f594a1733e5dd619c526fa25efca9a26e63bb6a1 100644 --- a/daemon/src/video/video_sender.h +++ b/daemon/src/video/video_sender.h @@ -41,7 +41,7 @@ #include <memory> #include <atomic> -namespace sfl_video { +namespace ring { namespace video { class SocketPair; @@ -72,6 +72,6 @@ private: std::string sdp_ = ""; }; -} +}} #endif // __VIDEO_SENDER_H__ diff --git a/daemon/test/Makefile.am b/daemon/test/Makefile.am index 492c92c9a20b59f2ac2bdd799750769f3094e20e..bdf84028e148f90bb1a2e2942cb5324353541e86 100644 --- a/daemon/test/Makefile.am +++ b/daemon/test/Makefile.am @@ -6,15 +6,15 @@ check_PROGRAMS = test TESTS = run_tests.sh test_CXXFLAGS = -DWORKSPACE=\"$(top_srcdir)/test/\" @PTHREAD_CFLAGS@ -test_LDADD = $(top_builddir)/src/libsflphone.la \ - $(top_builddir)/src/libsflphone_la-logger.lo \ +test_LDADD = $(top_builddir)/src/libring.la \ + $(top_builddir)/src/libring_la-logger.lo \ @CPPUNIT_LIBS@ @YAMLCPP_LIBS@ @CCRTP_LIBS@ @PJPROJECT_LIBS@ if BUILD_INSTANT_MESSAGING test_LDADD += @EXPAT_LIBS@ endif -EXTRA_DIST = sflphoned-sample.yml history-sample.tpl tlsSample run_tests.sh +EXTRA_DIST = dring-sample.yml history-sample.tpl tlsSample run_tests.sh test_SOURCES = constants.h \ test_utils.h \ main.cpp \ diff --git a/daemon/test/accounttest.cpp b/daemon/test/accounttest.cpp index 5e0875920c6c1d12b49e3490e43bf134adefb64f..571a14bd4c79bc69efac13cd1da061796e08e52a 100644 --- a/daemon/test/accounttest.cpp +++ b/daemon/test/accounttest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Julien Bonjean <julien.bonjean@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -39,7 +39,7 @@ void AccountTest::TestAddRemove() { - SFL_DBG("-------------------- %s --------------------\n", __PRETTY_FUNCTION__); + RING_DBG("-------------------- %s --------------------\n", __PRETTY_FUNCTION__); std::map<std::string, std::string> details(Manager::instance().getClient()->getConfigurationManager()->getAccountTemplate()); details[CONFIG_ACCOUNT_TYPE] = "SIP"; diff --git a/daemon/test/accounttest.h b/daemon/test/accounttest.h index be671ae8087c221ba38692af2fdf2cbfb74daf0a..d4fda0267464c7fc96b3454b1d6358e4568c0c2c 100644 --- a/daemon/test/accounttest.h +++ b/daemon/test/accounttest.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Julien Bonjean <julien.bonjean@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify diff --git a/daemon/test/audiobuffertest.cpp b/daemon/test/audiobuffertest.cpp index 83b2357c85e90ecdbb337b7ca636d810e4eead9b..bbd99e6420a9b3af97f24a313f753c18346aa167 100644 --- a/daemon/test/audiobuffertest.cpp +++ b/daemon/test/audiobuffertest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Adrien Beraud <adrienberaud@gmail.com> * * This program is free software; you can redistribute it and/or modify @@ -34,7 +34,7 @@ #include "logger.h" #include "test_utils.h" -using namespace sfl; +using namespace ring; void AudioBufferTest::testAudioBufferConstructors() { diff --git a/daemon/test/audiobuffertest.h b/daemon/test/audiobuffertest.h index b019923d90ad9c515463ce781b246c8c9adcc104..82aabc87899e32f73a7a92eae97c2e8ae8fb7cdb 100644 --- a/daemon/test/audiobuffertest.h +++ b/daemon/test/audiobuffertest.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Adrien Beraud <adrienberaud@gmail.com> * * This program is free software; you can redistribute it and/or modify diff --git a/daemon/test/audiocodectest.cpp b/daemon/test/audiocodectest.cpp index 2aa57b14f1833dcf5779f8436de865b36a8d2574..7bc88900ef89cc2b2188622550c2aaa71c3811c9 100644 --- a/daemon/test/audiocodectest.cpp +++ b/daemon/test/audiocodectest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Tristan Matthews <tristan.matthews@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -71,7 +71,7 @@ void AudioCodecTest::testCodecs() AudioCodecFactory factory(pluginMgr); const auto payloadTypes = factory.getCodecList(); - std::vector<std::shared_ptr<sfl::AudioCodec>> codecs; + std::vector<std::shared_ptr<ring::AudioCodec>> codecs; for (auto p : payloadTypes) codecs.push_back(factory.getCodec(p)); diff --git a/daemon/test/audiocodectest.h b/daemon/test/audiocodectest.h index d576504f2f5bbcf66e14ea1cf1a9bd23f8f02f54..e18a307065ad7cb71d11356a8f5afe74e63b961e 100644 --- a/daemon/test/audiocodectest.h +++ b/daemon/test/audiocodectest.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Tristan Matthews <tristan.matthews@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify diff --git a/daemon/test/audiolayertest.cpp b/daemon/test/audiolayertest.cpp index 1e6d4d555f4cdf1d1c4f302039a151edc4dc17a1..8a99da2b9798f5be1bd1d2bc74b97220c0e40550 100644 --- a/daemon/test/audiolayertest.cpp +++ b/daemon/test/audiolayertest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -37,7 +37,7 @@ #include "test_utils.h" #include <unistd.h> -using namespace sfl; +using namespace ring; AudioLayerTest::AudioLayerTest() : manager_(0), pulselayer_(0), layer_(0) {} @@ -73,7 +73,7 @@ void AudioLayerTest::testAudioLayerSwitch() bool wasAlsa = dynamic_cast<AlsaLayer*>(Manager::instance().getAudioDriver().get()) != 0; for (int i = 0; i < 2; i++) { - SFL_DBG("iter - %i", i); + RING_DBG("iter - %i", i); if (wasAlsa) Manager::instance().setAudioManager(PULSEAUDIO_API_STR); else diff --git a/daemon/test/audiolayertest.h b/daemon/test/audiolayertest.h index 0c1456c0e8a608ae83db2ec5349fe1b95fc878ca..e2791b0833dec7ec0727ac2f2e25184ecfed592e 100644 --- a/daemon/test/audiolayertest.h +++ b/daemon/test/audiolayertest.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -46,7 +46,7 @@ class ManagerImpl; -namespace sfl { +namespace ring { class PulseLayer; } @@ -69,7 +69,7 @@ class AudioLayerTest: public CppUnit::TestFixture { NON_COPYABLE(AudioLayerTest); ManagerImpl* manager_; - sfl::PulseLayer* pulselayer_; + ring::PulseLayer* pulselayer_; int layer_; }; CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(AudioLayerTest, "AudioLayerTest"); diff --git a/daemon/test/configurationtest.cpp b/daemon/test/configurationtest.cpp index ef08d9c2fddfcc606d8200af2920e4cb39b9b5bb..08e291c65595b1fc57e5541ca7ad7dc70b479114 100644 --- a/daemon/test/configurationtest.cpp +++ b/daemon/test/configurationtest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify diff --git a/daemon/test/configurationtest.h b/daemon/test/configurationtest.h index 7d63b541685724e0edc931f6d91b5c2035097368..3a4172ec0037afaa0c92f1ac39fd2e9ae9e14f32 100644 --- a/daemon/test/configurationtest.h +++ b/daemon/test/configurationtest.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify diff --git a/daemon/test/constants.h b/daemon/test/constants.h index 636644da1ecf5e218f3b037a07715e305295d188..8b33136b04ef5109f63010700274548eaf99fb6f 100644 --- a/daemon/test/constants.h +++ b/daemon/test/constants.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -34,7 +34,7 @@ #define HISTORY_SAMPLE WORKSPACE "history-sample.tpl" #define HISTORY_SAMPLE_BAK HISTORY_SAMPLE ".bak" -#define CONFIG_SAMPLE WORKSPACE "sflphoned-sample.yml" +#define CONFIG_SAMPLE WORKSPACE "dring-sample.yml" #define CONFIG_SAMPLE_BAK CONFIG_SAMPLE ".bak" #define HISTORY_SAMPLE_SIZE 3 diff --git a/daemon/test/sflphoned-sample.yml b/daemon/test/dring-sample.yml similarity index 97% rename from daemon/test/sflphoned-sample.yml rename to daemon/test/dring-sample.yml index b3ac98eb4250c8f49b1848b69d1fee8a0bb6ef6c..fe76421c92c0c9d7a7464c2c09fe129f4936433c 100644 --- a/daemon/test/sflphoned-sample.yml +++ b/daemon/test/dring-sample.yml @@ -21,7 +21,7 @@ accounts: publishPort: 5060 registrationexpire: 600 ringtoneEnabled: true - ringtonePath: /usr/share/sflphone/ringtones/konga.ul + ringtonePath: /usr/share/ring/ringtones/konga.ul sameasLocal: true serviceRoute: srtp: @@ -93,7 +93,7 @@ accounts: publishPort: 5060 registrationexpire: 60 ringtoneEnabled: true - ringtonePath: /usr/share/sflphone/ringtones/konga.ul + ringtonePath: /usr/share/ring/ringtones/konga.ul sameasLocal: true serviceRoute: srtp: diff --git a/daemon/test/historytest.cpp b/daemon/test/historytest.cpp index 39b7ef12b55f14c93d66ae6421731448c9acf8d8..c65f142ad62b9b2ed7006cbf709d43c3824679cd 100644 --- a/daemon/test/historytest.cpp +++ b/daemon/test/historytest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -39,17 +39,17 @@ namespace { void restore() { if (system("mv " HISTORY_SAMPLE_BAK " " HISTORY_SAMPLE) < 0) - SFL_ERR("Restoration of %s failed", HISTORY_SAMPLE); + RING_ERR("Restoration of %s failed", HISTORY_SAMPLE); } void backup() { if (system("cp " HISTORY_SAMPLE " " HISTORY_SAMPLE_BAK) < 0) - SFL_ERR("Backup of %s failed", HISTORY_SAMPLE); + RING_ERR("Backup of %s failed", HISTORY_SAMPLE); } } -namespace sfl { +namespace ring { void HistoryTest::setUp() { @@ -61,7 +61,7 @@ void HistoryTest::setUp() void HistoryTest::test_create_path() { - SFL_DBG("-------------------- HistoryTest::test_set_path --------------------\n"); + RING_DBG("-------------------- HistoryTest::test_set_path --------------------\n"); std::string path(HISTORY_SAMPLE); CPPUNIT_ASSERT(history_->path_ == path); @@ -69,7 +69,7 @@ void HistoryTest::test_create_path() void HistoryTest::test_load_from_file() { - SFL_DBG("-------------------- HistoryTest::test_load_from_file --------------------\n"); + RING_DBG("-------------------- HistoryTest::test_load_from_file --------------------\n"); bool res = history_->load(HISTORY_LIMIT); CPPUNIT_ASSERT(res); @@ -77,7 +77,7 @@ void HistoryTest::test_load_from_file() void HistoryTest::test_load_items() { - SFL_DBG("-------------------- HistoryTest::test_load_items --------------------\n"); + RING_DBG("-------------------- HistoryTest::test_load_items --------------------\n"); bool res = history_->load(HISTORY_LIMIT); CPPUNIT_ASSERT(res); CPPUNIT_ASSERT(history_->numberOfItems() == HISTORY_SAMPLE_SIZE); @@ -85,13 +85,13 @@ void HistoryTest::test_load_items() void HistoryTest::test_save_to_file() { - SFL_DBG("-------------------- HistoryTest::test_save_to_file --------------------\n"); + RING_DBG("-------------------- HistoryTest::test_save_to_file --------------------\n"); CPPUNIT_ASSERT(history_->save()); } void HistoryTest::test_get_serialized() { - SFL_DBG("-------------------- HistoryTest::test_get_serialized --------------------\n"); + RING_DBG("-------------------- HistoryTest::test_get_serialized --------------------\n"); bool res = history_->load(HISTORY_LIMIT); CPPUNIT_ASSERT(res); CPPUNIT_ASSERT(history_->getSerialized().size() == HISTORY_SAMPLE_SIZE); diff --git a/daemon/test/historytest.h b/daemon/test/historytest.h index 8d0aff07e8cb58048be7424b2a00018b58045584..2934e25552413180f1eadbb7333ccfc0ec81971e 100644 --- a/daemon/test/historytest.h +++ b/daemon/test/historytest.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -37,7 +37,7 @@ // Application import #include "noncopyable.h" -namespace sfl { +namespace ring { class History; @@ -88,7 +88,7 @@ class HistoryTest : public CppUnit::TestCase { private: NON_COPYABLE(HistoryTest); - sfl::History *history_; + ring::History *history_; }; /* Register our test module */ diff --git a/daemon/test/hooktest.cpp b/daemon/test/hooktest.cpp index a5b75ecf30a43c306f6670afbfaaf80d1b8ff5db..805e7e2703f81fc53156484430a4b632010744c8 100644 --- a/daemon/test/hooktest.cpp +++ b/daemon/test/hooktest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Julien Bonjean <julien.bonjean@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify diff --git a/daemon/test/instantmessagingtest.cpp b/daemon/test/instantmessagingtest.cpp index d386c296d56b6ec1646f6a636340bd1b08e3ab65..76427746ce81743c450b91f696cba86bfd2c5b57 100644 --- a/daemon/test/instantmessagingtest.cpp +++ b/daemon/test/instantmessagingtest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -40,7 +40,7 @@ #define MAXIMUM_SIZE 10 #define DELIMITER_CHAR "\n\n" -using namespace sfl::InstantMessaging; +using namespace ring::InstantMessaging; void InstantMessagingTest::testSaveSingleMessage() { @@ -143,13 +143,13 @@ void InstantMessagingTest::testGenerateXmlUriList() std::cout << std::endl; // Create a test list with two entries - sfl::InstantMessaging::UriList list; + ring::InstantMessaging::UriList list; - sfl::InstantMessaging::UriEntry entry1; - entry1[sfl::IM_XML_URI] = "\"sip:alex@example.com\""; + ring::InstantMessaging::UriEntry entry1; + entry1[ring::IM_XML_URI] = "\"sip:alex@example.com\""; - sfl::InstantMessaging::UriEntry entry2; - entry2[sfl::IM_XML_URI] = "\"sip:manu@example.com\""; + ring::InstantMessaging::UriEntry entry2; + entry2[ring::IM_XML_URI] = "\"sip:manu@example.com\""; list.push_front(entry1); list.push_front(entry2); @@ -166,7 +166,7 @@ void InstantMessagingTest::testGenerateXmlUriList() XML_SetElementHandler(parser, startElementCallback, endElementCallback); if (XML_Parse(parser, buffer.c_str(), buffer.size(), 1) == XML_STATUS_ERROR) { - SFL_ERR("%s at line %d", XML_ErrorString(XML_GetErrorCode(parser)), XML_GetCurrentLineNumber(parser)); + RING_ERR("%s at line %d", XML_ErrorString(XML_GetErrorCode(parser)), XML_GetCurrentLineNumber(parser)); CPPUNIT_ASSERT(false); } @@ -185,15 +185,15 @@ void InstantMessagingTest::testXmlUriListParsing() xmlbuffer.append("</resource-lists>"); - sfl::InstantMessaging::UriList list = parseXmlUriList(xmlbuffer); + ring::InstantMessaging::UriList list = parseXmlUriList(xmlbuffer); CPPUNIT_ASSERT(list.size() == 2); // An iterator over xml attribute - sfl::InstantMessaging::UriEntry::iterator iterAttr; + ring::InstantMessaging::UriEntry::iterator iterAttr; // An iterator over list entries for (auto &entry : list) { - iterAttr = entry.find(sfl::IM_XML_URI); + iterAttr = entry.find(ring::IM_XML_URI); CPPUNIT_ASSERT((iterAttr->second == std::string("sip:alex@example.com")) or (iterAttr->second == std::string("sip:manu@example.com"))); @@ -218,7 +218,7 @@ void InstantMessagingTest::testGetTextArea() formatedText.append("--boundary--"); std::string message(findTextMessage(formatedText)); - SFL_DBG("Message %s", message.c_str()); + RING_DBG("Message %s", message.c_str()); CPPUNIT_ASSERT(message == "Here is the text area"); } @@ -245,17 +245,17 @@ void InstantMessagingTest::testGetUriListArea() std::cout << "urilist: " << urilist << std::endl; - sfl::InstantMessaging::UriList list = parseXmlUriList(urilist); + ring::InstantMessaging::UriList list = parseXmlUriList(urilist); CPPUNIT_ASSERT(list.size() == 2); // order may be important, for example to identify message sender - sfl::InstantMessaging::UriEntry entry = list.front(); + ring::InstantMessaging::UriEntry entry = list.front(); CPPUNIT_ASSERT(entry.size() == 2); - sfl::InstantMessaging::UriEntry::iterator iterAttr = entry.find(sfl::IM_XML_URI); + ring::InstantMessaging::UriEntry::iterator iterAttr = entry.find(ring::IM_XML_URI); if (iterAttr == entry.end()) { - SFL_ERR("Did not find attribute"); + RING_ERR("Did not find attribute"); CPPUNIT_ASSERT(false); } @@ -284,7 +284,7 @@ void InstantMessagingTest::testIllFormatedMessage() try { std::string message = findTextMessage(formatedText); - } catch (const sfl::InstantMessageException &e) { + } catch (const ring::InstantMessageException &e) { exceptionCaught = true; } diff --git a/daemon/test/instantmessagingtest.h b/daemon/test/instantmessagingtest.h index 159cb1b210be88d13b4375ee27bccc96db934f3b..149cfec68a44a63af0fd47e7acbcf23d41a14553 100644 --- a/daemon/test/instantmessagingtest.h +++ b/daemon/test/instantmessagingtest.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify diff --git a/daemon/test/iptest.cpp b/daemon/test/iptest.cpp index 888dac637d112c8d5fbe8100b320a46c15f9a925..a68a7c2dbb533de577adb1a05aba30e0d03a897d 100644 --- a/daemon/test/iptest.cpp +++ b/daemon/test/iptest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Adrien Béraud <adrien.beraud@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify diff --git a/daemon/test/iptest.h b/daemon/test/iptest.h index 1f6be4a05ef977feba4c0a68dfa0dc678f8fac74..d1e920fa8d689884725afca0028b1fc65d62ce15 100644 --- a/daemon/test/iptest.h +++ b/daemon/test/iptest.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Adrien Béraud <adrien.beraud@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify diff --git a/daemon/test/main.cpp b/daemon/test/main.cpp index ef333ca561d73f737d9c2301e644839a17f0f483..e65d51dd0a290cb5d32c82c62fe6cfc38505c47e 100644 --- a/daemon/test/main.cpp +++ b/daemon/test/main.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Julien Bonjean <julien.bonjean@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -44,12 +44,12 @@ namespace { void restore() { if (system("mv " CONFIG_SAMPLE_BAK " " CONFIG_SAMPLE) < 0) - SFL_ERR("Restoration of %s failed", CONFIG_SAMPLE); + RING_ERR("Restoration of %s failed", CONFIG_SAMPLE); } void backup() { if (system("cp " CONFIG_SAMPLE " " CONFIG_SAMPLE_BAK) < 0) - SFL_ERR("Backup of %s failed", CONFIG_SAMPLE); + RING_ERR("Backup of %s failed", CONFIG_SAMPLE); } } @@ -62,12 +62,12 @@ void cleanup() int main(int argc, char* argv[]) { atexit(cleanup); - printf("\nSFLphone Daemon Test Suite, by Savoir-Faire Linux 2004-2014\n\n"); + printf("\nRing Daemon Test Suite, by Savoir-Faire Linux 2004-2015\n\n"); setConsoleLog(true); setDebugMode(true); fileutils::FileHandle f(fileutils::create_pidfile()); if (f.fd == -1) { - fprintf(stderr, "An sflphoned instance is already running, quitting...\n"); + fprintf(stderr, "An dring instance is already running, quitting...\n"); return 1; } @@ -97,13 +97,13 @@ int main(int argc, char* argv[]) argvIndex++; setDebugMode(true); - SFL_INFO("Debug mode activated"); + RING_INFO("Debug mode activated"); } else if (strcmp("--xml", argv[1]) == 0) { argvIndex++; xmlOutput = true; - SFL_INFO("Using XML output"); + RING_INFO("Using XML output"); } } @@ -124,7 +124,7 @@ int main(int argc, char* argv[]) CPPUNIT_NS::Test *suite = CPPUNIT_NS::TestFactoryRegistry::getRegistry(testSuiteName).makeTest(); if (suite->getChildTestCount() == 0) { - SFL_ERR("Invalid test suite name: %s", testSuiteName.c_str()); + RING_ERR("Invalid test suite name: %s", testSuiteName.c_str()); restore(); return 1; } diff --git a/daemon/test/numbercleanertest.cpp b/daemon/test/numbercleanertest.cpp index 036ed86ad72f074883159816c86da212ed2b47c9..af7a71ae5bbc7735cf2cbf0c936c300389b9e6d4 100644 --- a/daemon/test/numbercleanertest.cpp +++ b/daemon/test/numbercleanertest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -53,76 +53,76 @@ void NumberCleanerTest::test_format_1(void) { - SFL_DBG("-------------------- NumberCleanerTest::test_format_1 --------------------\n"); + RING_DBG("-------------------- NumberCleanerTest::test_format_1 --------------------\n"); CPPUNIT_ASSERT(NumberCleaner::clean(NUMBER_TEST_1) == VALID_NUMBER); } void NumberCleanerTest::test_format_2(void) { - SFL_DBG("-------------------- NumberCleanerTest::test_format_2 --------------------\n"); + RING_DBG("-------------------- NumberCleanerTest::test_format_2 --------------------\n"); CPPUNIT_ASSERT(NumberCleaner::clean(NUMBER_TEST_2) == VALID_NUMBER); } void NumberCleanerTest::test_format_3(void) { - SFL_DBG("-------------------- NumberCleanerTest::test_format_3 --------------------\n"); + RING_DBG("-------------------- NumberCleanerTest::test_format_3 --------------------\n"); CPPUNIT_ASSERT(NumberCleaner::clean(NUMBER_TEST_3) == VALID_NUMBER); } void NumberCleanerTest::test_format_4(void) { - SFL_DBG("-------------------- NumberCleanerTest::test_format_4 --------------------\n"); + RING_DBG("-------------------- NumberCleanerTest::test_format_4 --------------------\n"); CPPUNIT_ASSERT(NumberCleaner::clean(NUMBER_TEST_4) == VALID_NUMBER); } void NumberCleanerTest::test_format_5(void) { - SFL_DBG("-------------------- NumberCleanerTest::test_format_5 --------------------\n"); + RING_DBG("-------------------- NumberCleanerTest::test_format_5 --------------------\n"); CPPUNIT_ASSERT(NumberCleaner::clean(NUMBER_TEST_5) == VALID_NUMBER); } void NumberCleanerTest::test_format_6(void) { - SFL_DBG("-------------------- NumberCleanerTest::test_format_6 --------------------\n"); + RING_DBG("-------------------- NumberCleanerTest::test_format_6 --------------------\n"); CPPUNIT_ASSERT(NumberCleaner::clean(NUMBER_TEST_6) == VALID_NUMBER); } void NumberCleanerTest::test_format_7(void) { - SFL_DBG("-------------------- NumberCleanerTest::test_format_7 --------------------\n"); + RING_DBG("-------------------- NumberCleanerTest::test_format_7 --------------------\n"); CPPUNIT_ASSERT(NumberCleaner::clean(NUMBER_TEST_7) == VALID_EXTENSION); } void NumberCleanerTest::test_format_8(void) { - SFL_DBG("-------------------- NumberCleanerTest::test_format_8 --------------------\n"); + RING_DBG("-------------------- NumberCleanerTest::test_format_8 --------------------\n"); CPPUNIT_ASSERT(NumberCleaner::clean(NUMBER_TEST_8) == VALID_NUMBER); } void NumberCleanerTest::test_format_9(void) { - SFL_DBG("-------------------- NumberCleanerTest::test_format_9 --------------------\n"); + RING_DBG("-------------------- NumberCleanerTest::test_format_9 --------------------\n"); CPPUNIT_ASSERT(NumberCleaner::clean(NUMBER_TEST_9) == VALID_NUMBER); } void NumberCleanerTest::test_format_10(void) { - SFL_DBG("-------------------- NumberCleanerTest::test_format_10 --------------------\n"); + RING_DBG("-------------------- NumberCleanerTest::test_format_10 --------------------\n"); CPPUNIT_ASSERT(NumberCleaner::clean(NUMBER_TEST_1, "9") == VALID_PREPENDED_NUMBER); } void NumberCleanerTest::test_format_11(void) { - SFL_DBG("-------------------- NumberCleanerTest::test_format_11 --------------------\n"); + RING_DBG("-------------------- NumberCleanerTest::test_format_11 --------------------\n"); CPPUNIT_ASSERT(NumberCleaner::clean(NUMBER_TEST_10, "9") == VALID_EXTENSION); } diff --git a/daemon/test/numbercleanertest.h b/daemon/test/numbercleanertest.h index c5b6a115bc3f87d83b7abb1f5535b45a69ca5917..d2220f8b51c6dd16a2b2f37f3946fc65fd7e833f 100644 --- a/daemon/test/numbercleanertest.h +++ b/daemon/test/numbercleanertest.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify diff --git a/daemon/test/resamplertest.cpp b/daemon/test/resamplertest.cpp index 209432eed0520fafcccd1c50f86acbdd1594fc01..b541ba4bca0ca19326ac14aa06087dcee1df5ada 100644 --- a/daemon/test/resamplertest.cpp +++ b/daemon/test/resamplertest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -35,7 +35,7 @@ #include "resamplertest.h" -using namespace sfl; +using namespace ring; ResamplerTest::ResamplerTest() : CppUnit::TestCase("Resampler module test"), inputBuffer(MAX_BUFFER_LENGTH, AudioFormat::MONO()), outputBuffer(MAX_BUFFER_LENGTH, AudioFormat::MONO()) diff --git a/daemon/test/resamplertest.h b/daemon/test/resamplertest.h index 7d40236ee1c758ef72fc5a66fb72d6310a372551..fbb5272c5d0172297765e0c8e01fc47770d072c9 100644 --- a/daemon/test/resamplertest.h +++ b/daemon/test/resamplertest.h @@ -123,22 +123,22 @@ private: /* * Perform upsampling on the whole input buffer */ - void performUpsampling(sfl::Resampler &resampler); + void performUpsampling(ring::Resampler &resampler); /* * Perform downsampling on the whold input buffer */ - void performDownsampling(sfl::Resampler &resampler); + void performDownsampling(ring::Resampler &resampler); /** * Used to store input samples */ - sfl::AudioBuffer inputBuffer; + ring::AudioBuffer inputBuffer; /** * Used to receive output samples */ - sfl::AudioBuffer outputBuffer; + ring::AudioBuffer outputBuffer; }; /* Register the test module */ diff --git a/daemon/test/ringbufferpooltest.cpp b/daemon/test/ringbufferpooltest.cpp index 331e67d3965d7c2a0d3d516ac669bb17db938109..63f2a6884a254ec22b0bb8a8beb7586b6db07088 100644 --- a/daemon/test/ringbufferpooltest.cpp +++ b/daemon/test/ringbufferpooltest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -37,7 +37,7 @@ #include "logger.h" #include "test_utils.h" -using namespace sfl; +using namespace ring; void RingBufferPoolTest::testBindUnbindBuffer() { diff --git a/daemon/test/ringbufferpooltest.h b/daemon/test/ringbufferpooltest.h index 0589747689885e9c2e27e53e8269e7e78d0b0c3b..350d9b1298ebfd5bd616189e6fb9d0dcfff52d5b 100644 --- a/daemon/test/ringbufferpooltest.h +++ b/daemon/test/ringbufferpooltest.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -39,7 +39,7 @@ #include <memory> -namespace sfl { +namespace ring { class RingBufferPool; } @@ -76,7 +76,7 @@ class RingBufferPoolTest : public CppUnit::TestCase { private: - std::unique_ptr<sfl::RingBufferPool> rbPool_; + std::unique_ptr<ring::RingBufferPool> rbPool_; }; /* Register our test module */ diff --git a/daemon/test/scripts/presence_test.py b/daemon/test/scripts/presence_test.py index 1b46b26f1b6fb7f4a45e7065b378847a91cda080..757aa5afac94335559de241795b55735bc6fbfea 100755 --- a/daemon/test/scripts/presence_test.py +++ b/daemon/test/scripts/presence_test.py @@ -39,10 +39,10 @@ logger.addHandler(ch) #------------------ Initialise DBUS ------------------------------ dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) bus = dbus.SessionBus() -presenceManagerBus = bus.get_object('org.sflphone.SFLphone', '/org/sflphone/SFLphone/PresenceManager') -presenceManager = dbus.Interface(presenceManagerBus, dbus_interface='org.sflphone.SFLphone.PresenceManager') -configurationManagerBus = bus.get_object('org.sflphone.SFLphone', '/org/sflphone/SFLphone/ConfigurationManager') -configurationManager = dbus.Interface(configurationManagerBus, dbus_interface='org.sflphone.SFLphone.ConfigurationManager') +presenceManagerBus = bus.get_object('cx.ring.Ring', '/cx/ring/Ring/PresenceManager') +presenceManager = dbus.Interface(presenceManagerBus, dbus_interface='cx.ring.Ring.PresenceManager') +configurationManagerBus = bus.get_object('cx.ring.Ring', '/cx/ring/Ring/ConfigurationManager') +configurationManager = dbus.Interface(configurationManagerBus, dbus_interface='cx.ring.Ring.ConfigurationManager') #------------------------- General purpose functions ---------------------------- @@ -201,10 +201,10 @@ if __name__ == '__main__': try: # dbus signal monitor - presenceManagerBus.connect_to_signal("newBuddyNotification", newPresSubCientNotificationHandler, dbus_interface='org.sflphone.SFLphone.PresenceManager') - presenceManagerBus.connect_to_signal("newServerSubscriptionRequest", newPresSubServerRequestHandler, dbus_interface='org.sflphone.SFLphone.PresenceManager') - presenceManagerBus.connect_to_signal("subcriptionStateChanged", subcriptionStateChangedHandler, dbus_interface='org.sflphone.SFLphone.PresenceManager') - presenceManagerBus.connect_to_signal("serverError", serverErrorHandler, dbus_interface='org.sflphone.SFLphone.PresenceManager') + presenceManagerBus.connect_to_signal("newBuddyNotification", newPresSubCientNotificationHandler, dbus_interface='cx.ring.Ring.PresenceManager') + presenceManagerBus.connect_to_signal("newServerSubscriptionRequest", newPresSubServerRequestHandler, dbus_interface='cx.ring.Ring.PresenceManager') + presenceManagerBus.connect_to_signal("subcriptionStateChanged", subcriptionStateChangedHandler, dbus_interface='cx.ring.Ring.PresenceManager') + presenceManagerBus.connect_to_signal("serverError", serverErrorHandler, dbus_interface='cx.ring.Ring.PresenceManager') start_time = time.time() task_N = len(task_list) diff --git a/daemon/test/scripts/stress_test.py b/daemon/test/scripts/stress_test.py index cc468d80ac8f5488362a0a9036514cce1ddb09f7..7516ca0db5a68a95571814605b43bd72127c2f8b 100755 --- a/daemon/test/scripts/stress_test.py +++ b/daemon/test/scripts/stress_test.py @@ -81,12 +81,12 @@ def stop_daemon(): def reInit(): try: global callManagerBus,callManager,configurationManagerBus,configurationManager,instanceManagerBus,instanceManager - callManagerBus = bus.get_object('org.sflphone.SFLphone', '/org/sflphone/SFLphone/CallManager') - callManager = dbus.Interface(callManagerBus, dbus_interface='org.sflphone.SFLphone.CallManager') - configurationManagerBus = bus.get_object('org.sflphone.SFLphone', '/org/sflphone/SFLphone/ConfigurationManager') - configurationManager = dbus.Interface(configurationManagerBus, dbus_interface='org.sflphone.SFLphone.ConfigurationManager') - instanceManagerBus = bus.get_object('org.sflphone.SFLphone', '/org/sflphone/SFLphone/Instance') - instanceManager = dbus.Interface(instanceManagerBus , dbus_interface='org.sflphone.SFLphone.Instance') + callManagerBus = bus.get_object('cx.ring.Ring', '/cx/ring/Ring/CallManager') + callManager = dbus.Interface(callManagerBus, dbus_interface='cx.ring.Ring.CallManager') + configurationManagerBus = bus.get_object('cx.ring.Ring', '/cx/ring/Ring/ConfigurationManager') + configurationManager = dbus.Interface(configurationManagerBus, dbus_interface='cx.ring.Ring.ConfigurationManager') + instanceManagerBus = bus.get_object('cx.ring.Ring', '/cx/ring/Ring/Instance') + instanceManager = dbus.Interface(instanceManagerBus , dbus_interface='cx.ring.Ring.Instance') instanceManager.Register(123,"doombot") global first_account,first_iax_account,first_account_number first_account = get_first_account() diff --git a/daemon/test/sdesnegotiatortest.cpp b/daemon/test/sdesnegotiatortest.cpp index 215011e53b493bdb58683b66d9f798bec4cdb8b7..91a99fbb40c80bf73fb1be000ba7a3f32954b1ff 100644 --- a/daemon/test/sdesnegotiatortest.cpp +++ b/daemon/test/sdesnegotiatortest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -56,7 +56,7 @@ void SdesNegotiatorTest::testTagPattern() TITLE(); std::string subject = "a=crypto:4"; - sfl::Pattern pattern("^a=crypto:(?P<tag>[0-9]{1,9})", false); + ring::Pattern pattern("^a=crypto:(?P<tag>[0-9]{1,9})", false); pattern.updateSubject(subject); CPPUNIT_ASSERT(pattern.matches()); @@ -69,7 +69,7 @@ void SdesNegotiatorTest::testCryptoSuitePattern() TITLE(); std::string subject = "AES_CM_128_HMAC_SHA1_80"; - sfl::Pattern pattern("(?P<cryptoSuite>AES_CM_128_HMAC_SHA1_80|" \ + ring::Pattern pattern("(?P<cryptoSuite>AES_CM_128_HMAC_SHA1_80|" \ "AES_CM_128_HMAC_SHA1_32|" \ "F8_128_HMAC_SHA1_80|" \ "[A-Za-z0-9_]+)", false); @@ -86,7 +86,7 @@ void SdesNegotiatorTest::testKeyParamsPattern() std::string subject = "inline:d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj|2^20|1:32"; - sfl::Pattern pattern("(?P<srtpKeyMethod>inline|[A-Za-z0-9_]+)\\:" \ + ring::Pattern pattern("(?P<srtpKeyMethod>inline|[A-Za-z0-9_]+)\\:" \ "(?P<srtpKeyInfo>[A-Za-z0-9\x2B\x2F\x3D]+)\\|" \ "(2\\^(?P<lifetime>[0-9]+)\\|" \ "(?P<mkiValue>[0-9]+)\\:" \ @@ -110,7 +110,7 @@ void SdesNegotiatorTest::testKeyParamsPatternWithoutMKI() std::string subject("inline:d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj"); - sfl::Pattern pattern("(?P<srtpKeyMethod>inline|[A-Za-z0-9_]+)\\:" \ + ring::Pattern pattern("(?P<srtpKeyMethod>inline|[A-Za-z0-9_]+)\\:" \ "(?P<srtpKeyInfo>[A-Za-z0-9\x2B\x2F\x3D]+)" \ "(\\|2\\^(?P<lifetime>[0-9]+)\\|" \ "(?P<mkiValue>[0-9]+)\\:" \ @@ -138,12 +138,12 @@ void SdesNegotiatorTest::testNegotiation() remoteOffer.push_back("a=crypto:2 AES_CM_128_HMAC_SHA1_32 inline:NzB4d1BINUAvLEw6UzF3WSJ+PSdFcGdUJShpX1Zj|2^20|1:32"); // Register the local capabilities. - std::vector<sfl::CryptoSuiteDefinition> localCapabilities; + std::vector<ring::CryptoSuiteDefinition> localCapabilities; for (int i = 0; i < 3; ++i) - localCapabilities.push_back(sfl::CryptoSuites[i]); + localCapabilities.push_back(ring::CryptoSuites[i]); - sfl::SdesNegotiator sdesnego(localCapabilities, remoteOffer); + ring::SdesNegotiator sdesnego(localCapabilities, remoteOffer); CPPUNIT_ASSERT(sdesnego.negotiate()); } @@ -156,18 +156,18 @@ void SdesNegotiatorTest::testComponent() TITLE(); // Register the local capabilities. - std::vector<sfl::CryptoSuiteDefinition> capabilities; + std::vector<ring::CryptoSuiteDefinition> capabilities; // Support all the CryptoSuites for (int i = 0; i < 3; i++) - capabilities.push_back(sfl::CryptoSuites[i]); + capabilities.push_back(ring::CryptoSuites[i]); // Make sure that if a component is missing, negotiate will fail std::string cryptoLine("a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:|2^20|1:32"); std::vector<std::string> cryptoOffer; cryptoOffer.push_back(cryptoLine); - sfl::SdesNegotiator negotiator(capabilities, cryptoOffer); + ring::SdesNegotiator negotiator(capabilities, cryptoOffer); CPPUNIT_ASSERT(!negotiator.negotiate()); } @@ -179,18 +179,18 @@ void SdesNegotiatorTest::testMostSimpleCase() TITLE(); // Register the local capabilities. - std::vector<sfl::CryptoSuiteDefinition> capabilities; + std::vector<ring::CryptoSuiteDefinition> capabilities; // Support all the CryptoSuites for (int i = 0; i < 3; i++) - capabilities.push_back(sfl::CryptoSuites[i]); + capabilities.push_back(ring::CryptoSuites[i]); // Make sure taht this case works (since it's default for most application) std::string cryptoLine("a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwd"); std::vector<std::string> cryptoOffer; cryptoOffer.push_back(cryptoLine); - sfl::SdesNegotiator negotiator(capabilities, cryptoOffer); + ring::SdesNegotiator negotiator(capabilities, cryptoOffer); CPPUNIT_ASSERT(negotiator.negotiate()); @@ -209,17 +209,17 @@ void SdesNegotiatorTest::test32ByteKeyLength() TITLE(); // Register the local capabilities. - std::vector<sfl::CryptoSuiteDefinition> capabilities; + std::vector<ring::CryptoSuiteDefinition> capabilities; //Support all the CryptoSuites for (int i = 0; i < 3; i++) - capabilities.push_back(sfl::CryptoSuites[i]); + capabilities.push_back(ring::CryptoSuites[i]); std::string cryptoLine("a=crypto:1 AES_CM_128_HMAC_SHA1_32 inline:AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwd"); std::vector<std::string> cryptoOffer; cryptoOffer.push_back(cryptoLine); - sfl::SdesNegotiator negotiator(capabilities, cryptoOffer); + ring::SdesNegotiator negotiator(capabilities, cryptoOffer); CPPUNIT_ASSERT(negotiator.negotiate()); diff --git a/daemon/test/sdesnegotiatortest.h b/daemon/test/sdesnegotiatortest.h index e26afcafc59d0c6c7bba5f743449f20e63cf60b3..7610124315b88c820071ebab683191315d894a5a 100644 --- a/daemon/test/sdesnegotiatortest.h +++ b/daemon/test/sdesnegotiatortest.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -60,7 +60,7 @@ #include "sip/sdes_negotiator.h" // for CryptoSuiteDefinition -namespace sfl { +namespace ring { class Pattern; } diff --git a/daemon/test/sdptest.cpp b/daemon/test/sdptest.cpp index 77dd7b257beb91c6befbf467b7d676b92b6c4c5c..245645daecd48d4325b29b34f6b493c7eae60fda 100644 --- a/daemon/test/sdptest.cpp +++ b/daemon/test/sdptest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -120,7 +120,7 @@ namespace { std::vector<std::map<std::string, std::string> > createVideoCodecs() { std::vector<std::map<std::string, std::string> > videoCodecs; -#ifdef SFL_VIDEO +#ifdef RING_VIDEO std::map<std::string, std::string> codec; codec["name"] = "H264"; codec["enabled"] = "true"; @@ -282,8 +282,8 @@ void SDPTest::testReinvite() CPPUNIT_ASSERT(session_->getPublishedIP() == LOCALHOST); CPPUNIT_ASSERT(session_->getRemoteIP() == "host.example.com"); - std::vector<sfl::AudioCodec*> codecs(session_->getSessionAudioMedia()); - sfl::AudioCodec *codec = codecs[0]; + std::vector<ring::AudioCodec*> codecs(session_->getSessionAudioMedia()); + ring::AudioCodec *codec = codecs[0]; CPPUNIT_ASSERT(codec and codec->getMimeSubtype() == "PCMU"); pjmedia_sdp_session *reinviteOffer; diff --git a/daemon/test/sdptest.h b/daemon/test/sdptest.h index d3cab6bba57d5b83b48c8739c87a746f62d27163..0aae52696c6da53abe3eb53e0e5d2147c88141c5 100644 --- a/daemon/test/sdptest.h +++ b/daemon/test/sdptest.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify diff --git a/daemon/test/siptest.cpp b/daemon/test/siptest.cpp index 16890d563b42956f622e947685d644bc6772052f..cb4db0ce3ebb9cb32f4de3a21b1492ca55ae947c 100644 --- a/daemon/test/siptest.cpp +++ b/daemon/test/siptest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -133,7 +133,7 @@ void SIPTest::testSimpleOutgoingIpCall() int rc = pthread_create(&thethread, NULL, sippThread, &command); if (rc) - std::cout << "SIPTest: SFL_ERR; return code from pthread_create()" << std::endl; + std::cout << "SIPTest: RING_ERR; return code from pthread_create()" << std::endl; std::string testaccount("IP2IP"); std::string testcallid("callid1234"); @@ -155,7 +155,7 @@ void SIPTest::testSimpleOutgoingIpCall() rc = pthread_join(thethread, NULL); if (rc) - std::cout << "SIPTest: SFL_ERR; return code from pthread_join(): " << rc << std::endl; + std::cout << "SIPTest: RING_ERR; return code from pthread_join(): " << rc << std::endl; else std::cout << "SIPTest: completed join with thread" << std::endl; } @@ -171,9 +171,9 @@ void SIPTest::testSimpleIncomingIpCall() int rc = pthread_create(&thethread, NULL, sippThread, &command); if (rc) - std::cout << "SIPTest: SFL_ERR; return code from pthread_create()" << std::endl; + std::cout << "SIPTest: RING_ERR; return code from pthread_create()" << std::endl; - // sleep a while to make sure that sipp insdtance is initialized and sflphoned received + // sleep a while to make sure that sipp insdtance is initialized and dring received // the incoming invite. sleep(2); @@ -189,7 +189,7 @@ void SIPTest::testSimpleIncomingIpCall() rc = pthread_join(thethread, NULL); if (rc) - std::cout << "SIPTest: SFL_ERR; return code from pthread_join(): " << rc << std::endl; + std::cout << "SIPTest: RING_ERR; return code from pthread_join(): " << rc << std::endl; else std::cout << "SIPTest: completed join with thread" << std::endl; } @@ -207,13 +207,13 @@ void SIPTest::testTwoOutgoingIpCall() int rc = pthread_create(&firstCallThread, NULL, sippThread, &firstCallCommand); if (rc) - std::cout << "SIPTest: SFL_ERR; return code from pthread_create()" << std::endl; + std::cout << "SIPTest: RING_ERR; return code from pthread_create()" << std::endl; pthread_t secondCallThread; rc = pthread_create(&secondCallThread, NULL, sippThread, &secondCallCommand); if (rc) - std::cout << "SIPTest: SFL_ERR; return code from pthread_create()" << std::endl; + std::cout << "SIPTest: RING_ERR; return code from pthread_create()" << std::endl; sleep(1); @@ -243,7 +243,7 @@ void SIPTest::testTwoOutgoingIpCall() rc = pthread_join(firstCallThread, NULL); if (rc) - std::cout << "SIPTest: SFL_ERR; return code from pthread_join(): " << rc << std::endl; + std::cout << "SIPTest: RING_ERR; return code from pthread_join(): " << rc << std::endl; std::cout << "SIPTest: completed join with thread" << std::endl; @@ -252,7 +252,7 @@ void SIPTest::testTwoOutgoingIpCall() rc = pthread_join(secondCallThread, NULL); if (rc) - std::cout << "SIPTest: SFL_ERR; return code from pthread_join(): " << rc << std::endl; + std::cout << "SIPTest: RING_ERR; return code from pthread_join(): " << rc << std::endl; else std::cout << "SIPTest: completed join with thread" << std::endl; } @@ -276,9 +276,9 @@ void SIPTest::testTwoIncomingIpCall() int rc = pthread_create(&firstCallThread, &attr, sippThreadWithCount, &firstCallCommand); if (rc) - std::cout << "SIPTest: SFL_ERR; return code from pthread_create()" << std::endl; + std::cout << "SIPTest: RING_ERR; return code from pthread_create()" << std::endl; - // sleep a while to make sure that sipp insdtance is initialized and sflphoned received + // sleep a while to make sure that sipp insdtance is initialized and dring received // the incoming invite. sleep(1); @@ -331,7 +331,7 @@ void SIPTest::testHoldIpCall() int rc = pthread_create(&callThread, NULL, sippThread, (void *)(&callCommand)); if (rc) - std::cout << "SIPTest: SFL_ERR; return code from pthread_create(): " << rc << std::endl; + std::cout << "SIPTest: RING_ERR; return code from pthread_create(): " << rc << std::endl; else std::cout << "SIPTest: completed thread creation" << std::endl; @@ -401,9 +401,9 @@ void SIPTest::testIncomingIpCallSdp() int rc = pthread_create(&thethread, NULL, sippThread, (void *)(&command)); if (rc) - std::cout << "SIPTest: SFL_ERR; return code from pthread_create()" << std::endl; + std::cout << "SIPTest: RING_ERR; return code from pthread_create()" << std::endl; - // sleep a while to make sure that sipp insdtance is initialized and sflphoned received + // sleep a while to make sure that sipp insdtance is initialized and dring received // the incoming invite. sleep(2); @@ -423,7 +423,7 @@ void SIPTest::testIncomingIpCallSdp() rc = pthread_join(thethread, NULL); if (rc) - std::cout << "SIPTest: SFL_ERR; return code from pthread_join(): " << rc << std::endl; + std::cout << "SIPTest: RING_ERR; return code from pthread_join(): " << rc << std::endl; else std::cout << "SIPTest: completed join with thread" << std::endl; } diff --git a/daemon/test/siptest.h b/daemon/test/siptest.h index 53a38292664991d176288de964eadfe9a1a34c6a..a2218832dda8fb55f3e5665f1eeb7a95bc517224 100644 --- a/daemon/test/siptest.h +++ b/daemon/test/siptest.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify diff --git a/daemon/test/test_utils.h b/daemon/test/test_utils.h index b674b51e1dd19f697f769d07215c0613c61b7222..5fd9d9f4d6d09d5311c5d18c7d297b5d49d39810 100644 --- a/daemon/test/test_utils.h +++ b/daemon/test/test_utils.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Tristan Matthews <tristan.matthews@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify @@ -33,6 +33,6 @@ #include "logger.h" -#define TITLE() SFL_DBG("Starting test..."); fflush(stderr) +#define TITLE() RING_DBG("Starting test..."); fflush(stderr) #endif // TEST_UTILS_H_ diff --git a/daemon/test/tlstest.cpp b/daemon/test/tlstest.cpp index 4d7de01a641453869b86bb312deb2e572a0cc533..da62051be0b0e45c92fd03b4340cd25adef79b20 100644 --- a/daemon/test/tlstest.cpp +++ b/daemon/test/tlstest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify diff --git a/daemon/test/tlstest.h b/daemon/test/tlstest.h index 4df1eb1a73797c84c3b2018e7ed02907d4de21de..eea78b28bad6d26e02bedd6097507e008c5c1f17 100644 --- a/daemon/test/tlstest.h +++ b/daemon/test/tlstest.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. + * Copyright (C) 2004-2015 Savoir-Faire Linux Inc. * Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify diff --git a/gnome/data/Makefile.am b/gnome/data/Makefile.am index d65b5bd653c70e68b8b9e9561abba4cdaf48efb9..04ab2ed595080be1cf337821b0d2f4db14c00976 100644 --- a/gnome/data/Makefile.am +++ b/gnome/data/Makefile.am @@ -1,5 +1,5 @@ # gsettings_SCHEMAS is a list of all the schemas you want to install -gsettings_SCHEMAS = org.sflphone.SFLphone.gschema.xml +gsettings_SCHEMAS = cx.ring.Ring.gschema.xml # include the appropriate makefile rules for schema handling @GSETTINGS_RULES@ diff --git a/gnome/data/org.sflphone.SFLphone.gschema.xml b/gnome/data/cx.ring.Ring.gschema.xml similarity index 98% rename from gnome/data/org.sflphone.SFLphone.gschema.xml rename to gnome/data/cx.ring.Ring.gschema.xml index 23530401496e2d3f76fa49ba4e272376e76c2b84..fb1369e73fd5627a5297dd410002dc4c4f9dd3c8 100644 --- a/gnome/data/org.sflphone.SFLphone.gschema.xml +++ b/gnome/data/cx.ring.Ring.gschema.xml @@ -1,5 +1,5 @@ <schemalist> - <schema id="org.sflphone.SFLphone" path="/org/sflphone/sflphone-client-gnome/"> + <schema id="cx.ring.Ring" path="/cx/ring/ring-client-gnome/"> <key name="window-width" type="i"> <default>240</default> <summary>Main window width</summary> diff --git a/gnome/globals.mak b/gnome/globals.mak index 1af810769c7f031a923d3fbf6f286ea9c0431757..93a5d1c39572d5f7408eb818d5263dd162e38a2d 100644 --- a/gnome/globals.mak +++ b/gnome/globals.mak @@ -4,7 +4,7 @@ src = $(top_srcdir) ASTYLERC="$(top_srcdir)/../astylerc" indent="/usr/bin/astyle" -sfllibdir=$(DESTDIR)$(libdir)/sflphone +sfllibdir=$(DESTDIR)$(libdir)/ring sflplugindir=$(sfllibdir)/plugins # Preprocessor flags @@ -13,9 +13,9 @@ AM_CPPFLAGS = $(DEPS_CFLAGS) \ -I$(src)/src/config \ -I$(src)/src/dbus \ -I$(src)/src/contacts \ - -DDATA_DIR=\""$(prefix)/share/sflphone"\" \ - -DICONS_DIR=\""$(prefix)/share/sflphone"\" \ - -DCODECS_DIR=\""$(prefix)/lib/sflphone/codecs"\" \ + -DDATA_DIR=\""$(prefix)/share/ring"\" \ + -DICONS_DIR=\""$(prefix)/share/ring"\" \ + -DCODECS_DIR=\""$(prefix)/lib/ring/codecs"\" \ -DPREFIX=\"$(prefix)\" \ -DENABLE_TRACE \ -DPREFIX=\""$(prefix)"\" \ @@ -23,7 +23,7 @@ AM_CPPFLAGS = $(DEPS_CFLAGS) \ -DDATADIR=\""$(datadir)"\" \ -DLIBDIR=\""$(libdir)"\" \ -DLOCALEDIR=\""$(localedir)"\" \ - -DSFLPHONE_UIDIR=\""$(datadir)/sflphone/ui"\" \ + -DSFLPHONE_UIDIR=\""$(datadir)/ring/ui"\" \ -DPLUGINS_DIR=\""$(sflplugindir)"\" indent: @echo "Indenting code:" diff --git a/gnome/man/ring-client-gnome.pod b/gnome/man/ring-client-gnome.pod index 3ee96d962e53c1496919d90ad882fcdb7e6c7f87..ed0e04588095d5d4e1cbe3f92c2da8f2b5ff1d4e 100644 --- a/gnome/man/ring-client-gnome.pod +++ b/gnome/man/ring-client-gnome.pod @@ -24,7 +24,7 @@ This manual page was written by Emmanuel Milou <emmanuel.milou@savoirfairelinux. =head1 SEE ALSO -B<ringd>(1) +B<dring>(1) =head1 COPYRIGHT diff --git a/gnome/src/dbus/callmanager-introspec.xml b/gnome/src/dbus/callmanager-introspec.xml index 1b8664640354dde871ff8267b8478fc61e6ede42..78df357e4bb612e1753c9321844e6c6fcc81fe7f 100644 --- a/gnome/src/dbus/callmanager-introspec.xml +++ b/gnome/src/dbus/callmanager-introspec.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" ?> <node name="/callmanager-introspec" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"> - <interface name="org.sflphone.SFLphone.CallManager"> + <interface name="cx.ring.Ring.CallManager"> <tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>The CallManager interface is used to manage call and conference related actions.</p> diff --git a/gnome/src/dbus/configurationmanager-introspec.xml b/gnome/src/dbus/configurationmanager-introspec.xml index 8cc1c5dcd6b79c751f2441dc260a3473165dbec4..66ff98163ac21c382b90ddfb3288998e2ddd2257 100644 --- a/gnome/src/dbus/configurationmanager-introspec.xml +++ b/gnome/src/dbus/configurationmanager-introspec.xml @@ -1,6 +1,6 @@ <?xml version="1.0" ?> <node name="/configurationmanager-introspec" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"> - <interface name="org.sflphone.SFLphone.ConfigurationManager"> + <interface name="cx.ring.Ring.ConfigurationManager"> <tp:docstring xmlns="http://www.w3.org/1999/xhtml"> Used to handle the configuration stuff: accounts settings, account registration, user preferences, ... diff --git a/gnome/src/dbus/dbus.c b/gnome/src/dbus/dbus.c index 2686322e4e725adc939b30587fe6e5cfd191735c..e5408c8f8afc843fd579c1cb1c9e5517bd0fcf05 100644 --- a/gnome/src/dbus/dbus.c +++ b/gnome/src/dbus/dbus.c @@ -736,15 +736,15 @@ gboolean dbus_connect_session_manager(DBusGConnection *connection) gboolean dbus_connect(GError **error, SFLPhoneClient *client) { - const char *dbus_message_bus_name = "org.sflphone.SFLphone"; - const char *dbus_object_instance = "/org/sflphone/SFLphone/Instance"; - const char *dbus_interface = "org.sflphone.SFLphone.Instance"; - const char *callmanager_object_instance = "/org/sflphone/SFLphone/CallManager"; - const char *callmanager_interface = "org.sflphone.SFLphone.CallManager"; - const char *configurationmanager_object_instance = "/org/sflphone/SFLphone/ConfigurationManager"; - const char *configurationmanager_interface = "org.sflphone.SFLphone.ConfigurationManager"; - const char *presencemanager_object_instance = "/org/sflphone/SFLphone/PresenceManager"; - const char *presencemanager_interface = "org.sflphone.SFLphone.PresenceManager"; + const char *dbus_message_bus_name = "cx.ring.Ring"; + const char *dbus_object_instance = "/cx/ring/Ring/Instance"; + const char *dbus_interface = "cx.ring.Ring.Instance"; + const char *callmanager_object_instance = "/cx/ring/Ring/CallManager"; + const char *callmanager_interface = "cx.ring.Ring.CallManager"; + const char *configurationmanager_object_instance = "/cx/ring/Ring/ConfigurationManager"; + const char *configurationmanager_interface = "cx.ring.Ring.ConfigurationManager"; + const char *presencemanager_object_instance = "/cx/ring/Ring/PresenceManager"; + const char *presencemanager_interface = "cx.ring.Ring.PresenceManager"; DBusGConnection *connection = dbus_g_bus_get(DBUS_BUS_SESSION, error); if (connection == NULL) { @@ -1019,8 +1019,8 @@ gboolean dbus_connect(GError **error, SFLPhoneClient *client) G_CALLBACK(sip_presence_new_subscription_request_cb), NULL, NULL); #ifdef SFL_VIDEO - const gchar *videomanager_object_instance = "/org/sflphone/SFLphone/VideoManager"; - const gchar *videomanager_interface = "org.sflphone.SFLphone.VideoManager"; + const gchar *videomanager_object_instance = "/cx/ring/Ring/VideoManager"; + const gchar *videomanager_interface = "cx.ring.Ring.VideoManager"; video_proxy = dbus_g_proxy_new_for_name(connection, dbus_message_bus_name, videomanager_object_instance, videomanager_interface); if (video_proxy == NULL) { @@ -1078,7 +1078,7 @@ void dbus_hold(const callable_obj_t *c) { GError *error = NULL; gboolean result; - org_sflphone_SFLphone_CallManager_hold(call_proxy, c->_callID, &result, &error); + cx_ring_Ring_CallManager_hold(call_proxy, c->_callID, &result, &error); check_error(error); } @@ -1087,7 +1087,7 @@ dbus_unhold(const callable_obj_t *c) { GError *error = NULL; gboolean result; - org_sflphone_SFLphone_CallManager_unhold(call_proxy, c->_callID, &result, &error); + cx_ring_Ring_CallManager_unhold(call_proxy, c->_callID, &result, &error); check_error(error); } @@ -1096,7 +1096,7 @@ dbus_hold_conference(const conference_obj_t *c) { GError *error = NULL; gboolean result; - org_sflphone_SFLphone_CallManager_hold_conference(call_proxy, c->_confID, + cx_ring_Ring_CallManager_hold_conference(call_proxy, c->_confID, &result, &error); check_error(error); } @@ -1106,7 +1106,7 @@ dbus_unhold_conference(const conference_obj_t *c) { GError *error = NULL; gboolean result; - org_sflphone_SFLphone_CallManager_unhold_conference(call_proxy, c->_confID, + cx_ring_Ring_CallManager_unhold_conference(call_proxy, c->_confID, &result, &error); check_error(error); } @@ -1117,7 +1117,7 @@ dbus_start_recorded_file_playback(const gchar *filepath) GError *error = NULL; gboolean result; - org_sflphone_SFLphone_CallManager_start_recorded_file_playback(call_proxy, filepath, &result, &error); + cx_ring_Ring_CallManager_start_recorded_file_playback(call_proxy, filepath, &result, &error); check_error(error); return result; } @@ -1126,7 +1126,7 @@ void dbus_stop_recorded_file_playback(const gchar *filepath) { GError *error = NULL; - org_sflphone_SFLphone_CallManager_stop_recorded_file_playback(call_proxy, filepath, &error); + cx_ring_Ring_CallManager_stop_recorded_file_playback(call_proxy, filepath, &error); check_error(error); } @@ -1142,13 +1142,13 @@ hang_up_reply_cb(G_GNUC_UNUSED DBusGProxy *proxy, void dbus_hang_up(const callable_obj_t *c) { - org_sflphone_SFLphone_CallManager_hang_up_async(call_proxy, c->_callID, hang_up_reply_cb, NULL); + cx_ring_Ring_CallManager_hang_up_async(call_proxy, c->_callID, hang_up_reply_cb, NULL); } void dbus_hang_up_conference(const conference_obj_t *c) { - org_sflphone_SFLphone_CallManager_hang_up_conference_async(call_proxy, c->_confID, hang_up_reply_cb, NULL); + cx_ring_Ring_CallManager_hang_up_conference_async(call_proxy, c->_confID, hang_up_reply_cb, NULL); } void @@ -1156,7 +1156,7 @@ dbus_transfer(const callable_obj_t *c) { GError *error = NULL; gboolean result; - org_sflphone_SFLphone_CallManager_transfer(call_proxy, c->_callID, + cx_ring_Ring_CallManager_transfer(call_proxy, c->_callID, c->_trsft_to, &result, &error); check_error(error); } @@ -1166,7 +1166,7 @@ dbus_attended_transfer(const callable_obj_t *transfer, const callable_obj_t *tar { GError *error = NULL; gboolean result; - org_sflphone_SFLphone_CallManager_attended_transfer(call_proxy, transfer->_callID, + cx_ring_Ring_CallManager_attended_transfer(call_proxy, transfer->_callID, target->_callID, &result, &error); check_error(error); } @@ -1177,7 +1177,7 @@ dbus_accept(const callable_obj_t *c) status_tray_icon_blink(FALSE); GError *error = NULL; gboolean result; - org_sflphone_SFLphone_CallManager_accept(call_proxy, c->_callID, &result, &error); + cx_ring_Ring_CallManager_accept(call_proxy, c->_callID, &result, &error); check_error(error); } @@ -1187,7 +1187,7 @@ dbus_refuse(const callable_obj_t *c) status_tray_icon_blink(FALSE); GError *error = NULL; gboolean result; - org_sflphone_SFLphone_CallManager_refuse(call_proxy, c->_callID, &result, &error); + cx_ring_Ring_CallManager_refuse(call_proxy, c->_callID, &result, &error); check_error(error); } @@ -1196,7 +1196,7 @@ dbus_place_call(const callable_obj_t *c) { GError *error = NULL; gboolean result; - org_sflphone_SFLphone_CallManager_place_call(call_proxy, c->_accountID, + cx_ring_Ring_CallManager_place_call(call_proxy, c->_accountID, c->_callID, c->_peer_number, &result, &error); check_error(error); } @@ -1207,7 +1207,7 @@ dbus_account_list() GError *error = NULL; char **array = NULL; - org_sflphone_SFLphone_ConfigurationManager_get_account_list(config_proxy, &array, &error); + cx_ring_Ring_ConfigurationManager_get_account_list(config_proxy, &array, &error); check_error(error); return array; @@ -1219,7 +1219,7 @@ dbus_get_account_template() GError *error = NULL; GHashTable *details = NULL; - org_sflphone_SFLphone_ConfigurationManager_get_account_template(config_proxy, &details, &error); + cx_ring_Ring_ConfigurationManager_get_account_template(config_proxy, &details, &error); check_error(error); return details; @@ -1231,7 +1231,7 @@ dbus_get_account_details(const gchar *accountID) GError *error = NULL; GHashTable *details = NULL; - org_sflphone_SFLphone_ConfigurationManager_get_account_details(config_proxy, accountID, &details, &error); + cx_ring_Ring_ConfigurationManager_get_account_details(config_proxy, accountID, &details, &error); check_error(error); return details; @@ -1242,7 +1242,7 @@ dbus_set_credentials(account_t *a) { g_assert(a); GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_set_credentials(config_proxy, a->accountID, + cx_ring_Ring_ConfigurationManager_set_credentials(config_proxy, a->accountID, a->credential_information, &error); check_error(error); } @@ -1252,7 +1252,7 @@ dbus_get_credentials(account_t *a) { g_assert(a); GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_get_credentials(config_proxy, + cx_ring_Ring_ConfigurationManager_get_credentials(config_proxy, a->accountID, &a->credential_information, &error); check_error(error); } @@ -1263,7 +1263,7 @@ dbus_get_ip2ip_details(void) GError *error = NULL; GHashTable *details = NULL; - org_sflphone_SFLphone_ConfigurationManager_get_ip2_ip_details(config_proxy, &details, &error); + cx_ring_Ring_ConfigurationManager_get_ip2_ip_details(config_proxy, &details, &error); check_error(error); return details; @@ -1273,7 +1273,7 @@ void dbus_send_register(const gchar *accountID, gboolean enable) { GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_send_register(config_proxy, accountID, enable, &error); + cx_ring_Ring_ConfigurationManager_send_register(config_proxy, accountID, enable, &error); check_error(error); } @@ -1281,7 +1281,7 @@ void dbus_remove_account(const gchar *accountID) { GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_remove_account(config_proxy, accountID, &error); + cx_ring_Ring_ConfigurationManager_remove_account(config_proxy, accountID, &error); account_list_remove(accountID); check_error(error); } @@ -1291,7 +1291,7 @@ dbus_set_account_details(const account_t *a) { g_assert(a); GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_set_account_details(config_proxy, a->accountID, a->properties, + cx_ring_Ring_ConfigurationManager_set_account_details(config_proxy, a->accountID, a->properties, &error); check_error(error); } @@ -1305,7 +1305,7 @@ dbus_add_account(account_t *a) g_free(a->accountID); GError *error = NULL; a->accountID = NULL; - org_sflphone_SFLphone_ConfigurationManager_add_account(config_proxy, a->properties, &a->accountID, + cx_ring_Ring_ConfigurationManager_add_account(config_proxy, a->properties, &a->accountID, &error); check_error(error); } @@ -1314,7 +1314,7 @@ void dbus_set_volume(const gchar *device, gdouble value) { GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_set_volume(config_proxy, device, value, &error); + cx_ring_Ring_ConfigurationManager_set_volume(config_proxy, device, value, &error); check_error(error); } @@ -1322,7 +1322,7 @@ void dbus_mute_capture(gboolean muted) { GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_mute_capture(config_proxy, muted, &error); + cx_ring_Ring_ConfigurationManager_mute_capture(config_proxy, muted, &error); check_error(error); } @@ -1330,7 +1330,7 @@ void dbus_mute_dtmf(gboolean muted) { GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_mute_dtmf(config_proxy, muted, &error); + cx_ring_Ring_ConfigurationManager_mute_dtmf(config_proxy, muted, &error); check_error(error); } @@ -1338,7 +1338,7 @@ void dbus_mute_playback(gboolean muted) { GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_mute_playback(config_proxy, muted, &error); + cx_ring_Ring_ConfigurationManager_mute_playback(config_proxy, muted, &error); check_error(error); } @@ -1347,7 +1347,7 @@ dbus_is_dtmf_muted() { GError *error = NULL; gboolean muted; - org_sflphone_SFLphone_ConfigurationManager_is_dtmf_muted(config_proxy, &muted, &error); + cx_ring_Ring_ConfigurationManager_is_dtmf_muted(config_proxy, &muted, &error); check_error(error); return muted; } @@ -1357,7 +1357,7 @@ dbus_is_capture_muted() { GError *error = NULL; gboolean muted; - org_sflphone_SFLphone_ConfigurationManager_is_capture_muted(config_proxy, &muted, &error); + cx_ring_Ring_ConfigurationManager_is_capture_muted(config_proxy, &muted, &error); check_error(error); return muted; } @@ -1367,7 +1367,7 @@ dbus_is_playback_muted() { GError *error = NULL; gboolean muted; - org_sflphone_SFLphone_ConfigurationManager_is_playback_muted(config_proxy, &muted, &error); + cx_ring_Ring_ConfigurationManager_is_playback_muted(config_proxy, &muted, &error); check_error(error); return muted; } @@ -1377,7 +1377,7 @@ dbus_get_volume(const gchar *device) { gdouble value; GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_get_volume(config_proxy, device, &value, &error); + cx_ring_Ring_ConfigurationManager_get_volume(config_proxy, device, &value, &error); check_error(error); return value; } @@ -1386,7 +1386,7 @@ void dbus_play_dtmf(const gchar *key) { GError *error = NULL; - org_sflphone_SFLphone_CallManager_play_dt_mf(call_proxy, key, &error); + cx_ring_Ring_CallManager_play_dt_mf(call_proxy, key, &error); check_error(error); } @@ -1394,14 +1394,14 @@ void dbus_start_tone(int start, guint type) { GError *error = NULL; - org_sflphone_SFLphone_CallManager_start_tone(call_proxy, start, type, &error); + cx_ring_Ring_CallManager_start_tone(call_proxy, start, type, &error); check_error(error); } gboolean dbus_register(int pid, const gchar *name, GError **error) { - return org_sflphone_SFLphone_Instance_register(instance_proxy, pid, name, + return cx_ring_Ring_Instance_register(instance_proxy, pid, name, error); } @@ -1409,7 +1409,7 @@ void dbus_unregister(int pid) { GError *error = NULL; - org_sflphone_SFLphone_Instance_unregister_async(instance_proxy, pid, NULL, NULL); + cx_ring_Ring_Instance_unregister_async(instance_proxy, pid, NULL, NULL); check_error(error); } @@ -1418,7 +1418,7 @@ dbus_audio_codec_list() { GError *error = NULL; GArray *array = NULL; - org_sflphone_SFLphone_ConfigurationManager_get_audio_codec_list(config_proxy, &array, &error); + cx_ring_Ring_ConfigurationManager_get_audio_codec_list(config_proxy, &array, &error); check_error(error); return array; } @@ -1429,7 +1429,7 @@ dbus_get_video_codecs(const gchar *accountID) { GError *error = NULL; GPtrArray *array = NULL; - org_sflphone_SFLphone_VideoManager_get_codecs(video_proxy, accountID, &array, &error); + cx_ring_Ring_VideoManager_get_codecs(video_proxy, accountID, &array, &error); check_error(error); return array; } @@ -1438,7 +1438,7 @@ void dbus_set_video_codecs(const gchar *accountID, const GPtrArray *list) { GError *error = NULL; - org_sflphone_SFLphone_VideoManager_set_codecs(video_proxy, accountID, list, &error); + cx_ring_Ring_VideoManager_set_codecs(video_proxy, accountID, list, &error); check_error(error); } @@ -1447,7 +1447,7 @@ dbus_switch_video_input(const gchar *resource) { GError *error = NULL; gboolean switched; - org_sflphone_SFLphone_VideoManager_switch_input(video_proxy, resource, &switched, &error); + cx_ring_Ring_VideoManager_switch_input(video_proxy, resource, &switched, &error); check_error(error); return switched; } @@ -1458,7 +1458,7 @@ dbus_audio_codec_details(int payload) { GError *error = NULL; gchar **array; - org_sflphone_SFLphone_ConfigurationManager_get_audio_codec_details(config_proxy, payload, &array, &error); + cx_ring_Ring_ConfigurationManager_get_audio_codec_details(config_proxy, payload, &array, &error); check_error(error); return array; } @@ -1468,7 +1468,7 @@ dbus_get_active_audio_codec_list(const gchar *accountID) { GArray *array = NULL; GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_get_active_audio_codec_list(config_proxy, accountID, &array, + cx_ring_Ring_ConfigurationManager_get_active_audio_codec_list(config_proxy, accountID, &array, &error); check_error(error); @@ -1479,7 +1479,7 @@ void dbus_set_active_audio_codec_list(const gchar **list, const gchar *accountID) { GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_set_active_audio_codec_list(config_proxy, list, accountID, &error); + cx_ring_Ring_ConfigurationManager_set_active_audio_codec_list(config_proxy, list, accountID, &error); check_error(error); } @@ -1492,7 +1492,7 @@ dbus_get_audio_plugin_list() gchar **array = NULL; GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_get_audio_plugin_list(config_proxy, &array, &error); + cx_ring_Ring_ConfigurationManager_get_audio_plugin_list(config_proxy, &array, &error); check_error(error); return array; @@ -1502,7 +1502,7 @@ void dbus_set_audio_plugin(const gchar *audioPlugin) { GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_set_audio_plugin(config_proxy, audioPlugin, &error); + cx_ring_Ring_ConfigurationManager_set_audio_plugin(config_proxy, audioPlugin, &error); check_error(error); } @@ -1514,7 +1514,7 @@ dbus_get_audio_output_device_list() { gchar **array = NULL; GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_get_audio_output_device_list(config_proxy, &array, &error); + cx_ring_Ring_ConfigurationManager_get_audio_output_device_list(config_proxy, &array, &error); check_error(error); return array; } @@ -1526,7 +1526,7 @@ void dbus_set_audio_output_device(int device) { GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_set_audio_output_device(config_proxy, device, &error); + cx_ring_Ring_ConfigurationManager_set_audio_output_device(config_proxy, device, &error); check_error(error); } @@ -1537,7 +1537,7 @@ void dbus_set_audio_input_device(int device) { GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_set_audio_input_device(config_proxy, device, &error); + cx_ring_Ring_ConfigurationManager_set_audio_input_device(config_proxy, device, &error); check_error(error); } @@ -1548,7 +1548,7 @@ void dbus_set_audio_ringtone_device(int device) { GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_set_audio_ringtone_device(config_proxy, device, &error); + cx_ring_Ring_ConfigurationManager_set_audio_ringtone_device(config_proxy, device, &error); check_error(error); } @@ -1560,7 +1560,7 @@ dbus_get_audio_input_device_list() { gchar **array = NULL; GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_get_audio_input_device_list(config_proxy, &array, &error); + cx_ring_Ring_ConfigurationManager_get_audio_input_device_list(config_proxy, &array, &error); check_error(error); return array; @@ -1574,7 +1574,7 @@ dbus_get_current_audio_devices_index() { gchar **array = NULL; GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_get_current_audio_devices_index(config_proxy, &array, &error); + cx_ring_Ring_ConfigurationManager_get_current_audio_devices_index(config_proxy, &array, &error); check_error(error); return array; @@ -1588,7 +1588,7 @@ dbus_get_audio_output_device_index(const gchar *name) { int device_index = 0; GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_get_audio_output_device_index(config_proxy, name, &device_index, &error); + cx_ring_Ring_ConfigurationManager_get_audio_output_device_index(config_proxy, name, &device_index, &error); check_error(error); return device_index; @@ -1602,7 +1602,7 @@ dbus_get_audio_input_device_index(const gchar *name) { int device_index = 0; GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_get_audio_input_device_index(config_proxy, name, &device_index, &error); + cx_ring_Ring_ConfigurationManager_get_audio_input_device_index(config_proxy, name, &device_index, &error); check_error(error); return device_index; @@ -1616,7 +1616,7 @@ dbus_get_current_audio_output_plugin() { gchar *plugin; GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_get_current_audio_output_plugin(config_proxy, &plugin, &error); + cx_ring_Ring_ConfigurationManager_get_current_audio_output_plugin(config_proxy, &plugin, &error); if (check_error(error)) plugin = g_strdup(""); @@ -1632,7 +1632,7 @@ dbus_get_noise_suppress_state() { gboolean state; GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_get_noise_suppress_state(config_proxy, &state, &error); + cx_ring_Ring_ConfigurationManager_get_noise_suppress_state(config_proxy, &state, &error); if (check_error(error)) state = FALSE; @@ -1647,7 +1647,7 @@ void dbus_set_noise_suppress_state(gboolean state) { GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_set_noise_suppress_state(config_proxy, state, &error); + cx_ring_Ring_ConfigurationManager_set_noise_suppress_state(config_proxy, state, &error); check_error(error); } @@ -1659,7 +1659,7 @@ dbus_get_agc_state() { gboolean state; GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_is_agc_enabled(config_proxy, &state, &error); + cx_ring_Ring_ConfigurationManager_is_agc_enabled(config_proxy, &state, &error); if (check_error(error)) state = FALSE; @@ -1674,7 +1674,7 @@ void dbus_set_agc_state(gboolean state) { GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_set_agc_state(config_proxy, state, &error); + cx_ring_Ring_ConfigurationManager_set_agc_state(config_proxy, state, &error); check_error(error); } @@ -1683,7 +1683,7 @@ dbus_is_iax2_enabled() { int res = 0; GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_is_iax2_enabled(config_proxy, &res, &error); + cx_ring_Ring_ConfigurationManager_is_iax2_enabled(config_proxy, &res, &error); check_error(error); return res; @@ -1703,7 +1703,7 @@ dbus_join_participant_async_cb(G_GNUC_UNUSED DBusGProxy *proxy, void dbus_join_participant(const gchar *sel_callID, const gchar *drag_callID) { - org_sflphone_SFLphone_CallManager_join_participant_async(call_proxy, sel_callID, + cx_ring_Ring_CallManager_join_participant_async(call_proxy, sel_callID, drag_callID, dbus_join_participant_async_cb, NULL); } @@ -1721,7 +1721,7 @@ dbus_add_participant_async_cb(G_GNUC_UNUSED DBusGProxy *proxy, void dbus_add_participant(const gchar *callID, const gchar *confID) { - org_sflphone_SFLphone_CallManager_add_participant_async(call_proxy, callID, + cx_ring_Ring_CallManager_add_participant_async(call_proxy, callID, confID, dbus_add_participant_async_cb, NULL); } @@ -1739,7 +1739,7 @@ dbus_add_main_participant_async_cb(G_GNUC_UNUSED DBusGProxy *proxy, void dbus_add_main_participant(const gchar *confID) { - org_sflphone_SFLphone_CallManager_add_main_participant_async(call_proxy, + cx_ring_Ring_CallManager_add_main_participant_async(call_proxy, confID, dbus_add_main_participant_async_cb, NULL); } @@ -1748,7 +1748,7 @@ dbus_detach_participant(const gchar *callID) { GError *error = NULL; gboolean result; - org_sflphone_SFLphone_CallManager_detach_participant(call_proxy, callID, + cx_ring_Ring_CallManager_detach_participant(call_proxy, callID, &result, &error); check_error(error); } @@ -1758,7 +1758,7 @@ dbus_join_conference(const gchar *sel_confID, const gchar *drag_confID) { GError *error = NULL; gboolean result; - org_sflphone_SFLphone_CallManager_join_conference(call_proxy, sel_confID, + cx_ring_Ring_CallManager_join_conference(call_proxy, sel_confID, drag_confID, &result, &error); check_error(error); } @@ -1768,7 +1768,7 @@ dbus_toggle_recording(const gchar *id) { GError *error = NULL; gboolean isRecording; - org_sflphone_SFLphone_CallManager_toggle_recording(call_proxy, id, &isRecording, &error); + cx_ring_Ring_CallManager_toggle_recording(call_proxy, id, &isRecording, &error); check_error(error); return isRecording; } @@ -1778,7 +1778,7 @@ dbus_get_is_recording(const callable_obj_t *c) { GError *error = NULL; gboolean isRecording; - org_sflphone_SFLphone_CallManager_get_is_recording(call_proxy, c->_callID, &isRecording, &error); + cx_ring_Ring_CallManager_get_is_recording(call_proxy, c->_callID, &isRecording, &error); check_error(error); return isRecording; @@ -1788,7 +1788,7 @@ void dbus_set_record_path(const gchar *path) { GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_set_record_path(config_proxy, path, &error); + cx_ring_Ring_ConfigurationManager_set_record_path(config_proxy, path, &error); check_error(error); } @@ -1797,7 +1797,7 @@ dbus_get_record_path(void) { GError *error = NULL; gchar *path; - org_sflphone_SFLphone_ConfigurationManager_get_record_path(config_proxy, &path, &error); + cx_ring_Ring_ConfigurationManager_get_record_path(config_proxy, &path, &error); check_error(error); return path; @@ -1805,14 +1805,14 @@ dbus_get_record_path(void) void dbus_set_record_playback_seek(gdouble value) { GError *error = NULL; - org_sflphone_SFLphone_CallManager_record_playback_seek(call_proxy, value, &error); + cx_ring_Ring_CallManager_record_playback_seek(call_proxy, value, &error); check_error(error); } void dbus_set_is_always_recording(const gboolean alwaysRec) { GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_set_is_always_recording(config_proxy, alwaysRec, &error); + cx_ring_Ring_ConfigurationManager_set_is_always_recording(config_proxy, alwaysRec, &error); check_error(error); } @@ -1820,7 +1820,7 @@ gboolean dbus_get_is_always_recording(void) { GError *error = NULL; gboolean alwaysRec; - org_sflphone_SFLphone_ConfigurationManager_get_is_always_recording(config_proxy, &alwaysRec, &error); + cx_ring_Ring_ConfigurationManager_get_is_always_recording(config_proxy, &alwaysRec, &error); check_error(error); return alwaysRec; @@ -1830,7 +1830,7 @@ void dbus_set_history_limit(guint days) { GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_set_history_limit(config_proxy, days, &error); + cx_ring_Ring_ConfigurationManager_set_history_limit(config_proxy, days, &error); check_error(error); } @@ -1839,7 +1839,7 @@ dbus_get_history_limit(void) { GError *error = NULL; gint days = 30; - org_sflphone_SFLphone_ConfigurationManager_get_history_limit(config_proxy, &days, &error); + cx_ring_Ring_ConfigurationManager_get_history_limit(config_proxy, &days, &error); check_error(error); return days; @@ -1849,7 +1849,7 @@ void dbus_clear_history(void) { GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_clear_history(config_proxy, &error); + cx_ring_Ring_ConfigurationManager_clear_history(config_proxy, &error); check_error(error); } @@ -1858,7 +1858,7 @@ dbus_set_audio_manager(const gchar *api) { GError *error = NULL; gboolean result; - org_sflphone_SFLphone_ConfigurationManager_set_audio_manager(config_proxy, api, &result, &error); + cx_ring_Ring_ConfigurationManager_set_audio_manager(config_proxy, api, &result, &error); check_error(error); return result; } @@ -1868,7 +1868,7 @@ dbus_get_audio_manager(void) { gchar *api; GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_get_audio_manager(config_proxy, &api, &error); + cx_ring_Ring_ConfigurationManager_get_audio_manager(config_proxy, &api, &error); check_error(error); return api; @@ -1879,7 +1879,7 @@ dbus_get_supported_audio_managers() { GError *error = NULL; gchar **array = NULL; - org_sflphone_SFLphone_ConfigurationManager_get_supported_audio_managers(config_proxy, &array, &error); + cx_ring_Ring_ConfigurationManager_get_supported_audio_managers(config_proxy, &array, &error); check_error(error); return array; @@ -1892,7 +1892,7 @@ dbus_video_get_default_device() gchar *str = NULL; GError *error = NULL; - org_sflphone_SFLphone_VideoManager_get_default_device(video_proxy, &str, &error); + cx_ring_Ring_VideoManager_get_default_device(video_proxy, &str, &error); check_error(error); return str; @@ -1902,7 +1902,7 @@ void dbus_video_set_default_device(const gchar *name) { GError *error = NULL; - org_sflphone_SFLphone_VideoManager_set_default_device(video_proxy, name, &error); + cx_ring_Ring_VideoManager_set_default_device(video_proxy, name, &error); check_error(error); } @@ -1912,7 +1912,7 @@ dbus_video_get_settings(const gchar *name) GError *error = NULL; GHashTable *settings = NULL; - org_sflphone_SFLphone_VideoManager_get_settings(video_proxy, name, &settings, &error); + cx_ring_Ring_VideoManager_get_settings(video_proxy, name, &settings, &error); check_error(error); return settings; @@ -1922,7 +1922,7 @@ void dbus_video_apply_settings(const gchar *name, GHashTable *settings) { GError *error = NULL; - org_sflphone_SFLphone_VideoManager_apply_settings(video_proxy, name, settings, &error); + cx_ring_Ring_VideoManager_apply_settings(video_proxy, name, settings, &error); check_error(error); } @@ -1932,7 +1932,7 @@ dbus_video_get_device_list() gchar **array = NULL; GError *error = NULL; - org_sflphone_SFLphone_VideoManager_get_device_list(video_proxy, &array, &error); + cx_ring_Ring_VideoManager_get_device_list(video_proxy, &array, &error); check_error(error); return array; } @@ -1943,7 +1943,7 @@ dbus_video_get_capabilities(const gchar *name) GError *error = NULL; GHashTable *cap = NULL; - org_sflphone_SFLphone_VideoManager_get_capabilities(video_proxy, name, &cap, &error); + cx_ring_Ring_VideoManager_get_capabilities(video_proxy, name, &cap, &error); check_error(error); return cap; @@ -1957,7 +1957,7 @@ dbus_get_hook_settings(void) GError *error = NULL; GHashTable *results = NULL; - org_sflphone_SFLphone_ConfigurationManager_get_hook_settings(config_proxy, &results, &error); + cx_ring_Ring_ConfigurationManager_get_hook_settings(config_proxy, &results, &error); check_error(error); return results; @@ -1967,7 +1967,7 @@ void dbus_set_hook_settings(GHashTable *settings) { GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_set_hook_settings(config_proxy, settings, &error); + cx_ring_Ring_ConfigurationManager_set_hook_settings(config_proxy, settings, &error); check_error(error); } @@ -1976,7 +1976,7 @@ dbus_get_call_details(const gchar *callID) { GError *error = NULL; GHashTable *details = NULL; - org_sflphone_SFLphone_CallManager_get_call_details(call_proxy, callID, &details, &error); + cx_ring_Ring_CallManager_get_call_details(call_proxy, callID, &details, &error); check_error(error); return details; @@ -1987,7 +1987,7 @@ dbus_get_call_list(void) { GError *error = NULL; gchar **list = NULL; - org_sflphone_SFLphone_CallManager_get_call_list(call_proxy, &list, &error); + cx_ring_Ring_CallManager_get_call_list(call_proxy, &list, &error); check_error(error); return list; @@ -1998,7 +1998,7 @@ dbus_get_conference_list(void) { GError *error = NULL; gchar **list = NULL; - org_sflphone_SFLphone_CallManager_get_conference_list(call_proxy, &list, &error); + cx_ring_Ring_CallManager_get_conference_list(call_proxy, &list, &error); check_error(error); return list; @@ -2010,7 +2010,7 @@ dbus_get_display_names(const gchar *confID) GError *error = NULL; gchar **list = NULL; - org_sflphone_SFLphone_CallManager_get_display_names(call_proxy, confID, &list, &error); + cx_ring_Ring_CallManager_get_display_names(call_proxy, confID, &list, &error); check_error(error); return list; @@ -2022,7 +2022,7 @@ dbus_get_participant_list(const gchar *confID) GError *error = NULL; gchar **list = NULL; - org_sflphone_SFLphone_CallManager_get_participant_list(call_proxy, confID, &list, &error); + cx_ring_Ring_CallManager_get_participant_list(call_proxy, confID, &list, &error); check_error(error); return list; @@ -2033,7 +2033,7 @@ dbus_get_conference_id(const gchar *callID) { gchar *confID = NULL; GError *error = NULL; - org_sflphone_SFLphone_CallManager_get_conference_id(call_proxy, callID, &confID, &error); + cx_ring_Ring_CallManager_get_conference_id(call_proxy, callID, &confID, &error); check_error(error); return confID; } @@ -2043,7 +2043,7 @@ dbus_get_conference_details(const gchar *confID) { GError *error = NULL; GHashTable *details = NULL; - org_sflphone_SFLphone_CallManager_get_conference_details(call_proxy, confID, &details, &error); + cx_ring_Ring_CallManager_get_conference_details(call_proxy, confID, &details, &error); check_error(error); return details; @@ -2053,7 +2053,7 @@ void dbus_set_accounts_order(const gchar *order) { GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_set_accounts_order(config_proxy, order, &error); + cx_ring_Ring_ConfigurationManager_set_accounts_order(config_proxy, order, &error); check_error(error); } @@ -2069,14 +2069,14 @@ get_history_async_cb(G_GNUC_UNUSED DBusGProxy *proxy, GPtrArray *items, GError * void dbus_get_history(IdleData *id) { - org_sflphone_SFLphone_ConfigurationManager_get_history_async(config_proxy, get_history_async_cb, id); + cx_ring_Ring_ConfigurationManager_get_history_async(config_proxy, get_history_async_cb, id); } void dbus_confirm_sas(const callable_obj_t *c) { GError *error = NULL; - org_sflphone_SFLphone_CallManager_set_sa_sverified(call_proxy, c->_callID, &error); + cx_ring_Ring_CallManager_set_sa_sverified(call_proxy, c->_callID, &error); check_error(error); } @@ -2084,7 +2084,7 @@ void dbus_reset_sas(const callable_obj_t *c) { GError *error = NULL; - org_sflphone_SFLphone_CallManager_reset_sa_sverified(call_proxy, c->_callID, &error); + cx_ring_Ring_CallManager_reset_sa_sverified(call_proxy, c->_callID, &error); check_error(error); } @@ -2092,7 +2092,7 @@ void dbus_set_confirm_go_clear(const callable_obj_t *c) { GError *error = NULL; - org_sflphone_SFLphone_CallManager_set_confirm_go_clear(call_proxy, c->_callID, &error); + cx_ring_Ring_CallManager_set_confirm_go_clear(call_proxy, c->_callID, &error); check_error(error); } @@ -2100,7 +2100,7 @@ void dbus_request_go_clear(const callable_obj_t *c) { GError *error = NULL; - org_sflphone_SFLphone_CallManager_request_go_clear(call_proxy, c->_callID, &error); + cx_ring_Ring_CallManager_request_go_clear(call_proxy, c->_callID, &error); check_error(error); } @@ -2109,7 +2109,7 @@ dbus_get_supported_tls_method() { GError *error = NULL; gchar **array = NULL; - org_sflphone_SFLphone_ConfigurationManager_get_supported_tls_method(config_proxy, &array, &error); + cx_ring_Ring_ConfigurationManager_get_supported_tls_method(config_proxy, &array, &error); check_error(error); return array; @@ -2120,7 +2120,7 @@ dbus_get_tls_settings_default(void) { GError *error = NULL; GHashTable *results = NULL; - org_sflphone_SFLphone_ConfigurationManager_get_tls_settings_default(config_proxy, &results, &error); + cx_ring_Ring_ConfigurationManager_get_tls_settings_default(config_proxy, &results, &error); check_error(error); return results; @@ -2131,7 +2131,7 @@ dbus_check_certificate(const gchar *capath, const gchar *certpath) { GError *error = NULL; gboolean result; - org_sflphone_SFLphone_ConfigurationManager_check_certificate_validity(config_proxy, capath, certpath, &result, &error); + cx_ring_Ring_ConfigurationManager_check_certificate_validity(config_proxy, capath, certpath, &result, &error); check_error(error); return result; @@ -2142,7 +2142,7 @@ dbus_certificate_contains_private_key(const gchar *filepath) { GError *error = NULL; gboolean result; - org_sflphone_SFLphone_ConfigurationManager_check_for_private_key(config_proxy, filepath, &result, &error); + cx_ring_Ring_ConfigurationManager_check_for_private_key(config_proxy, filepath, &result, &error); check_error(error); return result; @@ -2153,7 +2153,7 @@ dbus_get_address_from_interface_name(const gchar *interface) { GError *error = NULL; gchar *address = NULL; - org_sflphone_SFLphone_ConfigurationManager_get_addr_from_interface_name(config_proxy, interface, &address, &error); + cx_ring_Ring_ConfigurationManager_get_addr_from_interface_name(config_proxy, interface, &address, &error); check_error(error); return address; @@ -2165,7 +2165,7 @@ dbus_get_all_ip_interface(void) GError *error = NULL; gchar **array = NULL; - org_sflphone_SFLphone_ConfigurationManager_get_all_ip_interface(config_proxy, &array, &error); + cx_ring_Ring_ConfigurationManager_get_all_ip_interface(config_proxy, &array, &error); check_error(error); return array; @@ -2177,7 +2177,7 @@ dbus_get_all_ip_interface_by_name(void) GError *error = NULL; gchar **array = NULL; - org_sflphone_SFLphone_ConfigurationManager_get_all_ip_interface_by_name(config_proxy, &array, &error); + cx_ring_Ring_ConfigurationManager_get_all_ip_interface_by_name(config_proxy, &array, &error); check_error(error); return array; @@ -2189,7 +2189,7 @@ dbus_get_shortcuts(void) GError *error = NULL; GHashTable *shortcuts = NULL; - org_sflphone_SFLphone_ConfigurationManager_get_shortcuts(config_proxy, &shortcuts, &error); + cx_ring_Ring_ConfigurationManager_get_shortcuts(config_proxy, &shortcuts, &error); check_error(error); return shortcuts; @@ -2199,7 +2199,7 @@ void dbus_set_shortcuts(GHashTable *shortcuts) { GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_set_shortcuts(config_proxy, shortcuts, &error); + cx_ring_Ring_ConfigurationManager_set_shortcuts(config_proxy, shortcuts, &error); check_error(error); } @@ -2207,7 +2207,7 @@ void dbus_send_text_message(const gchar *callID, const gchar *message) { GError *error = NULL; - org_sflphone_SFLphone_CallManager_send_text_message(call_proxy, callID, message, &error); + cx_ring_Ring_CallManager_send_text_message(call_proxy, callID, message, &error); check_error(error); } @@ -2224,14 +2224,14 @@ void dbus_start_video_camera() { set_camera_button_sensitivity(FALSE); - org_sflphone_SFLphone_VideoManager_start_camera_async(video_proxy, video_camera_async_cb, NULL); + cx_ring_Ring_VideoManager_start_camera_async(video_proxy, video_camera_async_cb, NULL); } void dbus_stop_video_camera() { set_camera_button_sensitivity(FALSE); - org_sflphone_SFLphone_VideoManager_stop_camera_async(video_proxy, video_camera_async_cb, NULL); + cx_ring_Ring_VideoManager_stop_camera_async(video_proxy, video_camera_async_cb, NULL); } gboolean @@ -2239,7 +2239,7 @@ dbus_has_video_camera_started() { GError *error = NULL; gboolean started = FALSE; - org_sflphone_SFLphone_VideoManager_has_camera_started(video_proxy, &started, &error); + cx_ring_Ring_VideoManager_has_camera_started(video_proxy, &started, &error); check_error(error); return started; } @@ -2334,7 +2334,7 @@ void dbus_presence_publish(const gchar *accountID, gboolean status) { GError *error = NULL; - org_sflphone_SFLphone_PresenceManager_publish(presence_proxy, accountID,status, "Tout va bien.", NULL); + cx_ring_Ring_PresenceManager_publish(presence_proxy, accountID,status, "Tout va bien.", NULL); check_error(error); } @@ -2342,6 +2342,6 @@ void dbus_presence_subscribe(const gchar *accountID, const gchar *uri, gboolean flag) { GError *error = NULL; - org_sflphone_SFLphone_PresenceManager_subscribe_buddy(presence_proxy, accountID, uri, flag, NULL); + cx_ring_Ring_PresenceManager_subscribe_buddy(presence_proxy, accountID, uri, flag, NULL); check_error(error); } diff --git a/gnome/src/dbus/instance-introspec.xml b/gnome/src/dbus/instance-introspec.xml index f3d1373a6409b7875a4d80db5bf0f815f285d637..d8a620bc218c9122ed38a22450286a31273df92b 100644 --- a/gnome/src/dbus/instance-introspec.xml +++ b/gnome/src/dbus/instance-introspec.xml @@ -1,6 +1,6 @@ <?xml version="1.0" ?> <node name="/instance-introspec" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"> - <interface name="org.sflphone.SFLphone.Instance"> + <interface name="cx.ring.Ring.Instance"> <tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>Count the number of clients actually registered to the core. When initializing your client, you need to register it against the core by using this interface.</p> </tp:docstring> diff --git a/gnome/src/dbus/presencemanager-introspec.xml b/gnome/src/dbus/presencemanager-introspec.xml index 77b1527a43bd910c947cc7ff7dd99a2265e6f20c..7aad39b0eee257dd9faaed1de01886726a7a8347 100644 --- a/gnome/src/dbus/presencemanager-introspec.xml +++ b/gnome/src/dbus/presencemanager-introspec.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" ?> <node name="/presencemanager-introspec" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"> - <interface name="org.sflphone.SFLphone.PresenceManager"> + <interface name="cx.ring.Ring.PresenceManager"> <!-- METHODS !--> <method name="publish" tp:name-for-bindings="publish"> <tp:added version="1.3.0"/> diff --git a/gnome/src/dbus/shortcutsmanager-introspec.xml b/gnome/src/dbus/shortcutsmanager-introspec.xml index c6491e2d99b969456330868fe8a957e8dccfb178..60a23a95ab1487503d44a6d36de1c56b6f15a7b1 100644 --- a/gnome/src/dbus/shortcutsmanager-introspec.xml +++ b/gnome/src/dbus/shortcutsmanager-introspec.xml @@ -1,6 +1,6 @@ <?xml version="1.0" ?> -<node name="/org/sflphone/SFLphone"> - <interface name="org.sflphone.SFLphone.ContactManager"> +<node name="/cx/ring/Ring"> + <interface name="cx.ring.Ring.ContactManager"> <!-- Contacts related methods --> diff --git a/gnome/src/dbus/videomanager-introspec.xml b/gnome/src/dbus/videomanager-introspec.xml index b7773f8379cff93f0e687fb2fede89979c021aed..de9761b9fb7bcb5f8654076db775bc8a5400218a 100644 --- a/gnome/src/dbus/videomanager-introspec.xml +++ b/gnome/src/dbus/videomanager-introspec.xml @@ -1,6 +1,6 @@ <?xml version="1.0" ?> <node name="/videomanager-introspec" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"> - <interface name="org.sflphone.SFLphone.VideoManager"> + <interface name="cx.ring.Ring.VideoManager"> <!-- Video device methods --> <method name="getDeviceList" tp:name-for-bindings="getDeviceList"> diff --git a/gnome/src/ring_client.h b/gnome/src/ring_client.h index 6901afd0e109b1dd9a17329ecadf53f4550b02e4..e9925a805700c0310ce4f3766e952971dd4a727a 100644 --- a/gnome/src/ring_client.h +++ b/gnome/src/ring_client.h @@ -37,7 +37,7 @@ #include <gtk/gtk.h> -#define RING_GSETTINGS_SCHEMA "org.sflphone.SFLphone" +#define RING_GSETTINGS_SCHEMA "cx.ring.Ring" #define RING_TYPE_CLIENT (ring_client_get_type()) #define RING_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), RING_TYPE_CLIENT, SFLPhoneClient)) diff --git a/plugins/README b/plugins/README index cdba125509b00f4bd810ac78564c5a8bc6606088..3c3393ccc7518e1c3e47151350af991bc7e1ef1d 100644 --- a/plugins/README +++ b/plugins/README @@ -1,4 +1,4 @@ -Welcome to SFLphone! +Welcome to Ring! Refer to the development site for further information: https://projects.savoirfairelinux.com/projects/show/sflphone diff --git a/tools/git-gerrit b/tools/git-gerrit index 9561125fbc754681bd57851a2cb491dc5d7178ab..846f63331f1f55ad3bd3e77e6c7eb1b1a69b61c9 100755 --- a/tools/git-gerrit +++ b/tools/git-gerrit @@ -39,7 +39,7 @@ test -n "$GERRIT_USER" -a -n "$GERRIT_HOST" -a -n "$GERRIT_PORT" || { echo "You must configure your Gerrit host, e.g.:" echo echo " git config gerrit.user vivien" - echo " git config gerrit.host gerrit-sflphone.savoirfairelinux.com" + echo " git config gerrit.host gerrit-ring.savoirfairelinux.com" echo " git config gerrit.port 29420" echo exit 1 diff --git a/tools/sflphone-callto b/tools/sflphone-callto index bce010fceadff1cdec91bb64e0edec6f3466cc46..c652a776f06831ecd818a80bb2d1a999ae66e0c3 100755 --- a/tools/sflphone-callto +++ b/tools/sflphone-callto @@ -13,9 +13,9 @@ if [ -f "$RESFILE" ]; then # Test if a SFLphone client is already open, if not open a new one # Opening a new client will start sflphoned if not already running -SFLPHONEC=`ps -A | grep sflphone-client` +SFLPHONEC=`ps -A | grep ring-client` if [ "$SFLPHONEC" = "" ]; then - sflphone-client-gnome& + ring-client-gnome& fi # FIXME: this doesn't check if account is enabled, and is unreadable/unmaintainable.