1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2024-06-28 14:49:30 +00:00
Commit graph

385 commits

Author SHA1 Message Date
Evangelos Ribeiro Tzaras a99755424f media-manager: Don't run deinitialize GStreamer in finalize()
This makes running tests harder as we cannot call gst_init() after gst_deinit()
has been called.

This is what the API reference has to say about it at
https://gstreamer.freedesktop.org/documentation/gstreamer/gst.html?gi-language=c#gst_deinit

It is normally not needed to call this function in a normal application as the
resources will automatically be freed when the program terminates. This function
is therefore mostly used by testsuites and other memory profiling tools.
2022-03-01 18:04:18 +01:00
Evangelos Ribeiro Tzaras 2d4c3f9b43 sip: call: Remove unnecessary G_OBJECT() cast
g_object_set() takes a gpointer as argument, so there is no need to cast the
argument using G_OBJECT()
2022-03-01 18:04:18 +01:00
Evangelos Ribeiro Tzaras fee633e78b sip: media-pipeline: Prefix overriden GObjectClass methods
Purely cosmetical change to be in line with our style guide.
2022-03-01 18:04:18 +01:00
Evangelos Ribeiro Tzaras bf428f0fa6 sip: media-pipeline: Remove comment about preexisting linked pads
Since we're not reusing pipelines we don't have to check for any existing linked
pads.
2022-03-01 18:04:18 +01:00
Evangelos Ribeiro Tzaras ce00698e71 sip: build: Use simple variant of gnome.mkenums
We were using standard template files anyway.
2022-03-01 18:04:18 +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 876f12df95 sip: media-manager: Don't include sofia-sip/nua.h in public header
It isn't needed in the implementation either. It was only useful because it
included system headers like sys/types.h and sys/socket.h which we should now
include directly.

