Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jami-libclient
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
savoirfairelinux
jami-libclient
Commits
dd5856e9
Commit
dd5856e9
authored
5 years ago
by
Sébastien Blin
Browse files
Options
Downloads
Patches
Plain Diff
callmodel: expose setCurrentCall
Change-Id: I1177d216bed15091642dec84bdef623b55e4d44b
parent
639a38d3
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/api/lrc.h
+6
-0
6 additions, 0 deletions
src/api/lrc.h
src/api/newcallmodel.h
+7
-1
7 additions, 1 deletion
src/api/newcallmodel.h
src/lrc.cpp
+3
-0
3 additions, 0 deletions
src/lrc.cpp
src/newcallmodel.cpp
+35
-19
35 additions, 19 deletions
src/newcallmodel.cpp
with
51 additions
and
20 deletions
src/api/lrc.h
+
6
−
0
View file @
dd5856e9
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
#include
<memory>
#include
<memory>
#include
<vector>
#include
<vector>
#include
<string>
#include
<string>
#include
<atomic>
// Lrc
// Lrc
#include
"typedefs.h"
#include
"typedefs.h"
...
@@ -110,6 +111,11 @@ public:
...
@@ -110,6 +111,11 @@ public:
*/
*/
static
std
::
vector
<
std
::
string
>
getConferenceSubcalls
(
const
std
::
string
&
id
);
static
std
::
vector
<
std
::
string
>
getConferenceSubcalls
(
const
std
::
string
&
id
);
/**
* Preference
*/
static
std
::
atomic_bool
holdConferences
;
private
:
private
:
std
::
unique_ptr
<
LrcPimpl
>
lrcPimpl_
;
std
::
unique_ptr
<
LrcPimpl
>
lrcPimpl_
;
};
};
...
...
This diff is collapsed.
Click to expand it.
src/api/newcallmodel.h
+
7
−
1
View file @
dd5856e9
...
@@ -148,7 +148,8 @@ public:
...
@@ -148,7 +148,8 @@ public:
void
playDTMF
(
const
std
::
string
&
callId
,
const
std
::
string
&
value
)
const
;
void
playDTMF
(
const
std
::
string
&
callId
,
const
std
::
string
&
value
)
const
;
/**
/**
* Toggle pause on a call
* Toggle pause on a call.
* @warn only use this function for SIP calls
* @param callId
* @param callId
*/
*/
void
togglePause
(
const
std
::
string
&
callId
)
const
;
void
togglePause
(
const
std
::
string
&
callId
)
const
;
...
@@ -225,6 +226,11 @@ public:
...
@@ -225,6 +226,11 @@ public:
*/
*/
static
std
::
string
getSIPCallStatusString
(
const
short
&
statusCode
);
static
std
::
string
getSIPCallStatusString
(
const
short
&
statusCode
);
/**
* Set a call as the current call (hold other calls)
*/
void
setCurrentCall
(
const
std
::
string
&
callId
)
const
;
Q_SIGNALS
:
Q_SIGNALS
:
/**
/**
* Emitted when a call state changes
* Emitted when a call state changes
...
...
This diff is collapsed.
Click to expand it.
src/lrc.cpp
+
3
−
0
View file @
dd5856e9
...
@@ -45,6 +45,8 @@ namespace lrc
...
@@ -45,6 +45,8 @@ namespace lrc
using
namespace
api
;
using
namespace
api
;
std
::
atomic_bool
lrc
::
api
::
Lrc
::
holdConferences
;
// To judge whether the call is finished or not depending on callState
// To judge whether the call is finished or not depending on callState
bool
isFinished
(
const
QString
&
callState
);
bool
isFinished
(
const
QString
&
callState
);
...
@@ -65,6 +67,7 @@ public:
...
@@ -65,6 +67,7 @@ public:
Lrc
::
Lrc
(
MigrationCb
willDoMigrationCb
,
MigrationCb
didDoMigrationCb
)
Lrc
::
Lrc
(
MigrationCb
willDoMigrationCb
,
MigrationCb
didDoMigrationCb
)
{
{
lrc
::
api
::
Lrc
::
holdConferences
.
store
(
true
);
#ifndef ENABLE_LIBWRAP
#ifndef ENABLE_LIBWRAP
// Replace locale for timestamps
// Replace locale for timestamps
std
::
locale
::
global
(
std
::
locale
(
""
));
std
::
locale
::
global
(
std
::
locale
(
""
));
...
...
This diff is collapsed.
Click to expand it.
src/newcallmodel.cpp
+
35
−
19
View file @
dd5856e9
...
@@ -139,12 +139,8 @@ public:
...
@@ -139,12 +139,8 @@ public:
* Retrieve active conferences from the daemon and init the model
* Retrieve active conferences from the daemon and init the model
*/
*/
void
initConferencesFromDaemon
();
void
initConferencesFromDaemon
();
/**
* Set a call as the current call (hold other calls)
*/
void
setCurrentCall
(
const
std
::
string
&
callId
);
bool
manageCurrentCall_
{
true
};
bool
manageCurrentCall_
{
true
};
bool
dontHoldConferences_
{
false
};
std
::
string
currentCall_
{
};
std
::
map
<
std
::
string
,
std
::
string
>
pendingConferences_
;
std
::
map
<
std
::
string
,
std
::
string
>
pendingConferences_
;
public
Q_SLOTS
:
public
Q_SLOTS
:
...
@@ -323,7 +319,7 @@ NewCallModel::togglePause(const std::string& callId) const
...
@@ -323,7 +319,7 @@ NewCallModel::togglePause(const std::string& callId) const
if
(
call
->
status
==
call
::
Status
::
PAUSED
)
{
if
(
call
->
status
==
call
::
Status
::
PAUSED
)
{
if
(
call
->
type
==
call
::
Type
::
DIALOG
)
{
if
(
call
->
type
==
call
::
Type
::
DIALOG
)
{
CallManager
::
instance
().
unhold
(
callId
.
c_str
());
CallManager
::
instance
().
unhold
(
callId
.
c_str
());
pimpl_
->
setCurrentCall
(
callId
);
setCurrentCall
(
callId
);
}
else
{
}
else
{
CallManager
::
instance
().
unholdConference
(
callId
.
c_str
());
CallManager
::
instance
().
unholdConference
(
callId
.
c_str
());
}
}
...
@@ -582,19 +578,37 @@ NewCallModelPimpl::initConferencesFromDaemon()
...
@@ -582,19 +578,37 @@ NewCallModelPimpl::initConferencesFromDaemon()
}
}
void
void
NewCallModel
Pimpl
::
setCurrentCall
(
const
std
::
string
&
callId
)
NewCallModel
::
setCurrentCall
(
const
std
::
string
&
callId
)
const
{
{
if
(
!
manageCurrentCall_
)
return
;
if
(
!
pimpl_
->
manageCurrentCall_
)
return
;
auto
it
=
pendingConferences_
.
find
(
callId
);
auto
it
=
pimpl_
->
pendingConferences_
.
find
(
callId
);
// Set current call only if not adding this call
// Set current call only if not adding this call
// to a current conference
// to a current conference
if
(
it
!=
pendingConferences_
.
end
())
return
;
if
(
it
!=
pimpl_
->
pendingConferences_
.
end
())
return
;
if
(
!
hasCall
(
callId
))
return
;
// The client should be able to set the current call multiple times
if
(
pimpl_
->
currentCall_
==
callId
)
return
;
pimpl_
->
currentCall_
=
callId
;
// Unhold call
auto
&
call
=
pimpl_
->
calls
[
callId
];
if
(
call
->
status
==
call
::
Status
::
PAUSED
)
{
auto
&
call
=
pimpl_
->
calls
[
callId
];
if
(
call
->
type
==
call
::
Type
::
DIALOG
)
{
CallManager
::
instance
().
unhold
(
callId
.
c_str
());
}
else
{
CallManager
::
instance
().
unholdConference
(
callId
.
c_str
());
}
}
std
::
vector
<
std
::
string
>
filterCalls
;
std
::
vector
<
std
::
string
>
filterCalls
;
QStringList
conferences
=
CallManager
::
instance
().
getConferenceList
();
QStringList
conferences
=
CallManager
::
instance
().
getConferenceList
();
for
(
const
auto
&
confId
:
conferences
)
{
for
(
const
auto
&
confId
:
conferences
)
{
QStringList
callList
=
CallManager
::
instance
().
getParticipantList
(
confId
);
QStringList
callList
=
CallManager
::
instance
().
getParticipantList
(
confId
);
foreach
(
const
auto
&
c
allI
d
,
callList
)
{
foreach
(
const
auto
&
c
i
d
,
callList
)
{
filterCalls
.
emplace_back
(
c
allI
d
.
toStdString
());
filterCalls
.
emplace_back
(
c
i
d
.
toStdString
());
}
}
}
}
for
(
const
auto
&
cid
:
Lrc
::
activeCalls
())
{
for
(
const
auto
&
cid
:
Lrc
::
activeCalls
())
{
...
@@ -603,10 +617,11 @@ NewCallModelPimpl::setCurrentCall(const std::string& callId)
...
@@ -603,10 +617,11 @@ NewCallModelPimpl::setCurrentCall(const std::string& callId)
CallManager
::
instance
().
hold
(
cid
.
c_str
());
CallManager
::
instance
().
hold
(
cid
.
c_str
());
}
}
}
}
if
(
dontH
oldConferences
_
)
{
if
(
!
lrc
::
api
::
Lrc
::
h
oldConferences
)
{
return
;
return
;
}
}
for
(
const
auto
&
confId
:
conferences
)
{
for
(
const
auto
&
confId
:
conferences
)
{
if
(
callId
!=
confId
.
toStdString
())
CallManager
::
instance
().
holdConference
(
confId
);
CallManager
::
instance
().
holdConference
(
confId
);
}
}
}
}
...
@@ -695,17 +710,18 @@ NewCallModelPimpl::slotCallStateChanged(const std::string& callId, const std::st
...
@@ -695,17 +710,18 @@ NewCallModelPimpl::slotCallStateChanged(const std::string& callId, const std::st
// NOTE: signal emission order matters, always emit CallStatusChanged before CallEnded
// NOTE: signal emission order matters, always emit CallStatusChanged before CallEnded
emit
linked
.
callStatusChanged
(
callId
,
code
);
emit
linked
.
callStatusChanged
(
callId
,
code
);
if
(
call
->
status
==
call
::
Status
::
OUTGOING_RINGING
)
{
if
(
call
->
status
==
call
::
Status
::
OUTGOING_RINGING
setCurrentCall
(
callId
);
&&
linked
.
owner
.
profileInfo
.
type
!=
profile
::
Type
::
SIP
)
{
linked
.
setCurrentCall
(
callId
);
}
else
if
(
call
->
status
==
call
::
Status
::
ENDED
)
{
}
else
if
(
call
->
status
==
call
::
Status
::
ENDED
)
{
emit
linked
.
callEnded
(
callId
);
emit
linked
.
callEnded
(
callId
);
}
else
if
(
call
->
status
==
call
::
Status
::
IN_PROGRESS
)
{
}
else
if
(
call
->
status
==
call
::
Status
::
IN_PROGRESS
)
{
if
(
previousStatus
==
call
::
Status
::
INCOMING_RINGING
if
(
previousStatus
==
call
::
Status
::
INCOMING_RINGING
||
previousStatus
==
call
::
Status
::
OUTGOING_RINGING
)
{
||
previousStatus
==
call
::
Status
::
OUTGOING_RINGING
)
{
if
(
previousStatus
==
call
::
Status
::
INCOMING_RINGING
)
if
(
previousStatus
==
call
::
Status
::
INCOMING_RINGING
setCurrentCall
(
callId
);
&&
linked
.
owner
.
profileInfo
.
type
!=
profile
::
Type
::
SIP
)
linked
.
setCurrentCall
(
callId
);
call
->
startTime
=
std
::
chrono
::
steady_clock
::
now
();
call
->
startTime
=
std
::
chrono
::
steady_clock
::
now
();
emit
linked
.
callStarted
(
callId
);
emit
linked
.
callStarted
(
callId
);
sendProfile
(
callId
);
sendProfile
(
callId
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment