Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
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
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
fddb2ef8
Commit
fddb2ef8
authored
3 years ago
by
Olivier Dion
Browse files
Options
Downloads
Patches
Plain Diff
agent: Add wait-for-call-state
Change-Id: I692df9c8e315e703fb079e136962905b9e83dce8
parent
c4da9deb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
test/agent/agent.cpp
+26
-0
26 additions, 0 deletions
test/agent/agent.cpp
test/agent/agent.h
+1
-0
1 addition, 0 deletions
test/agent/agent.h
test/agent/bindings.cpp
+9
-0
9 additions, 0 deletions
test/agent/bindings.cpp
with
36 additions
and
0 deletions
test/agent/agent.cpp
+
26
−
0
View file @
fddb2ef8
...
...
@@ -318,6 +318,32 @@ Agent::ensureAccount()
AGENT_INFO
(
"Using account %s - %s"
,
accountID_
.
c_str
(),
peerID_
.
c_str
());
}
void
Agent
::
waitForCallState
(
const
std
::
string
&
wanted
)
{
LOG_AGENT_STATE
();
std
::
mutex
mtx
;
std
::
condition_variable
cv
;
std
::
unique_lock
lk
(
mtx
);
onCallStateChanged_
.
add
([
&
](
const
std
::
string
&
/* call_id */
,
const
std
::
string
&
state
,
signed
/* code */
)
{
if
(
wanted
==
state
)
{
std
::
unique_lock
lk
(
mtx
);
cv
.
notify_one
();
return
false
;
}
return
true
;
});
cv
.
wait
(
lk
);
}
Agent
&
Agent
::
instance
()
...
...
This diff is collapsed.
Click to expand it.
test/agent/agent.h
+
1
−
0
View file @
fddb2ef8
...
...
@@ -122,6 +122,7 @@ public:
void
ensureAccount
();
void
waitForAnnouncement
(
std
::
chrono
::
seconds
timeout
=
std
::
chrono
::
seconds
(
30
));
void
activate
(
bool
state
);
void
waitForCallState
(
const
std
::
string
&
wanted
=
"CURRENT"
);
void
init
();
void
fini
();
...
...
This diff is collapsed.
Click to expand it.
test/agent/bindings.cpp
+
9
−
0
View file @
fddb2ef8
...
...
@@ -262,6 +262,14 @@ disable_binding()
return
SCM_UNDEFINED
;
}
static
SCM
wait_for_call_state
(
SCM
wanted_state_str
)
{
Agent
::
instance
().
waitForCallState
(
from_guile
(
wanted_state_str
));
return
SCM_UNDEFINED
;
}
/*
* Register Guile bindings here.
*
...
...
@@ -308,4 +316,5 @@ install_scheme_primitives()
define_primitive
(
"archive->agent"
,
1
,
0
,
0
,
(
void
*
)
import_from_archive_binding
);
define_primitive
(
"agent:enable"
,
0
,
0
,
0
,
(
void
*
)
enable_binding
);
define_primitive
(
"agent:disable"
,
0
,
0
,
0
,
(
void
*
)
disable_binding
);
define_primitive
(
"agent:wait-for-call-state"
,
1
,
0
,
0
,
(
void
*
)
wait_for_call_state
);
}
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