This will make it easier to move the media manager into the core sources.
2022-03-01 16:31:44 +01:00
Evangelos Ribeiro Tzaras 19cf2ab92f sip: media-pipeline: Add G_BEGIN_DECLS and G_END_DECLS to header 2022-03-01 16:31:44 +01:00
Evangelos Ribeiro Tzaras 3ac8cc1580 dummy-provider: Add new anonymous incoming call on SIGUSR2 2022-02-18 10:55:53 +01:00
Evangelos Ribeiro Tzaras 8c0d135298 media-pipeline: Put deprecated GStreamer function behind version check macro
gst_element_get_request_pad() is marked as deprecated in GStreamer 1.20.0 in
favour of gst_element_request_pad_simple()
2022-02-12 23:49:30 +00:00
Evangelos Ribeiro Tzaras 8f8da42f76 dummy-origin: Emit call-added only after adding to list
Otherwise we get incorrect values when calling calls_origin_get_calls ()
2022-02-03 12:36:58 +01:00
Evangelos Ribeiro Tzaras 69c530dda8 dummy: provider: Fake being a modem
This is useful to avoid the "No modem" warning in the UI and helps us avoiding
to special case the dummy provider/origins.
2022-01-31 17:08:38 +00:00
Evangelos Ribeiro Tzaras 6aba8e119c dummy: origin: Restrict supported protocols to "tel" 2022-01-31 17:08:38 +00:00
Evangelos Ribeiro Tzaras a8de63f838 dummy: origin: Fix memory leaks 2022-01-27 18:02:15 +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 470475e531 mm: 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 58507556e5 dummy: 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 c2c8b1acd9 dummy: origin: Use g_assert in non public functions 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 38f9e0b608 sip: media-manager: Get rid of global session IP
Since we're now passing the IP to be used to retrieve the capabilities
for the SDP message body, this has become dead code.
2022-01-08 21:25:09 +00: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 ae4053e1c9 sip: call: Remove unnecessary code
The call state depending on whether a call is inbound or not is handled in the
constructed() method of the CallsCall base class.
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 992a243de6 sip-account-widget: Add switch to specify account can handle tel URI
Fixes #277
2021-12-26 17:45:12 +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 8575adf998 media-manager: Take preferred audio codecs into account for SDP
Fixes #349
2021-12-21 15:05:47 +01:00
Evangelos Ribeiro Tzaras 0b8fb4a448 media-codecs: Clarify that codec availability should be checked before use 2021-12-21 15:05:47 +01:00
Evangelos Ribeiro Tzaras 27463212d9 media-codecs: Add codec availability check to public API
This will be useful for building a list of preferred audio codecs.
2021-12-21 15:05:47 +01:00
Evangelos Ribeiro Tzaras b49041a3f2 sip: codecs: Fix transfer annotation of media_codecs_get_candidates() 2021-12-21 15:05:47 +01:00
Evangelos Ribeiro Tzaras c12b7a8c69 call: Use protocol fallback
We're falling back to "tel" as the default case.
2021-12-20 12:25:19 +01:00
Evangelos Ribeiro Tzaras dbfa593a07 call: Move name property to base class
This let's us avoid some duplication in the derived classes.
2021-12-20 12:25:19 +01:00
Evangelos Ribeiro Tzaras a1fefcdbac call: Move id property into base class
This allows us to avoid some duplication in the derived classes.
2021-12-20 12:25:19 +01: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 ddf1dd7349 call: Move inbound property into base class
This avoids some repetition in the derived classes.
2021-12-20 12:25:18 +01:00
Evangelos Ribeiro Tzaras 797c9a0c46 mm: call: Codestyle 2021-12-20 12:25:18 +01:00
Evangelos Ribeiro Tzaras b3aff65822 dummy: call: Codestyle 2021-12-20 12:25:18 +01:00
Evangelos Ribeiro Tzaras aadf546472 ofono: call: Codestyle 2021-12-20 12:25:18 +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 f206b7d257 call: Rename property from "number" to "id"
The term number is not necessarily accurate when dealing with f.e. SIP.
2021-12-05 09:49:05 +01:00
Evangelos Ribeiro Tzaras 4c2717c362 dummy: Add dummy send_dtmf_tone function
This will allow DTMF to be tested UI wise when running the dummy plugin.
2021-11-23 08:50:01 +00:00
Evangelos Ribeiro Tzaras a353a03d01 call: Get rid of tone_stop
It wasn't used by any plugin backend and helps getting rid of a lot of code.
2021-11-23 08:50:01 +00: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 94d730c3ed Let provider plugin decide whether to automatically hang up secondary calls
Revert "manager: hang up secondary calls"

This reverts commit 94345e0916 and moves that
functionality to the ModemManager plugin.

Fixes #290
2021-10-22 06:00:45 +02:00
Evangelos Ribeiro Tzaras 21eb12e9b1 dummy-call: Simplify change_state() 2021-10-22 04:58:01 +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 b8efaf1f66 media-manager: Use G_BEGIN_DECLS and G_END_DECLS in header 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 24040c2122 sip: media: Fix gtk-doc transfer annotation 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 876375a39b sip: provider: Skip creating credential directory on test
As it's not guaranteed that the home directory is always writable
during the build. Debspawn for example does not allow this
and we might get such a warning:

`CallsSipProvider-WARNING **: 21:58:14.839: Failed to create directory '/home/salsaci/.config/calls': 13`
2021-09-03 00:08:05 +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
Evangelos Ribeiro Tzaras 7330fe11fd account-widget: Fix apply button not becoming sensitive
when only the transport protocol has been changed.
2021-09-02 09:12:13 +02:00
Evangelos Ribeiro Tzaras 42c0872499 origin: Fix the password when updating credentials
Updating the credentials was broken otherwise.
2021-09-02 09:12:13 +02:00
Evangelos Ribeiro Tzaras 0bfa55473e sip: Make save_to_disk() public and use it when updating accounts
Account credentials will not get updated at all otherwise.
2021-09-02 09:12:13 +02:00
Evangelos Ribeiro Tzaras f47139f7d2 account-widget: Actually use the entered port 2021-09-02 09:12:13 +02:00
Evangelos Ribeiro Tzaras 9faac7e789 account-widget: Actually use the selected protocol
instead of using the hardcoded UDP value.
2021-09-02 09:12:13 +02:00
Evangelos Ribeiro Tzaras 5371debc57 sip: origin: Bail when trying to go online but nua handle is not present
This fixes a segmentation fault.
2021-09-02 09:12:13 +02:00
Evangelos Ribeiro Tzaras c9dd476fa8 sip: Avoid dereferencing a NULL pointer
secret_password_*_finish() may return FALSE without setting the GError.
F.e. trying to remove a non existent secret is not a failure.

