Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
savoirfairelinux
jami-daemon
Commits
29b600a7
Commit
29b600a7
authored
Aug 23, 2011
by
Tristan Matthews
Browse files
* #6699: refactoring, cleanup in accounts
parent
6f81029e
Changes
10
Hide whitespace changes
Inline
Side-by-side
daemon/src/account.h
View file @
29b600a7
...
...
@@ -220,14 +220,6 @@ class Account : public Serializable
enabled_
=
enable
;
}
/**
* Get the registration state of the specified link
* @return RegistrationState The registration state of underlying VoIPLink
*/
RegistrationState
getRegistrationState
()
const
{
return
registrationState_
;
}
/**
* Set the registration state of the specified link
* @param state The registration state of underlying VoIPLink
...
...
@@ -239,10 +231,6 @@ class Account : public Serializable
return
username_
;
}
void
setUsername
(
const
std
::
string
&
username
)
{
username_
=
username
;
}
std
::
string
getHostname
(
void
)
const
{
return
hostname_
;
}
...
...
@@ -299,13 +287,6 @@ class Account : public Serializable
displayName_
=
name
;
}
std
::
string
getUserAgent
(
void
)
const
{
return
userAgent_
;
}
void
setUseragent
(
const
std
::
string
&
ua
)
{
userAgent_
=
ua
;
}
std
::
string
getMailBox
(
void
)
const
{
return
mailBox_
;
}
...
...
daemon/src/dbus/configurationmanager.cpp
View file @
29b600a7
...
...
@@ -221,10 +221,6 @@ std::map<std::string, std::string> ConfigurationManager::getTlsSettings()
void
ConfigurationManager
::
setTlsSettings
(
const
std
::
map
<
std
::
string
,
std
::
string
>&
details
)
{
std
::
map
<
std
::
string
,
std
::
string
>
map_cpy
=
details
;
std
::
map
<
std
::
string
,
std
::
string
>::
iterator
it
;
SIPAccount
*
sipaccount
=
(
SIPAccount
*
)
Manager
::
instance
().
getAccount
(
IP2IP_PROFILE
);
if
(
!
sipaccount
)
{
...
...
@@ -232,63 +228,64 @@ void ConfigurationManager::setTlsSettings (const std::map<std::string, std::stri
return
;
}
it
=
map_cpy
.
find
(
TLS_LISTENER_PORT
);
std
::
map
<
std
::
string
,
std
::
string
>::
const_iterator
it
;
it
=
details
.
find
(
TLS_LISTENER_PORT
);
if
(
it
!=
details
.
end
())
sipaccount
->
setTlsListenerPort
(
atoi
(
it
->
second
.
data
()));
it
=
map_cpy
.
find
(
TLS_ENABLE
);
it
=
details
.
find
(
TLS_ENABLE
);
if
(
it
!=
details
.
end
())
sipaccount
->
setTlsEnable
(
it
->
second
);
it
=
map_cpy
.
find
(
TLS_CA_LIST_FILE
);
it
=
details
.
find
(
TLS_CA_LIST_FILE
);
if
(
it
!=
map_cpy
.
end
())
sipaccount
->
setTlsCaListFile
(
it
->
second
);
if
(
it
!=
details
.
end
())
sipaccount
->
setTlsCaListFile
(
it
->
second
);
it
=
map_cpy
.
find
(
TLS_CERTIFICATE_FILE
);
it
=
details
.
find
(
TLS_CERTIFICATE_FILE
);
if
(
it
!=
map_cpy
.
end
())
sipaccount
->
setTlsCertificateFile
(
it
->
second
);
if
(
it
!=
details
.
end
())
sipaccount
->
setTlsCertificateFile
(
it
->
second
);
it
=
map_cpy
.
find
(
TLS_PRIVATE_KEY_FILE
);
it
=
details
.
find
(
TLS_PRIVATE_KEY_FILE
);
if
(
it
!=
map_cpy
.
end
())
sipaccount
->
setTlsPrivateKeyFile
(
it
->
second
);
if
(
it
!=
details
.
end
())
sipaccount
->
setTlsPrivateKeyFile
(
it
->
second
);
it
=
map_cpy
.
find
(
TLS_PASSWORD
);
it
=
details
.
find
(
TLS_PASSWORD
);
if
(
it
!=
map_cpy
.
end
())
sipaccount
->
setTlsPassword
(
it
->
second
);
if
(
it
!=
details
.
end
())
sipaccount
->
setTlsPassword
(
it
->
second
);
it
=
map_cpy
.
find
(
TLS_METHOD
);
it
=
details
.
find
(
TLS_METHOD
);
if
(
it
!=
map_cpy
.
end
())
sipaccount
->
setTlsMethod
(
it
->
second
);
if
(
it
!=
details
.
end
())
sipaccount
->
setTlsMethod
(
it
->
second
);
it
=
map_cpy
.
find
(
TLS_CIPHERS
);
it
=
details
.
find
(
TLS_CIPHERS
);
if
(
it
!=
map_cpy
.
end
())
sipaccount
->
setTlsCiphers
(
it
->
second
);
if
(
it
!=
details
.
end
())
sipaccount
->
setTlsCiphers
(
it
->
second
);
it
=
map_cpy
.
find
(
TLS_SERVER_NAME
);
it
=
details
.
find
(
TLS_SERVER_NAME
);
if
(
it
!=
map_cpy
.
end
())
sipaccount
->
setTlsServerName
(
it
->
second
);
if
(
it
!=
details
.
end
())
sipaccount
->
setTlsServerName
(
it
->
second
);
it
=
map_cpy
.
find
(
TLS_VERIFY_CLIENT
);
it
=
details
.
find
(
TLS_VERIFY_CLIENT
);
if
(
it
!=
map_cpy
.
end
())
sipaccount
->
setTlsVerifyClient
(
(
it
->
second
==
"true"
)
?
true
:
false
)
;
if
(
it
!=
details
.
end
())
sipaccount
->
setTlsVerifyClient
(
it
->
second
==
"true"
);
it
=
map_cpy
.
find
(
TLS_REQUIRE_CLIENT_CERTIFICATE
);
it
=
details
.
find
(
TLS_REQUIRE_CLIENT_CERTIFICATE
);
if
(
it
!=
map_cpy
.
end
())
sipaccount
->
setTlsRequireClientCertificate
(
(
it
->
second
==
"true"
)
?
true
:
false
)
;
if
(
it
!=
details
.
end
())
sipaccount
->
setTlsRequireClientCertificate
(
it
->
second
==
"true"
);
it
=
map_cpy
.
find
(
TLS_NEGOTIATION_TIMEOUT_SEC
);
it
=
details
.
find
(
TLS_NEGOTIATION_TIMEOUT_SEC
);
if
(
it
!=
map_cpy
.
end
())
sipaccount
->
setTlsNegotiationTimeoutSec
(
it
->
second
);
if
(
it
!=
details
.
end
())
sipaccount
->
setTlsNegotiationTimeoutSec
(
it
->
second
);
it
=
map_cpy
.
find
(
TLS_NEGOTIATION_TIMEOUT_MSEC
);
it
=
details
.
find
(
TLS_NEGOTIATION_TIMEOUT_MSEC
);
if
(
it
!=
map_cpy
.
end
())
sipaccount
->
setTlsNegotiationTimeoutMsec
(
it
->
second
);
if
(
it
!=
details
.
end
())
sipaccount
->
setTlsNegotiationTimeoutMsec
(
it
->
second
);
Manager
::
instance
().
saveConfig
();
// Update account details to the client side
accountsChanged
();
}
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>
>
ConfigurationManager
::
getCredentials
(
...
...
@@ -619,31 +616,6 @@ void ConfigurationManager::setIsAlwaysRecording(const bool& rec)
{
Manager
::
instance
().
setIsAlwaysRecording
(
rec
);
}
/*
int32_t ConfigurationManager::getDialpad(void) {
return Manager::instance().getDialpad();
}
void ConfigurationManager::setDialpad(const bool& display) {
Manager::instance().setDialpad(display);
}
int32_t ConfigurationManager::getSearchbar(void) {
return Manager::instance().getSearchbar();
}
void ConfigurationManager::setSearchbar(void) {
Manager::instance().setSearchbar();
}
int32_t ConfigurationManager::getVolumeControls(void) {
return Manager::instance().getVolumeControls();
}
void ConfigurationManager::setVolumeControls(const bool& display) {
Manager::instance().setVolumeControls(display);
}
*/
int32_t
ConfigurationManager
::
getHistoryLimit
(
void
)
{
...
...
@@ -655,40 +627,6 @@ void ConfigurationManager::setHistoryLimit (const int32_t& days)
Manager
::
instance
().
setHistoryLimit
(
days
);
}
/*
void ConfigurationManager::setHistoryEnabled(void) {
Manager::instance().setHistoryEnabled();
}
std::string ConfigurationManager::getHistoryEnabled(void) {
return Manager::instance().getHistoryEnabled();
}
void ConfigurationManager::startHidden(void) {
Manager::instance().startHidden();
}
int32_t ConfigurationManager::isStartHidden(void) {
return Manager::instance().isStartHidden();
}
void ConfigurationManager::switchPopupMode(void) {
Manager::instance().switchPopupMode();
}
int32_t ConfigurationManager::popupMode(void) {
return Manager::instance().popupMode();
}
void ConfigurationManager::setNotify(void) {
Manager::instance().setNotify();
}
int32_t ConfigurationManager::getNotify(void) {
return Manager::instance().getNotify();
}
*/
void
ConfigurationManager
::
setAudioManager
(
const
int32_t
&
api
)
{
Manager
::
instance
().
setAudioManager
(
api
);
...
...
@@ -784,23 +722,7 @@ std::map<std::string, std::string> ConfigurationManager::getShortcuts()
void
ConfigurationManager
::
setShortcuts
(
const
std
::
map
<
std
::
string
,
std
::
string
>&
shortcutsMap
)
{
std
::
map
<
std
::
string
,
std
::
string
>
map_cpy
=
shortcutsMap
;
/*
std::map<std::string, std::string> map_cpy = shortcutsMap;
std::map<std::string, std::string>::iterator it;
for (int i = 0; i < (int)shortcutsKeys.size(); i++) {
std::string key = shortcutsKeys.at(i);
it = map_cpy.find(key);
if (it != shortcutsMap.end()) {
Manager::instance().setConfig("Shortcuts", key, it->second);
}
}
*/
Manager
::
instance
().
shortcutPreferences
.
setShortcuts
(
map_cpy
);
Manager
::
instance
().
shortcutPreferences
.
setShortcuts
(
shortcutsMap
);
Manager
::
instance
().
saveConfig
();
}
daemon/src/iax/iaxvoiplink.cpp
View file @
29b600a7
...
...
@@ -300,7 +300,7 @@ IAXVoIPLink::getIAXCall (const std::string& id)
void
IAXVoIPLink
::
sendRegister
(
Account
*
a
)
throw
(
VoipLinkException
)
IAXVoIPLink
::
sendRegister
(
Account
*
a
)
{
_debug
(
"IAX: Sending registration"
);
...
...
daemon/src/iax/iaxvoiplink.h
View file @
29b600a7
...
...
@@ -89,7 +89,7 @@ class IAXVoIPLink : public VoIPLink
/**
* Send out registration
*/
virtual
void
sendRegister
(
Account
*
a
)
throw
(
VoipLinkException
)
;
virtual
void
sendRegister
(
Account
*
a
);
/**
* Destroy registration session
...
...
daemon/src/managerimpl_registration.cpp
View file @
29b600a7
...
...
@@ -157,7 +157,7 @@ ManagerImpl::sendRegister (const std::string& accountID , const int32_t& enable)
// Update the active field
Account
*
acc
=
getAccount
(
accountID
);
acc
->
setEnabled
(
!!
enable
);
acc
->
setEnabled
(
enable
);
acc
->
loadConfig
();
Manager
::
instance
().
saveConfig
();
...
...
daemon/src/sip/sipaccount.cpp
View file @
29b600a7
...
...
@@ -32,6 +32,7 @@
#include
"sipaccount.h"
#include
"manager.h"
#include
"config.h"
#include
<pwd.h>
#include
<sstream>
#include
<cassert>
...
...
@@ -379,33 +380,33 @@ void SIPAccount::unserialize (Conf::MappingNode *map)
void
SIPAccount
::
setAccountDetails
(
std
::
map
<
std
::
string
,
std
::
string
>
details
)
{
// Account setting common to SIP and IAX
setAlias
(
details
[
CONFIG_ACCOUNT_ALIAS
]
)
;
setType
(
details
[
CONFIG_ACCOUNT_TYPE
]
)
;
setU
sername
(
details
[
USERNAME
]
)
;
setH
ostname
(
details
[
HOSTNAME
]
)
;
setE
nabled
(
(
details
[
CONFIG_ACCOUNT_ENABLE
]
==
"true"
))
;
setR
ingtonePath
(
details
[
CONFIG_RINGTONE_PATH
]
)
;
setR
ingtoneEnabled
(
(
details
[
CONFIG_RINGTONE_ENABLED
]
==
"true"
))
;
setM
ailBox
(
details
[
CONFIG_ACCOUNT_MAILBOX
]
)
;
alias_
=
details
[
CONFIG_ACCOUNT_ALIAS
];
type_
=
details
[
CONFIG_ACCOUNT_TYPE
];
u
sername
_
=
details
[
USERNAME
];
h
ostname
_
=
details
[
HOSTNAME
];
e
nabled
_
=
details
[
CONFIG_ACCOUNT_ENABLE
]
==
"true"
;
r
ingtonePath
_
=
details
[
CONFIG_RINGTONE_PATH
];
r
ingtoneEnabled
_
=
details
[
CONFIG_RINGTONE_ENABLED
]
==
"true"
;
m
ailBox
_
=
details
[
CONFIG_ACCOUNT_MAILBOX
];
// SIP specific account settings
// general sip settings
setD
isplayName
(
details
[
DISPLAY_NAME
]
)
;
se
tSe
rviceRoute
(
details
[
ROUTESET
]
)
;
setLocalI
nterface
(
details
[
LOCAL_INTERFACE
]
)
;
setP
ublishedSameasLocal
(
details
[
PUBLISHED_SAMEAS_LOCAL
]
==
"true"
)
;
setP
ublishedAddress
(
details
[
PUBLISHED_ADDRESS
]
)
;
setL
ocalPort
(
atoi
(
details
[
LOCAL_PORT
].
c_str
())
)
;
setP
ublishedPort
(
atoi
(
details
[
PUBLISHED_PORT
].
c_str
())
)
;
s
etS
tunServer
(
details
[
STUN_SERVER
]
)
;
s
etS
tunEnabled
(
details
[
STUN_ENABLE
]
==
"true"
)
;
setD
tmfType
(
(
details
[
ACCOUNT_DTMF_TYPE
]
==
"overrtp"
)
?
OVERRTP
:
SIPINFO
)
;
setR
esolveOnce
(
details
[
CONFIG_ACCOUNT_RESOLVE_ONCE
]
==
"true"
)
;
setR
egistrationExpire
(
details
[
CONFIG_ACCOUNT_REGISTRATION_EXPIRE
]
)
;
setU
ser
a
gent
(
details
[
USERAGENT
]
)
;
d
isplayName
_
=
details
[
DISPLAY_NAME
];
serviceRoute
_
=
details
[
ROUTESET
];
i
nterface
_
=
details
[
LOCAL_INTERFACE
];
p
ublishedSameasLocal
_
=
details
[
PUBLISHED_SAMEAS_LOCAL
]
==
"true"
;
p
ublished
Ip
Address
_
=
details
[
PUBLISHED_ADDRESS
];
l
ocalPort
_
=
atoi
(
details
[
LOCAL_PORT
].
c_str
());
p
ublishedPort
_
=
atoi
(
details
[
PUBLISHED_PORT
].
c_str
());
stunServer
_
=
details
[
STUN_SERVER
];
stunEnabled
_
=
details
[
STUN_ENABLE
]
==
"true"
;
d
tmfType
_
=
details
[
ACCOUNT_DTMF_TYPE
]
==
"overrtp"
?
OVERRTP
:
SIPINFO
;
r
esolveOnce
_
=
details
[
CONFIG_ACCOUNT_RESOLVE_ONCE
]
==
"true"
;
r
egistrationExpire
_
=
details
[
CONFIG_ACCOUNT_REGISTRATION_EXPIRE
];
u
ser
A
gent
_
=
details
[
USERAGENT
];
// srtp settings
setSrtpEnable
(
details
[
SRTP_ENABLE
]
==
"true"
);
...
...
@@ -435,10 +436,10 @@ void SIPAccount::setAccountDetails (std::map<std::string, std::string> details)
setTlsNegotiationTimeoutSec
(
details
[
TLS_NEGOTIATION_TIMEOUT_SEC
]);
setTlsNegotiationTimeoutMsec
(
details
[
TLS_NEGOTIATION_TIMEOUT_MSEC
]);
if
(
getC
redential
Count
()
==
0
)
{
// credentials not set, construct 1 entry
if
(
c
redential
s_
.
empty
()
)
{
// credentials not set, construct 1 entry
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>
>
v
;
std
::
map
<
std
::
string
,
std
::
string
>
map
;
map
[
USERNAME
]
=
getU
sername
()
;
map
[
USERNAME
]
=
u
sername
_
;
map
[
PASSWORD
]
=
details
[
PASSWORD
];
map
[
REALM
]
=
"*"
;
v
.
push_back
(
map
);
...
...
@@ -485,7 +486,7 @@ std::map<std::string, std::string> SIPAccount::getAccountDetails() const
// Add sip specific details
a
[
ROUTESET
]
=
getServiceRoute
();
a
[
CONFIG_ACCOUNT_RESOLVE_ONCE
]
=
isResolveOnce
()
?
"true"
:
"false"
;
a
[
USERAGENT
]
=
getU
serAgent
()
;
a
[
USERAGENT
]
=
u
serAgent
_
;
a
[
CONFIG_ACCOUNT_REGISTRATION_EXPIRE
]
=
getRegistrationExpire
();
a
[
LOCAL_INTERFACE
]
=
getLocalInterface
();
...
...
@@ -677,17 +678,17 @@ void SIPAccount::loadConfig()
bool
SIPAccount
::
fullMatch
(
const
std
::
string
&
username
,
const
std
::
string
&
hostname
)
const
{
return
userMatch
(
username
)
&&
hostnameMatch
(
hostname
);
return
userMatch
(
username
)
and
hostnameMatch
(
hostname
);
}
bool
SIPAccount
::
userMatch
(
const
std
::
string
&
username
)
const
{
return
!
username
.
empty
()
&&
username
==
getU
sername
()
;
return
!
username
.
empty
()
and
username
==
u
sername
_
;
}
bool
SIPAccount
::
hostnameMatch
(
const
std
::
string
&
hostname
)
const
{
return
hostname
==
getH
ostname
()
;
return
hostname
==
h
ostname
_
;
}
std
::
string
SIPAccount
::
getMachineName
(
void
)
const
...
...
@@ -881,18 +882,24 @@ std::string computeMd5HashFromCredential (
void
SIPAccount
::
setCredentials
(
const
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>
>&
creds
)
{
using
std
::
vector
;
using
std
::
string
;
using
std
::
map
;
bool
md5HashingEnabled
=
Manager
::
instance
().
preferences
.
getMd5Hash
();
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>
>::
iterator
it
;
assert
(
creds
.
size
()
>
0
);
// we can not authenticate without credentials
credentials_
=
creds
;
/* md5 hashing */
for
(
it
=
credentials_
.
begin
();
it
!=
credentials_
.
end
();
++
it
)
{
std
::
string
username
=
(
*
it
)[
USERNAME
];
std
::
string
realm
=
(
*
it
)[
REALM
];
std
::
string
password
=
(
*
it
)[
PASSWORD
];
for
(
vector
<
map
<
string
,
string
>
>::
iterator
it
=
credentials_
.
begin
();
it
!=
credentials_
.
end
();
++
it
)
{
map
<
string
,
string
>::
const_iterator
val
=
(
*
it
).
find
(
USERNAME
);
const
std
::
string
username
=
val
!=
(
*
it
).
end
()
?
val
->
second
:
""
;
val
=
(
*
it
).
find
(
REALM
);
const
std
::
string
realm
(
val
!=
(
*
it
).
end
()
?
val
->
second
:
""
);
val
=
(
*
it
).
find
(
PASSWORD
);
const
std
::
string
password
(
val
!=
(
*
it
).
end
()
?
val
->
second
:
""
);
if
(
md5HashingEnabled
)
{
// TODO: Fix this.
...
...
@@ -904,32 +911,36 @@ void SIPAccount::setCredentials (const std::vector<std::map<std::string, std::st
// the configuration file. This is to avoid to
// re-hash a hashed password.
if
(
password
.
length
()
!=
32
)
{
if
(
password
.
length
()
!=
32
)
(
*
it
)[
PASSWORD
]
=
computeMd5HashFromCredential
(
username
,
password
,
realm
);
}
}
}
std
::
string
digest
;
size_t
n
=
getCredentialCount
();
// Create the credential array
delete
[]
cred_
;
cred_
=
new
pjsip_cred_info
[
n
];
unsigned
i
;
for
(
i
=
0
;
i
<
n
;
i
++
)
{
const
std
::
string
&
password
=
credentials_
[
i
][
PASSWORD
];
int
dataType
=
(
md5HashingEnabled
&&
password
.
length
()
==
32
)
cred_
=
new
pjsip_cred_info
[
credentials_
.
size
()];
size_t
i
=
0
;
for
(
vector
<
map
<
string
,
string
>
>::
const_iterator
iter
=
credentials_
.
begin
();
iter
!=
credentials_
.
end
();
++
iter
)
{
map
<
string
,
string
>::
const_iterator
val
=
(
*
iter
).
find
(
PASSWORD
);
const
std
::
string
password
=
val
!=
(
*
iter
).
end
()
?
val
->
second
:
""
;
int
dataType
=
(
md5HashingEnabled
and
password
.
length
()
==
32
)
?
PJSIP_CRED_DATA_DIGEST
:
PJSIP_CRED_DATA_PLAIN_PASSWD
;
cred_
[
i
].
username
=
pj_str
((
char
*
)
credentials_
[
i
][
USERNAME
].
c_str
());
cred_
[
i
].
data
=
pj_str
((
char
*
)
password
.
c_str
());
cred_
[
i
].
realm
=
pj_str
((
char
*
)
credentials_
[
i
][
REALM
].
c_str
());
val
=
(
*
iter
).
find
(
USERNAME
);
if
(
val
!=
(
*
iter
).
end
())
cred_
[
i
].
username
=
pj_str
((
char
*
)
val
->
second
.
c_str
());
cred_
[
i
].
data
=
pj_str
((
char
*
)
password
.
c_str
());
val
=
(
*
iter
).
find
(
REALM
);
if
(
val
!=
(
*
iter
).
end
())
cred_
[
i
].
realm
=
pj_str
((
char
*
)
val
->
second
.
c_str
());
cred_
[
i
].
data_type
=
dataType
;
cred_
[
i
].
scheme
=
pj_str
(
(
char
*
)
"digest"
);
++
i
;
}
}
...
...
@@ -937,3 +948,13 @@ const std::vector<std::map<std::string, std::string> > &SIPAccount::getCredentia
{
return
credentials_
;
}
std
::
string
SIPAccount
::
getUserAgentName
()
const
{
std
::
string
result
(
userAgent_
);
if
(
result
==
"sflphone"
or
result
.
empty
())
result
+=
"/"
PACKAGE_VERSION
;
return
result
;
}
daemon/src/sip/sipaccount.h
View file @
29b600a7
...
...
@@ -125,6 +125,7 @@ class SIPAccount : public Account
* Virtual destructor
*/
virtual
~
SIPAccount
();
std
::
string
getUserAgentName
()
const
;
void
setRegistrationStateDetailed
(
const
std
::
pair
<
int
,
std
::
string
>
&
details
)
{
registrationStateDetailed_
=
details
;
}
virtual
void
serialize
(
Conf
::
YamlEmitter
*
emitter
);
...
...
@@ -190,9 +191,6 @@ class SIPAccount : public Account
bool
isResolveOnce
(
void
)
const
{
return
resolveOnce_
;
}
void
setResolveOnce
(
bool
reslv
)
{
resolveOnce_
=
reslv
;
}
/**
* A client sendings a REGISTER request MAY suggest an expiration
...
...
daemon/src/sip/sipvoiplink.cpp
View file @
29b600a7
...
...
@@ -361,13 +361,13 @@ SIPVoIPLink::getEvent()
}
void
SIPVoIPLink
::
sendRegister
(
Account
*
a
)
throw
(
VoipLinkException
)
void
SIPVoIPLink
::
sendRegister
(
Account
*
a
)
{
pj_status_t
status
;
pjsip_tx_data
*
tdata
;
pjsip_hdr
hdr_list
;
SIPAccount
*
account
=
(
SIPAccount
*
)
a
;
SIPAccount
*
account
=
static_cast
<
SIPAccount
*
>
(
a
);
// Resolve hostname here and keep its
// IP address for the whole time the
...
...
@@ -461,7 +461,7 @@ void SIPVoIPLink::sendRegister (Account *a) throw(VoipLinkException)
ss
<<
port
;
ss
>>
portStr
;
std
::
string
contactUri
=
account
->
getContactHeader
(
address
,
portStr
);
std
::
string
contactUri
(
account
->
getContactHeader
(
address
,
portStr
)
)
;
_debug
(
"UserAgent: sendRegister: fromUri: %s serverUri: %s contactUri: %s"
,
fromUri
.
c_str
(),
...
...
@@ -497,7 +497,7 @@ void SIPVoIPLink::sendRegister (Account *a) throw(VoipLinkException)
// Add User-Agent Header
pj_list_init
(
&
hdr_list
);
const
std
::
string
&
agent
=
getUser
a
gentName
(
account
);
const
std
::
string
agent
(
account
->
getUser
A
gentName
()
);
pj_str_t
useragent
=
pj_str
((
char
*
)
agent
.
c_str
());
pjsip_generic_string_hdr
*
h
=
pjsip_generic_string_hdr_create
(
_pool
,
&
STR_USER_AGENT
,
&
useragent
);
...
...
@@ -1152,18 +1152,6 @@ SIPVoIPLink::getCurrentCodecName(Call *call)
return
""
;
}
std
::
string
SIPVoIPLink
::
getUseragentName
(
SIPAccount
*
account
)
{
std
::
ostringstream
useragent
;
useragent
<<
account
->
getUserAgent
();
if
(
useragent
.
str
()
==
"sflphone"
||
useragent
.
str
()
==
""
)
useragent
<<
"/"
<<
PACKAGE_VERSION
;
return
useragent
.
str
();
}
bool
SIPVoIPLink
::
carryingDTMFdigits
(
const
std
::
string
&
id
,
char
code
)
{
...
...
@@ -1297,7 +1285,6 @@ SIPVoIPLink::SIPStartCall (SIPCall* call)
return
false
;
}
// Creates URI
std
::
string
fromUri
=
account
->
getFromUri
();
std
::
string
toUri
=
call
->
getPeerNumber
();
// expecting a fully well formed sip uri
...
...
@@ -1310,7 +1297,7 @@ SIPVoIPLink::SIPStartCall (SIPCall* call)
ss
<<
port
;
ss
>>
portStr
;
std
::
string
contactUri
=
account
->
getContactHeader
(
address
,
portStr
);
std
::
string
contactUri
(
account
->
getContactHeader
(
address
,
portStr
)
)
;
_debug
(
"UserAgent: FROM uri: %s, TO uri: %s, CONTACT uri: %s"
,
fromUri
.
c_str
(),
toUri
.
c_str
(),
contactUri
.
c_str
());
...
...
@@ -1559,7 +1546,7 @@ bool SIPVoIPLink::SIPNewIpToIpCall (const std::string& id, const std::string& to
ss
<<
port
;
ss
>>
portStr
;
std
::
string
contactUri
=
account
->
getContactHeader
(
address
,
portStr
);
std
::
string
contactUri
(
account
->
getContactHeader
(
address
,
portStr
)
)
;
_debug
(
"UserAgent: FROM uri: %s, TO uri: %s, CONTACT uri: %s"
,
fromUri
.
c_str
(),
toUri
.
c_str
(),
contactUri
.
c_str
());
...
...
daemon/src/sip/sipvoiplink.h
View file @
29b600a7
...
...
@@ -121,7 +121,7 @@ class SIPVoIPLink : public VoIPLink
/**
* Build and send SIP registration request
*/
virtual
void
sendRegister
(
Account
*
a
)
throw
(
VoipLinkException
)
;
virtual
void
sendRegister
(
Account
*
a
);
/**
* Build and send SIP unregistration request
...
...
@@ -272,7 +272,7 @@ class SIPVoIPLink : public VoIPLink
/**
* Retrive useragent name from account
*/
std
::
string
getUseragentName
(
SIPAccount
*
);
std
::
string
getUseragentName
(
SIPAccount
*
)
const
;
/**
* List all the interfaces on the system and return
...
...
daemon/src/voiplink.h
View file @
29b600a7
...
...
@@ -93,7 +93,7 @@ class VoIPLink
* Virtual method
* Build and send account registration request
*/
virtual
void
sendRegister
(
Account
*
a
)
throw
(
VoipLinkException
)
=
0
;
virtual
void
sendRegister
(
Account
*
a
)
=
0
;
/**
* Virtual method
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment