609 Commits

Author SHA1 Message Date
16ddb8b134 conversationrepository: do not validateDevice on leave
Because we remove the certificate, there is nothing to verify.
Also fix tests broken with new validation.

Change-Id: I8003e5d1b8cd61cfc9d944b57725081667485c00
2023-04-20 15:24:46 -04:00
cf78a2ba4d drt: fix ut
- mobile shutdown: added time / block for callback
- check existing connection before removing node from rt
- threadpool instead of lock for shutdown

Change-Id: I79fc9506cd465763cd38723aedd08a59a0573970
2023-04-20 15:23:25 -04:00
b3d8577db4 DRT: integrate DRT components to conversation
This patches avoid swarm members to connect to all devices of the
conversation by using a better routing mechanism.
The idea is to add a component called "DRT" that will store, like
a DHT, a routing table containing the known devices of the conversation.
The DRT is bootstraped with the list of the devices that already wrote
a message in the conversation, else with some other members that have
devices present (because lot of devices may never have written any message).
Moreover, because a user can import an old backup without the conversation
and without other devices present, we also try to connect to 2 other random
members because they may never connect if they are on an old back-up.

Once bootstraped, the DRT is used to decide to who a user should be
connected. And it will use approximately log(N) connections (instead
of N like before). So, when sending a message, a user will send to
connected peers (and some mobiles). Then, some peers in the conversation
will get the message, pull it, then announce to their nearest peers (and
some mobiles) until all peers got the new message. To avoid infinite loop,
we check if we already got the commit and if we have something to announce.

Finally, if somebody disconnect, this will cause the DRT to try to re-fill
its bucket and try to connect to a new device.

GitLab: #297
Change-Id: I137788c77219fe74287585882260547cc5628784
2023-04-13 09:16:19 -04:00
f2288e0cc3 DRT: implement Distributed Routing Table
This patch adds the minimal code for the DRT. This component
should avoid the fact that every peer in a swarm must connects
to every other peer.

The idea is to get a similar algorithm we use in OpenDHT, meaning
to store known devices in buckets and try to dynamically connect
to some of the peers, creating a routing table, so every peer
in a conversation should connect to a subset of peers.

The big difference is that we must includes mobile devices (for
OpenDHT push/baterry optimizations can be taken into accounts).
For this, we consider a special type of node in the DRT that is
considered as reachable but not connected and stored in the mobile
nodes. A mobile announces itself as a mobile after bootstraping
via a message in the swarm channel. In this case, if they disconnect
the node is moved to a special state (mobile node) instead (known nodes).

A user can know to which devices they can send messages via Routing
Table's mobile nodes and connected nodes.

Docs: TODO add link
GitLab: #297
Change-Id: Ic061c58ca487698afee712cb2eef5e57f9c208fb
2023-04-13 09:16:19 -04:00
c6cd037b68 conversation_module: add "created" to syncing
So that clients can show whenever a syncing conversation was added

Change-Id: Iccee12066384e0ccc78e3a96b8e5137b79bfa314
2023-03-22 13:44:18 -04:00
52d54291ad recorder: unbind add/remove streams from the toggle
GitLab: #762
GitLab: #446
Change-Id: I6efbd78314c07f772935ead083db8e9ae119d834
2023-03-16 13:20:19 -04:00
fc975f0cac contrib: ffmpeg 6.0
Change-Id: Ib5ff688d4ad6127e97d15ddcdd28368a3eb5d5cc
2023-03-14 15:49:31 -04:00
75e4a5d365 test: fix ut_conversation_call on CI
There is no camera

Change-Id: I1260c06cefc7d86c60ef3b24235c2be6f2aa0b48
2023-03-02 16:18:36 -05:00
f119ea1416 conversation: synchronize read status across device
On the same model as conversation's preferences

GitLab: #815
Change-Id: I15461d40c5d9e83e39ef5f83b6b663d9427615f8
2023-02-20 13:25:28 -05:00
565ff0f025 conversation: sync preferences right after clone
Add preferences to original sync information sent and use it after
a clone.

GitLab: #814
Change-Id: I742ba8ff3ddf56d1f73658fffa0675ce481981e0
2023-02-20 09:01:20 -05:00
cbca28f59b swarm-call: fix start call in audio only
Use the negotiated medias to start conference in a correct state
(e.g. if calling a swarm in audio-only we should only see
one audio only participant). The previous code was incorrectly
starting the conference and adding an extra partipant when
attaching the call.

Note: lot of code in conference is also currently re-factored for
homogeneizing 1:1 and video conferences. So I prefered to avoid
to change a lot of things there.

A test is also added to check that video or audio is correctly
attached in the participants information.

