Emeric Vigier | 1f90ce1 | 2012-08-06 13:39:08 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010, 2011 Savoir-Faire Linux Inc. |
| 3 | * Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com> |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 3 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 18 | * |
| 19 | * Additional permission under GNU GPL version 3 section 7: |
| 20 | * |
| 21 | * If you modify this program, or any covered work, by linking or |
| 22 | * combining it with the OpenSSL project's OpenSSL library (or a |
| 23 | * modified version of that library), containing parts covered by the |
| 24 | * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc. |
| 25 | * grants you additional permission to convey the resulting work. |
| 26 | * Corresponding Source for a non-source form of such a combination |
| 27 | * shall include the source code for the parts of OpenSSL used as well |
| 28 | * as that of the covered work. |
| 29 | */ |
| 30 | |
| 31 | #ifndef __SFL_CALLMANAGER_H__ |
| 32 | #define __SFL_CALLMANAGER_H__ |
| 33 | |
| 34 | #include "dbus_cpp.h" |
| 35 | #if __GNUC__ >= 4 && __GNUC_MINOR__ >= 6 |
| 36 | /* This warning option only exists for gcc 4.6.0 and greater. */ |
| 37 | #pragma GCC diagnostic ignored "-Wunused-but-set-variable" |
| 38 | #endif |
| 39 | |
| 40 | #pragma GCC diagnostic ignored "-Wignored-qualifiers" |
| 41 | #pragma GCC diagnostic ignored "-Wunused-parameter" |
| 42 | #include "callmanager-glue.h" |
| 43 | #pragma GCC diagnostic warning "-Wignored-qualifiers" |
| 44 | #pragma GCC diagnostic warning "-Wunused-parameter" |
| 45 | |
| 46 | #if __GNUC__ >= 4 && __GNUC_MINOR__ >= 6 |
| 47 | /* This warning option only exists for gcc 4.6.0 and greater. */ |
| 48 | #pragma GCC diagnostic warning "-Wunused-but-set-variable" |
| 49 | #endif |
| 50 | |
| 51 | #include <stdexcept> |
| 52 | |
| 53 | class CallManagerException: public std::runtime_error { |
| 54 | public: |
| 55 | CallManagerException(const std::string& str="") : |
| 56 | std::runtime_error("A CallManagerException occured: " + str) {} |
| 57 | }; |
| 58 | |
| 59 | namespace sfl { |
| 60 | class AudioZrtpSession; |
| 61 | } |
| 62 | |
| 63 | class CallManager |
| 64 | : public org::sflphone::SFLphone::CallManager_adaptor, |
| 65 | public DBus::IntrospectableAdaptor, |
| 66 | public DBus::ObjectAdaptor { |
| 67 | public: |
| 68 | |
| 69 | CallManager(DBus::Connection& connection); |
| 70 | |
| 71 | /* methods exported by this interface, |
| 72 | * you will have to implement them in your ObjectAdaptor |
| 73 | */ |
| 74 | |
| 75 | /* Call related methods */ |
| 76 | void placeCall(const std::string& accountID, const std::string& callID, const std::string& to); |
| 77 | void placeCallFirstAccount(const std::string& callID, const std::string& to); |
| 78 | |
| 79 | void refuse(const std::string& callID); |
| 80 | void accept(const std::string& callID); |
| 81 | void hangUp(const std::string& callID); |
| 82 | void hold(const std::string& callID); |
| 83 | void unhold(const std::string& callID); |
| 84 | void transfer(const std::string& callID, const std::string& to); |
| 85 | void attendedTransfer(const std::string& transferID, const std::string& targetID); |
| 86 | std::map< std::string, std::string > getCallDetails(const std::string& callID); |
| 87 | std::vector< std::string > getCallList(); |
| 88 | |
| 89 | /* Conference related methods */ |
| 90 | void joinParticipant(const std::string& sel_callID, const std::string& drag_callID); |
| 91 | void createConfFromParticipantList(const std::vector< std::string >& participants); |
| 92 | void addParticipant(const std::string& callID, const std::string& confID); |
| 93 | void addMainParticipant(const std::string& confID); |
| 94 | void detachParticipant(const std::string& callID); |
| 95 | void joinConference(const std::string& sel_confID, const std::string& drag_confID); |
| 96 | void hangUpConference(const std::string& confID); |
| 97 | void holdConference(const std::string& confID); |
| 98 | void unholdConference(const std::string& confID); |
| 99 | std::vector<std::string> getConferenceList(); |
| 100 | std::vector<std::string> getParticipantList(const std::string& confID); |
| 101 | std::string getConferenceId(const std::string& callID); |
| 102 | std::map<std::string, std::string> getConferenceDetails(const std::string& callID); |
| 103 | |
| 104 | /* File Playback methods */ |
| 105 | bool startRecordedFilePlayback(const std::string& filepath); |
| 106 | void stopRecordedFilePlayback(const std::string& filepath); |
| 107 | |
| 108 | /* General audio methods */ |
| 109 | void setVolume(const std::string& device, const double& value); |
| 110 | double getVolume(const std::string& device); |
| 111 | void setRecording(const std::string& callID); |
| 112 | void recordPlaybackSeek(const double& value); |
| 113 | bool getIsRecording(const std::string& callID); |
| 114 | std::string getCurrentAudioCodecName(const std::string& callID); |
| 115 | void playDTMF(const std::string& key); |
| 116 | void startTone(const int32_t& start, const int32_t& type); |
| 117 | |
| 118 | /* Security related methods */ |
| 119 | void setSASVerified(const std::string& callID); |
| 120 | void resetSASVerified(const std::string& callID); |
| 121 | void setConfirmGoClear(const std::string& callID); |
| 122 | void requestGoClear(const std::string& callID); |
| 123 | void acceptEnrollment(const std::string& callID, const bool& accepted); |
| 124 | |
| 125 | /* Instant messaging */ |
| 126 | void sendTextMessage(const std::string& callID, const std::string& message); |
| 127 | |
| 128 | private: |
| 129 | |
| 130 | #if HAVE_ZRTP |
| 131 | sfl::AudioZrtpSession * getAudioZrtpSession(const std::string& callID); |
| 132 | #endif |
| 133 | }; |
| 134 | |
| 135 | #endif//CALLMANAGER_H |