The bug supposedly manifests itself because the updating account credentials
from the UI does not always seem to work correctly.
2021-08-26 12:04:21 +00:00
Evangelos Ribeiro Tzaras 77ec258acc sip: provider: Try to create folder for credentials
Otherwise the user could be left unable to save credentials to disk later.

Fixes #326
2021-08-26 12:23:20 +02:00
Evangelos Ribeiro Tzaras 4e76efc5e7 sip: provider: No need to print warning when no credentials file found
The file could simply not (yet) exist.
2021-08-26 12:23:20 +02:00
Evangelos Ribeiro Tzaras 2520a9a555 sip: Avoid g_error for non-fatal issues
The media pipeline acting up does not warrant crashing the application.
2021-08-26 12:23:19 +02:00
Evangelos Ribeiro Tzaras c7731b189a origin: Add "numeric-addresses" property
This will be useful in the dialpad to determine whether we should allow
only numeric input or not.
2021-08-13 02:13:27 +02:00
Evangelos Ribeiro Tzaras f5cd48bd99 sip: origin: Add protocol prefix if missing 2021-08-13 02:13:27 +02:00
Mohammed Sadiq 55a69944f1 sip-account-widget: Validate port value on change 2021-08-10 14:03:13 +00:00
Evangelos Ribeiro Tzaras 21578557f4 sip: provider: Don't store the password in the GKeyFile 2021-07-20 10:17:17 +02:00
Evangelos Ribeiro Tzaras fe6b5f9f4a sip: provider: Retrieve password from keyring
Fixes #251.
2021-07-20 10:17:17 +02:00
Evangelos Ribeiro Tzaras 8ca63828df sip: provider: Delete password from keyring when deleting account 2021-07-20 10:17:17 +02:00
Evangelos Ribeiro Tzaras a8516f6e7b sip: provider: Update credentials on disk when removing origin
Otherwise the key file will be unaltered and loads the same account on
the next startup.

One more step closer to fixing #251.
2021-07-20 10:17:17 +02:00
Evangelos Ribeiro Tzaras 40cea6760b sip: provider: Use the secret store to store credentials 2021-07-20 10:17:17 +02:00
Evangelos Ribeiro Tzaras 3f12b3fcd5 sip: provider: Add argument to _add_origin() whether to store credentials
This allows us to avoid unnecessary saving to disk during initial account
loading.
2021-07-20 10:17:17 +02:00
Evangelos Ribeiro Tzaras e9f155678e sip: origin: Set and update name of origin 2021-07-20 10:17:17 +02:00
Evangelos Ribeiro Tzaras 5c1b76908b sip: provider: Save accounts to disk 2021-07-20 10:17:17 +02:00
Evangelos Ribeiro Tzaras 7717633698 sip: provider: Add API to save credentials to GKeyFile 2021-07-20 10:17:17 +02:00
Evangelos Ribeiro Tzaras 0e5366ddbb sip: account-widget: Emit "widget-edit-done" when done editting
This let's top level containers know to take appropriate action (i.e. hide).
2021-07-20 10:17:17 +02:00
Evangelos Ribeiro Tzaras e36469e796 sip: Implement CallsAccountProvider interface 2021-07-20 10:17:17 +02:00
Evangelos Ribeiro Tzaras 23cb050f61 sip: Introduce CallsSipAccountWidget
This widget can be used to add new accounts or edit existing ones.

First part of #264.
2021-07-20 10:17:17 +02:00
Evangelos Ribeiro Tzaras 1749dcec60 sip: provider: Add API to remove origins 2021-07-20 10:17:17 +02:00
Evangelos Ribeiro Tzaras 1a4b501653 sip: provider: Rename test environment variable 2021-07-20 10:17:17 +02:00
Evangelos Ribeiro Tzaras fd9b57c1b3 sip: provider: Load credentials from GKeyFile 2021-07-20 10:17:17 +02:00
Evangelos Ribeiro Tzaras 58331afcf7 sip: provider: Use g_auto and GStrv
Instead of char** and g_strfreev()
2021-07-20 10:17:17 +02:00
Evangelos Ribeiro Tzaras a638b64402 account: Add address property 2021-07-20 10:17:17 +02:00
Evangelos Ribeiro Tzaras babd013bd7 Remove CallsCredentials and adapt to changes
The provider knows best which credentials it needs and CallsCredentials
was not generic to begin with, so get rid of it.
2021-07-20 10:17:17 +02:00
Evangelos Ribeiro Tzaras 2af2b316ec Various codestyle fixes 2021-07-20 10:17:17 +02:00
Evangelos Ribeiro Tzaras 864a15d799 sip: origin: Explicitly include contact header for sofia > 1.13
Fixes #304
2021-07-16 09:11:27 +00:00
Evangelos Ribeiro Tzaras f930874d00 sip: provider: Keep provider alive while there are still origins
CallsSipOrigin accesses the CallsSipContext (owned by the provider) in its
dispose() which will be invalid once CallsSipProvider gets freed.
This commit will make certain that the provider stays alive for the lifetime
of it's origins.
2021-06-26 08:56:18 +02:00
Evangelos Ribeiro Tzaras 8a230fc5b5 sip: origin: No need to explicitly clear nua handles
Memory allocations from su_home_t will get cleaned up, when the home is freed.
2021-06-21 13:20:32 +02:00
Evangelos Ribeiro Tzaras a803294c4a sip: origin: Handle unregistering (going offline)
and set the account state accordingly.
2021-06-18 19:29:25 +02:00
Evangelos Ribeiro Tzaras e6c7994abc sip: origin: Remove unnecessary notify 2021-06-18 19:29:25 +02:00
Evangelos Ribeiro Tzaras 5bd84043b9 sip: origin: codestyle 2021-06-18 19:28:12 +02:00
Evangelos Ribeiro Tzaras dbb829be06 debug: Add G_LOG_DOMAIN to every file using g_debug() 2021-06-18 11:12:13 +02:00
Evangelos Ribeiro Tzaras 736c17a4bc sip: origin: Fix if condition in dispose()
This should make sure that origins go offline
2021-06-11 17:51:06 +02:00
Evangelos Ribeiro Tzaras 6c146897d4 mm: origin: Don't shadow props variable
As caught by compiling with `'-Wshadow`
2021-06-03 19:46:45 +00:00
Evangelos Ribeiro Tzaras 521979ef69 ofono: call: Don't shadow props variable
As caught by compiling with `-Wshadow`
2021-06-03 19:46:45 +00:00
Evangelos Ribeiro Tzaras 7988ddf85b sip: media-pipeline: Don't shadow props variable
As caught by compiling with `-Wshadow`
2021-06-03 19:46:45 +00:00
Evangelos Ribeiro Tzaras 2847508034 Fix missing-declarations warnings all over the codebase
As caught by compiling with `-Wmissing-declarations`
by either making functions static, or declaring them in the header.
2021-06-03 19:46:45 +00:00
Evangelos Ribeiro Tzaras 96a7d901c1 Fix old-style warnings all over the codebase
As caught by compiling with `-Wold-style-definition` and `-Wstrict-prototypes`.
2021-06-03 19:46:45 +00:00
Evangelos Ribeiro Tzaras dde4bd8abf sip: provider: Don't warn when trying to add account multiple times
A g_debug() will suffice which will let us get rid of g_test_expect_message() to
as we don't need to guard against the warning anymore.
2021-06-01 14:52:23 +02:00
Evangelos Ribeiro Tzaras 44f2002f86 manager: Differentiate the NO_ORIGIN state
This avoids confusion when only the SIP plugin is loaded, but no account
is being used.

