Commit Graph

353 Commits

Author SHA1 Message Date
37d1d9a5e3 connectionmanager: erase info on connection failure
In some cases, the infos were not correctly refreshed, causing some
pending callbacks to never be called.
Also, split getInfo() in two methods to improve readability.

Change-Id: I1b60f2cf2ac5bf97c9a44a53794b56906d314e6a
GitLab: #TODO
2022-06-15 15:29:29 -04:00
cbbf93ad27 swarm: fix merge commit's validation after migration
Merge's commits were'nt checked, while comitting and while pulling.
This means that the author could be incorrect. Add a check before
doing a merge commit and when validating it.
This avoid incorrect repository in case a merge commit is generated
after a migration.

Misc: fix incorrect test

GitLab: #738

Change-Id: Id9748eb7d3dd5db023dd2ab4a30261c31af5d514
2022-06-14 10:59:36 -04:00
a6e0119ce7 conference: remove dummy participant if audio only
With video split we don't need dummy rtp session.

GitLab: #729
Change-Id: Ibf6bb303d1860a80549f6cfb2a06e36e51f48b70
2022-04-07 08:30:37 -04:00
b499034ba4 swarm: improve vote system and supports unban
This patch fixes several behaviours:

+ Banning a member now stores the previous state of the member
+ This allow to store empty .crt files for invited
+ Unbanning a member is now possible for an admin
+ This re-add the member in its previous state

https://git.jami.net/savoirfairelinux/jami-product-backlog/-/issues/51
Change-Id: I34d5913c023043e07544f1b8bb6211aea5db0065
2022-03-23 12:30:14 -04:00
ab3e52316c conversation_module: return swarm's profile to the client for requests
Conversation's requests also have metadata attached which clients
must be able to access.

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

Change-Id: If02fffb5646074e993c090846ff998e83ab79d78
2022-03-21 14:18:34 -04:00
775aa2f803 Build system: No '--disable-shared'
The agent and unit tests can now be compiled without requiring
`--disable-shared' at configuration time.

The agent requires the logger functions to have default visibility instead of
hidden.  Thus, `jami::logger::[v]log' can be considered part of the public API.

The unit tests however require hidden symbols.  Thus, we link the tests against
a static version of libjami instead.

Change-Id: I59d9e67679766e0310a19f9a879c06a31c5124c4
2022-03-03 17:10:21 -05:00
c3d0e5ebee Mute audio: do not change media direction
Mute/un-mute audio is done only locally, i.e. without requesting
a media change (re-invite) as done for the video, thus the media
direction in the SDP must not change for the audio stream.

Gitlab: #688

Change-Id: I3775a29f6c566a159d5b9269b4d9462ab4e3c36f
2022-02-28 09:55:54 -05:00
8a1052781c swarm: banned members MUST NOT receive new messages
membersUris() didn't remove banned members from the list by default,
causing the daemon to send messages to banned members.

Change-Id: I84a80476d36d27ec33379b6e8be38f317322ec3b
GitLab: #298
2022-02-19 10:54:39 -05:00
4ddf1c6f2e swarm: allow admin to kick invited members
/invited was not checked for kicking member, add this directory
and cleanup the function for resolving votes too.

Documentation is updated:
https://git.jami.net/savoirfairelinux/jami-project/-/wikis/technical/\
2.3.-Swarm#remove-a-device-from-a-conversation

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

Change-Id: I18882066e3e42ced8ed656da3b1d2ed0a19929cf
2022-02-19 10:54:39 -05:00
53cf11bd0c swarm: verify all certificates changes
In some cases, a user in the swarm can update its certificates.
However, the new certificate MUST be checked and MUST be signed
by the account.
So, this patch validates two scenarios:
+ Check that a fetch error is sent to the client whenever an invalid
certificate is detected in the original clone
+ Check that a fetch error is sent to the client whenever a
certificate is replaced during the conversation.

Change-Id: Ieb15fb6444dcf4541f00c511a9f4ba0c64617130
2022-02-15 16:00:44 -05:00
d2d18bdedc swarm: handle device's expiration
If a device expires, a migration will regenerate the device's
certificate. In this case, the device certificate in swarms must
be updated.
So, the idea of this patch is to verify that the current certificate
in the repository for this device is still correct. If the device or
the member got invalidated, it tries to replace the current certificate
(updated via the migration). So that the new commits will still be valid.

Change-Id: I75b19b0edbb5601a758a73a4c4a44678d77295e1
GitLab: #684
2022-02-15 16:00:44 -05:00
0078370f9e swarm: make sure appdata/contacts is synced with appdata/convInfo
On older versions, removeConversation didn't update appdata/contacts
causing some removed conversations to be announced in contacts details.
On Android, this hide the contact from the smartlist, as it's waiting
for a removed conversation.

