Skip to content
This repository has been archived by the owner on Aug 25, 2021. It is now read-only.

Draft: Add Control API on_start/on_stop callbacks #91

Draft
wants to merge 253 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
253 commits
Select commit Hold shift + click to select a range
ecfd202
Fix protos convertations in medea-control-api-mock
evdokimovs Jan 27, 2020
26f15be
Migrate client of medea-control-api-mock to Tonic
evdokimovs Jan 27, 2020
e10669c
Migrate medea-control-api-mock to tonic and actix-web 2.0
evdokimovs Jan 27, 2020
9140b33
Fix warns, lints
evdokimovs Jan 27, 2020
34c34cf
Migrate medea E2E tests to tonic
evdokimovs Jan 27, 2020
848307f
Fix all E2E tests
evdokimovs Jan 28, 2020
b1b8f2e
Fix deadlock
evdokimovs Jan 28, 2020
c4031e9
Wrap GrpcCallbackClient into Actor
evdokimovs Jan 29, 2020
da79adf
Fix warns
evdokimovs Jan 29, 2020
cb04361
Refactor Protobuf imports
evdokimovs Jan 29, 2020
3244322
Refactor [run ci]
evdokimovs Jan 29, 2020
db83154
Merge branch 'master' into migration-to-tonic
alexlapa Jan 30, 2020
cbb8924
Remove mock Client lazyness and add wait.port to Makefile
evdokimovs Jan 30, 2020
3ddef2e
Remove RefCell from gRPC callback sender [run ci]
evdokimovs Jan 30, 2020
a349d43
Add wait.port to .PHONY
evdokimovs Jan 30, 2020
c76408b
Remove mutable reference in Room Protobuf convertation
evdokimovs Jan 30, 2020
84924f2
Add on_start on_stop
evdokimovs Jan 31, 2020
e6ac8bb
Normal 'on_start' and 'on_stop' validation
evdokimovs Feb 3, 2020
da8e50c
refactor, add todo
alexlapa Feb 3, 2020
dec70ae
Mock CallbackFactory and CallbackClient, add tests for it, refactor
evdokimovs Feb 4, 2020
e28c51e
Fix 'clippy::missing_errors_doc' lints [run ci]
evdokimovs Feb 4, 2020
9d7163b
Fix new clippy lints [run ci]
evdokimovs Feb 4, 2020
8a8f932
Temporary disable wasm-opt because it broken [run ci]
evdokimovs Feb 4, 2020
0c8b071
Minor docs fix [run ci]
evdokimovs Feb 4, 2020
f02f2ff
Merge branch 'migration-to-tonic' into on-play-on-stop
evdokimovs Feb 5, 2020
44fde68
IceUsers now is creating for Peers
evdokimovs Feb 7, 2020
0acf3af
Add coturn stats fetching and processing
evdokimovs Feb 10, 2020
5332d55
refactor
alexlapa Feb 11, 2020
5679147
coturn telnet docs
alexlapa Feb 11, 2020
2512b0b
doctest
alexlapa Feb 11, 2020
54e39d3
Add some docs
evdokimovs Feb 11, 2020
be00905
add timeouts to config
alexlapa Feb 11, 2020
92ced95
add timeouts to config
alexlapa Feb 11, 2020
9f9657e
Refactor validation of specs
evdokimovs Feb 11, 2020
938d922
add timeouts to config
alexlapa Feb 11, 2020
033b97a
add timeouts to config
alexlapa Feb 11, 2020
926b879
wip
alexlapa Feb 11, 2020
0692609
Merge branch 'master' into drop-coturn-sessions-via-telnet
alexlapa Feb 11, 2020
11a1a07
Merge branch 'master' into drop-coturn-sessions-via-telnet
alexlapa Feb 11, 2020
08afede
Add on_start on_stop to WebRtcPublishEndpoint
evdokimovs Feb 11, 2020
e09d1f4
fixes
alexlapa Feb 11, 2020
04aea39
fixes
alexlapa Feb 11, 2020
47aa64a
k8s integration
alexlapa Feb 11, 2020
5352204
Merge branch 'master' into on-start-on-stop
evdokimovs Feb 11, 2020
1e05b16
k8s
alexlapa Feb 12, 2020
0911d0e
k8s [run ci]
alexlapa Feb 12, 2020
1b7cd09
changelog
alexlapa Feb 12, 2020
68dfa1b
rename coturn-telnet to medea-coturn-telnet [run ci]
alexlapa Feb 12, 2020
c06d120
changelog
alexlapa Feb 12, 2020
17eefe7
quickfix [run ci]
alexlapa Feb 13, 2020
e9184d5
Add Coturn sessions parser
evdokimovs Feb 13, 2020
a8e6cf9
Merge branch 'drop-coturn-sessions-via-telnet' of github.com:instrume…
evdokimovs Feb 13, 2020
3ba4bef
Merge branch 'coturn-session-parser' into on-start-on-stop
evdokimovs Feb 13, 2020
cc82e4f
Add TrafficUsage
evdokimovs Feb 17, 2020
9e02153
examine
alexlapa Feb 20, 2020
889ab8f
Add basic on_start/on_stop support
evdokimovs Feb 21, 2020
e38e5b5
Refactor
evdokimovs Feb 21, 2020
5746686
implementing rtc stats parsing
alexlapa Feb 25, 2020
1d00ff6
implementing stats
alexlapa Feb 26, 2020
fb9f189
asd
alexlapa Feb 26, 2020
88aa4c3
on_stop with watchdog
evdokimovs Feb 27, 2020
d9942fa
Add on_start/on_stop events sending for the WebRtcPlayEndpoint
evdokimovs Feb 27, 2020
1d7e47a
Implement on_start/on_stop for WebRtcPublishEndpoint
evdokimovs Feb 27, 2020
923155d
Fmt, warns, lints, fix bug
evdokimovs Feb 28, 2020
4354a7b
Merge branch 'master' into gather-peer-connection-metrics
evdokimovs Mar 2, 2020
3139358
Add binding SysTrackId with TrackId
evdokimovs Mar 2, 2020
c21c80e
Add basic metrics
evdokimovs Mar 2, 2020
2a7c587
Print all stats as HashMap
evdokimovs Mar 3, 2020
bc96d24
Add all available stats
evdokimovs Mar 3, 2020
82e39fb
Add sending and receiving of stats update
evdokimovs Mar 3, 2020
822e861
Extend docs, and reduce Options count
evdokimovs Mar 4, 2020
52b6912
Add stats update caching
evdokimovs Mar 4, 2020
307cfdc
Remove unwraps, add sending of TrackIds, refactor
evdokimovs Mar 5, 2020
211bbd6
Docs for Jason, fix all warns
evdokimovs Mar 5, 2020
18ca197
Fix lints
evdokimovs Mar 5, 2020
e9ab659
Decrease stats update interval [run ci]
evdokimovs Mar 5, 2020
56e2332
Merge branch 'master' into gather-peer-connection-metrics
evdokimovs Mar 5, 2020
d9f4e67
Minor fixes
evdokimovs Mar 6, 2020
b29d892
Merge branch 'master' into on-start-on-stop
evdokimovs Mar 6, 2020
b0e8507
Merge branch 'gather-peer-connection-metrics' into on-start-on-stop
evdokimovs Mar 6, 2020
51de3d2
Add stats storing for Tracks
evdokimovs Mar 6, 2020
0931925
Make stats public
evdokimovs Mar 6, 2020
4805727
Merge branch 'gather-peer-connection-metrics' into on-start-on-stop
evdokimovs Mar 6, 2020
838768b
Add TrackId extraction for StatId
evdokimovs Mar 6, 2020
b84690a
Merge branch 'gather-peer-connection-metrics' into on-start-on-stop
evdokimovs Mar 6, 2020
5e45e02
Track stats updating
evdokimovs Mar 6, 2020
6d84ff8
Add Video/Audio stats into Medea
evdokimovs Mar 9, 2020
d27a414
Fix bug with many fn args in enum_delegate macro
evdokimovs Mar 10, 2020
76b997c
Add on_start based on client stats
evdokimovs Mar 10, 2020
fa3da3e
Fill all docs [run ci]
evdokimovs Mar 10, 2020
c27524a
Add additional docs to another crates [run ci]
evdokimovs Mar 10, 2020
6f46ade
Upd RFC and add CHANGELOG entries
evdokimovs Mar 11, 2020
9484dd5
Add test for getStats, fix disabled/unknown variant parsing [run ci]
evdokimovs Mar 11, 2020
0bb0bc3
Reread [run ci]
evdokimovs Mar 11, 2020
31e1818
Remove outdated TODO [run ci]
evdokimovs Mar 11, 2020
59d3625
Compact RtcStats logging [run ci]
evdokimovs Mar 11, 2020
9addd40
Remove unneeded code
evdokimovs Mar 11, 2020
b3b9515
Merge branch 'gather-peer-connection-metrics' into on-start-on-stop
evdokimovs Mar 11, 2020
4d9aa46
Add on_start based on client stats
evdokimovs Mar 11, 2020
eefa7bf
Add StatsValidator
evdokimovs Mar 12, 2020
b4c75ef
Add MetricService
evdokimovs Mar 13, 2020
6b547eb
Refactoring
evdokimovs Mar 13, 2020
ddc7763
Remove subscription mechanism from CoturnMetrics
evdokimovs Mar 13, 2020
943f8f1
Move client stats logic into another actor
evdokimovs Mar 13, 2020
c141538
Cleanup from outdated code
evdokimovs Mar 13, 2020
c217bf2
Fix all warns, fmt
evdokimovs Mar 16, 2020
9394739
add todos
alexlapa Mar 16, 2020
c00c02e
Fix most of TODOs
evdokimovs Mar 16, 2020
e9ddc66
Rename unused feature to unused-stats
evdokimovs Mar 16, 2020
dac9a0a
Update CHANGELOG
evdokimovs Mar 16, 2020
821d1a2
Minor fixes [run ci]
evdokimovs Mar 16, 2020
df4847b
Return Box [run ci]
evdokimovs Mar 16, 2020
43caff2
Fix Firefox version [run ci]
evdokimovs Mar 17, 2020
e1122b3
More sources
evdokimovs Mar 17, 2020
345e015
Merge branch 'gather-peer-connection-metrics' into on-start-on-stop
evdokimovs Mar 17, 2020
2a7abe5
Subscribe only on Peers which have on_start/on_stop
evdokimovs Mar 17, 2020
19540d9
Improve stop detection
evdokimovs Mar 17, 2020
dfd1cb2
Merge branch 'master' into gather-peer-connection-metrics
alexlapa Mar 17, 2020
237126a
merge
alexlapa Mar 17, 2020
f4f0eff
Fatal Peer errors handling
evdokimovs Mar 17, 2020
b4b86aa
Unsubs
evdokimovs Mar 17, 2020
8d22e79
Cleanup
evdokimovs Mar 17, 2020
3617f74
Add test, docs
evdokimovs Mar 17, 2020
4c6caf5
Fix lints
evdokimovs Mar 17, 2020
485a6ab
refactor
alexlapa Mar 18, 2020
ea2a29c
Refactor
evdokimovs Mar 18, 2020
f9e6f14
Refactor PeerMetricsService
evdokimovs Mar 18, 2020
dbc926f
add todos
alexlapa Mar 18, 2020
9f981f8
Add channel between Room and PeerMetricsService
evdokimovs Mar 18, 2020
d698770
Add docs
evdokimovs Mar 18, 2020
0aacf94
More correct on_stop callbacks sending
evdokimovs Mar 18, 2020
50eb24d
Remove some unwraps, refactor
evdokimovs Mar 18, 2020
30fa86e
Redis coturn stats auto reconnection
evdokimovs Mar 18, 2020
f6040a3
Fix formatting
evdokimovs Mar 18, 2020
aac41b4
Fix all TODOs and rewrite stats caching mechanism [run ci]
evdokimovs Mar 19, 2020
dd0bfe0
Fix tracks in test [run ci]
evdokimovs Mar 19, 2020
f7916f0
Some docs corrections and better errors [run ci]
evdokimovs Mar 19, 2020
2f15058
Merge branch 'gather-peer-connection-metrics' into on-start-on-stop
evdokimovs Mar 19, 2020
f37fecf
Add missing docs and do some refactoring
evdokimovs Mar 19, 2020
3788738
Add minor docs
evdokimovs Mar 20, 2020
8f167fe
Add coturn_metrics_service
evdokimovs Mar 20, 2020
7060611
New logic of Coturn users creation
evdokimovs Mar 20, 2020
0f42a29
Remove unwrap, improve CoturnMetrics Redis reconnection
evdokimovs Mar 20, 2020
c13475f
Fix some unwraps
evdokimovs Mar 20, 2020
ba274b6
Refactor
evdokimovs Mar 20, 2020
0a31cd7
Fix test
evdokimovs Mar 20, 2020
b853f5b
Clean outdated code
evdokimovs Mar 20, 2020
45072a6
Strange fix for the E2E tests o_O
evdokimovs Mar 20, 2020
17a407b
Remove unwraps
evdokimovs Mar 20, 2020
e1d2bb2
Fix [run ci]
evdokimovs Mar 23, 2020
77e8f10
Final reread [run ci]
evdokimovs Mar 23, 2020
95d3da0
Add CHANGELOG entry, fix unit test [run ci]
evdokimovs Mar 23, 2020
1227d35
redis-statdb in Coturn config [run ci]
evdokimovs Mar 23, 2020
33ae9e7
Fix three_pubs E2E test [run ci]
evdokimovs Mar 23, 2020
40ad117
deps
alexlapa Mar 23, 2020
ef9a613
refactor
alexlapa Mar 23, 2020
531cc93
Merge remote-tracking branch 'origin/coturn-stats-service' into cotur…
alexlapa Mar 24, 2020
be8c713
Add --redis-statsdb to the Helm chart [run ci]
evdokimovs Mar 24, 2020
d298932
Rollback Makefile [run ci]
evdokimovs Mar 24, 2020
9de2f50
refactor
alexlapa Mar 25, 2020
c682b20
Merge branch 'coturn-stats-service' into on-start-on-stop
evdokimovs Mar 25, 2020
3b3fa77
refactor
alexlapa Mar 25, 2020
487c000
cargo update
alexlapa Mar 25, 2020
e6975de
Merge branch 'master' into coturn-stats-service
alexlapa Mar 25, 2020
f651f3a
Remove session parsing functional from 'medea-coturn-telnet-client'
evdokimovs Mar 25, 2020
a5a0698
Fix unit tests
evdokimovs Mar 25, 2020
40e373a
Fix unit tests
evdokimovs Mar 25, 2020
503188d
Add docs
evdokimovs Mar 25, 2020
68bd4ad
Merge branch 'coturn-stats-service' into on-start-on-stop
evdokimovs Mar 25, 2020
5524650
Refactor
evdokimovs Mar 25, 2020
f5875bd
Fix Coturn users removing
evdokimovs Mar 25, 2020
6c32f93
Allow on_start/on_stop for not relayed endpoints
evdokimovs Mar 25, 2020
1cf6bc2
Fix lints [run ci]
evdokimovs Mar 26, 2020
7d4f291
Refactor [run ci]
evdokimovs Mar 26, 2020
98c3f35
refactor [run ci]
alexlapa Mar 27, 2020
b309b14
refactor [run ci]
alexlapa Mar 27, 2020
ecfb1fc
refactor [run ci]
alexlapa Mar 27, 2020
1ef26a6
Merge branch 'coturn-stats-service' into on-start-on-stop
evdokimovs Mar 30, 2020
06ae899
Merge branch 'master' into on-start-on-stop
evdokimovs Mar 30, 2020
0ccff00
Fix lints, fmt
evdokimovs Mar 30, 2020
848ce4f
Refactor [run ci]
evdokimovs Mar 30, 2020
774b12b
Remove spec validation [run ci]
evdokimovs Mar 30, 2020
c24df5e
Reread [run ci]
evdokimovs Mar 30, 2020
2b90ef4
Fix bug with on_stop on PeerSpec contradiction
evdokimovs Mar 31, 2020
a0ef4a1
Upd [run ci]
evdokimovs Mar 31, 2020
4116a7c
Final reread [run ci]
evdokimovs Mar 31, 2020
24d9433
Meh, fix Peers removing [run ci]
evdokimovs Mar 31, 2020
4cbddbc
Fix lint [run ci]
evdokimovs Mar 31, 2020
c8e557f
Minor docs [run ci]
evdokimovs Mar 31, 2020
87c48aa
Add on_start/on_stop to the 'medea-control-api-mock' and 'e2e-demo' […
evdokimovs Mar 31, 2020
94fec94
Merge branch 'master' into on-start-on-stop
alexlapa Apr 7, 2020
2bf226e
merge [run ci]
alexlapa Apr 7, 2020
c183f4e
Add on_start/on_stop callbacks
evdokimovs Apr 9, 2020
5c3ea67
Add docs
evdokimovs Apr 9, 2020
97426bc
Merge branch 'on-start-on-stop' of github.com:instrumentisto/medea in…
evdokimovs Apr 9, 2020
89148a5
Fix merge [run ci]
evdokimovs Apr 9, 2020
d80fc3c
Increase delays for CI [run ci]
evdokimovs Apr 9, 2020
4f25be9
Increase delays more for CI [run ci]
evdokimovs Apr 9, 2020
3f8912c
refactor [run ci]
alexlapa Apr 10, 2020
636d741
Remove peers_endpoints from PeerRepository [run ci]
evdokimovs Apr 13, 2020
9d483ff
Fix lints [run ci]
evdokimovs Apr 13, 2020
d6a1ca9
Remove some redudant code [run ci]
evdokimovs Apr 13, 2020
f7451f4
use google.protobuf.StringValue for callbacks
alexlapa Apr 10, 2020
804e691
Send more accurate timestamps in callbacks [run ci]
evdokimovs Apr 13, 2020
4a473ba
Fix lint [run ci]
evdokimovs Apr 13, 2020
8d69953
refactor, add todos
alexlapa Apr 15, 2020
e117596
Fix peer spec contradiction
evdokimovs Apr 15, 2020
d69aa14
Add timeouts configuration
evdokimovs Apr 15, 2020
e6f805f
Remove redundant TrafficStoppedSources
evdokimovs Apr 15, 2020
eb993dc
Fix unit tests
evdokimovs Apr 15, 2020
559b71c
Add flow metrics source checking in the PeersTrafficWatcher
evdokimovs Apr 15, 2020
768964d
Minor refactor, fix lints
evdokimovs Apr 15, 2020
38ede12
Refactor
evdokimovs Apr 16, 2020
a5843e8
Speedup E2E tests
evdokimovs Apr 16, 2020
e16cee1
Config test and docs [run ci]
evdokimovs Apr 16, 2020
b525ff7
Minor fixes [run ci]
evdokimovs Apr 16, 2020
80e68eb
Fix invalid on_stops on element delete, fix infinite stop sending fro…
evdokimovs Apr 16, 2020
46dc8b7
minor refactor
alexlapa Apr 17, 2020
f01846d
New on_start/on_stop semantic
evdokimovs Apr 20, 2020
788e468
Update docs [run ci]
evdokimovs Apr 20, 2020
ea8e688
Add many on_stops sending protection [run ci]
evdokimovs Apr 21, 2020
038f653
Revert "Add many on_stops sending protection [run ci]"
evdokimovs Apr 21, 2020
d0e4136
Add many on_stops sending protection [run ci]
evdokimovs Apr 21, 2020
115cfaa
Fix imports [run ci]
evdokimovs Apr 21, 2020
7bef57b
Meh, forgot PeerStarted sending after stop [run ci]
evdokimovs Apr 21, 2020
b252853
Add metainformation for the on_start/on_stop
evdokimovs Apr 22, 2020
e6ca879
Send on_start/on_stop on mute
evdokimovs Apr 23, 2020
1af2206
Refactor, add some tests, add WrongTrafficFlowing on_stop reason
evdokimovs Apr 23, 2020
d8dfa7d
Add registering and unregistering of Peers on mute
evdokimovs Apr 23, 2020
b737a1f
Correct implementation of the on_start/on_stop on mute/unmute
evdokimovs Apr 24, 2020
b353f0e
Refactor, improve logging
evdokimovs Apr 27, 2020
a895db4
Rename EndpointKind to MediaType and EndpointDirection to MediaDirection
evdokimovs Apr 27, 2020
a6d8582
Add new callback to the medea-control-api-mock and improve e2e-demo c…
evdokimovs Apr 27, 2020
a3e8d44
Don't remove Peers on FatalPeerFailure
evdokimovs Apr 27, 2020
09f4cc9
Use 'at' in PeerStopped
evdokimovs Apr 27, 2020
8ab440b
Reread [run ci]
evdokimovs Apr 27, 2020
13c03e1
Fix lints [run ci]
evdokimovs Apr 27, 2020
5e56d63
Reread [run ci]
evdokimovs Apr 27, 2020
a8b4764
Send media type in the TrafficNotFlowing from PeerMetricsService [run…
evdokimovs May 4, 2020
19b0446
Merge branch 'master' into on-start-on-stop
evdokimovs May 13, 2020
8359165
Fix on_start/on_stop after merge
evdokimovs May 13, 2020
408b659
Add missed docs, refactor MediaTrafficState
evdokimovs May 19, 2020
26881ef
Fix on_stop reason for the Control API Delete [run ci]
evdokimovs May 19, 2020
154c8ad
asd
alexlapa May 28, 2020
e0788f6
Merge branch 'master' into on-start-on-stop
alexlapa May 28, 2020
a89b43d
refactor
alexlapa May 29, 2020
78f2065
Merge branch 'master' into on-start-on-stop
alexlapa May 29, 2020
b77e7cb
fix merge
alexlapa May 29, 2020
d5c2f02
Merge branch 'master' into on-start-on-stop
alexlapa May 29, 2020
bd9bdeb
refactor
alexlapa Jun 1, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add basic on_start/on_stop support
  • Loading branch information
evdokimovs committed Feb 21, 2020
commit 889ab8f3e0aa16d5323b4fe2776b9ae10e3576cb
23 changes: 21 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -46,6 +46,7 @@ medea-control-api-proto = { path = "proto/control-api" }
medea-macro = { path = "crates/medea-macro" }
rand = "0.7"
redis = "0.15"
patched_redis = { path = "../redis-rs", package = "redis" }
rust-crypto = "0.2"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
34 changes: 34 additions & 0 deletions _dev/specs/fully-not-relayed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
kind: Room
id: fully-not-relayed
spec:
pipeline:
member-2:
kind: Member
credentials: test
on_join: "grpc://127.0.0.1:9099"
on_leave: "grpc://127.0.0.1:9099"
spec:
pipeline:
publish:
kind: WebRtcPublishEndpoint
spec:
p2p: Always
play-responder:
kind: WebRtcPlayEndpoint
spec:
src: "local://fully-not-relayed/member-1/publish"
member-1:
kind: Member
credentials: test
on_join: "grpc://127.0.0.1:9099"
on_leave: "grpc://127.0.0.1:9099"
spec:
pipeline:
publish:
kind: WebRtcPublishEndpoint
spec:
p2p: Always
play-caller:
kind: WebRtcPlayEndpoint
spec:
src: "local://fully-not-relayed/member-2/publish"
38 changes: 38 additions & 0 deletions _dev/specs/fully-relayed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
kind: Room
id: fully-relayed
spec:
pipeline:
member-2:
kind: Member
credentials: test
on_join: "grpc://127.0.0.1:9099"
on_leave: "grpc://127.0.0.1:9099"
spec:
pipeline:
publish:
kind: WebRtcPublishEndpoint
spec:
p2p: Always
force_relay: true
play-responder:
kind: WebRtcPlayEndpoint
spec:
src: "local://fully-not-relayed/member-1/publish"
force_relay: true
member-1:
kind: Member
credentials: test
on_join: "grpc://127.0.0.1:9099"
on_leave: "grpc://127.0.0.1:9099"
spec:
pipeline:
publish:
kind: WebRtcPublishEndpoint
spec:
p2p: Always
force_relay: true
play-caller:
kind: WebRtcPlayEndpoint
spec:
src: "local://fully-not-relayed/member-2/publish"
force_relay: true
36 changes: 36 additions & 0 deletions _dev/specs/relayed-not-relayed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
kind: Room
id: relayed-not-relayed
spec:
pipeline:
relayed-member:
kind: Member
credentials: test
on_join: "grpc://127.0.0.1:9099"
on_leave: "grpc://127.0.0.1:9099"
spec:
pipeline:
publish:
kind: WebRtcPublishEndpoint
spec:
p2p: Always
force_relay: true
play-responder:
kind: WebRtcPlayEndpoint
spec:
src: "local://relayed-not-relayed/not-relayed-member/publish"
force_relay: true
not-relayed-member:
kind: Member
credentials: test
on_join: "grpc://127.0.0.1:9099"
on_leave: "grpc://127.0.0.1:9099"
spec:
pipeline:
publish:
kind: WebRtcPublishEndpoint
spec:
p2p: Always
play-caller:
kind: WebRtcPlayEndpoint
spec:
src: "local://relayed-not-relayed/relayed-member/publish"
9 changes: 9 additions & 0 deletions crates/medea-coturn-telnet/src/sessions_parser.rs
Original file line number Diff line number Diff line change
@@ -31,6 +31,15 @@ impl TryFrom<&str> for Protocol {
}
}

impl fmt::Display for Protocol {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Protocol::Udp => write!(f, "UDP"),
Protocol::Tcp => write!(f, "TCP"),
}
}
}