For this we introduce two new functions in the abstract CallsProvider class:
`is_modem()` to indicate whether the the provider deals with PTSN telephony and
`is_operational()` which by default simply checks if there any avalaible origins
2021-06-01 14:52:23 +02:00
Evangelos Ribeiro Tzaras 0c966fdf83 origin: Add API to query supported protocols
This will allow selecting a suitable origin when placing outgoing calls.
2021-05-28 17:02:02 +02:00
Evangelos Ribeiro Tzaras 7ad0f4cdd6 provider: Add API to query supported protocols
These are the protocols that the provider plugin may support. The origins
must be queried independently whether or not they support any given protocol.

Example: A SIP origin/account may or may not support the "tel" protocol.
2021-05-28 17:02:02 +02:00
Evangelos Ribeiro Tzaras 53f69b06dd call: Introduce protocol property 2021-05-28 13:18:24 +02:00
Evangelos Ribeiro Tzaras 1def4c3585 plugins: provider: Use CallsOrigin instead of derived types for GListStore
Otherwise we run into trouble when using `g_list_store_find()`
2021-05-28 13:18:24 +02:00
Evangelos Ribeiro Tzaras a888ac54b1 mm: origin: Try using own number as the origin name
This will make it easier to select an origin for outgoing calls. Without this
change the name might be "0" which is not very expressive.
2021-05-28 13:18:24 +02:00
Evangelos Ribeiro Tzaras fecdc1fff8 cleanup: Fix calls_origin_get_name() related memory leaks
Document calls_origin_get_name() correctly as transfer-full.
Additionaly fix related memory leaks.
2021-05-28 13:18:24 +02:00
Mohammed Sadiq b1278f6140 build: Avoid building files multiple times
We don't have to build each source for every test, instead we could
create a static library link it with every test, which will be a lot
faster.
2021-05-17 20:00:04 +05:30
Evangelos Ribeiro Tzaras 95f16cb527 sip: provider: Implement CallsAccountProvider interface 2021-05-04 06:44:43 +02:00
Evangelos Ribeiro Tzaras 36cd9bd122 sip: provider: return origin in calls_sip_provider_add_origin() 2021-05-04 05:58:41 +02:00
Evangelos Ribeiro Tzaras a6cb02a4c9 sip: provider: codestyle 2021-05-04 05:58:41 +02:00
Evangelos Ribeiro Tzaras 3edd6d002b sip: origin: Implement CallsAccountsInterface 2021-05-04 05:57:42 +02:00
Evangelos Ribeiro Tzaras 781adaddee sip: origin: Use CallsAccountState instead of SipAccountState 2021-05-04 05:57:42 +02:00
Evangelos Ribeiro Tzaras 5d0de3d299 sip: origin: Use CallsCredentials and adapt to changes
All parts not related to credentials are now being set when creating the nua
handles and then updated with nua_set_params() when the credentials get updated.
2021-05-04 05:57:06 +02:00
Evangelos Ribeiro Tzaras 3f72d34c49 Add CallsCredentials class and use it in CallsSipProvider
CallsCredentials is a dumb container to store account credentials.
This is done in preparation for the account management in the UI.
2021-05-04 05:57:06 +02:00
Evangelos Ribeiro Tzaras d6916b3510 sip: media-pipeline: Do not set the stream properties prematurely 2021-05-04 05:57:06 +02:00
Evangelos Ribeiro Tzaras 06076a864a sip: media-pipeline: Fix memory leak in error path 2021-05-02 02:36:31 +02:00
Evangelos Ribeiro Tzaras 9cd13ca681 sip: media-pipeline: Fix memory leak 2021-05-02 02:36:25 +02:00
Evangelos Ribeiro Tzaras 21e72c9e12 sip: origin: Fix nua_authenticate call
nua_* calls need TAG_END or TAG_NULL as the final parameter.
2021-05-01 13:59:32 +02:00
Evangelos Ribeiro Tzaras 5ed24c4ed7 doc: Fix gtk-doc transfer annotations 2021-04-27 11:38:26 +02:00
Evangelos Ribeiro Tzaras d7df1a4931 Revert "sip: build: depend on config.h"
This reverts commit 1a35d6544b.
This has not actually fixed the issue completely. See follow up commit
2021-04-27 01:51:05 +02:00
Evangelos Ribeiro Tzaras 868d9e36da codestyle: get rid of CALLS_SET_PTR_PROPERTY macro
One more step towards fixing #214
In `calls-ofono-call.c` the changed code also adheres to the newly introduced
coding style.
2021-04-25 18:12:59 +02:00
Evangelos Ribeiro Tzaras 70cb120951 sip: fix typos
Thanks to lintian for pointing it out!
2021-04-23 15:35:14 +02:00
Evangelos Ribeiro Tzaras 2ee6b23475 sip: media-pipeline: Allow overriding audio elements from environment
This is useful for tests where "pulsesrc" and "pulsesink" GstElements may not
be available (for example in CI).

