1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2024-09-12 14:35:27 +00:00
Commit graph

103 commits

Author SHA1 Message Date
Evangelos Ribeiro Tzaras
e75e04fb4e sip: Allow specifying if media encryption is desired
A property of type SipMediaEncryption is added to both the origin and
the call which allows to state if we want the media session to be
encrypted with SRTP.

Logic is added to interact with the CallsSdpCryptoContext if encryption
is desired.
2022-05-24 22:48:56 +02:00
Evangelos Ribeiro Tzaras
0e57d31c1e sip: media-manager: Include crypto attributes for capabilities
The API is changed to accept a list of calls_srtp_crypto_attributes
which get inserted into the SDP line.
2022-05-24 22:30:03 +02:00
Evangelos Ribeiro Tzaras
47d252eb8b sip-origin: Notify on account property updates
The UI does not have a chance to react otherwise.
2022-05-24 11:55:52 +00:00
Evangelos Ribeiro Tzaras
4714aea068 sip: origin: Don't treat DNS failures as errors
No need to g_warning() for this.
2022-05-24 11:55:52 +00:00
Evangelos Ribeiro Tzaras
46ff807f6b sip: origin: Always notify state changes when relevant to the UI
by adding functions to the public API which determine if state changes
should be shown to the user and use them (instead of duplicating similar
logic).
2022-05-24 11:55:52 +00:00
Evangelos Ribeiro Tzaras
0605582fc7 sip: origin: Notify on state change
The account state has G_EXPLICIT_NOTIFY but we did never notified.
2022-05-24 11:55:52 +00:00
Evangelos Ribeiro Tzaras
59c06aef44 sip: origin: Tweak debugging
Be slightly more verbose in messages.
Demote some warnings.
Don't print empty tags.
2022-05-24 11:55:52 +00:00
Evangelos Ribeiro Tzaras
b31db4a51c sip-origin: Codestyle 2022-05-24 11:55:52 +00:00
Evangelos Ribeiro Tzaras
96f1cc0a30 sip: call: Defer setting up codecs for pipeline until activated
This let's us get rid of some ugly code
2022-05-09 11:13:15 +02:00
Evangelos Ribeiro Tzaras
c6c17671e1 sip: origin: Remove unused variable 2022-05-09 11:13:15 +02:00
Evangelos Ribeiro Tzaras
7ac862155b Uncrustify sources
Ran `find src plugins -iname '*.[c|h]' -print0 | xargs -0 uncrustify --no-backup`
with some minimal manual intervention.
2022-04-24 12:59:42 +02:00
Evangelos Ribeiro Tzaras
f44b4c7ef8 sip: origin: Debug print public IP as seen by the registrar 2022-04-22 19:23:14 +02:00
Evangelos Ribeiro Tzaras
a7fcb9c0c0 sip: origin: Try fetching RTCP port from SDP attributes
And fallback to the legacy behaviour of RTCP=RTP+1
2022-03-05 23:02:15 +01:00
Evangelos Ribeiro Tzaras
849f298609 sip: media-pipeline: Remove lport-rtp and lport-rtcp property
We're not setting the desired ports from the outside anymore, but rather
querying the ports that have been allocated by the operating system.

Therefore the lport-rtp and lport-rtcp property have become superfluous and are
being removed. We also adapt to changes outside of the pipeline code.
2022-03-05 23:02:15 +01:00
Evangelos Ribeiro Tzaras
aeebdfbf53 sip: call: Add pipeline as a construct only property
In the future when we will be able to switch pipelines this might change.
2022-03-05 23:02:15 +01:00
Evangelos Ribeiro Tzaras
16b86c29b2 origin: Add id property and adapt to changes
The id property will be used to keep track of which origin was used for a call,
so that we can default to reusing the same origin when placing a call from the
history.
2022-03-04 18:00:32 +01:00
Evangelos Ribeiro Tzaras
e185cac3cb sip: Debug print remote SDP and codec to be used
Fixes #415
2022-03-01 16:32:30 +01:00
Evangelos Ribeiro Tzaras
f6e6d08332 sip: origin: Fix memory leak 2022-01-27 18:02:15 +01:00
Evangelos Ribeiro Tzaras
1b4af654f1 sip: origin: Fix comment style 2022-01-27 18:02:15 +01:00
Evangelos Ribeiro Tzaras
7c5dcd37d7 sip: origin: Switch to state notify signal
We don't need the old state here, so let's use the "notify::state" signal
instead of the "state-changed" signal.
2022-01-20 10:23:09 +00:00
Evangelos Ribeiro Tzaras
695839a2d9 sip: origin: Emit user feedback on state change 2022-01-11 12:00:10 +00:00
Evangelos Ribeiro Tzaras
cdb6f90acc account: Rework account states
Introduce a state-changed signal which also gives a reason for why the state
changed. This will allow the UI to give some meaningful feedback to the user.