Change-Id: I05be12ffcd2e5fe38d84c6f972b97e082c612ac7
GitLab: #714
2022-02-07 15:23:39 -05:00
34af9c4a3a account_archive: re-work migrating process
When a device is expired, the migration will update the certificate
chain with the previous key. So, after a migration, the device's id
must be unchanged.
However, if a device is revoked, this should trigger a re-generation
of the device with a new PrivateKey (so generates a new device).
Add related unit tests.

GitLab: #684 (this is some preparative work)
Change-Id: I7ff0cff97b7285186539cfadc6e33b620ded5b27
2022-02-04 15:59:04 -05:00
57723b8c5a tests: fix ut_conversation
+ testSetMessageDisplayed and testSetMessageDisplayedPreference were
broken because the lastDisplayed behaviour was recently changed to
support syncing across devices. Update the two related tests. Also,
avoid to update the lastDisplayed on merge
+ testSyncWithoutPinnedCert was badly written causing some sporadic
failures.

Change-Id: I364818b4ececb0fa63e87441f55a7da76fe1feb6
2022-02-02 15:45:14 -05:00
e215d54a7d test/agent/scenarios: Add bulk calls
Gitlab: #687

Change-Id: Ib21093ab520165f02631aab483c1a86efc31aae7
2022-01-28 17:47:06 -05:00
945c4ce971 test/agent/jami/signal: Add syntax rules for signal handlers
Small helpers for signal handling.

`with-signal-handler` is useful for scoping signal handler and
`with-signal-handler-sync` for signal synchronization.

Change-Id: Idc7696fb273003d526f3a4658e7fb5623c2c5827
2022-01-28 17:47:06 -05:00
84c7c9de75 swarm: sync read status across devices
Because swarm is a synched history compatible with multi-devices,
if a message from the swarm is read on one device it should be
synchronized with other devices as much as possible.
The idea of this patch is to add lastDisplayed sent in synched
datas to allow clients to update the read status. However, there
is several scenarios to take into account, because the history
can be partially synched across devices.

5 scenarios are supported:
+ if the last displayed sent by other devices is the same as the
current one, there is nothing to do.
+ if there is no last displayed for the current device, the remote
displayed message is used.
+ if the remote last displayed is not present in the repo, it means
that the commit will be fetched later, so cache the result
+ if the remote is already fetched, we check that the local last
displayed is before in the history to replace it
+ Finally if a message is announced from the same author, it means
that we need to update the last displayed.

If the last displayed message is updated, AccountMessageStatusChanged
is triggered for the client.

Doc: https://git.jami.net/savoirfairelinux/jami-project/-/wikis/technical/2.3.%20Swarm
Change-Id: Iedd29129d72cbeb43499471bdfd492dd4d49dcb6
2022-01-27 21:28:44 -05:00
d1bc939090 jamiaccount: add test for migrations
Accounts can see their certificates expire. When it's the case, a
migration is needed. However, several regressions can happen, because
this behaviour can be tricky to test correctly. In this patch, a
test is added to validate that the migration is done whenever the
certificate expires.

+ OpenDHT needs to be bumped in order to be able to change the validity
period of a certificate.
+ In ArchiveAccountManager, a method is added to change the validity
of a certificate in the chain.
+ This patch also fixes a crash when a migration occurs directly on
the archive (info_ was null causing a segfault).
+ Finally, cleanup some signatures unused in JamiAccount.

GitLab: #684 (this is some preparative work)
Change-Id: I901bc67fd63ce2ab26ded64662f8333d3a0eed50
2022-01-26 15:18:07 -05:00
9fa8bf161a conversationrepository: fix isValidUserAtCommit
The method was bugguy, because the whole point here is to check
if the conversation contains enough informations at this point to
validate the user, not to compare with pinned certificate.
Moreover, a user can sync the history from another device, without
ever connecting to the original author, so the certificateStore
will not have the device certificate in this case, so only uses
from the repository.
A test is added to reflect this.

Change-Id: I3af5e7769174eedcb54e17181d4530593960c9c9
2022-01-25 13:13:01 -05:00
70a2a65086 SIP call: re-invite without ice re-negotiation
When muting/un-muting the video, a re-invite is performed
leading to a full media renegotiation and restart,  including
ICE session if used.
With these changes, the mute/unmute video will still require
a re-invite (a new SDP to indicate the new media directions), but
the ICE session is re-used and only the video is stopped/started
accordingly.
The behavior improves the UX by avoiding unnecessary audio disruptions
and is more compliant with SIP/ICE specs (see RFC-5245 section 9.1.1.1
for example)

Gitlab: #671

Change-Id: I13caf9a965af1d76e922fe5f6b86d5332b3296d6
2022-01-25 10:09:13 -05:00
523b2780bf account_archive: add test to validate changeAccountPassword
Change-Id: I7380645f022b1b08d2a961e191c3dd978916fe0e
2022-01-12 12:43:34 -05:00
5018565239 misc: update copyright date to 2022
Change-Id: I795e3f2f69c07349bf84c87dbcafb502dc8490f8
2022-01-05 16:21:58 -05:00
256743d590 meson: update tests
Change-Id: I834b8f24f94e639ab65272a2ff7e5ac4ea84c725
2022-01-05 12:15:55 -05:00
e14868e43b doc/agent: Add agent documentation
Change-Id: I028985ac90d07199cfa30d33e21f55ebef228ff3
2021-12-30 11:30:29 -05:00
8bab18aad4 agent: Add compilation of Scheme file
Change-Id: Ic25a41cb28ae1e8b8dc51a149c304edc7f04ef50
2021-12-30 11:30:29 -05:00
aadc86900d agent: Add commentaries to examples and peer-monitor scenario
Change-Id: I3aae03770f302bfe043f7bf6070a99a0d56fcebc
2021-12-30 11:30:29 -05:00
ce1995d172 agent: Use GOOPS
GOOPS is Guile Object Oriented Programming System.

It's easier to extend and break less the scenarios using GOOPS.  e.g., a
scenario published on Gitlab should work two weeks later.  This is not the case
right now and the goal of using GOOPS is to offer a stable API for the agent,
while keeping it flexible.

Change-Id: If6a038b6d8c371f8e74849749770f1dec8559b91
2021-12-30 11:30:29 -05:00
02c5cecd36 agent/active-agent: Fix calling problems
Change-Id: I3f7b3fd9e5bea986f5b600273ae4ddb07bdd787a
2021-12-23 09:52:48 -05:00
38981578d5 auto-answer - add unit test
Add a media negotiation unit test for auto-answer mode

Gitlab: #645

Change-Id: I37f768ce48e078fbd95a2c9b28997877a4dc468d
2021-12-17 09:35:33 -05:00
a887b2dee1 SDP - set media direction according to mute state
Currently, the media attribute in the SDP is always set to
'sendrecv' regardless of the mute state of the media.
In this patch, media direction will be set according to mute
state of the media.
Note that this only applies if the mute/unmute requires media
renegotiation (SIP re-invite with new SDP session). Currently,
this only the case for video media. For audio, mute/unmute is
done locally without SIP re-invite.

References:
RFC-3264
RFC-4317 (non-normative)

Gitlab: #645

Change-Id: I604331255bd25dfe732e192039a673a0980105fa
2021-12-16 15:32:36 -05:00
3236a6af07 account_archive: add test for import/export on DHT
Change-Id: I547dfeaf1734873ac9f8db82a181769de11a2bb6
2021-12-10 11:54:14 -05:00
a5aed459a0 agent/bindings/conversation: Add swarm bindings
Change-Id: I8a02ae82cb2cf1494a13b263aca0555ab84ed98f
2021-12-10 09:21:18 -05:00
b65146fed3 agent/bindings/account: Add add-contact, remove-contact bindings
Change-Id: I2fca281e9144d06243ca09879a1d86551ccd1996
2021-12-10 09:21:18 -05:00
66ab51817f agent/bindings/signal: Protect from GC callbacks
Change-Id: If91bed7badd8229aee216a91445b758e8901e573
2021-12-10 09:21:18 -05:00
440a71b488 conference: fix current protocol issues
This patch fix 3 little issues:
+ "device" was always empty. Uses the transport to fill the device
field. This will be used in the next version of the protocol.
+ raiseHand was bugguy in two ways:
    + It was only usable by moderators
    + Somebody was able to change the raiseHand for other peers

Change-Id: I32bf37c5063973a5a5962dd8984c87fb05d33a3d
2021-12-09 14:50:33 -05:00
35e4cfce40 multiplexed_socket: fix race condition on acceptation
Because some callbacks can take a long time (accepting a SIP channel
will starts to sync profiles, ask for new channel, etc), control packets
are handled in their own thread. However, if the peer accepts a request,
it can starts to use it and send data on it. When finished, it will close
the socket and both peer will remove the channel.
In some case, the channel can be removed before
MultiplexedSocket::Impl::onAccept, causing upper layers to handle a
bad channel. In this patch, we removes the channel only when upper layers
know that the channel is accepted and ready to use. Also, onAccept()
doesn't create wrong channels (which was a bug, where isInitiator() was
in the wrong state).

