Commit c2a052bc authored by Tristan Matthews's avatar Tristan Matthews

Merge branch 'master' of...

Merge branch 'master' of git+ssh://git.sflphone.org/var/repos/sflphone/git/sflphone into hold_secured_call

Resolved Conflicts:
	daemon/src/audio/audiortp/audio_rtp_factory.cpp
parents d8c8aab1 123d79c8
......@@ -21,8 +21,7 @@ endif
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = libs src ringtones man $(TESTS_DIR) doc
EXTRA_DIST = README.gentoo \
m4/libtool.m4 \
EXTRA_DIST = m4/libtool.m4 \
m4/lt~obsolete.m4 \
m4/ltoptions.m4 \
m4/ltsugar.m4 \
......
......@@ -72,10 +72,14 @@ static const char *const CONFIG_ACCOUNT_ALIAS = "Account.alias";
static const char *const CONFIG_ACCOUNT_MAILBOX = "Account.mailbox";
static const char *const CONFIG_ACCOUNT_ENABLE = "Account.enable";
static const char *const CONFIG_ACCOUNT_REGISTRATION_EXPIRE = "Account.registrationExpire";
static const char *const CONFIG_ACCOUNT_REGISTRATION_STATUS = "Account.registrationStatus";
static const char *const CONFIG_ACCOUNT_REGISTRATION_STATE_CODE = "Account.registrationCode";
static const char *const CONFIG_ACCOUNT_REGISTRATION_STATE_DESC = "Account.registrationDescription";
static const char *const CONFIG_CREDENTIAL_NUMBER = "Credential.count";
static const char *const CONFIG_ACCOUNT_DTMF_TYPE = "Account.dtmfType";
static const char *const CONFIG_RINGTONE_PATH = "Account.ringtonePath";
static const char *const CONFIG_RINGTONE_ENABLED = "Account.ringtoneEnabled";
static const char *const CONFIG_KEEP_ALIVE_ENABLED = "Account.keepAliveEnabled";
static const char *const CONFIG_ACCOUNT_HOSTNAME = "Account.hostname";
static const char *const CONFIG_ACCOUNT_USERNAME = "Account.username";
......@@ -124,10 +128,6 @@ static const char *const CONFIG_TLS_REQUIRE_CLIENT_CERTIFICATE = "TLS.requireCli
static const char *const CONFIG_TLS_NEGOTIATION_TIMEOUT_SEC = "TLS.negotiationTimeoutSec";
static const char *const CONFIG_TLS_NEGOTIATION_TIMEOUT_MSEC = "TLS.negotiationTimemoutMsec";
static const char *const CONFIG_REGISTRATION_STATUS = "Registration.Status";
static const char *const CONFIG_REGISTRATION_STATE_CODE = "Registration.code";
static const char *const CONFIG_REGISTRATION_STATE_DESCRIPTION = "Registration.description";
// General configuration keys for accounts
static const char * const ALIAS_KEY = "alias";
static const char * const TYPE_KEY = "type";
......
......@@ -205,15 +205,21 @@ void AudioRtpFactory::sendDtmfDigit(int digit)
void sfl::AudioRtpFactory::saveLocalContext()
{
AudioSrtpSession *srtp = static_cast<AudioSrtpSession *>(rtpSession_);
cachedLocalMasterKey_ = srtp->getLocalMasterKey();
cachedLocalMasterSalt_ = srtp->getLocalMasterSalt();
if (rtpSession_ and keyExchangeProtocol_ == SDES) {
AudioSrtpSession *srtp = dynamic_cast<AudioSrtpSession *>(rtpSession_);
assert(srtp);
cachedLocalMasterKey_ = srtp->getLocalMasterKey();
cachedLocalMasterSalt_ = srtp->getLocalMasterSalt();
}
}
void sfl::AudioRtpFactory::restoreLocalContext()
{
AudioSrtpSession *srtp = static_cast<AudioSrtpSession *>(rtpSession_);
srtp->setLocalMasterKey(cachedLocalMasterKey_);
srtp->setLocalMasterSalt(cachedLocalMasterSalt_);
if (rtpSession_ and keyExchangeProtocol_ == SDES) {
AudioSrtpSession *srtp = dynamic_cast<AudioSrtpSession *>(rtpSession_);
assert(srtp);
srtp->setLocalMasterKey(cachedLocalMasterKey_);
srtp->setLocalMasterSalt(cachedLocalMasterSalt_);
}
}
}
......@@ -37,9 +37,9 @@
<li>DISPLAY_NAMEL: The display name</li>
<li>STUN_ENABLE: True or False (Default: False)</li>
<li>STUN_SERVER: The STUN server address</li>
<li>REGISTRATION_STATUS: The account registration status. Should be Registered to make calls.</li>
<li>REGISTRATION_STATE_CODE</li>
<li>REGISTRATION_STATE_DESCRIPTION</li>
<li>ACCOUNT_REGISTRATION_STATUS: The account registration status. Should be Registered to make calls.</li>
<li>ACCOUNT_REGISTRATION_STATE_CODE</li>
<li>ACCOUNT_REGISTRATION_STATE_DESC</li>
<li>SRTP_KEY_EXCHANGE</li>
<li>SRTP_ENABLE: Whether or not voice communication are encrypted - True or False (Default: False)</li>
<li>SRTP_RTP_FALLBACK</li>
......@@ -91,7 +91,6 @@
Get configuration settings of the IP2IP_PROFILE. They are sligthly different from account settings since no VoIP accounts are involved.
</tp:docstring>
<annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="MapStringString"/>
<!--<annotation name="com.trolltech.QtDBus.QtTypeName.In0" value="MapStringString"/>-->
<arg type="a{ss}" name="details" direction="out" tp:type="String_String_Map">
<tp:docstring>
Available parameters are:
......
......@@ -126,7 +126,7 @@ std::map<std::string, std::string> IAXAccount::getAccountDetails() const
RegistrationState state(registrationState_);
a[CONFIG_REGISTRATION_STATUS] = mapStateNumberToString(state);
a[CONFIG_ACCOUNT_REGISTRATION_STATUS] = mapStateNumberToString(state);
a[CONFIG_ACCOUNT_USERAGENT] = userAgent_;
return a;
......
......@@ -98,6 +98,7 @@ SIPAccount::SIPAccount(const std::string& accountID)
, zrtpHelloHash_(true)
, zrtpNotSuppWarning_(true)
, registrationStateDetailed_()
, keepAliveEnabled_(false)
, keepAliveTimer_()
, keepAliveTimerActive_(false)
, link_(SIPVoIPLink::instance())
......@@ -128,6 +129,7 @@ void SIPAccount::serialize(Conf::YamlEmitter &emitter)
ScalarNode port(portstr.str());
ScalarNode serviceRoute(serviceRoute_);
ScalarNode contactUpdateEnabled(contactUpdateEnabled_);
ScalarNode keepAliveEnabled(keepAliveEnabled_);
ScalarNode mailbox(mailBox_);
ScalarNode publishAddr(publishedIpAddress_);
......@@ -194,6 +196,7 @@ void SIPAccount::serialize(Conf::YamlEmitter &emitter)
accountmap.setKeyValue(CODECS_KEY, &codecs);
accountmap.setKeyValue(RINGTONE_PATH_KEY, &ringtonePath);
accountmap.setKeyValue(RINGTONE_ENABLED_KEY, &ringtoneEnabled);
accountmap.setKeyValue(KEEP_ALIVE_ENABLED, &keepAliveEnabled);
accountmap.setKeyValue(SRTP_KEY, &srtpmap);
srtpmap.setKeyValue(SRTP_ENABLE_KEY, &srtpenabled);
......@@ -278,6 +281,7 @@ void SIPAccount::unserialize(const Conf::MappingNode &map)
map.getValue(PUBLISH_PORT_KEY, &port);
publishedPort_ = port;
map.getValue(SAME_AS_LOCAL_KEY, &publishedSameasLocal_);
map.getValue(KEEP_ALIVE_ENABLED, &keepAliveEnabled_);
std::string dtmfType;
map.getValue(DTMF_TYPE_KEY, &dtmfType);
......@@ -416,6 +420,7 @@ void SIPAccount::setAccountDetails(std::map<std::string, std::string> details)
registrationExpire_ = MIN_REGISTRATION_TIME;
userAgent_ = details[CONFIG_ACCOUNT_USERAGENT];
keepAliveEnabled_ = details[CONFIG_KEEP_ALIVE_ENABLED] == "true";
// srtp settings
srtpEnabled_ = details[CONFIG_SRTP_ENABLE] == "true";
......@@ -485,9 +490,9 @@ std::map<std::string, std::string> SIPAccount::getAccountDetails() const
registrationStateDescription = registrationStateDetailed_.second;
}
a[CONFIG_REGISTRATION_STATUS] = isIP2IP() ? "READY": mapStateNumberToString(state);
a[CONFIG_REGISTRATION_STATE_CODE] = registrationStateCode;
a[CONFIG_REGISTRATION_STATE_DESCRIPTION] = registrationStateDescription;
a[CONFIG_ACCOUNT_REGISTRATION_STATUS] = isIP2IP() ? "READY": mapStateNumberToString(state);
a[CONFIG_ACCOUNT_REGISTRATION_STATE_CODE] = registrationStateCode;
a[CONFIG_ACCOUNT_REGISTRATION_STATE_DESC] = registrationStateDescription;
// Add sip specific details
a[CONFIG_ACCOUNT_ROUTESET] = serviceRoute_;
......@@ -509,6 +514,7 @@ std::map<std::string, std::string> SIPAccount::getAccountDetails() const
a[CONFIG_STUN_ENABLE] = stunEnabled_ ? "true" : "false";
a[CONFIG_STUN_SERVER] = stunServer_;
a[CONFIG_ACCOUNT_DTMF_TYPE] = dtmfType_;
a[CONFIG_KEEP_ALIVE_ENABLED] = keepAliveEnabled_ ? "true" : "false";
a[CONFIG_SRTP_KEY_EXCHANGE] = srtpKeyExchange_;
a[CONFIG_SRTP_ENABLE] = srtpEnabled_ ? "true" : "false";
......
......@@ -55,6 +55,7 @@ namespace Conf {
const char *const DTMF_TYPE_KEY = "dtmfType";
const char *const SERVICE_ROUTE_KEY = "serviceRoute";
const char *const UPDATE_CONTACT_HEADER_KEY = "updateContact";
const char *const KEEP_ALIVE_ENABLED = "keepAlive";
// TODO: write an object to store credential which implement serializable
const char *const SRTP_KEY = "srtp";
......@@ -520,6 +521,10 @@ class SIPAccount : public Account {
*/
static void keepAliveRegistrationCb(pj_timer_heap_t *th, pj_timer_entry *te);
bool isKeepAliveEnabled() const {
return keepAliveEnabled_;
}
/**
* Pointer to the transport used by this acccount
*/
......@@ -730,15 +735,23 @@ class SIPAccount : public Account {
*/
std::pair<int, std::string> registrationStateDetailed_;
/**
* Determine if the keep alive timer will be activated or not
*/
bool keepAliveEnabled_;
/**
* Timer used to regularrly send re-register request based
* on the "Expire" sip header (or the "expire" Contact parameter)
*/
pj_timer_entry keepAliveTimer_;
/**
* Once enabled, this variable tells if the keepalive timer is activated
* for this accout
*/
bool keepAliveTimerActive_;
/**
* Voice over IP Link contains a listener thread and calls
*/
......
......@@ -460,6 +460,10 @@ SIPVoIPLink::SIPVoIPLink() : sipTransport(endpt_, cp_, pool_), evThread_(this)
SIPVoIPLink::~SIPVoIPLink()
{
const int MAX_TIMEOUT_ON_LEAVING = 5;
for (int timeout = 0; pjsip_tsx_layer_get_tsx_count() and timeout < MAX_TIMEOUT_ON_LEAVING; timeout++)
sleep(1);
handlingEvents_ = false;
if (thread_) {
pj_thread_join(thread_);
......@@ -595,7 +599,8 @@ void SIPVoIPLink::sendRegister(Account *a)
// start the periodic registration request based on Expire header
// account determines itself if a keep alive is required
account->startKeepAliveTimer();
if(account->isKeepAliveEnabled())
account->startKeepAliveTimer();
}
void SIPVoIPLink::sendUnregister(Account *a)
......
Installation Instructions
*************************
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
2006, 2007, 2008, 2009 Free Software Foundation, Inc.
Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation,
Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
......@@ -226,6 +226,11 @@ order to use an ANSI C compiler:
and if that doesn't work, install pre-built binaries of GCC for HP-UX.
HP-UX `make' updates targets which have the same time stamps as
their prerequisites, which makes it generally unusable when shipped
generated files such as `configure' are involved. Use GNU `make'
instead.
On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
parse its `<wchar.h>' header file. The option `-nodtk' can be used as
a workaround. If GNU CC is not installed, it is therefore recommended
......
......@@ -217,7 +217,7 @@ void sflphone_fill_account_list(void)
account_list_add(acc);
/* Fill the actual array of credentials */
dbus_get_credentials(acc);
gchar * status = account_lookup(acc, REGISTRATION_STATUS);
gchar * status = account_lookup(acc, ACCOUNT_REGISTRATION_STATUS);
if (g_strcmp0(status, "REGISTERED") == 0)
acc->state = ACCOUNT_STATE_REGISTERED;
......@@ -242,10 +242,10 @@ void sflphone_fill_account_list(void)
else
acc->state = ACCOUNT_STATE_INVALID;
gchar * code = account_lookup(acc, REGISTRATION_STATE_CODE);
gchar * code = account_lookup(acc, ACCOUNT_REGISTRATION_STATE_CODE);
if (code != NULL)
acc->protocol_state_code = atoi(code);
acc->protocol_state_description = account_lookup(acc, REGISTRATION_STATE_DESCRIPTION);
acc->protocol_state_description = account_lookup(acc, ACCOUNT_REGISTRATION_STATE_DESC);
}
g_strfreev(array);
......
......@@ -150,7 +150,7 @@ void conference_participant_list_update(gchar** participants, conference_obj_t*
}
for (gchar **part = participants; part && *part; ++part) {
gchar *call_id = (gchar *) (*part);
const gchar *call_id = (const gchar *) (*part);
callable_obj_t *call = calllist_get_call(current_calls_tab, call_id);
if (call->_confID != NULL) {
......
......@@ -955,7 +955,7 @@ void calltree_add_conference_to_current_calls(conference_obj_t* conf)
DEBUG("Calltree: Determine if at least one participant uses SRTP");
for (GSList *part = conf->participant_list; part; part = g_slist_next(part)) {
const gchar * const call_id = (gchar *) part->data;
const gchar * const call_id = (const gchar *) part->data;
callable_obj_t *call = calllist_get_call(current_calls_tab, call_id);
if (call == NULL)
......
......@@ -37,9 +37,9 @@
<li>DISPLAY_NAMEL: The display name</li>
<li>STUN_ENABLE: True or False (Default: False)</li>
<li>STUN_SERVER: The STUN server address</li>
<li>REGISTRATION_STATUS: The account registration status. Should be Registered to make calls.</li>
<li>REGISTRATION_STATE_CODE</li>
<li>REGISTRATION_STATE_DESCRIPTION</li>
<li>ACCOUNT_REGISTRATION_STATUS: The account registration status. Should be Registered to make calls.</li>
<li>ACCOUNT_REGISTRATION_STATE_CODE</li>
<li>ACCOUNT_REGISTRATION_STATE_DESC</li>
<li>SRTP_KEY_EXCHANGE</li>
<li>SRTP_ENABLE: Whether or not voice communication are encrypted - True or False (Default: False)</li>
<li>SRTP_RTP_FALLBACK</li>
......
......@@ -1180,7 +1180,7 @@ void
dbus_unregister(int pid)
{
GError *error = NULL;
org_sflphone_SFLphone_Instance_unregister(instance_proxy, pid, &error);
org_sflphone_SFLphone_Instance_unregister_async(instance_proxy, pid, NULL, NULL);
check_error(error);
}
......@@ -1722,7 +1722,7 @@ gchar **
dbus_get_participant_list(const gchar *confID)
{
GError *error = NULL;
char **list = NULL;
gchar **list = NULL;
DEBUG("DBUS: Get conference %s participant list", confID);
org_sflphone_SFLphone_CallManager_get_participant_list(call_proxy, confID, &list, &error);
......
......@@ -60,6 +60,10 @@
#define ACCOUNT_MAILBOX "Account.mailbox"
#define ACCOUNT_USERAGENT "Account.useragent"
#define ACCOUNT_REGISTRATION_EXPIRE "Account.registrationExpire"
#define ACCOUNT_REGISTRATION_STATUS "Account.registrationStatus"
#define ACCOUNT_REGISTRATION_STATE_CODE "Account.registrationCode"
#define ACCOUNT_REGISTRATION_STATE_DESC "Account.registrationDescription"
#define ACCOUNT_SIP_STUN_SERVER "STUN.server"
#define ACCOUNT_SIP_STUN_ENABLED "STUN.enable"
#define ACCOUNT_DTMF_TYPE "Account.dtmfType"
......@@ -104,10 +108,6 @@
#define PUBLISHED_PORT "Account.publishedPort"
#define PUBLISHED_ADDRESS "Account.publishedAddress"
#define REGISTRATION_STATUS "Registration.Status"
#define REGISTRATION_STATE_CODE "Registration.code"
#define REGISTRATION_STATE_DESCRIPTION "Registration.description"
#define SHORTCUT_PICKUP "pickUp"
#define SHORTCUT_HANGUP "hangUp"
#define SHORTCUT_POPUP "popupWindow"
......
......@@ -14,6 +14,9 @@ FIND_PACKAGE ( KdepimLibs REQUIRED )
FIND_PACKAGE ( KDE4 REQUIRED )
FIND_PACKAGE ( Qt4 REQUIRED )
set(AKONADI_MIN_VERSION 1.0)
find_package(Akonadi QUIET NO_MODULE ${AKONADI_MIN_VERSION})
INCLUDE ( KDE4Defaults )
MESSAGE("cmake install prefix is : ${CMAKE_INSTALL_PREFIX}")
......@@ -31,9 +34,7 @@ add_subdirectory(man)
add_subdirectory(po)
add_subdirectory(plasma)
# make dist target, see:
# https://agateau.wordpress.com/2009/08/09/cmake-and-make-dist-the-simple-version/
set(PROJECT_VERSION "1.0.0")
set(PROJECT_VERSION "1.0.2")
set(ARCHIVE_NAME ${CMAKE_PROJECT_NAME}-${PROJECT_VERSION})
add_custom_target(dist
COMMAND git archive --prefix=${ARCHIVE_NAME}/ HEAD
......
......@@ -55,14 +55,14 @@ void AccountView::initItemWidget()
if(m_pWidget != NULL)
delete m_pWidget;
bool enabled = getAccountDetail(ACCOUNT_ENABLED) == ACCOUNT_ENABLED_TRUE;
bool enabled = getAccountDetail(ACCOUNT_ENABLED) == REGISTRATION_ENABLED_TRUE;
m_pWidget = new AccountItemWidget();
m_pWidget->setEnabled(enabled);
m_pWidget->setAccountText(getAccountDetail(ACCOUNT_ALIAS));
if(isNew() || !enabled)
m_pWidget->setState(AccountItemWidget::Unregistered);
else if(getAccountDetail(ACCOUNT_STATUS) == ACCOUNT_STATE_REGISTERED || getAccountDetail(ACCOUNT_STATUS) == ACCOUNT_STATE_READY)
else if(getAccountDetail(REGISTRATION_STATUS) == ACCOUNT_STATE_REGISTERED || getAccountDetail(REGISTRATION_STATUS) == ACCOUNT_STATE_READY)
m_pWidget->setState(AccountItemWidget::Registered);
else
m_pWidget->setState(AccountItemWidget::NotWorking);
......@@ -91,9 +91,9 @@ AccountItemWidget* AccountView::getItemWidget()
///Return the state color
QColor AccountView::getStateColor()
{
if(getAccountDetail(ACCOUNT_STATUS) == ACCOUNT_STATE_UNREGISTERED)
if(getAccountDetail(REGISTRATION_STATUS) == ACCOUNT_STATE_UNREGISTERED)
return Qt::black;
if(getAccountDetail(ACCOUNT_STATUS) == ACCOUNT_STATE_REGISTERED || getAccountDetail(ACCOUNT_STATUS) == ACCOUNT_STATE_READY)
if(getAccountDetail(REGISTRATION_STATUS) == ACCOUNT_STATE_REGISTERED || getAccountDetail(REGISTRATION_STATUS) == ACCOUNT_STATE_READY)
return Qt::darkGreen;
return Qt::red;
}
......@@ -104,9 +104,9 @@ const QString& AccountView::getStateColorName()
static const QString black ( "black" );
static const QString darkGreen( "darkGreen" );
static const QString red ( "red" );
if(getAccountDetail(ACCOUNT_STATUS) == ACCOUNT_STATE_UNREGISTERED)
if(getAccountDetail(REGISTRATION_STATUS) == ACCOUNT_STATE_UNREGISTERED)
return black;
if(getAccountDetail(ACCOUNT_STATUS) == ACCOUNT_STATE_REGISTERED || getAccountDetail(ACCOUNT_STATUS) == ACCOUNT_STATE_READY)
if(getAccountDetail(REGISTRATION_STATUS) == ACCOUNT_STATE_REGISTERED || getAccountDetail(REGISTRATION_STATUS) == ACCOUNT_STATE_READY)
return darkGreen;
return red;
}
......@@ -154,11 +154,11 @@ void AccountView::updateState()
Account::updateState();
AccountItemWidget * m_pWidget = getItemWidget();
if(getAccountDetail(ACCOUNT_ENABLED) != ACCOUNT_ENABLED_TRUE ) {
if(getAccountDetail(ACCOUNT_ENABLED) != REGISTRATION_ENABLED_TRUE ) {
kDebug() << "Changing account state to Unregistered";
m_pWidget->setState(AccountItemWidget::Unregistered);
}
else if(getAccountDetail(ACCOUNT_STATUS) == ACCOUNT_STATE_REGISTERED || getAccountDetail(ACCOUNT_STATUS) == ACCOUNT_STATE_READY) {
else if(getAccountDetail(REGISTRATION_STATUS) == ACCOUNT_STATE_REGISTERED || getAccountDetail(REGISTRATION_STATUS) == ACCOUNT_STATE_READY) {
kDebug() << "Changing account state to Registered";
m_pWidget->setState(AccountItemWidget::Registered);
}
......
......@@ -246,7 +246,7 @@ void AccountWizard::accept()
server = QString( SFL_ACCOUNT_HOST );
password = QString( acc.passwd );
user = QString( acc.user );
enabled = QString( ACCOUNT_ENABLED_TRUE );
enabled = QString( REGISTRATION_ENABLED_TRUE );
is_create_account = true;
is_using_sip = true;
......@@ -260,7 +260,7 @@ void AccountWizard::accept()
ret += i18n("This assistant is now finished.") + "\n";
alias = field ( FIELD_SIP_ALIAS ).toString();
enabled = QString ( ACCOUNT_ENABLED_TRUE );
enabled = QString ( REGISTRATION_ENABLED_TRUE );
mailbox = field ( FIELD_SIP_VOICEMAIL ).toString();
protocol = QString ( ACCOUNT_TYPE_SIP );
server = field ( FIELD_SIP_SERVER ).toString();
......@@ -275,7 +275,7 @@ void AccountWizard::accept()
ret += i18n("This assistant is now finished.") + "\n";
alias = field ( FIELD_IAX_ALIAS ).toString();
enabled = QString ( ACCOUNT_ENABLED_TRUE );
enabled = QString ( REGISTRATION_ENABLED_TRUE );
mailbox = field ( FIELD_IAX_VOICEMAIL ).toString();
protocol = QString ( ACCOUNT_TYPE_IAX );
server = field ( FIELD_IAX_SERVER ).toString();
......@@ -290,21 +290,21 @@ void AccountWizard::accept()
// common sip paramaters
if(is_using_sip) {
if(field(FIELD_SIP_ENABLE_STUN).toBool()) {
stun_enabled = QString(ACCOUNT_ENABLED_TRUE);
stun_enabled = QString(REGISTRATION_ENABLED_TRUE);
stun_server = field(FIELD_SIP_STUN_SERVER).toString();
}
else {
stun_enabled = QString(ACCOUNT_ENABLED_FALSE);
stun_enabled = QString(REGISTRATION_ENABLED_FALSE);
stun_server = QString();
}
if(field(FIELD_ZRTP_ENABLED).toBool()) {
srtp_enabled = QString( ACCOUNT_ENABLED_TRUE );
srtp_enabled = QString( REGISTRATION_ENABLED_TRUE );
key_exchange = QString( ZRTP );
zrtp_display_sas = QString( ACCOUNT_ENABLED_TRUE );
zrtp_not_supp_warning = QString( ACCOUNT_ENABLED_TRUE );
zrtp_hello_hash = QString( ACCOUNT_ENABLED_TRUE );
display_sas_once = QString( ACCOUNT_ENABLED_FALSE );
zrtp_display_sas = QString( REGISTRATION_ENABLED_TRUE );
zrtp_not_supp_warning = QString( REGISTRATION_ENABLED_TRUE );
zrtp_hello_hash = QString( REGISTRATION_ENABLED_TRUE );
display_sas_once = QString( REGISTRATION_ENABLED_FALSE );
}
QStringList ifaceList = configurationManager.getAllIpInterface();
......
......@@ -44,6 +44,8 @@
//SFLPhone library
#include "lib/Contact.h"
#include "lib/AccountList.h"
#include "lib/Account.h"
//SFLPhone
#include "SFLPhone.h"
......@@ -86,10 +88,19 @@ ContactBackend* AkonadiBackend::getInstance()
return m_pInstance;
}
///Find contact using a phone number
Contact* AkonadiBackend::getContactByPhone(const QString& phoneNumber)
///Find contact using a phone number,
///@param resolveDNS check if the DNS is used by an account, then assume contact with that phone number / extension is the same as the caller
Contact* AkonadiBackend::getContactByPhone(const QString& phoneNumber,bool resolveDNS)
{
return m_ContactByPhone[phoneNumber];
if (!resolveDNS)
return m_ContactByPhone[phoneNumber];
else if (!getHostNameFromPhone(phoneNumber).isEmpty() && m_ContactByPhone[getUserFromPhone(phoneNumber)]) {
foreach (Account* a, SFLPhone::model()->getAccountList()->getAccounts()) {
if (a->getAccountDetail(ACCOUNT_HOSTNAME) == getHostNameFromPhone(phoneNumber))
return m_ContactByPhone[getUserFromPhone(phoneNumber)];
}
}
return nullptr;
}
///Find contact by UID
......@@ -245,4 +256,34 @@ void AkonadiBackend::collectionsReceived( const Akonadi::Collection::List& list
ContactList AkonadiBackend::update_slot()
{
return update(m_Collection);
}
/*****************************************************************************
* *
* Helpers *
* *
****************************************************************************/
///Return the extension/user of an URI (<sip:12345@exemple.com>)
QString AkonadiBackend::getUserFromPhone(QString phoneNumber)
{
if (phoneNumber.indexOf("@") != -1) {
QString user = phoneNumber.split("@")[0];
if (user.indexOf(":") != -1) {
return user.split(":")[1];
}
else {
return user;
}
}
return phoneNumber;
}
///Return the domaine of an URI (<sip:12345@exemple.com>)
QString AkonadiBackend::getHostNameFromPhone(QString phoneNumber)
{
if (phoneNumber.indexOf("@") != -1) {
return phoneNumber.split("@")[1].left(phoneNumber.split("@")[1].size()-1);
}
return "";
}
\ No newline at end of file
......@@ -48,15 +48,19 @@ class AkonadiBackend : public ContactBackend {
Q_OBJECT
public:
static ContactBackend* getInstance();
Contact* getContactByPhone ( const QString& phoneNumber );
Contact* getContactByUid ( const QString& uid );
void editContact ( Contact* contact );
void addNewContact ( Contact* contact );
Contact* getContactByPhone ( const QString& phoneNumber ,bool resolveDNS = false );
Contact* getContactByUid ( const QString& uid );
void editContact ( Contact* contact );
void addNewContact ( Contact* contact );
private:
AkonadiBackend(QObject* parent);
virtual ~AkonadiBackend();
//Helper
QString getUserFromPhone(QString phoneNumber);
QString getHostNameFromPhone(QString phoneNumber);
//Attributes
static AkonadiBackend* m_pInstance ;
Akonadi::Session* m_pSession ;
......
......@@ -7,6 +7,8 @@ ADD_DEFINITIONS(
-DSHARE_INSTALL_PREFIX="\\\"${SHARE_INSTALL_PREFIX}\\\""
)
ADD_DEFINITIONS("-std=c++0x")
add_subdirectory(lib)
MESSAGE("CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}")
......@@ -75,7 +77,7 @@ INSTALL(FILES conf/sflphone-client-kde.kcfg DESTINATION ${KCFG_INSTALL_DIR})
KDE4_ADD_EXECUTABLE(sflphone-client-kde ${sflphone_client_kde_SRCS} ${QtApp_RCC_SRCS})
TARGET_LINK_LIBRARIES(sflphone-client-kde qtsflphone ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS} ${KDEPIMLIBS_AKONADI_KMIME_LIBS} ${KDEPIMLIBS_AKONADI_LIBS} ${KDEPIMLIBS_AKONADI_CONTACT_LIBS} )
TARGET_LINK_LIBRARIES(sflphone-client-kde qtsflphone ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS} ${KDEPIMLIBS_AKONADI_KMIME_LIBS} ${KDEPIMLIBS_AKONADI_LIBS} ${KDEPIMLIBS_AKONADI_CONTACT_LIBS} ${KDE4_PHONON_LIBS} )
########### install files ###############
......
......@@ -79,7 +79,7 @@ QVector<AccountView*> ConfigAccountList::getAccountByState(QString & state)
{
QVector<AccountView*> v;
for (int i = 0; i < accounts->size(); ++i) {
if ((*accounts)[i]->getAccountDetail(ACCOUNT_STATUS) == state)
if ((*accounts)[i]->getAccountDetail(REGISTRATION_STATUS) == state)
v += (*accounts)[i];
}
return v;
......@@ -167,7 +167,7 @@ QVector<AccountView*> ConfigAccountList::registeredAccounts() const
AccountView* current;
for (int i = 0; i < accounts->count(); ++i) {
current = (*accounts)[i];
if(current->getAccountDetail(ACCOUNT_STATUS) == ACCOUNT_STATE_REGISTERED) {
if(current->getAccountDetail(REGISTRATION_STATUS) == ACCOUNT_STATE_REGISTERED) {