Additionally we can get rid of a number of things that were not really states,
but rather reasons for why a state changed (f.e. authentication failures).
2022-01-11 12:00:10 +00:00
Evangelos Ribeiro Tzaras
d5fd098479 sip: origin: Make go_online() a no-op in the direct connection case
This avoids some special casing in init_sip_account()
2022-01-11 12:00:10 +00:00
Evangelos Ribeiro Tzaras
69b615a2c2 sip: origin: Codestyle 2022-01-11 12:00:10 +00:00
Evangelos Ribeiro Tzaras
eeb97c82c0 sip: origin: Purge own IP when uninitialising account
This will make sure that we're not using a stale IP address if we're resetting
the account after an IP change.
2022-01-10 08:27:08 +01:00
Evangelos Ribeiro Tzaras
8b126484cb sip: Use per origin IP instead of a global IP
Sofia detects a NAT by presence of the "received" parameter in the Via header in
the response to a REGISTER. Sofia will then update the Contact header to use the
IP as reported by the registrar.

The "received" parameter MUST be included in the response according to
https://datatracker.ietf.org/doc/html/rfc3261#section-18.2.1
when the registrar detects a difference between the domain part of the top Via
header and the packet source address but practice has shown that this will not
always be the case.

Addditionally this change allows us to have origins bound to different network
interfaces which would be useful when a registrar can only be accessed through a
VPN.

This also fixes an issue with SDP introduced in
36880c3d34 which was only seen on some SIP
providers:

