Commit 248ad66a authored by Tristan Matthews's avatar Tristan Matthews

* #23661: daemon: restore getCallList

parent af812f0a
......@@ -102,4 +102,5 @@ libsflphone_la_SOURCES = conference.cpp \
sfl_types.h \
array_size.h \
account_schema.h \
registration_states.h
registration_states.h \
map_utils.h
......@@ -44,6 +44,7 @@
#include "audio/samplerateconverter.h"
#include "array_size.h"
#include "scoped_lock.h"
#include "map_utils.h"
AccountMap IAXVoIPLink::iaxAccountMap_;
IAXCallMap IAXVoIPLink::iaxCallMap_;
......@@ -168,6 +169,16 @@ IAXVoIPLink::getEvent()
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
IAXVoIPLink::sendAudioFromMic()
{
......
......@@ -72,6 +72,11 @@ class IAXVoIPLink : public VoIPLink {
*/
virtual bool getEvent();
/* Returns a list of all callIDs */
static std::vector<std::string>
getCallIDs();
/**
* Return the internal account map for all VOIP links
*/
......
......@@ -43,6 +43,7 @@
#include "dbus/callmanager.h"
#include "global.h"
#include "fileutils.h"
#include "map_utils.h"
#include "sip/sipvoiplink.h"
#include "sip/sipaccount.h"
#include "sip/sipcall.h"
......@@ -2796,20 +2797,14 @@ std::vector<std::map<std::string, std::string> > ManagerImpl::getHistory()
return history_.getSerialized();
}
namespace {
template <typename M, typename V>
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>
ManagerImpl::getCallList() const
{
std::vector<std::string> v;
// vectorFromMapKeys(callAccountMap_, v);
std::vector<std::string> v(SIPVoIPLink::instance()->getCallIDs());
#if HAVE_IAX
const std::vector<std::string> iaxCalls(IAXVoIPLink::getCallIDs());
v.insert(v.end(), iaxCalls.begin(), iaxCalls.end());
#endif
return v;
}
......@@ -2830,7 +2825,7 @@ std::map<std::string, std::string> ManagerImpl::getConferenceDetails(
std::vector<std::string> ManagerImpl::getConferenceList() const
{
std::vector<std::string> v;
vectorFromMapKeys(conferenceMap_, v);
map_utils::vectorFromMapKeys(conferenceMap_, v);
return v;
}
......
......@@ -32,6 +32,7 @@
#define MAP_UTILS_H_
#include <vector>
#include <map>
namespace map_utils {
template <typename M, typename V>
......
......@@ -40,6 +40,7 @@
#include "sipvoiplink.h"
#include "array_size.h"
#include "manager.h"
#include "map_utils.h"
#include "logger.h"
#include "scoped_lock.h"
......@@ -1150,6 +1151,17 @@ SIPVoIPLink::clearSipCallMap()
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)
{
if (!call)
......
......@@ -96,6 +96,10 @@ class SIPVoIPLink : public VoIPLink {
*/
virtual bool getEvent();
/* Returns a list of all callIDs */
std::vector<std::string>
getCallIDs();
/**
* Return the internal account map for this VOIP link
*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment