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
46fea3f2
Commit
46fea3f2
authored
Aug 11, 2009
by
Alexandre Savard
Browse files
[#1883] Fix mnagerimpl conference map insertion
parent
aa5740f3
Changes
4
Hide whitespace changes
Inline
Side-by-side
sflphone-common/src/conference.cpp
View file @
46fea3f2
...
...
@@ -41,14 +41,17 @@ Conference::~Conference()
void
Conference
::
add
(
CallID
participant_id
)
{
_debug
(
"Conference::add participant %s
\n
"
,
participant_id
.
c_str
());
_debug
(
"
----
Conference::
add participant %s
\n
"
,
participant_id
.
c_str
());
if
(
_nbParticipant
>=
1
)
{
ParticipantSet
::
iterator
iter
;
for
(
iter
=
_participants
.
begin
();
iter
!=
_participants
.
end
();
iter
++
)
{
_debug
(
"---- Conference:: bind callid %s with %s in conference add
\n
"
,
participant_id
.
c_str
(),
(
*
iter
).
c_str
());
Manager
::
instance
().
getAudioDriver
()
->
getMainBuffer
()
->
bindCallID
(
participant_id
,
*
iter
);
}
}
// Manager::instance().getAudioDriver()->getMainBuffer()->bindCallID(participant_id);
...
...
@@ -62,12 +65,17 @@ void Conference::add(CallID participant_id)
void
Conference
::
remove
(
CallID
participant_id
)
{
_debug
(
"---- Conference:: remove participant %s
\n
"
,
participant_id
.
c_str
());
if
(
_nbParticipant
>=
1
)
{
ParticipantSet
::
iterator
iter
=
_participants
.
begin
();
for
(
iter
=
_participants
.
begin
();
iter
!=
_participants
.
end
();
iter
++
)
Manager
::
instance
().
getAudioDriver
()
->
getMainBuffer
()
->
unBindCallID
(
participant_id
,
*
iter
);
{
_debug
(
"---- Conference:: unbind callid %s from %s in conference add
\n
"
,
participant_id
.
c_str
(),
(
*
iter
).
c_str
());
Manager
::
instance
().
getAudioDriver
()
->
getMainBuffer
()
->
unBindCallID
(
participant_id
,
*
iter
);
}
}
_participants
.
erase
(
participant_id
);
...
...
sflphone-common/src/managerimpl.cpp
View file @
46fea3f2
...
...
@@ -317,7 +317,7 @@ ManagerImpl::answerCall (const CallID& id)
}
else
{
_debug
(
"There is a conference!
!!!!!!!!!!!!!!!!!!!!!
\n
"
);
_debug
(
"There is a conference!
Do not hold the current call
\n
"
);
}
}
...
...
@@ -364,10 +364,14 @@ ManagerImpl::hangupCall (const CallID& id)
_debug
(
"hangupCall: callList is of size %i call(s)
\n
"
,
nbCalls
);
// stop stream
// stop streamx
if
(
!
(
nbCalls
>
1
))
audiolayer
->
stopStream
();
if
(
participToConference
(
id
))
removeParticipant
(
id
);
/* Direct IP to IP call */
if
(
getConfigFromCall
(
id
)
==
Call
::
IPtoIP
)
{
returnValue
=
SIPVoIPLink
::
instance
(
AccountNULL
)
->
hangup
(
id
);
...
...
@@ -377,7 +381,8 @@ ManagerImpl::hangupCall (const CallID& id)
else
{
accountid
=
getAccountFromCall
(
id
);
if
(
accountid
==
AccountNULL
)
{
if
(
accountid
==
AccountNULL
)
{
_debug
(
"! Manager Hangup Call: Call doesn't exists
\n
"
);
return
false
;
}
...
...
@@ -449,6 +454,9 @@ ManagerImpl::onHoldCall (const CallID& id)
call_id
=
id
;
if
(
participToConference
(
id
))
removeParticipant
(
id
);
/* Direct IP to IP call */
if
(
getConfigFromCall
(
id
)
==
Call
::
IPtoIP
)
{
...
...
@@ -635,7 +643,9 @@ ManagerImpl::createConference(const CallID& id)
_debug
(
"ManagerImpl::createConference()
\n
"
);
Conference
*
conf
=
new
Conference
();
_conferencemap
[
"conf"
]
=
conf
;
_conferencecall
.
insert
(
pair
<
CallID
,
Conference
*>
(
id
,
conf
));
_conferencemap
.
insert
(
pair
<
CallID
,
Conference
*>
(
"conf"
,
conf
));
conf
->
add
(
getCurrentCallId
());
conf
->
add
(
id
);
...
...
@@ -645,30 +655,98 @@ ManagerImpl::createConference(const CallID& id)
}
void
ManagerImpl
::
addParticipant
(
const
CallID
&
id
)
ManagerImpl
::
removeConference
(
const
CallID
&
conference_
id
)
{
_debug
(
"ManagerImpl::addParticipant(%s)
\n
"
,
id
.
c_str
());
_debug
(
"ManagerImpl::removeConference(%s)
\n
"
,
conference_id
.
c_str
());
Conference
*
conf
;
ConferenceMap
::
iterator
iter
=
_conferencemap
.
find
(
conference_id
);
conf
=
iter
->
second
;
ConferenceCallMap
::
iterator
iter_p
;
for
(
iter_p
=
_conferencecall
.
begin
();
iter_p
!=
_conferencecall
.
end
();
iter_p
++
)
{
if
(
iter_p
->
second
==
conf
)
{
_conferencecall
.
erase
(
iter_p
);
}
}
_conferencemap
.
erase
(
"conf"
);
}
bool
ManagerImpl
::
participToConference
(
const
CallID
&
call_id
)
{
ConferenceCallMap
::
iterator
iter
=
_conferencecall
.
find
(
call_id
);
if
(
iter
==
_conferencecall
.
end
())
{
return
false
;
}
else
{
return
true
;
}
}
void
ManagerImpl
::
addParticipant
(
const
CallID
&
call_id
)
{
_debug
(
"ManagerImpl::addParticipant(%s)
\n
"
,
call_id
.
c_str
());
_debug
(
" Current call ID %s
\n
"
,
getCurrentCallId
().
c_str
());
if
(
_conferencemap
.
empty
())
// TODO: add conference_id as a second parameter
ConferenceMap
::
iterator
iter
=
_conferencemap
.
find
(
"conf"
);
if
(
iter
==
_conferencemap
.
end
())
{
_debug
(
"NO CONFERENCE YET, CREATE ONE
\n
"
);
createConference
(
id
);
createConference
(
call_
id
);
}
else
{
_debug
(
"ALREADY A CONFERENCE CREATED, ADD PARTICIPANT TO IT
\n
"
);
Conference
*
conf
;
ConferenceMap
::
iterator
iter
=
_conferencemap
.
find
(
"conf"
);
conf
=
iter
->
second
;
Conference
*
conf
=
iter
->
second
;
conf
->
add
(
id
);
conf
->
add
(
call_id
);
_conferencecall
.
insert
(
pair
<
CallID
,
Conference
*>
(
call_id
,
conf
));
answerCall
(
id
);
answerCall
(
call_
id
);
}
}
void
ManagerImpl
::
removeParticipant
(
const
CallID
&
call_id
)
{
_debug
(
"ManagerImpl::removeParticipant(%s)
\n
"
,
call_id
.
c_str
());
// TODO: add conference_id as a second parameter
Conference
*
conf
;
ConferenceMap
::
iterator
iter
=
_conferencemap
.
find
(
"conf"
);
if
(
iter
==
_conferencemap
.
end
())
{
_debug
(
"NO CONFERENCE CREATED, CANNOT REMOVE PARTICIPANT
\n
"
);
}
else
{
conf
=
iter
->
second
;
_debug
(
"REMOVE PARTICIPANT %s
\n
"
,
call_id
.
c_str
());
conf
->
remove
(
call_id
);
_conferencecall
.
erase
(
iter
);
if
(
conf
->
getNbParticipants
()
<=
1
)
removeConference
(
"conf"
);
}
}
//THREAD=Main
bool
ManagerImpl
::
saveConfig
(
void
)
...
...
@@ -976,6 +1054,9 @@ ManagerImpl::peerHungupCall (const CallID& id)
AccountID
accountid
;
bool
returnValue
;
if
(
participToConference
(
id
))
removeParticipant
(
id
);
/* Direct IP to IP call */
if
(
getConfigFromCall
(
id
)
==
Call
::
IPtoIP
)
{
...
...
@@ -993,6 +1074,8 @@ ManagerImpl::peerHungupCall (const CallID& id)
returnValue
=
getAccountLink
(
accountid
)
->
peerHungup
(
id
);
}
/* Broadcast a signal over DBus */
if
(
_dbus
)
_dbus
->
getCallManager
()
->
callStateChanged
(
id
,
"HUNGUP"
);
...
...
sflphone-common/src/managerimpl.h
View file @
46fea3f2
...
...
@@ -70,8 +70,11 @@ typedef std::set<CallID> CallIDSet;
/** To send multiple string */
typedef
std
::
list
<
std
::
string
>
TokenList
;
/** To store conference objects by ids */
typedef
std
::
map
<
CallID
,
Conference
*>
ConferenceMap
;
/** To store conference objects by call ids */
typedef
std
::
map
<
CallID
,
Conference
*>
ConferenceCallMap
;
/** To store conference objects by conference ids */
typedef
std
::
map
<
CallID
,
Conference
*>
ConferenceMap
;
/** Manager (controller) of sflphone daemon */
class
ManagerImpl
{
...
...
@@ -182,7 +185,13 @@ class ManagerImpl {
void
createConference
(
const
CallID
&
id
);
void
addParticipant
(
const
CallID
&
id
);
void
removeConference
(
const
CallID
&
conference_id
);
bool
participToConference
(
const
CallID
&
call_id
);
void
addParticipant
(
const
CallID
&
call_id
);
void
removeParticipant
(
const
CallID
&
call_id
);
/**
* Save config to file
...
...
@@ -1150,6 +1159,8 @@ class ManagerImpl {
int
isStunEnabled
(
void
);
void
enableStun
(
void
);
ConferenceCallMap
_conferencecall
;
ConferenceMap
_conferencemap
;
private:
...
...
sflphone-common/src/sipvoiplink.cpp
View file @
46fea3f2
...
...
@@ -711,6 +711,7 @@ SIPVoIPLink::hangup (const CallID& id)
}
// User hangup current call. Notify peer
_debug
(
"SIPVoIPLink::hangup Create inv session for call id: %s
\n
"
,
call
->
getCallId
().
c_str
());
status
=
pjsip_inv_end_session
(
call
->
getInvSession
(),
404
,
NULL
,
&
tdata
);
if
(
status
!=
PJ_SUCCESS
)
...
...
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