Change-Id: I074cc4eb41b21418a6d751e3395db93e8a4da7f5
GitLab: #803
2023-02-06 15:34:23 -05:00
4166137736 misc: Update copyright years to 2023
Change-Id: Ia80fc12ba65b1abd516af205e6664261ae2e33fe
2023-02-06 01:46:45 -05:00
c6f9250758 meson: update tests
Change-Id: I0a72cd58d0c3822ecb99366f2e96c10eb81d7900
2023-02-04 00:34:16 +03:00
dccbae2199 fileutils: check hard links count before erasing content
This avoid to erase the content of a file if it's an hard link,
which was the case for file transfers.

Change-Id: I5ee2ace650de0ef12953e5643f014e62e2d3c04d
2023-02-01 15:58:38 -05:00
d2e7d36505 conversation: getConversationMembers should return banned members
If a member is banned from a conversation, only administrators can
re-add this member. So, clients should not show them in the list
for non admin users.
Moreover, clients should be able to show banned members in a list.

Change-Id: I0b0a80f1e2a3ed15339cd749e66dfa3e469f403c
2023-01-23 10:20:53 -05:00
ddb36d0fe9 conversation: do not add conversation request if accepted
Change-Id: I7fb785243b6684ab9a02f9364e65b118a88c120d
2023-01-18 12:55:31 -05:00
c1533c9e0a test: remove ut_compability
As any conversation shown in clients are swarm nowadays

Change-Id: Icd00fc7bd69033eecc36d88d0d0c668ac4cdb7fd
2023-01-18 12:15:23 -05:00
eb9c52cee4 test: remove testSmartools (as deprecated)
Change-Id: Ia46604d00ab749d76ccc0d795a3024f6838b7a1b
2023-01-10 09:37:43 -05:00
33e6ac4348 conversationrepository remove "<>" from display name
This should not appears in user.name as it will fail during
the signature creation.

