Skip to content
Snippets Groups Projects
Commit 248ad66a authored by Tristan Matthews's avatar Tristan Matthews
Browse files

* #23661: daemon: restore getCallList

parent af812f0a
Branches
Tags
No related merge requests found
...@@ -102,4 +102,5 @@ libsflphone_la_SOURCES = conference.cpp \ ...@@ -102,4 +102,5 @@ libsflphone_la_SOURCES = conference.cpp \
sfl_types.h \ sfl_types.h \
array_size.h \ array_size.h \
account_schema.h \ account_schema.h \
registration_states.h registration_states.h \
map_utils.h
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
#include "audio/samplerateconverter.h" #include "audio/samplerateconverter.h"
#include "array_size.h" #include "array_size.h"
#include "scoped_lock.h" #include "scoped_lock.h"
#include "map_utils.h"
AccountMap IAXVoIPLink::iaxAccountMap_; AccountMap IAXVoIPLink::iaxAccountMap_;
IAXCallMap IAXVoIPLink::iaxCallMap_; IAXCallMap IAXVoIPLink::iaxCallMap_;
...@@ -168,6 +169,16 @@ IAXVoIPLink::getEvent() ...@@ -168,6 +169,16 @@ IAXVoIPLink::getEvent()
return handlingEvents_; return handlingEvents_;
} }
std::vector<std::string>
IAXVoIPLink::getCallIDs()
{
std::vector<std::string> v;
sfl::ScopedLock m(iaxCallMapMutex_);
map_utils::vectorFromMapKeys(iaxCallMap_, v);
return v;
}
void void
IAXVoIPLink::sendAudioFromMic() IAXVoIPLink::sendAudioFromMic()
{ {
......
...@@ -72,6 +72,11 @@ class IAXVoIPLink : public VoIPLink { ...@@ -72,6 +72,11 @@ class IAXVoIPLink : public VoIPLink {
*/ */
virtual bool getEvent(); virtual bool getEvent();
/* Returns a list of all callIDs */
static std::vector<std::string>
getCallIDs();
/** /**
* Return the internal account map for all VOIP links * Return the internal account map for all VOIP links
*/ */
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#include "dbus/callmanager.h" #include "dbus/callmanager.h"
#include "global.h" #include "global.h"
#include "fileutils.h" #include "fileutils.h"
#include "map_utils.h"
#include "sip/sipvoiplink.h" #include "sip/sipvoiplink.h"
#include "sip/sipaccount.h" #include "sip/sipaccount.h"
#include "sip/sipcall.h" #include "sip/sipcall.h"
...@@ -2796,20 +2797,14 @@ std::vector<std::map<std::string, std::string> > ManagerImpl::getHistory() ...@@ -2796,20 +2797,14 @@ std::vector<std::map<std::string, std::string> > ManagerImpl::getHistory()
return history_.getSerialized(); return history_.getSerialized();
} }
namespace { std::vector<std::string>
template <typename M, typename V> ManagerImpl::getCallList() const
void vectorFromMapKeys(const M &m, V &v)
{
for (typename M::const_iterator it = m.begin(); it != m.end(); ++it)
v.push_back(it->first);
}
}
// FIXME: get call ids from voiplinks
std::vector<std::string> ManagerImpl::getCallList() const
{ {
std::vector<std::string> v; std::vector<std::string> v(SIPVoIPLink::instance()->getCallIDs());
// vectorFromMapKeys(callAccountMap_, v); #if HAVE_IAX
const std::vector<std::string> iaxCalls(IAXVoIPLink::getCallIDs());
v.insert(v.end(), iaxCalls.begin(), iaxCalls.end());
#endif
return v; return v;
} }
...@@ -2830,7 +2825,7 @@ std::map<std::string, std::string> ManagerImpl::getConferenceDetails( ...@@ -2830,7 +2825,7 @@ std::map<std::string, std::string> ManagerImpl::getConferenceDetails(
std::vector<std::string> ManagerImpl::getConferenceList() const std::vector<std::string> ManagerImpl::getConferenceList() const
{ {
std::vector<std::string> v; std::vector<std::string> v;
vectorFromMapKeys(conferenceMap_, v); map_utils::vectorFromMapKeys(conferenceMap_, v);
return v; return v;
} }
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#define MAP_UTILS_H_ #define MAP_UTILS_H_
#include <vector> #include <vector>
#include <map>
namespace map_utils { namespace map_utils {
template <typename M, typename V> template <typename M, typename V>
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include "sipvoiplink.h" #include "sipvoiplink.h"
#include "array_size.h" #include "array_size.h"
#include "manager.h" #include "manager.h"
#include "map_utils.h"
#include "logger.h" #include "logger.h"
#include "scoped_lock.h" #include "scoped_lock.h"
...@@ -1150,6 +1151,17 @@ SIPVoIPLink::clearSipCallMap() ...@@ -1150,6 +1151,17 @@ SIPVoIPLink::clearSipCallMap()
sipCallMap_.clear(); sipCallMap_.clear();
} }
std::vector<std::string>
SIPVoIPLink::getCallIDs()
{
std::vector<std::string> v;
sfl::ScopedLock m(sipCallMapMutex_);
map_utils::vectorFromMapKeys(sipCallMap_, v);
return v;
}
void SIPVoIPLink::addSipCall(SIPCall* call) void SIPVoIPLink::addSipCall(SIPCall* call)
{ {
if (!call) if (!call)
......
...@@ -96,6 +96,10 @@ class SIPVoIPLink : public VoIPLink { ...@@ -96,6 +96,10 @@ class SIPVoIPLink : public VoIPLink {
*/ */
virtual bool getEvent(); virtual bool getEvent();
/* Returns a list of all callIDs */
std::vector<std::string>
getCallIDs();
/** /**
* Return the internal account map for this VOIP link * Return the internal account map for this VOIP link
*/ */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment