Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
savoirfairelinux
jami-daemon
Commits
13dadfa2
Commit
13dadfa2
authored
Sep 19, 2011
by
Rafaël Carré
Browse files
* #6905 : SIP refactor
parent
f498e9ed
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
daemon/src/managerimpl.cpp
View file @
13dadfa2
...
...
@@ -576,22 +576,15 @@ void ManagerImpl::transferSucceded ()
bool
ManagerImpl
::
attendedTransfer
(
const
std
::
string
&
transferID
,
const
std
::
string
&
targetID
)
{
bool
returnValue
;;
if
(
getConfigFromCall
(
transferID
)
==
Call
::
IPtoIP
)
return
SIPVoIPLink
::
instance
()
->
attendedTransfer
(
transferID
,
targetID
);
// Direct IP to IP call
if
(
getConfigFromCall
(
transferID
)
==
Call
::
IPtoIP
)
returnValue
=
SIPVoIPLink
::
instance
()
->
attendedTransfer
(
transferID
,
targetID
);
else
{
// Classic call, attached to an account
std
::
string
accountid
=
getAccountFromCall
(
transferID
);
if
(
accountid
.
empty
())
return
false
;
returnValue
=
getAccountLink
(
accountid
)
->
attendedTransfer
(
transferID
,
targetID
);
}
getMainBuffer
()
->
stateInfo
();
// Classic call, attached to an account
std
::
string
accountid
=
getAccountFromCall
(
transferID
);
if
(
accountid
.
empty
())
return
false
;
return
returnValue
;
return
getAccountLink
(
accountid
)
->
attendedTransfer
(
transferID
,
targetID
)
;
}
//THREAD=Main : Call:Incoming
...
...
@@ -2682,7 +2675,7 @@ bool ManagerImpl::associateCallToAccount (const std::string& callID,
return
false
;
}
std
::
string
ManagerImpl
::
getAccountFromCall
(
const
std
::
string
&
callID
)
std
::
string
ManagerImpl
::
getAccountFromCall
(
const
std
::
string
&
callID
)
{
ost
::
MutexLock
m
(
_callAccountMapMutex
);
CallAccountMap
::
iterator
iter
=
_callAccountMap
.
find
(
callID
);
...
...
daemon/src/sip/sipaccount.cpp
View file @
13dadfa2
...
...
@@ -43,7 +43,7 @@ SIPAccount::SIPAccount (const std::string& accountID)
,
transport
(
NULL
)
,
regc_
(
NULL
)
,
bRegister_
(
false
)
,
registrationExpire_
(
""
)
,
registrationExpire_
(
600
)
,
interface_
(
"default"
)
,
publishedSameasLocal_
(
true
)
,
publishedIpAddress_
(
""
)
...
...
@@ -102,7 +102,9 @@ void SIPAccount::serialize (Conf::YamlEmitter *emitter)
Conf
::
ScalarNode
hostname
(
Account
::
hostname_
);
Conf
::
ScalarNode
enable
(
enabled_
);
Conf
::
ScalarNode
type
(
Account
::
type_
);
Conf
::
ScalarNode
expire
(
registrationExpire_
);
std
::
stringstream
expirevalstr
;
expirevalstr
<<
registrationExpire_
;
Conf
::
ScalarNode
expire
(
expirevalstr
);
Conf
::
ScalarNode
interface
(
interface_
);
std
::
stringstream
portstr
;
portstr
<<
localPort_
;
...
...
@@ -381,7 +383,7 @@ void SIPAccount::setAccountDetails (std::map<std::string, std::string> details)
stunEnabled_
=
details
[
STUN_ENABLE
]
==
"true"
;
dtmfType_
=
details
[
ACCOUNT_DTMF_TYPE
]
==
"overrtp"
?
OVERRTP
:
SIPINFO
;
registrationExpire_
=
details
[
CONFIG_ACCOUNT_REGISTRATION_EXPIRE
];
registrationExpire_
=
atoi
(
details
[
CONFIG_ACCOUNT_REGISTRATION_EXPIRE
]
.
c_str
())
;
userAgent_
=
details
[
USERAGENT
];
...
...
@@ -464,7 +466,9 @@ std::map<std::string, std::string> SIPAccount::getAccountDetails() const
a
[
ROUTESET
]
=
serviceRoute_
;
a
[
USERAGENT
]
=
userAgent_
;
a
[
CONFIG_ACCOUNT_REGISTRATION_EXPIRE
]
=
registrationExpire_
;
std
::
stringstream
expireval
;
expireval
<<
registrationExpire_
;
a
[
CONFIG_ACCOUNT_REGISTRATION_EXPIRE
]
=
expireval
.
str
();
a
[
LOCAL_INTERFACE
]
=
interface_
;
a
[
PUBLISHED_SAMEAS_LOCAL
]
=
publishedSameasLocal_
?
"true"
:
"false"
;
a
[
PUBLISHED_ADDRESS
]
=
publishedIpAddress_
;
...
...
@@ -619,8 +623,8 @@ void SIPAccount::initStunConfiguration (void)
void
SIPAccount
::
loadConfig
()
{
if
(
registrationExpire_
.
empty
()
)
registrationExpire_
=
"
600
"
;
/** Default expire value for registration */
if
(
registrationExpire_
==
0
)
registrationExpire_
=
600
;
/** Default expire value for registration */
if
(
tlsEnable_
==
"true"
)
{
initTlsConfiguration
();
...
...
daemon/src/sip/sipaccount.h
View file @
13dadfa2
...
...
@@ -165,19 +165,21 @@ class SIPAccount : public Account
* interval that indicates how long the client would like the
* registration to be valid.
*
* @return
A string describing
the expiration value.
* @return the expiration value.
*/
const
std
::
string
&
getRegistrationExpire
(
void
)
const
{
return
registrationExpire_
;
unsigned
getRegistrationExpire
(
void
)
const
{
if
(
registrationExpire_
==
0
)
return
PJSIP_REGC_EXPIRATION_NOT_SPECIFIED
;
return
registrationExpire_
;
}
/**
* Setting the Expiration Interval of Contact Addresses.
*
* @param A string describing the expiration value.
* Doubles the Expiration Interval of Contact Addresses.
*/
void
setRegistrationExpire
(
const
std
::
string
&
expr
)
{
registrationExpire_
=
expr
;
void
doubleRegistrationExpire
(
void
)
{
registrationExpire_
*=
2
;
if
(
registrationExpire_
<
0
)
registrationExpire_
=
0
;
}
bool
fullMatch
(
const
std
::
string
&
username
,
const
std
::
string
&
hostname
)
const
;
...
...
@@ -444,7 +446,7 @@ class SIPAccount : public Account
bool
bRegister_
;
// Network settings
std
::
str
in
g
registrationExpire_
;
in
t
registrationExpire_
;
// interface name on which this account is bound
std
::
string
interface_
;
...
...
daemon/src/sip/sipvoiplink.cpp
View file @
13dadfa2
This diff is collapsed.
Click to expand it.
daemon/src/sip/sipvoiplink.h
View file @
13dadfa2
...
...
@@ -144,6 +144,8 @@ class SIPVoIPLink : public VoIPLink
*/
virtual
void
offhold
(
const
std
::
string
&
id
);
bool
transferCommon
(
SIPCall
*
call
,
pj_str_t
*
dst
);
/**
* Transfer the call
* @param id The call identifier
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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