Change-Id: I8bc04b9fdd60cb6c80fc267d064433ab331f6338
2023-01-05 10:36:43 -05:00
2b25a2b271 tests: fix bad condition for canSendBeacon
Change-Id: Iee8f14efab208e18eba1ab631a5f22e0ce0f34ad
2023-01-03 14:51:05 -05:00
a71875f725 misc: fix testCanSendBeacon
Change-Id: I50e6dbaa70957245ecc13e46d64704bdf5052c1d
2022-12-30 11:29:36 -05:00
11c47a9882 filetransfer: fix profile transmission across device
ut_syncHistory was broken since "filetransfer: massive cleanup"
due to this (An account without conversation MUST sync it's profile).
So use an empty conversation to use nonSwarmTransferManager_

Change-Id: I6d6f27875129730ebaac60ba40652fd1795311cd
2022-12-30 09:18:04 -05:00
ac44384e9a account_config: re-add setAccountDeviceName
Regression introduced with config changes, it was not possible
to rename a device.
Also, call knownDevicesChanged() because clients should update
their list if a name changes

https://git.jami.net/savoirfairelinux/jami-client-qt/-/issues/916

Change-Id: I723a509d45149bd6b38e4250e7668cb918eba583
2022-12-29 17:53:35 -05:00
43c260423a misc: fix some raceCondition in tests
Wait for call is current before stopping it

Change-Id: I3286f8564a209aec5fd1130a11648552b37057b9
2022-12-29 13:30:55 -05:00
6b4d00f39e unitTest fix: conversationRequest
- Added loop for testMalformedTrustRequest

Change-Id: Ia65980f52c68d8c5b1a2e78a9443103b74a7b3dd
2022-12-28 15:00:52 -05:00
8ef3f94400 data_transfer: do not restart download from zero if possible
The protocol already supports start/end but it was never used.
This patch:
+ Open the incoming file in append mode (else it will restart)
+ Pass start=detectedOffset to the peer to restart the download
where we need.
+ Only remove the file if the file is EOF or cancelled by the
user to avoid to restart from 0.

GitLab: #788
Change-Id: I8eee635a076e668af226fd9ad7ba372f6adae3f6
2022-12-23 09:31:58 -05:00
a118ddfa51 syncHistory: fix testProfileReceivedMultiDevice
The directory was not created in /tmp causing the test to fail
(std::rename fails).

Change-Id: Ic583447ec4d8bc7df9c63744cba9d6c096ee9792
2022-12-21 10:21:37 -05:00
f0adf132cf swarm: link declineConversationRequest to discardTrustRequest
Also, fix previous illformed files if declineConversationRequest
was called before this patch, some incomingTrustRequests exists
without conversation request linked.

Change-Id: Id34a6f0cfcc9df1a39ffb055b7d62975266e2399
2022-12-20 10:50:17 -05:00
997583a259 recorder: add test for single person rdv
GitLab: #691
Change-Id: Ic6f019c5230cdf13e5a0aec97eaec508c8908980
2022-12-15 12:36:17 -05:00
172d685b9e account details: add test to check deviceId presence
Change-Id: I971bd0821b358085c6d664b22818e54a24db5d2a
2022-12-15 09:24:55 -03:00
6de2b1e1df turn: improve connectivity with unreachable TURN
Initializing a ICE session will need to gather candidates. The TURN
can be long to retrieve, and fails can be really long to detect.
There is at least 3 cases of failures:

+ IPv6 badly configured, which can cause a DNS resolution timeout
of several minutes (that's why the IP was cached)
+ Empty DNS entries, causing a resolution failure
+ A TURN server un-reachable or wrongly configured (e.g. 1.1.1.1)

The idea here is to resolve the TURN and test the connection before
caching it. And use it when cached.
This avoid all resolutions steps and we're basically sure that
it was working.

Other approaches:
+ Add a new callback in pjsip to detect that the TURN is taking too long
to remove it for next calls, but I prefer to not add another patch in
pj and it's not an ideal solution
+ trickle ICE to not wait for all candidates, but this is a big changes
and will generate more DHT messages
+ Do not retransmit messages, but this is against the RFC

Change-Id: I2bbc8d9ae76a9e3124c71343df02e2ed077b938d
GitLab: #781
2022-12-07 16:22:11 -05:00
d1fac179af connectionmanager: replace wait_for by async task
Change-Id: Ic5597f0713b9abbc6cfa903f13f9811b9a6f03b4
2022-12-01 13:46:01 -05:00
b2937e7a60 misc: ensure directory exists before storing vcard
This fixes testProfileReceivedMultiDevice

Change-Id: I9fadebe2f353cdacd5a06fd860195ba7a50813dd
2022-11-29 15:28:43 -05:00
90c7ee52c1 ut: adding media player unit tests
Change-Id: Ic8c46108f8cb25a148f1d90a9537602653e432c5
2022-11-24 15:31:57 -05:00
e037e6358c conversation: add case sensitive flag on searchConversation
This allow the search request to be case insensitive by default

Change-Id: I97d0e9c01a2ca311faba7136cfda460ce7ad9957
2022-11-21 10:18:13 -05:00
fa03e232b7 swarm: add reaction support
This is a pretty trivial patch as all the necessary logics are
already supported by the deamon.
A client can use sendMessage with flag = 2 to add a reaction.
This only adds a "react-to" in the body of the message that the
client can interpret.
To remove a reaction, the client can use editMessage (and set the
body to "" for the id of the reaction), also there is no limit
on the content of the reaction and multiple reactions can be added
to the same message.
For non compatible clients, it will be shown as a simple text message
as it's the same type.

Change-Id: I7b13d32771109118b94ed17d0b918e66487e94bb
2022-11-21 10:17:57 -05:00
6855453033 Revert "turn: improve connectivity with unreachable TURN"
Reason for revert: crash

Change-Id: Ibc97ff3edeb40a1bf49df38be35de268da10399b
2022-11-18 19:39:22 -05:00
64ffbffcb5 turn: improve connectivity with unreachable TURN
Initializing a ICE session will need to gather candidates. The TURN
can be long to retrieve, and fails can be really long to detect.
There is at least 3 cases of failures:

+ IPv6 badly configured, which can cause a DNS resolution timeout
of several minutes (that's why the IP was cached)
+ Empty DNS entries, causing a resolution failure
+ A TURN server un-reachable or wrongly configured (e.g. 1.1.1.1)

The idea here is to resolve the TURN and test the connection before
caching it. And use it when cached.
This avoid all resolutions steps and we're basically sure that
it was working.

Other approaches:
+ Add a new callback in pjsip to detect that the TURN is taking too long
to remove it for next calls, but I prefer to not add another patch in
pj and it's not an ideal solution
+ trickle ICE to not wait for all candidates, but this is a big changes
and will generate more DHT messages
+ Do not retransmit messages, but this is against the RFC

Change-Id: Iaec4308bca8cbbbfa4d6b1b6d7a7759b8062a67a
GitLab: #781
2022-11-18 17:12:33 -05:00
87c5f3cef8 misc: fix ut_conversation_call
Change-Id: I6dc0b22f4336dde4db1d6a869e4447ad51d809ff
2022-11-18 15:27:03 -05:00
5b56cc7e42 fileTransfer: massive cleanup
The new logic is there! Swarm is working since some time now, so we can
remove previous logic.

GitLab: #524
Change-Id: I5ca172e9349694d944c9561d97fe8a63d190ebf3
2022-11-18 15:22:23 -05:00
08ef8dd80d swarm: follow user preference for hosting conferences
This avoid mobile phone to host conferences for others unless
explicitly authorized by the user.
Clients can show it via the "hostConference" conversation's preference.

Documentation: https://docs.jami.net/technical/swarm.html#call-in-swarm
GitLab: #312
Change-Id: I9bbd3e394cd1b3bcfd4a3120d9023a5ed686303d
2022-11-17 11:25:10 -05:00
8960936221 swarm: add call support
This patch introduces the ability to start calls and extends the
usage of rendezvous points to swarm with multiple participants.

When starting a call in a swarm with multiple participats, one device
will work as the host of the conference, and the caller will
immediately start the call alone.
Other peers will receive a commit and a notification to be able
to join the active call. To join a call, users needs to call
rdv:uri/device/convId/confId to be added (if authorized) to the conf.

There are some majors differences in the process.
First, every conversation will be able to decide a default host
for conferences. This still needs some design and will be
introduced in another patch. For now, the caller is the host.
Then, because all members of the call may not be interested to join
a call, or they may want to get several calls at the same time, the
system must be able to manage more than one active calls (e.g. a
company with multiple projects can do several standups at the same
time).
Finally, in the conversation, two commits will be generated to be
able to know what active calls are available. The first is
announcing that a conference started, the second announces that
the conference stopped (the host closed the call).
However, this introduces a difficulty. The host may crash and not
commit the end of the call in time. In this case, hostedCalls are
stored in a file and the conversation is updated during the init
of the daemon.

Change-Id: I081a4920edb3773bbed884ae50f34e476ad42094
Documentation: https://docs.jami.net/technical/swarm.html#call-in-swarm
GitLab: #312
2022-11-17 08:10:17 -05:00
1360c775e9 config: use AccountConfig for all Account classes
Change-Id: Ia7dc5c12c91c0b9ea07c41b2de3ac58df7d1239f
2022-11-16 13:58:00 -05:00
ac7ce59c42 connectivity: initial split from jami-related components
As a measure of refactorization of the code and to prepare to the
development of dhtnet, the following changes aims at seperating
jami-specific code to connectivity-specific code.

GitLab: #778
Change-Id: Iaa08100f7d61c80292f039a5aae66819cc85b0e9
2022-11-04 11:00:17 -04:00
412c301f98 call: add media transport information
https://git.jami.net/savoirfairelinux/jami-client-qt/-/issues/510#510

Change-Id: Ie09ebd95ba161559c5c08b7e0618d6e87ecca1ee
2022-11-02 09:30:59 -04:00
fe058538fb conversation: do not show error for non critical errors
If an error occurs during the execution of git_remote_fetch, there
is no need to signal any error to the client as it's not a critical
issue (no malformed conversation, mode is recognized, no unauthorized
method) and the sync will be retried later.

Change-Id: I2d875445e51aa6cd78eb2e7dbfe5efb8b2831860
2022-10-31 12:18:16 -04:00
d54a84ec0b Replace DRing for libjami
It's not possible to replace the DRing namespace for jami because of conflicts
with namespaces and classes defined under the jami namespace.  Thus, use libjami
as the namespace.

Script to reproduce:

 rg -l DRing | sort | uniq | awk '$0 !~ /NEWS/' | xargs sed -i -e 's|DRing|libjami|g'
 rg -l DRING_ | sort | uniq | xargs sed -i -e 's|DRING_|LIBJAMI_|g'
 sed -i -e 's|dring|jami|g' src/jami/CMakeLists.txt
 sed -i -e 's|dring|jami|g' src/jami/def.h

Change-Id: I80e8c8b58a7586527a016bbef850bab07869c473
2022-10-29 16:49:27 -04:00
db3e62e415 conversation: fix logUntil
logUntil should retrieve the commits with the commit passed.
Add a LogOptions parameter to avoid too much parameters.

Change-Id: I77a0150b135b14fe44577747d2b1a86cb2cf2509
2022-10-27 15:52:26 -04:00
f854663614 tests/sip/Makefile: Tests have to be compiled against static version
Change-Id: I995b422ca3d078b02cf560056edeeacc35628a70
2022-10-26 11:22:00 -04:00
81da3f7678 conference: fix sinks creation test
The sinks only should be created when there is a video device
available. If no video device is available, no sinks should be
created.

Change-Id: Iec35288bf9966eb664470b2f8c1e5738f6909893
2022-10-25 08:55:42 -03:00