Additionally only set the echo cancellation and buffer properties for the
pulse GstElements.
2021-04-20 09:47:16 +02:00
Evangelos Ribeiro Tzaras e5dc3f06ce plugins: make plugins shared modules again
This reverts the main part of commit 4a264252a7.

As plugins are the prime use case for `shared_module`
getting rid of the warning from meson about linking against shared modules
weighs less heavy.
2021-04-16 16:41:18 +00:00
Evangelos Ribeiro Tzaras 367ca081a2 sip: call: Don't fail when hanging up on an incoming call 2021-04-16 00:39:42 +00:00
Evangelos Ribeiro Tzaras f178b3546b sip: provider: document public functions 2021-04-16 00:39:42 +00:00
Evangelos Ribeiro Tzaras 7ed1ee2502 sip: codestyle changes
Shuffle the code around and make use of docstrings to conform to
the newly introduced coding style as described in `HACKING.md`

This commit also introduces docstrings describing each source file.
2021-04-16 00:39:42 +00:00
Evangelos Ribeiro Tzaras 765cd2ebb9 sip: pipeline: Only inform of unhandled bus massages when debugging
These messages are mainly useful for development. This part will be rewritten
once we introduce structured logging. For the moment this will just add noise.
2021-04-16 00:39:42 +00:00
Evangelos Ribeiro Tzaras 166ea8b21a sip: origin: Allow using a local port of 0
Using a port of 0 let's the operating system decide to which port to bind to.
Additionally refuse to use priviliged ports and print a warning.
2021-04-16 00:39:42 +00:00
Evangelos Ribeiro Tzaras f7626e532f sip: provider: use g_clear_pointer pattern instead of emulating it 2021-04-16 00:39:42 +00:00
Evangelos Ribeiro Tzaras 6e6873432b sip: provider: Allow overriding SIP account config via environment
This will make it easier for testing down the line.
2021-04-16 00:39:42 +00:00
Evangelos Ribeiro Tzaras b3cd378704 sip: origin: Remove unnecessary code
Remove a remnant from early development which has no use anymore
since "direct-connection" is now a property.
2021-04-16 00:39:42 +00:00
Evangelos Ribeiro Tzaras db63efa29f sip: origin: Remove hardcoded display name from contact header
We might want to set it from the configuration later.
2021-04-16 00:39:42 +00:00
Evangelos Ribeiro Tzaras b88d432401 sip: origin: make create_inbound a private function
and shuffle the functions around so that we don't need forward declarations
2021-04-16 00:39:42 +00:00
Evangelos Ribeiro Tzaras 1a35d6544b sip: build: depend on config.h
Closes #257
2021-04-15 18:50:39 +02:00
anteater a4851c4fdc ofono: correct variant format confusion
this fixes the crash observed when starting the modem (#248)
2021-04-14 20:45:15 -04:00
anteater edc1089224 ofono: track status in CallsOfonoProvider 2021-04-14 20:45:15 -04:00
anteater cc93733c42 ofono: don't clear self->modem after constructing CallsOfonoOrigin
self->modem is used in calls_ofono_origin_matches; in that context, warn if it is NULL
2021-04-14 20:45:15 -04:00
anteater 9b4563e046 ofono: ref self across async callback 2021-04-15 00:44:26 +00:00
anteater 6db32b5452 ofono: fix return of incorrect field 2021-04-15 00:44:26 +00:00
Evangelos Ribeiro Tzaras 63cc6507e7 sip: media-manager: fix SDP message when there is no supported codec 2021-04-12 08:38:24 +00:00
Evangelos Ribeiro Tzaras 7d8be1d68d sip: media-manager: fix G_LOG_DOMAIN 2021-04-12 08:38:24 +00:00
Evangelos Ribeiro Tzaras d253870509 sip: gst-rfc3551: Add docstrings for public functions 2021-04-12 08:38:24 +00:00
Evangelos Ribeiro Tzaras 2cb8139094 sip: gst-rfc3551: query for plugin availability 2021-04-12 08:38:24 +00:00
Evangelos Ribeiro Tzaras a5a9f728ae sip: media-pipeline: only create pipeline after codec negotiation 2021-04-12 08:38:24 +00:00
Evangelos Ribeiro Tzaras c2bd6e9344 sip: media: rework codec negotiation
introduce `calls_sip_media_manager_get_capabilities ()` which takes
a GList of MediaCodecInfo's as input to generate a SDP message.
If using in an SDP answer we simply feed it a list of the common codecs
as gathered from the SDP offer.
2021-04-12 08:38:24 +00:00
Evangelos Ribeiro Tzaras 4eb07148cc sip: call: rename setup local/remote connection functions
Avoid ambiguity by renaming the functions. `setup_local_media ()`
could give the impression that we're setting up media codecs which
is not the case.
2021-04-12 08:38:24 +00:00
Evangelos Ribeiro Tzaras 157dc1fffb sip: media: use number types for payload id and clock rate
This is needed for the next commits where we check the received SDP
offers/answers.
2021-04-12 08:38:24 +00:00
Evangelos Ribeiro Tzaras 7d113d4180 media: manager: support multiple codecs SDP wise
static capabilities are now supporting multiple codecs and generate correct SDP
messages. This only relates to SDP offers. When we are answering an offer we
must take the offer from the other party into account when creating the answer.

Hence why we differentiate between "static" and "dynamic" (not implemented yet)
capability strings.
2021-04-12 08:38:24 +00:00
Evangelos Ribeiro Tzaras 9fd43eaca8 sip: media-manager: remove unused function prototypes 2021-04-12 08:38:24 +00:00
Evangelos Ribeiro Tzaras af3cda9c5c media-manager: codestyle
move public function `get_best_codec ()` to the bottom
2021-04-12 08:38:24 +00:00
Evangelos Ribeiro Tzaras b1add894be mm-origin: fix memory leak 2021-04-07 18:25:09 +02:00
Evangelos Ribeiro Tzaras e92ccb4f8b mm-origin: codestyle
be consistent in the naming of callback functions
2021-04-07 18:22:56 +02:00
Evangelos Ribeiro Tzaras a44c265903 sip: remove FOR_TESTING ifdef 2021-04-06 16:55:33 +00:00
Evangelos Ribeiro Tzaras 4a264252a7 plugins: build as shared library instead of shared module 2021-04-06 16:55:33 +00:00
Evangelos Ribeiro Tzaras a559587a19 mm: Implement country-code property
Closes #167
2021-04-06 14:27:26 +00:00
Evangelos Ribeiro Tzaras 463344c52b Add API to get SIM country code
This is a copy of Mohammed Sadiq's code in purple-mm-sms
2021-04-06 14:27:26 +00:00
Evangelos Ribeiro Tzaras 7d69d78b70 origin: Add country-code property
And add a binding in CallsManager for the default origin
2021-04-06 14:27:26 +00:00
Evangelos Ribeiro Tzaras 75d32d0924 sip: Allow controlling automatic account loading via environment 2021-04-05 06:13:44 +00:00
Mohammed Sadiq c30a41ffa9 Let calls-call be an abstract class
And adapt to changes.

A calls-mm-call IS-A calls-call (and so on)
2021-04-05 09:38:03 +05:30
Evangelos Ribeiro Tzaras e6b730b805 sip: pipeline: clean up in finalize () 2021-04-03 00:46:29 +02:00
Evangelos Ribeiro Tzaras 71cbc5c636 sip: provider: Fall back to reasonable values for local-port property 2021-04-03 00:46:29 +02:00
Evangelos Ribeiro Tzaras 5a7c22c80f sip: provider: use g_get_user_config_dir () for account config 2021-04-03 00:46:29 +02:00
Evangelos Ribeiro Tzaras 840ffa4653 sip: do not auto load accounts when running tests
because `calls_sip_provider_load_accounts ()` looks at the home folder
for a configuration file.
2021-04-03 00:08:31 +02:00
Evangelos Ribeiro Tzaras 19e7f8f119 sip-media: enable echo cancellation
by setting "filter.want" to "echo-cancel" for the pulsesink and pulsesrc
GStElement's.
2021-04-03 00:08:31 +02:00
Evangelos Ribeiro Tzaras 8a6f1bb203 sip: fix infinite ringtone loop
by making sure the call-added signal is emitted early enough
so that all consumers (display, ringer, etc) have a chance of getting
notified when the call state changes from f.e. DIALING to DISCONNECTED
similar to how its done in 03d960ccaf
for the dummy provider.
2021-04-03 00:08:31 +02:00
Evangelos Ribeiro Tzaras 17ac56fe44 sip: slightly improved authentication
* removed nua_callstate_authenticating as it was never hit
* move debug statement further up, because we might not reach it if no
  corresponding call is found
* handle 401 and 407 the same way
  note: we should record which realm we're authenticating against during
  REGISTER so we can prompt the user for additional credentials when
  challenged for a different realm - still happens when calling from
  a sip.linphone.org account to a jmp.bwapp.bwsip.io account.
2021-04-03 00:08:31 +02:00
Evangelos Ribeiro Tzaras cadaa6a3e0 sip: use g_return_if_fail and friends only for public functions 2021-04-03 00:08:31 +02:00
Evangelos Ribeiro Tzaras 45285062ca sip: improve connection handling by using relevant sofia tags
NUTAG_SUPPORTED and SIPTAG_EXPIRES_STR for instance

sip: include expire, urn uuid

sip.linphone.org accounts seems to be working!
2021-04-03 00:08:31 +02:00
Evangelos Ribeiro Tzaras de44a17fe5 sip: use ipv4 exclusively for now
IPv6 should work, but sofia's outbound engine keep printing
errors involving the outbound engine. Working theory:
Failing ICMPv6 (pings) can make sofia think we don't have connectivity.
Note that we also don't get any answers from the SIP servers we tried so far.
2021-04-03 00:08:31 +02:00
Evangelos Ribeiro Tzaras dcff7538f2 sip: media: improve SDP offer/answer handling 2021-04-03 00:08:31 +02:00
Evangelos Ribeiro Tzaras 97a925ee39 sip: handle i_outbound 404 errors 2021-04-03 00:08:31 +02:00
Evangelos Ribeiro Tzaras 7b54855f5e sip: media: change default codec to PCMA 2021-04-03 00:08:31 +02:00
Evangelos Ribeiro Tzaras c33fd53829 sip: Use app name in the user agent 2021-04-03 00:08:31 +02:00
Evangelos Ribeiro Tzaras 1836c7c915 sip: allow specifying local port and use IPv6 2021-04-03 00:08:31 +02:00
Evangelos Ribeiro Tzaras 37b9fe1c30 sip: rework setting SDP 2021-04-03 00:08:31 +02:00
Evangelos Ribeiro Tzaras afd5b5d6a8 sip: go offline when disposing CallsSipOrigin 2021-04-03 00:08:31 +02:00
Evangelos Ribeiro Tzaras 4521033127 sip: origin: register with SIP server 2021-04-03 00:08:31 +02:00
Evangelos Ribeiro Tzaras 017af5ec8b sip: pipeline: bind sockets for RTP
Add debugging information for used sockets
2021-04-03 00:08:31 +02:00
Evangelos Ribeiro Tzaras a53f07dfd3 sip: origin: do not use hardcoded ports for RTP 2021-04-03 00:08:31 +02:00
Evangelos Ribeiro Tzaras 6681077886 sip: origin: emit message on DNS error 2021-04-03 00:08:31 +02:00