diff --git a/daemon/src/managerimpl.cpp b/daemon/src/managerimpl.cpp index 99d1a8537f2a51ebc21548190c65136580242d40..41d68417d3973ee4ce2ac461c051d1c288f51916 100644 --- a/daemon/src/managerimpl.cpp +++ b/daemon/src/managerimpl.cpp @@ -43,11 +43,17 @@ #include "dbus/callmanager.h" #include "global.h" #include "fileutils.h" +#include "sip/sipvoiplink.h" #include "sip/sipaccount.h" #include "sip/sipcall.h" #include "im/instant_messaging.h" + +#if HAVE_IAX #include "iax/iaxaccount.h" #include "iax/iaxcall.h" +#include "iax/iaxvoiplink.h" +#endif + #include "numbercleaner.h" #include "config/yamlparser.h" #include "config/yamlemitter.h" @@ -55,8 +61,6 @@ #include "audio/sound/tonelist.h" #include "audio/sound/audiofile.h" #include "audio/sound/dtmf.h" -#include "sip/sipvoiplink.h" -#include "iax/iaxvoiplink.h" #include "history/historynamecache.h" #include "manager.h" @@ -874,10 +878,12 @@ ManagerImpl::getCallFromCallID(const std::string &callID) Call *call = NULL; call = SIPVoIPLink::getSipCall(callID); +#if HAVE_IAX if(call != NULL) return call; call = IAXVoIPLink::getIaxCall(callID); +#endif return call; } @@ -1260,8 +1266,10 @@ void ManagerImpl::saveConfig() iter != SIPVoIPLink::getInternalAccountMap().end(); ++iter) iter->second->serialize(emitter); +#if HAVE_IAX for (AccountMap::iterator iter = IAXVoIPLink::getInternalAccountMap().begin(); iter != IAXVoIPLink::getInternalAccountMap().end(); ++iter) iter->second->serialize(emitter); +#endif preferences.serialize(emitter); voipPreferences.serialize(emitter); @@ -2446,7 +2454,9 @@ void ManagerImpl::removeAccount(const std::string& accountID) if (remAccount != NULL) { remAccount->unregisterVoIPLink(); SIPVoIPLink::getInternalAccountMap().erase(accountID); +#if HAVE_IAX IAXVoIPLink::getInternalAccountMap().erase(accountID); +#endif // http://projects.savoirfairelinux.net/issues/show/2355 // delete remAccount; } @@ -2529,7 +2539,11 @@ namespace { return id == "IP2IP"; } +#if HAVE_IAX void loadAccount(const Conf::YamlNode *item, AccountMap &sipAccountMap, AccountMap &iaxAccountMap) +#else + void loadAccount(const Conf::YamlNode *item, AccountMap &sipAccountMap) +#endif { if (!item) { ERROR("Could not load account"); @@ -2650,20 +2664,29 @@ void ManagerImpl::loadAccountMap(Conf::YamlParser &parser) // Each valid account element in sequence is a new account to load // std::for_each(seq->begin(), seq->end(), // std::tr1::bind(loadAccount, _1, std::tr1::ref(accountMap_))); +#if HAVE_IAX std::for_each(seq->begin(), seq->end(), std::tr1::bind(loadAccount, _1, std::tr1::ref(SIPVoIPLink::getInternalAccountMap()), std::tr1::ref(IAXVoIPLink::getInternalAccountMap()))); +#else + std::for_each(seq->begin(), seq->end(), + std::tr1::bind(loadAccount, _1, std::tr1::ref(SIPVoIPLink::getInternalAccountMap()))); +#endif } void ManagerImpl::registerAllAccounts() { std::for_each(SIPVoIPLink::getInternalAccountMap().begin(), SIPVoIPLink::getInternalAccountMap().end(), registerAccount); +#if HAVE_IAX std::for_each(IAXVoIPLink::getInternalAccountMap().begin(), IAXVoIPLink::getInternalAccountMap().end(), registerAccount); +#endif } void ManagerImpl::unregisterAllAccounts() { std::for_each(SIPVoIPLink::getInternalAccountMap().begin(), SIPVoIPLink::getInternalAccountMap().end(), unregisterAccount); +#if HAVE_IAX std::for_each(IAXVoIPLink::getInternalAccountMap().begin(), IAXVoIPLink::getInternalAccountMap().end(), unregisterAccount); +#endif } void ManagerImpl::unloadAccountMap() @@ -2671,8 +2694,10 @@ void ManagerImpl::unloadAccountMap() std::for_each(SIPVoIPLink::getInternalAccountMap().begin(), SIPVoIPLink::getInternalAccountMap().end(), unloadAccount); SIPVoIPLink::getInternalAccountMap().clear(); +#if HAVE_IAX std::for_each(IAXVoIPLink::getInternalAccountMap().begin(), IAXVoIPLink::getInternalAccountMap().end(), unloadAccount); IAXVoIPLink::getInternalAccountMap().clear(); +#endif } bool ManagerImpl::accountExists(const std::string &accountID) @@ -2680,10 +2705,14 @@ bool ManagerImpl::accountExists(const std::string &accountID) bool ret = false; ret = SIPVoIPLink::getInternalAccountMap().find(accountID) != SIPVoIPLink::getInternalAccountMap().end(); +#if HAVE_IAX if(ret) return ret; - return IAXVoIPLink::getInternalAccountMap().find(accountID) != IAXVoIPLink::getInternalAccountMap().end(); + ret = IAXVoIPLink::getInternalAccountMap().find(accountID) != IAXVoIPLink::getInternalAccountMap().end(); +#endif + + return ret; } SIPAccount* @@ -2705,9 +2734,11 @@ ManagerImpl::getAccount(const std::string& accountID) const if(account != NULL) return account; +#if HAVE_IAX account = getIaxAccount(accountID); if(account != NULL) return account; +#endif return NULL; } @@ -2722,6 +2753,7 @@ ManagerImpl::getSipAccount(const std::string& accountID) const return NULL; } +#if HAVE_IAX IAXAccount * ManagerImpl::getIaxAccount(const std::string& accountID) const { @@ -2731,11 +2763,14 @@ ManagerImpl::getIaxAccount(const std::string& accountID) const return NULL; } +#endif void ManagerImpl::fillConcatAccountMap(AccountMap &concatMap) const{ concatMap.insert(SIPVoIPLink::getInternalAccountMap().begin(), SIPVoIPLink::getInternalAccountMap().end()); +#if HAVE_IAX concatMap.insert(IAXVoIPLink::getInternalAccountMap().begin(), IAXVoIPLink::getInternalAccountMap().end()); +#endif } std::string diff --git a/daemon/src/managerimpl.h b/daemon/src/managerimpl.h index 32bcdee45f60d6f2a170184c2d5dfbd1ce28f902..457c544f66a1b81a43848eb8a43e2b91163194d9 100644 --- a/daemon/src/managerimpl.h +++ b/daemon/src/managerimpl.h @@ -1080,12 +1080,14 @@ class ManagerImpl { */ SIPAccount *getSipAccount(const std::string& accontID) const; +#if HAVE_IAX /** * Get an IAX account pointer * @param accountID account ID to get * @return IAXAccount* The account pointer or 0 */ IAXAccount *getIaxAccount(const std::string& accountID) const; +#endif /** * Get a pointer to the IP2IP account