GitLab: #659
Change-Id: I4f45feacc2624ce0135ace09f7e0188b56fcf81f
2021-11-29 09:57:52 -05:00
c6661d1857 swarm: fix racecondition with acceptTrustRequest
AcceptTrustRequest should update conversation's module to directly
return the syncing conversation. Moreover, configurationMutex_ should
be recursive to allow sync between trust and conversation's requests.

This fix ut_conversationRequest where the problem was that the
conversation's requests were updated after ContactAdded, causing
removeContact() to remove the conversation, but acceptTrustRequest
re-adds it during the operation.

Change-Id: If676dc58290f87c289a6e63eb9afa04d2cc25df5
GitLab: #659
2021-11-25 15:29:19 -05:00
df9dba9bba multi-stream - remove legacy code
Remove obsolete code kept for backward compatibility.
Add call transfer test case

Gitlab: #470

Change-Id: I81472b8308ec402911670e8658308a184b97206c
2021-11-22 15:37:14 -05:00
71b4d7a396 swarm: various fixes
This patch fixes current unitTest
+ Fix testCreateConversationWithMessagesThenAddDevice messageReceived
flag
+ Remove useless sleep in tests
+ in ut_conversation fix messageReceived flag
+ lock convInfo and convRequests to avoid invalid write operations
+ fix pending callbacks if connected via a DHT request
+ remove useless log

Change-Id: If53ecf0c064e9c1424c11a4af1e13d31294e6be9
2021-11-22 13:26:34 -05:00
caad9b34c9 tests: fix ut_conference
The conference should be used in the tests after the first
conferenceChanged, to be sure that every calls are binded to the
conference.
Then, before adding a call to the conference, it should be CURRENT
from the host perspective, not the receiver. So, add "hostState"
to store the state of the call from the host perspective.

Change-Id: I9d27b4c0461ede05d27ea849de08c22e9fc3b249
2021-11-19 14:01:35 -05:00
5e6b8823fb agent/bindings: Bump bindings to new API for calls, conferences
Change-Id: I759ebe5f1827c27468f0d60e91098c70257c7b30
2021-11-19 10:55:15 -05:00
01cb294c44 callmanager: add accountId to identify calls, conferences
This starts the work to move calls and conference per account,
cleaning up the API and start future re-factorization.

Change-Id: I2a3a2c77e9ba78b1a280bdf8dca7eeaabb72f3fd
2021-11-16 15:59:41 -05:00
f8830b7894 conversation_module: update pending fetch on errors
Note: also cleanup warning for conversationRequest and fix test

Change-Id: I4b14dd5983bdde2d479093a33ee3d6343fa8ed87
GitLab: #659
2021-11-15 14:34:12 -05:00
41a7ef1970 conference: fix crashes on leave
This patch fix several problems:
+ participants_ must be protected and not iterated while accessed
+ getVideoMixer() do not generate a video mixer, this is only
managed at one place.
+ Remove setConfId, enter/exitConf are here for this and this
is causing the videoMixer to not be destroyed in time, because
exitConference() was called after setConfId(""). This was causing
crashes because the videoMixer will update for the last participant
with the error: "The call is not bound to any conference"

GitLab: #660
Change-Id: Ic60bc7377b0315f7e2906ab03a7653381436180c
2021-11-15 11:55:17 -05:00
e89bf17249 conversation_module: fix removeContact with self
removeContact("SELF") MUST NOT remove all swarm.

Change-Id: I421a235fd2beb2fc33276fd58aa1413454b40233
GitLab: #665
2021-11-12 14:51:27 -05:00
94882a0abc contact_list: erase trust request via sync
If a contact is added, the first device will erase the trust request,
but the second device will update the contact but not the trust
request. Causing, the removeContact to generate a new request for
the previously created conversation.

Change-Id: I2f0a48b3c6b6b18ed6218e7a08c61de2beb08d3d
GitLab: #664
2021-11-12 13:32:58 -05:00
d66edafb7d agent/agent: Use parameter instead of fluid
Change-Id: I365b4346d123b0cc8c71a17e62e25bae37e5fc49
2021-11-12 11:20:19 -05:00
562f8c8a56 agent/examples: Fix examples
Change-Id: Idf54e78391eb77c7964c6650b6f70df71b8eac3a
2021-11-12 11:19:23 -05:00
914a8ec516 agent/peer-monitor: Fix typo and add pause in sighandler
Change-Id: I298a8bdca4a9263a5afa332b8501b1fefc3929de
2021-11-12 09:42:17 -05:00
dd5e65098b Hold/Resume: fix media direction and add unit test
When a call is held, the media direction in the SDP
for an active media must be set to sendonly.
Also add unit test for simple hold/resume operations

Gitlab: #644

Change-Id: Ib41434c55f9be1a6d34a7d51c9127af89081c8e8
2021-11-03 12:26:07 -04:00