const TURN_SESSION_ID_FACTOR: u64 = 1000000000000000;

#[derive(Clone, Copy, Debug)]
12 changes: 10 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -21,8 +21,9 @@ use crate::{
clients::CallbackClientFactoryImpl, service::CallbackService,
},
conf::Conf,
turn::TurnAuthService,
turn::{coturn_stats::CoturnStats, TurnAuthService},
};
use actix::Addr;

/// Global application context.
#[derive(Clone, Debug)]
@@ -39,16 +40,23 @@ pub struct AppContext {
///
/// [`CallbackEvent`]: crate::api::control::callbacks::CallbackEvent
pub callbacks: CallbackService<CallbackClientFactoryImpl>,

pub coturn_stats: Addr<CoturnStats>,
}

impl AppContext {
/// Creates new [`AppContext`].
#[inline]
pub fn new(config: Conf, turn: Arc<dyn TurnAuthService>) -> Self {
pub fn new(
config: Conf,
turn: Arc<dyn TurnAuthService>,
coturn_stats: Addr<CoturnStats>,
) -> Self {
Self {
config: Arc::new(config),
turn_service: turn,
callbacks: CallbackService::default(),
coturn_stats,
}
}
}
16 changes: 12 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -12,7 +12,8 @@ use medea::{
shutdown::{self, GracefulShutdown},
signalling::{room_repo::RoomRepository, room_service::RoomService},
turn::{
coturn_stats::{new_coturn_stats_watcher, CoturnStatsWatcher},
cli::CoturnTelnetClient,
coturn_stats::{run_coturn_stats_watcher, CoturnStats},
new_turn_auth_service,
},
AppContext,
@@ -36,11 +37,18 @@ fn main() -> Result<(), Error> {
Arbiter::spawn(
async move {
let turn_service = new_turn_auth_service(&config.turn)?;
let coturn_stats_watcher =
new_coturn_stats_watcher(&config.turn).unwrap().start();
let graceful_shutdown =
GracefulShutdown::new(config.shutdown.timeout).start();
let app_context = AppContext::new(config.clone(), turn_service);
let coturn_client = CoturnTelnetClient::new(
(config.turn.cli.ip.to_string(), config.turn.cli.port),
config.turn.cli.pass.clone(),
config.turn.cli.pool.into(),
);
let coturn_stats = CoturnStats::new(&config.turn, coturn_client)
.unwrap()
.start();
let app_context =
AppContext::new(config.clone(), turn_service, coturn_stats);

let room_repo = RoomRepository::new(HashMap::new());
let room_service = RoomService::new(
41 changes: 39 additions & 2 deletions src/signalling/room.rs
Original file line number Diff line number Diff line change
@@ -6,8 +6,8 @@
use std::collections::{HashMap, HashSet};

use actix::{
Actor, ActorFuture, Addr, Context, ContextFutureSpawner as _, Handler,
Message, WrapFuture as _, WrapFuture,
Actor, ActorFuture, Addr, AsyncContext, Context, ContextFutureSpawner as _,
Handler, Message, WrapFuture as _, WrapFuture,
};
use derive_more::Display;
use failure::Fail;
@@ -55,6 +55,7 @@ use crate::{
participants::{ParticipantService, ParticipantServiceErr},
peers::PeerRepository,
},
turn::coturn_stats::{CoturnStats, EventType, Subscribe},
utils::ResponseActAnyFuture,
AppContext,
};
@@ -175,6 +176,8 @@ pub struct Room {

/// Current state of this [`Room`].
state: State,

coturn_stats: Addr<CoturnStats>,
}

impl Room {
@@ -197,6 +200,7 @@ impl Room {
members: ParticipantService::new(room_spec, context)?,
state: State::Started,
callbacks: context.callbacks.clone(),
coturn_stats: context.coturn_stats.clone(),
})
}

@@ -344,6 +348,20 @@ impl Room {
first_peer: PeerId,
second_peer: PeerId,
) {
self.coturn_stats.do_send(Subscribe {
peer_id: first_peer,
partner_peer_id: second_peer,
room_id: self.id.clone(),
addr: ctx.address(),
events_type: HashSet::new(),
});
self.coturn_stats.do_send(Subscribe {
peer_id: second_peer,
partner_peer_id: first_peer,
room_id: self.id.clone(),
addr: ctx.address(),
events_type: HashSet::new(),
});
match self.send_peer_created(first_peer, second_peer) {
Ok(res) => Box::new(res.then(|res, this, ctx| -> ActFuture<()> {
if res.is_ok() {
@@ -1307,3 +1325,22 @@ impl Handler<CreateEndpoint> for Room {
Ok(())
}
}

#[derive(Message, Debug)]
#[rtype(result = "()")]
pub struct OnStartOnStopCallback {
pub event: EventType,
pub peer_id: PeerId,
}

impl Handler<OnStartOnStopCallback> for Room {
type Result = ();

fn handle(
&mut self,
msg: OnStartOnStopCallback,
ctx: &mut Self::Context,
) -> Self::Result {
debug!("LOOK AT ME: {:?}", msg);
}
}
10 changes: 10 additions & 0 deletions src/turn/cli.rs
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@ use failure::Fail;
use medea_coturn_telnet::{CoturnTelnetError, Manager, Pool, PoolError};

use crate::media::IceUser;
use medea_coturn_telnet::sessions_parser::Session;

#[derive(Display, Debug, Fail, From)]
pub enum CoturnCliError {
@@ -50,6 +51,15 @@ impl CoturnTelnetClient {

Ok(())
}

pub async fn get_sessions(
&self,
username: String,
) -> Result<Vec<Session>, CoturnCliError> {
let mut connection = self.0.get().await?;

Ok(connection.print_sessions(username).await?)
}
}

impl fmt::Debug for CoturnTelnetClient {
Loading