The session name ("s=") line is not relevant for establishing a connection,
the connection data (c=") line is.

See https://datatracker.ietf.org/doc/html/rfc4566 section 5.3 and 5.7
2022-01-08 21:25:09 +00:00
Evangelos Ribeiro Tzaras
ba00665c36 sip: origin: Decouple TLS usage from target address
Since we cannot do encrypted media streams yet, we should hardcode whether or
not we want to use SRTP to FALSE, so that sips target URLs can be used in SIP
calls at all.
2022-01-07 16:34:25 +01:00
Evangelos Ribeiro Tzaras
0cadf24ed0 sip: origin: Fix host being passed as number
Closes #389

Fixes e2acfd3794
2021-12-28 16:40:46 +01:00
Evangelos Ribeiro Tzaras
e2acfd3794 sip: origin: Pass telephone number to the call object
If the origin is used for PSTN telephony extract the number from the
SIP dialstring (i.e. sip:+49160123456789@my-sip-host.de) and pass that
to call object for contact matching.
2021-12-26 17:57:14 +01:00
Evangelos Ribeiro Tzaras
fbbe17139d sip: origin: Add property tracking usage for tel URIs
Fixes #277
2021-12-26 17:45:12 +01:00
Evangelos Ribeiro Tzaras
66224c9a48 origin: Get rid of "numeric-addresses" property 2021-12-26 17:45:12 +01:00
Evangelos Ribeiro Tzaras
cd6917dcf6 sip: origin: Include address in warning when we cannot dial
This allows figuring out which call failed.
2021-12-21 14:52:14 +00:00
Evangelos Ribeiro Tzaras
a048b4c83d call: Move state property into base class
This let's us get rid of a lot of duplication in the derived classes.

Additionally we set the initial state to CALLS_CALL_STATE_INCOMING if
inbound is TRUE and CALLS_CALL_STATE_DIALING otherwise.
2021-12-20 12:25:19 +01:00
Evangelos Ribeiro Tzaras
73cf5081d0 sip: origin: Prevent dialing when not online
Setting up the nua context could have failed (see #379) and in that case
our nua_*() calls might derefence a NULL pointer.
2021-12-15 20:01:40 +01:00
Evangelos Ribeiro Tzaras
2cf7c5e981 sip: origin: Make sure "@host" is in the dial string
This helps avoid some typing work in the case of dialing telephone numbers.

Fixes #350
2021-10-30 18:49:27 +02:00
Evangelos Ribeiro Tzaras
1b4e968e8e sip: origin: Bail when trying to dial empty string 2021-10-30 18:49:27 +02:00
Evangelos Ribeiro Tzaras
36880c3d34 sip: Gather public IP from REGISTER response and use it in SDP
Fixes #335
2021-10-06 13:43:04 +00:00
Evangelos Ribeiro Tzaras
4675821838 sip: origin: Recreate handles when updating credentials
Otherwise transport protocol changes won't be picked up.

This also allows to get rid of update_nua().
2021-09-29 21:33:55 +00:00
Evangelos Ribeiro Tzaras
1718823b80 sip: Do not fail if CallsNetworkWatch is unavailable
In this case network changes will not be detected.
Additionally fall back to binding on all network interfaces (in this case a user
will have problems when using multiple network interfaces, but there is really
not much we can do without a functioning CallsNetworkWatch).
2021-09-24 05:24:41 +00:00
Evangelos Ribeiro Tzaras
b6ee0bb48d sip: sdp: Hang up call when there are no common codecs 2021-09-20 02:14:27 +00:00
Evangelos Ribeiro Tzaras
929d76708a sip: sdp: Honour per media connections
Otherwise we might miss the IP of the remote peer leaving us unable to
establish a connection for RTP.

From https://datatracker.ietf.org/doc/html/rfc4566#section-5.7

   A session description MUST contain either at least one "c=" field in
   each media description or a single "c=" field at the session level.
   It MAY contain a single session-level "c=" field and additional "c="
   field(s) per media description, in which case the per-media values
   override the session-level settings for the respective media.
2021-09-20 02:14:27 +00:00
Evangelos Ribeiro Tzaras
cf3face6cc sip: Fix possible NULL pointer dereference
The assumption that the IP of the remote peer can always be found in the
sdp_connection member of the sdp_session_s struct does not always hold true
and we should handle this case gracefully (i.e. without crashing).
2021-09-20 02:14:27 +00:00
Evangelos Ribeiro Tzaras
400281c07e sip: origin: Fix memory leak 2021-09-20 02:14:27 +00:00
Evangelos Ribeiro Tzaras
a5cfd9eb24 sip: origin: Bind sockets to NIC with default route
Otherwise sofia may use the wrong interface resulting in unroutable packets.

Closes #317
2021-09-05 18:16:24 +02:00
Evangelos Ribeiro Tzaras
6b33845b11 sip: origin: Do not use CallsNetworkWatch during tests
As local testing showed we might get netlink message headers of type
NLMSG_ERROR which leads to a warning being printed and the test to fail.
2021-09-05 18:01:45 +02:00
Evangelos Ribeiro Tzaras
56259fd1f1 sip: origin: Destroy registration handle on deinit
Otherwise shutting down may be timing out, because there are pending messages.
Calling nua_destroy_handle() will kill any dialog/leg.
2021-09-02 20:13:25 +02:00
Evangelos Ribeiro Tzaras
a3d91d92b5 sip: origin: Handle nua_shutdown() timeout gracefully
If we don't handle the timeout explicitly we would never leave the
`while (!self->is_nua_shutdown)` loop.
2021-09-02 20:11:36 +02:00
Evangelos Ribeiro Tzaras
bede9f42e8 sip: origin: Recreate sofia handles on network change
Otherwise the origin will not be able to do any communication anymore
as used sockets might not be valid any more.

Fixes #317
2021-09-02 20:08:48 +02:00
Evangelos Ribeiro Tzaras
2df221c94c sip: origin: Warn instead of asserting in update_nua() on nua stack
Crashing the application is overkill in this case.
2021-09-02 09:12:13 +02:00
Evangelos Ribeiro Tzaras
16897eebe6 sip: origin: Include transport parameter in NUTAG_URL and friends
This makes sure all of the supported protocols have a chance of working.

Since nua_set_params does not update NUTAG_URL (carefully rechecking the docs
verifies this), it is safe to remove the code in update_nua().

However, this means that we will have to recreate the nua stack,
which incidentally is currently being worked on:
https://gitlab.gnome.org/GNOME/calls/-/merge_requests/402
2021-09-02 09:12:13 +02:00