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
8cac3792
Commit
8cac3792
authored
Apr 16, 2010
by
Alexandre Savard
Browse files
[#2926] Code cleanup
parent
b26f9e3f
Changes
1
Hide whitespace changes
Inline
Side-by-side
sflphone-common/src/managerimpl.cpp
View file @
8cac3792
...
@@ -1225,7 +1225,7 @@ void ManagerImpl::removeParticipant (const CallID& call_id) {
...
@@ -1225,7 +1225,7 @@ void ManagerImpl::removeParticipant (const CallID& call_id) {
void
ManagerImpl
::
processRemainingParticipant
(
CallID
current_call_id
,
void
ManagerImpl
::
processRemainingParticipant
(
CallID
current_call_id
,
Conference
*
conf
)
{
Conference
*
conf
)
{
_debug
(
"Manager
Impl::p
rocess
R
emaining
P
articipant
()
"
);
_debug
(
"Manager
: P
rocess
r
emaining
p
articipant"
);
if
(
conf
->
getNbParticipants
()
>
1
)
{
if
(
conf
->
getNbParticipants
()
>
1
)
{
...
@@ -1244,6 +1244,9 @@ void ManagerImpl::processRemainingParticipant (CallID current_call_id,
...
@@ -1244,6 +1244,9 @@ void ManagerImpl::processRemainingParticipant (CallID current_call_id,
_audiodriver
->
getMainBuffer
()
->
flush
(
default_id
);
_audiodriver
->
getMainBuffer
()
->
flush
(
default_id
);
}
else
if
(
conf
->
getNbParticipants
()
==
1
)
{
}
else
if
(
conf
->
getNbParticipants
()
==
1
)
{
_debug
(
"Manager: Only one remaining participant"
);
AccountID
currentAccountId
;
AccountID
currentAccountId
;
Call
*
call
=
NULL
;
Call
*
call
=
NULL
;
...
@@ -1270,6 +1273,9 @@ void ManagerImpl::processRemainingParticipant (CallID current_call_id,
...
@@ -1270,6 +1273,9 @@ void ManagerImpl::processRemainingParticipant (CallID current_call_id,
removeConference
(
conf
->
getConfID
());
removeConference
(
conf
->
getConfID
());
}
else
{
}
else
{
_debug
(
"Manager: No remaining participant, remove conference"
);
removeConference
(
conf
->
getConfID
());
removeConference
(
conf
->
getConfID
());
switchCall
(
""
);
switchCall
(
""
);
...
@@ -1322,7 +1328,7 @@ void ManagerImpl::joinConference (const CallID& conf_id1,
...
@@ -1322,7 +1328,7 @@ void ManagerImpl::joinConference (const CallID& conf_id1,
}
}
void
ManagerImpl
::
addStream
(
const
CallID
&
call_id
)
{
void
ManagerImpl
::
addStream
(
const
CallID
&
call_id
)
{
_debug
(
"Manager
Impl::addS
tream %s"
,
call_id
.
c_str
());
_debug
(
"Manager
: Add audio s
tream %s"
,
call_id
.
c_str
());
AccountID
currentAccountId
;
AccountID
currentAccountId
;
Call
*
call
=
NULL
;
Call
*
call
=
NULL
;
...
@@ -1372,7 +1378,7 @@ void ManagerImpl::addStream (const CallID& call_id) {
...
@@ -1372,7 +1378,7 @@ void ManagerImpl::addStream (const CallID& call_id) {
}
}
void
ManagerImpl
::
removeStream
(
const
CallID
&
call_id
)
{
void
ManagerImpl
::
removeStream
(
const
CallID
&
call_id
)
{
_debug
(
"Manager
Impl::removeS
tream %s"
,
call_id
.
c_str
());
_debug
(
"Manager
: Remove audio s
tream %s"
,
call_id
.
c_str
());
getAudioDriver
()
->
getMainBuffer
()
->
unBindAll
(
call_id
);
getAudioDriver
()
->
getMainBuffer
()
->
unBindAll
(
call_id
);
...
@@ -1424,7 +1430,7 @@ bool ManagerImpl::playDtmf (char code) {
...
@@ -1424,7 +1430,7 @@ bool ManagerImpl::playDtmf (char code) {
bool
hasToPlayTone
=
getConfigBool
(
SIGNALISATION
,
PLAY_DTMF
);
bool
hasToPlayTone
=
getConfigBool
(
SIGNALISATION
,
PLAY_DTMF
);
if
(
!
hasToPlayTone
)
{
if
(
!
hasToPlayTone
)
{
_debug
(
"
playDtmf: Do not have to play a tone..."
);
_debug
(
"
Manager:
playDtmf: Do not have to play a tone..."
);
return
false
;
return
false
;
}
}
...
@@ -1432,7 +1438,7 @@ bool ManagerImpl::playDtmf (char code) {
...
@@ -1432,7 +1438,7 @@ bool ManagerImpl::playDtmf (char code) {
pulselen
=
getConfigInt
(
SIGNALISATION
,
PULSE_LENGTH
);
pulselen
=
getConfigInt
(
SIGNALISATION
,
PULSE_LENGTH
);
if
(
!
pulselen
)
{
if
(
!
pulselen
)
{
_debug
(
"
playDtmf: Pulse length is not set..."
);
_debug
(
"
Manager:
playDtmf: Pulse length is not set..."
);
return
false
;
return
false
;
}
}
...
@@ -1444,7 +1450,7 @@ bool ManagerImpl::playDtmf (char code) {
...
@@ -1444,7 +1450,7 @@ bool ManagerImpl::playDtmf (char code) {
// fast return, no sound, so no dtmf
// fast return, no sound, so no dtmf
if
(
audiolayer
==
0
||
_dtmfKey
==
0
)
{
if
(
audiolayer
==
0
||
_dtmfKey
==
0
)
{
_debug
(
"
playDtmf: Error no audio layer..."
);
_debug
(
"
Manager:
playDtmf: Error no audio layer..."
);
return
false
;
return
false
;
}
}
...
@@ -1488,23 +1494,23 @@ bool ManagerImpl::incomingCallWaiting () {
...
@@ -1488,23 +1494,23 @@ bool ManagerImpl::incomingCallWaiting () {
void
ManagerImpl
::
addWaitingCall
(
const
CallID
&
id
)
{
void
ManagerImpl
::
addWaitingCall
(
const
CallID
&
id
)
{
_info
(
"Manager: Add waiting call %s (%d calls)"
,
id
.
c_str
(),
_nbIncomingWaitingCall
);
ost
::
MutexLock
m
(
_waitingCallMutex
);
ost
::
MutexLock
m
(
_waitingCallMutex
);
_waitingCall
.
insert
(
id
);
_waitingCall
.
insert
(
id
);
_nbIncomingWaitingCall
++
;
_nbIncomingWaitingCall
++
;
_info
(
"Manager: Add waiting call %s (%d calls)"
,
id
.
c_str
(),
_nbIncomingWaitingCall
);
}
}
void
ManagerImpl
::
removeWaitingCall
(
const
CallID
&
id
)
{
void
ManagerImpl
::
removeWaitingCall
(
const
CallID
&
id
)
{
_info
(
"Manager: Remove waiting call %s (%d calls)"
,
id
.
c_str
(),
_nbIncomingWaitingCall
);
ost
::
MutexLock
m
(
_waitingCallMutex
);
ost
::
MutexLock
m
(
_waitingCallMutex
);
// should return more than 1 if it erase a call
// should return more than 1 if it erase a call
if
(
_waitingCall
.
erase
(
id
))
{
if
(
_waitingCall
.
erase
(
id
))
{
_nbIncomingWaitingCall
--
;
_nbIncomingWaitingCall
--
;
}
}
_info
(
"Manager: Remove waiting call %s (%d calls)"
,
id
.
c_str
(),
_nbIncomingWaitingCall
);
}
}
bool
ManagerImpl
::
isWaitingCall
(
const
CallID
&
id
)
{
bool
ManagerImpl
::
isWaitingCall
(
const
CallID
&
id
)
{
...
@@ -1594,7 +1600,7 @@ bool ManagerImpl::incomingCall (Call* call, const AccountID& accountId) {
...
@@ -1594,7 +1600,7 @@ bool ManagerImpl::incomingCall (Call* call, const AccountID& accountId) {
//THREAD=VoIP
//THREAD=VoIP
void
ManagerImpl
::
incomingMessage
(
const
AccountID
&
accountId
,
void
ManagerImpl
::
incomingMessage
(
const
AccountID
&
accountId
,
const
std
::
string
&
message
)
{
const
std
::
string
&
message
)
{
if
(
_dbus
)
{
if
(
_dbus
)
{
_dbus
->
getCallManager
()
->
incomingMessage
(
accountId
,
message
);
_dbus
->
getCallManager
()
->
incomingMessage
(
accountId
,
message
);
}
}
...
@@ -1602,6 +1608,9 @@ void ManagerImpl::incomingMessage (const AccountID& accountId,
...
@@ -1602,6 +1608,9 @@ void ManagerImpl::incomingMessage (const AccountID& accountId,
//THREAD=VoIP CALL=Outgoing
//THREAD=VoIP CALL=Outgoing
void
ManagerImpl
::
peerAnsweredCall
(
const
CallID
&
id
)
{
void
ManagerImpl
::
peerAnsweredCall
(
const
CallID
&
id
)
{
_debug
(
"Manager: Peer answered call %s"
,
id
.
c_str
());
// The if statement is usefull only if we sent two calls at the same time.
// The if statement is usefull only if we sent two calls at the same time.
if
(
isCurrentCall
(
id
))
{
if
(
isCurrentCall
(
id
))
{
stopTone
();
stopTone
();
...
@@ -1610,12 +1619,6 @@ void ManagerImpl::peerAnsweredCall (const CallID& id) {
...
@@ -1610,12 +1619,6 @@ void ManagerImpl::peerAnsweredCall (const CallID& id) {
if
(
_dbus
)
if
(
_dbus
)
_dbus
->
getCallManager
()
->
callStateChanged
(
id
,
"CURRENT"
);
_dbus
->
getCallManager
()
->
callStateChanged
(
id
,
"CURRENT"
);
// std::string codecName = getCurrentCodecName (id);
// _debug("ManagerImpl::hangupCall(): broadcast codec name %s ",codecName.c_str());
// if (_dbus) _dbus->getCallManager()->currentSelectedCodec (id,codecName.c_str());
// Required if there have been no sip reinvite, in this case we must reinit buffers since the
_audiodriver
->
flushMain
();
_audiodriver
->
flushMain
();
_audiodriver
->
flushUrgent
();
_audiodriver
->
flushUrgent
();
...
@@ -1623,6 +1626,9 @@ void ManagerImpl::peerAnsweredCall (const CallID& id) {
...
@@ -1623,6 +1626,9 @@ void ManagerImpl::peerAnsweredCall (const CallID& id) {
//THREAD=VoIP Call=Outgoing
//THREAD=VoIP Call=Outgoing
void
ManagerImpl
::
peerRingingCall
(
const
CallID
&
id
)
{
void
ManagerImpl
::
peerRingingCall
(
const
CallID
&
id
)
{
_debug
(
"Manager: Peer call %s ringing"
,
id
.
c_str
());
if
(
isCurrentCall
(
id
))
{
if
(
isCurrentCall
(
id
))
{
ringback
();
ringback
();
}
}
...
@@ -1685,7 +1691,7 @@ void ManagerImpl::peerHungupCall (const CallID& call_id) {
...
@@ -1685,7 +1691,7 @@ void ManagerImpl::peerHungupCall (const CallID& call_id) {
// stop streams
// stop streams
if
(
nbCalls
<=
0
)
{
if
(
nbCalls
<=
0
)
{
_debug
(
"
hangupCall
:
s
top audio stream, ther is only %i call(s) remaining"
,
nbCalls
);
_debug
(
"
Manager
:
S
top audio stream, ther is only %i call(s) remaining"
,
nbCalls
);
AudioLayer
*
audiolayer
=
getAudioDriver
();
AudioLayer
*
audiolayer
=
getAudioDriver
();
audiolayer
->
stopStream
();
audiolayer
->
stopStream
();
...
@@ -1698,7 +1704,7 @@ void ManagerImpl::peerHungupCall (const CallID& call_id) {
...
@@ -1698,7 +1704,7 @@ void ManagerImpl::peerHungupCall (const CallID& call_id) {
//THREAD=VoIP
//THREAD=VoIP
void
ManagerImpl
::
callBusy
(
const
CallID
&
id
)
{
void
ManagerImpl
::
callBusy
(
const
CallID
&
id
)
{
_debug
(
"Call busy"
);
_debug
(
"
Manager:
Call
%s
busy"
,
id
.
c_str
()
);
if
(
_dbus
)
if
(
_dbus
)
_dbus
->
getCallManager
()
->
callStateChanged
(
id
,
"BUSY"
);
_dbus
->
getCallManager
()
->
callStateChanged
(
id
,
"BUSY"
);
...
@@ -1727,7 +1733,7 @@ void ManagerImpl::callFailure (const CallID& call_id) {
...
@@ -1727,7 +1733,7 @@ void ManagerImpl::callFailure (const CallID& call_id) {
if
(
participToConference
(
call_id
))
{
if
(
participToConference
(
call_id
))
{
_debug
(
"Call %s participating to a conference failed
\n
"
,
call_id
.
c_str
());
_debug
(
"
Manager:
Call %s participating to a conference failed"
,
call_id
.
c_str
());
Conference
*
conf
=
getConferenceFromCallID
(
call_id
);
Conference
*
conf
=
getConferenceFromCallID
(
call_id
);
...
...
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