Same as ptime but for the maxptime.
Also add replication of it.
This is required later to be used for the sdp_create() handling.
Additionally: fix tests, because maxptime now takes another
place within the media session, which doesn't affect functionality.
Change-Id: I058e35323849679976c60b2e9fb2555fd0168e67
While processing subscriptions in `monologue_subscribe_request()`
update the `->session_last_sdp_orig` related to the dest monologue.
This can be then later used in the `sdp_create()` the user
of which is `call_subscribe_request_ng()`.
Change-Id: Iee503ca94f82e0e5334fcd787f984f1ed3f7ca4d
Set the `monologue->session_last_sdp_orig` not while
replacing in `sdp_replace()`, but while initializing the
monologue in `__call_monologue_init_from_flags()`.
This allows to be agnostic in relation to `sdp_replace()`,
and let the `monologue->session_last_sdp_orig` be always
actual for the `sdp_create()` related processing
(without a need to pull the SDP sessions list towards it).
Change-Id: Ideb129ab8a94ef750abfa222335aede42bcbcc89
Instead of using separate char arrays storing
parts of the SDP origin (in monologue), just
use the corresponding structure.
Deprecate unused parts used before.
Additionally add logic:
don't set `->session_sdp_orig` for monologues
with empty tags. This leads to setting origin line
to those monologues, which will later skip updating it
with its own (so real one).
This is fixes the case with the offer/answer model,
where offer always sets its origin for the other side,
meanwhile the other side hasn't given the answer yet.
Then later this answer related monologue never gets
its real origin.
For this sake also adopt logic of `sdp_version_check()`
which serves 'SDP-version' and 'force-increment-sdp-ver'
flags.
Change-Id: I17f3ff67e1b3dafca797c5feb876ebb238dceaa2
Instead of using separate data members to
bring data with the `call_monologue` structure,
just use the whole `sdp_origin` object type (structure)
as a pointer and keep it aling with real SDP origin
of according monologue's side.
Refactor the code accordingly for `sdp_create()`
users (firstly only here).
Additionally introduce functions to alloc/de-alloc
`sdp_orig` object:
- `sdp_orig_dup()` returns a pointer to copied object
- `sdp_orig_free()` deallocates it
Change-Id: Iff6a777e4867e78c73ca79c73fdb73ff8e9f22eb
If already included by the main header (call.h)
then don't do that second time in the implementation (call.c).
Change-Id: I2cabf48cbd3bca00efc68c76b54c582223a10efc
Move the `call_subscribe_request_ng()` fully to a usage
of the `sdp_create()` only.
Carry the origin IP and net family via flags
to the monologue, so can be reused later when creating SDP.
Always use given SDP session origin IP address and family
for the SDP being prepared, unless sdp origin replacement
is required via given flags (in this case just used
an advertised IP of rtpengine).
Additionally: fix unit tests for subscribe cases accordingly
to the policy.
Change-Id: Ib7697876ce45e01597edd27764d4147d12f738c8
Run the SDES reordering routine also when the opposite side is plain
RTP. Add a matching test case.
Ref: https://groups.google.com/g/rtpengine/c/pG6NB24G-BY
Change-Id: I7844290e85e44c1bba2c7665202b6259aead1028
Split the code that handles reordering offerer SDES suites based on the
respective option into its own function. Rework it slightly so that it
reorders the list in place for simplicity. Remove the part that honours
SDES-no and SDES-only as these should affect the opposite (outgoing)
direction. This requires changing one of the test cases, which seems
more correct now.
Change-Id: Ie284d052d72031fad64c94767fa95c74639ae331
Update the bandwidth in the media object only on the side that has
received the SDP. Then when printing the SDP, look up the peer's media
via the subscriptions and use that one's bandwidth values.
Change-Id: I53c99b3628f53b2469f4cd73eb486c0110d989ba
Instead of carrying along an extra entry for the remote address, use the
existing advertised_endpoint, and look up the appropriate peer via media
subscriptions when printing the SDP.
Change-Id: I4c79053ba0fe072562ad71eb62ece3c527008936
Don't carry parameters required for processing
in the `sdp_create()` via the `stream_params`,
but rahter handle them like:
- parsing in `sdp_parse()`
- `sdp_media` -> `stream_params` in sdp_streams()
- `stream_params` -> `call_media` in ` __media_init_from_flags()`
Additionally: update the test "subscribe_request AMR asymmetric".
This is because we seem to never actually take into account
presence of bandwidth data in offer/answer model preceding
the subscribe request.
Change-Id: I5b4b19ae244c6bbf961d5ea7c18b6747519144db
Always ensure to set the actual sdp session timing
if given, when creating SDP using `sdp_create()`.
Otherwise just use default value "0 0".
A new dedicated func `sdp_out_add_timing()` introduced
for that.
Change-Id: Ic02e1a1f55e21b85e50793e1608978ca0951c49d
Always ensure to set the actual sdp session level
bandwidth, if given, when creating SDP using `sdp_create()`.
A new dedicated func `sdp_out_add_bandwidth()` introduced
for that.
Additionally: explicitely set b=RR/b=RS to -1 when creating
a brand new monologue (e.g. for subscriber requests case)
so it's not considered as 0 inadvertently.
Change-Id: I5bfa236ceeb326785feadadf7f22393814505d3f
For typed hash tables, enforce the correct type in the arguments to the
hashing and equality functions.
Adapt existing affected callback functions and change their arguments
from void* to the respective types.
Add reverse casts to GHashFunc and GEqualFunc in instances where these
functions are used in non-typed hash tables (that should be converted at
a later point).
Add convenience macro to create typed wrapper functions for hash tables
that use "direct" hashing (i.e. the pointer value).
Add wrappers for existing GLib functions that have generic arguments so
that they can be used in typed hash tables.
Change-Id: I43bb32969208f4aae49584d95c0df8353df6e2a0
Always ensure to set the actual sdp session name when
creating SDP using `sdp_create()`.
A new dedicated func `sdp_out_add_session_name()` introduced
for that.
Additionally: fix auto-daemon-tests-websocket and
auto-daemon-tests-pubsub accordingly.
Change-Id: Ie62573149ef9ae226dc8c955dcb2cfaaa4d3ae87
In order to be able to retrieve the top most media
subscription of top media for a given call monologue, introduce
a new func: `call_get_top_media_subscription()`
This is then useful for offer/answer model cases,
where most of cases single-to-single subscription model is used,
and one needs just an access to the opposite subscription/monologue/etc.
Change-Id: I6139a0987eda618d0d27b173abdce6c7562e0544
In order to be able to set `sdp_origin` related things
while initiating a monologue from flags (so in
`__call_monologue_init_from_flags()` ), duplicate `sdp_origin`
from `sdp_session` while doing streams parsing in `sdp_streams()`.
Change-Id: I17a4400a41623d336590010e9dfc5389460b27be
Use relaxed-order atomic ops to access config variables that can be set
during run time.
Rename config_lock to keyspaces_lock as the keyspaces list remains the
only object that it protects.
All other config variables aren't settable at runtime and so don't
require locks or atomic ops.
Change-Id: I7e01a34a4818a558d5648ae27a86f9880a95d050
The requirement to continuously update stats from the kernel has been
eliminates. Remove all relevant code.
Change-Id: Idc8093b64290b89ff3d015f3e61e4bbe25df6e23
We now have accurate "last packet" timestamps for both user and kernel
space. Since we iterate all calls anyway, we can use these timestamps to
update the gauges.
Change-Id: If0522c387ed1fba51058129ef37a41f45d0c0c8b
Use the already existing ext_seq (in shm) in place of srtp_index as
these carry duplicate information.
Kernel still tracks its own index in the crypto context at this point.
Change data type from 64-bit to (unsigned) int as we don't need that
many bits.
Change-Id: I2468c6a814964eb64a19d84c918d3a37c2494b66
Keep two separate timestamps, one updated by userspace code only and the
other updated by kernel only. This way we can tell where the packet
processing happens. For code that wants to report only the last
timestamp regardless of which one of the two it is, we add a convenience
function that just returns the newer one.
Change-Id: Ib3af7aa55006d8b32e2bc3db4f8bfa5514c57e40
Allocate memory from bufferpool for per-stream stats. No functional
change, but it allows sharing these between kernel and user space.
Change-Id: I370a49e1d94bb91c7fd0a2bc7d00ba65f99c4f6a
This has been broken for a while and nobody seems to be using it since
nobody complained. Remove it.
Change-Id: I114e7b1859ecd1982338c625f4523f372af3bbe8
Synchronize the `enum call_opmode` with the
kamailio module list of operation modes, as well
as with the `enum ng_command`.
This allows to operate based on `call_opmode`
in a more specific way, for example for a proper
setting of From/To tags based on directional flag,
which in its turn is being set using `call_opmode`.
Additionally introduce a macro checker, which covers
all previously non-existent operation mode types
as OP_OTHER, for backwards compatibility in conditions.
Change-Id: Idf4b9d910b81ee24be51008996c3fd02d8336a38
If multiple pollers are in use, use a single poller per call instead of
assigning pollers round-robin to each socket used in the call.
Change-Id: Iec49bd9d2fbd75d947d6232bcccfdfe87c4c6d7c
Store SDP session attributes in the monologue that were received instead
of the ones to be sent out. Look up the corresponding source monologue
when creating an outgoing SDP and insert that one's attributes.
Change-Id: Ic2e57db71b0e0b48b9868940d326b5a951d89e92
Consider call_media SDP attributes as ones that were received instead of
the ones to be sent out. Use media subscriptions to look up the source
media and print that one's attributes when creating an outgoing SDP.
Change-Id: Ibdf3a77a6f8a61654e0fc7c14aae16dfc6eabf14
An empty attribute list is not the indicative factor of whether or not
to empty out and re-fill the list of attributes, as having no attributes
is a valid scenario and should lead to no attributes present on the
output side.
Change-Id: I3464cd6cf0709a38b7c89a2f138d7a0329ce993b
Use a settable callback function to do attribute printing. This makes it
possible to use different sources for SDP attribute output in different
situations.
Change-Id: I30be7772dd73d9ca8cb9483de53eb60734e12950
Fix up tests to match reordered attributes.
Remove 10-year-old a=ssrc parsing code completely as it's unused.
Change-Id: I78064b1b2f27a442fe8bf4b448c7174c5458d3b1
Only the legacy protocols (which hardly anyone uses) don't pass a
`flags` object to the offer/answer functions. Make them also pass a
dummy `flags` object so that all the non-null checks become redundant
and can be removed.
Change-Id: Id2ec76ba307ad80958168a3a42e5679687765e22
In the file implementations follow the rules:
1. Firstly goes the correlated header file, then one empty row.
2. Secondly go system headers, so in angle-brackets, then one empty row.
3. Thirdly, go custom header files, so in double quotes,
then one empty row.
4. If there is "xt_RTPENGINE.h", it's mentioned next, but separately,
then one empty row.
5. If there are pre-processor definitions, they are added.
6. And eventually at least one empty row before the code.
In some situations it's allowed to step aside from the rules,
when inclusions are dependent on each other, so on the sequence,
and also possibly on some inline objects definitions, but if possible
to follow the rules, it's being done.
Change-Id: Ie512a970e230fe202398656d1942e8874bb14cd9
Instead of using transcoding flag `_TRANSCODING`
on the monologue level, we have to use that on the media
level in order to properly reflect the level on which
transocding is being used, and also to be able to selectively
set this for specific media sessions.
Change-Id: I9a25dc7be24f80b2b6ada816448a67933c762d86
Sinks must be a list of medias, not monologues.
Refactor `call_block_silence_media()`.
Additionally: deprecate the `call_media_subscribed_to_monologue()`
because of no use.
Change-Id: Iafa4fc87d613948b84373985711e8cebfa48fad8
gcc <12 propagates the const-ness of the given value to the newly
declared variable with __auto_type, leading to silly "can't assign to
const variable" errors. Work around this with an ugly macro.
Change-Id: Ic952c094c24bd802379fc10ad19d559613b2c1d0
There's two flavours of this struct being in use, even though the
structs' signatures are the same. One contains socket_t objects, the
other contains stream_fd objects. Separate them out and be explicit
about which is which.
Change-Id: I5ef1d154cc442528149f69be2e6a02625a6c650d
Stop handling redundant media subscribing in the:
- `call_get_monologue_new()`
- `call_get_dialogue()`
and leave this work only for the offer/answer model:
- `monologue_offer_answer()`
In the meanwhile the subscribe request/answer model
keeps on using directly the:
- `__add_media_subscription()`
Change-Id: I6cfaef634b8b9e5e805df25f1c6f80225648b75a
Allow codec_tracker_update to reference an existing codec_store. Then
when a supplemental codec type needs to be generated, make it look up
the type in the existing codec_store and re-use the existing payload
type if present instead of creating a new one. This allows payload type
numbers to remain unchanged during a re-invite.
Change-Id: I9e5edd897515a5e3eb5033aa6bbf21c8667d6133
During an offer, we update the codecs from the given list not only on
the side of the offerer, but also on the answerer's side, in order to
perform the codec answer routine during the answer phase. While doing
this, we empty out the existing list of codecs (on both sides) and
repopulate it fresh from the given list.
This can cause problems during a reverse re-invite, when the list of
codecs on the answerer's side already contained the codecs that had been
offered before. When setting up the new re-invite offer, we want to
retain codecs (and their payload types and format parameters) that were
already in place, instead of recreating a new list from scratch.
Improve this by adding a `merge_cs` option to the populating functions,
which points back to the stream_params codec_store. Codecs that would
have been removed from the codec_store during the repopulation are then
moved back into the stream_params codec_store instead. This then allows
the functions adding new codecs to the list (offer/transcode) to
reference these codecs that were previously in place, and so they can be
added back with the same options as they had existed before, instead of
recreating them from scratch.
Change-Id: I53e7ab10e9144a308a5c36be5ebfddd73c212f06
*** CID 1570963: Null pointer dereferences (REVERSE_INULL)
/daemon/call.c: 3553 in monologue_subscribe_answer()
3547 /* set src_media based on subscription (assuming it is one-to-one) */
3548 struct call_media * dst_media = __get_media(dst_ml, sp, flags, 0);
3549 GList * src_ml_media_it = dst_media->media_subscriptions.head;
3550 struct media_subscription * ms = src_ml_media_it->data;
3551 struct call_media * src_media = ms->media;
3552
>>> CID 1570963: Null pointer dereferences (REVERSE_INULL)
>>> Null-checking "dst_media" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
3553 if (!dst_media || !src_media)
3554 continue;
3555
3556 /* additional attributes to be carried for `sdp_create()` */
3557 if (print_extra_sess_attrs && !g_queue_find(&attr_mls, ms->monologue)) {
3558 sdp_copy_session_attributes(ms->monologue, dst_ml);
Change-Id: I391b95f61237e5a7af206b0568a1cf421dcbb8f8
From now on the `call_subscription` concept gets
deprecated, and instead of it the `media_subscriptions`
concept gets applied.
Benefits of this change is:
- ability to subscribe one-to-multiple medias (different monologues)
- media level manipulations, without affecting whole SDP session
- no need to use medias offset, to detect proper subscription's media
- there is no need of particular medias order, they can be
subscribed to each other in any possible way
(even though RFC still requires to always have proper ordering)
Deprecated objects:
- `struct call_subscription`
- `GQueue subscriptions`
- `GQueue subscribers`
- `GHashTable * subscriptions_ht`
- `GHashTable * subscribers_ht`
Deprecated functionality:
- `__unsubscribe_one()`
- `__unsubscribe_all_offer_answer_subscribers()`
- `__unsubscribe_from_all()`
- `__subscribe_offer_answer_both_ways()`
- `__add_subscription()`
- `__unsubscribe_one_link()`
- `call_get_call_subscription()`
- `call_subscriptions_clear()`
- `call_subscriptions_free()`
Offtopic: additionally this commit adds helper func:
- `call_media_subscribed_to_monologue()`
Change-Id: Ifb44f7a1ba5b483b1472882b1b8d06444dba1727
Rework the `set_monologue_flags_per_subscribers()` to work on medias
instead of working on monologues and refactor according code
appealing to this func.
Also to reflect the sense of this function better, change naming
from: `set_monologue_flags_per_subscribers()`
to: `media_update_transcoding_flag()`
Change-Id: I517ea13c91240d8fb9d3608edee16f132f4f61e1
Rework the `__update_init_subscribers()` so, that it takes:
- `call_media`
- `stream_params`
directly for processing, instead of operating on the whole ml.
Therefore also refactored code that appeals to the concerned func.
Change-Id: I56a9c6aa54b17d8c8dede2181414c481ca0cf2ca
During the `monologues_intact` stage of the `call_get_monologue_new()`
use media subscription in order to:
- update `os` ml, if still not set before
- update subscription ml's tag with totag, if not set before
After the first possible subscription's `offer/answer` ml
has been found and all work done, break cycling expecting
that this is one-to-one (so offer/answer) model, where only
medias of two monologues are involved.
Change-Id: I8b06cee2090563da4ce4c290ab3c0b9ce8c7ab3f
Rework the logic of fromtag monologue detection in the
`call_get_dialogue()`.
Fristly, try to match using given from tag (if there is one).
Secondly, try to match using given viabranch.
Thirdly, try to use top-most subscription of the top-most
media related to the totag monologue (newer behavior).
Fourthly, if still not found just create a brand-new one.
This change relates to the fact, that we stop using call monologue
subscriptions model and switch to the media based one.
Change-Id: I106bdd79f5e4754f76bd048f51c8fc211ee57410
Due to introduction of media subscriptions model.
Rely on subscription monologue's empty tag,
while trying to detect, whether or not to destroy given monologue
but with a clause that:
- this ml is subscribed to medias of other signle ml
It's important to keep this check because
if the `delete` is done with from-tag and to-tag,
just right away after an `offer` without the to-tag
and without use of via-branch, then the call's data
can potentially remain dangling without being deleted completely.
So looking up the offer side of the call through the from-tag
and then checking, if the call has not been answered
(answer side has an empty to-tag), gives a clue whether
to delete an entire call.
Additionally, introduce a helper function:
- `ml_medias_subscribed_to_single_ml()`
which checks, whether this monologue medias are subscribed
to a single other monologue medias.
Change-Id: I2474d24ac66ce2cb12bd282f2c0df809fce7880c
From now on, the newer media subscriptions based concept has been
introduced, which means the call monologue is able to have:
- medias, which have non-even amount of subscribers and subscriptions
- medias of different monologues in the media's subscriptions list
- medias of different monologues in the media's subscribers list
Further, improve the `call_get_dialogue()` accordingly so,
that a detection, whether or not a from-monologue has already seen
before given to-monologue, will be based on from-monologue's media subscriptions.
Absent to-monologue medias in from-monologue subscriptions list means —
to-monologue has been never seen before, and we have to update tags accordingly
as well as subscribe matched medias of to/from-monologue to each other.
Change-Id: Icef81d06ac2ee6e150ecdea7133547166290b015
Moving from call subscriptions to media subscriptions.
Add a possibility to run `media_stop()` and `__monologue_stop()`
for all related to this monologue media subscribers.
This is an improvement, which gives the following benefits:
- all subscribers are handled inside of the func, less code out of it
- the function gets in sync with new media subscriptions concept
Change-Id: Ia0b897f53438559a68c8b469c71fec72f0d562af
Use media subscriptions model in the `kill_calls_timer()`
to find subscribers and related monologues in order
the to update the `xmlrpc_helper` data.
Change-Id: I4e7e8586a701eeb135c34138ba5a9dc288817c8d
In the `dialogue_unconfirm()` (previously `dialogue_unkernelize()`)
use media subscriptions to find subscribers/subscriptions
and correlated to them medias to unconfirm them.
This change is bound to the switch from monologue
subscriptions to media subscriptions.
Additionally: Refactor unkernelize/unconfirm in `call.c`
To provide a sense of the functions clearer,
the namings of the following function singatures
have been changed:
- `dialogue_unkernelize()` -> `dialogue_unconfirm()`
- `__monologue_unkernelize()` -> `__monologue_unconfirm()`
Change-Id: If8cc2515eb26dcc4ffed02a420514f98d43cc5c6
Report to whom a `call_monologue` is subscribed and
who is subscribed to it using media level subscriptions
instead of using monologues one.
Change-Id: I07a7353d5682b9346d1ade25d11b902ee927d4ac
Add handling of SDP session level attributes for:
- `monologue_subscribe_request()`
- `monologue_subscribe_answer()`
This will be used by `janus.c` related functionality.
Change-Id: I1c50b5b9da08e7d8cb2c98eb6995d8610386d6ed
Move `a=extmap:` attribute to the `call_media`'s
`sdp_attributes` using `stream_params`.
Required by the `insert_sdp_attributes()` used in `sdp_create()`.
Additionally revert `extmap` unit test checks in the
`testVideoroomWebRTCVideo`.
Change-Id: If63e4e8733ea0899f34fae1f1d38997e9e2c081c
Move `a=ssrc-group:` attribute to the `call_media`'s
`sdp_attributes` using `stream_params`.
Required by the `insert_sdp_attributes()` used in `sdp_create()`.
Change-Id: I67025dc83dd8e5e46422b6dc1bc54aa9c838dfea
We have to move the list of attributes with following types
to the `call_media`'s `sdp_attributes` using `stream_params`:
ATTR_SSRC
ATTR_MSID
ATTR_OTHER
This is then required by the `insert_sdp_attributes()`
used by:
- `sdp_replace()` -> `replace_sdp_media_section()`
- `sdp_create()`
Additionally: move the `insert_sdp_attributes()`
to the usage of the `append_attr_to_gstring()`, which
gives SDP attrs manipulations control over attributes
being inserted into SDP. Previously not supported.
Additionally: `process_media_attributes()` takes new
argument `bool strip_attr_other`, in order to control
whether or not to strip `ATTR_OTHER/ATTR_SSRC/ATTR_MSID`.
For now there is only one user of it `replace_sdp_media_section()`,
but for later on, we can control this using this bool.
Additionally: `print_sdp_media_section()` takes new
argument `bool print_other_attrs`, in order to control
whether or not to strip `ATTR_OTHER/ATTR_SSRC/ATTR_MSID`.
This is required, because the sdp replacing/creating mechanism
needs a controllable way of adding them, users are:
- `janus_videoroom_join()`
`janus_videoroom_configure()` - always need them
- `call_publish_ng` - always needs them
- `call_subscribe_request_ng` - never needs them
(otherwise leads to a duplication of such attributes)
- `call_offer_answer_ng()` - requires them always
- `call_subscribe_request_ng()` - never needs them
(otherwise leads to a duplication of such attributes)
Change-Id: I9c83d99da1603acb55443c462797b2cd1e72477d
Stop using the call subscriptions model in the
subscribe request/answer functionality and move to
the media subscriptions.
Change-Id: I8aab2b1b4cdf9a3c5a04172c395ca509295ce0a3
If we're updating the handlers for one particular source -> sink flow,
only stop/reset the handlers matching this flow.
Change-Id: I1d046f47f8d26cac47c5d0f4318498eacb6c5677
Fix all instances of argument-less function signatures.
Fix all instances of auto-cleanup variables declared after they need to
be in scope.
Change-Id: I3a005df03ede971e08d4f62d7c7711a1913fda5e
With the "foreign" flag now stored in call_flags, restoring a call from
Redis restores this flag as well, overwriting the desired flag as we had
set it through call_get_or_create().
Reverse the flag setting by taking it out of call_get_or_create() (where
it's always false anyway, except when coming from Redis) and setting it
explicitly with call_make_own_foreign() after restorting call and its
flags.
Change-Id: Ib68be2aeedfa988b7555e426fa337657e1062245
Stop using call subscriptions for lookups based on
the `__sub_is_transcoding()` and use media subscriptions instead.
Change-Id: I545daca19f5ce433fd660a5a7d60181ac4ed1d8b
Part 1.
Deprecate usage of the call subscriptions for updating
transcoding attributes, use media subscriptions instead.
Change-Id: Iadde906189c9634d7691d823556f2c0dfd61a655
Stop using call subscription in the `monologue_offer_answer()`,
which is used here to update transcoding related attributes and
use media subscriptions model instead.
Change-Id: I27abfe23ed2f3f532c3899e5d483cb302e43a142
Start using the media subscriptions model
(based on newly introduced `media_subscription` objects)
in scope of:
- `redis_encode_json()`
- `json_link_medias()`
- `rbl_subs_cb()`
Change-Id: I3f7267ab156b361d7e7bec4ff91a8976a7be02ee
Start using the media subscriptions model
(based on newly introduced `media_subscription` objects)
in scope of `call_get_dialogue()`.
Change-Id: Id7b8f84354bcc0525ff180d94cedfc6dc29a7c63
The following functions have been deprecated
due to no use:
- `__offer_answer_get_subscriptions()`
- `__tags_get_subscriptions()`
Change-Id: Id71dcd1a5573720299711b369410cd7fcd9de476
Start using the media subscriptions model
(based on newly introduced `media_subscription` objects)
in scope of `__update_init_subscribers()`.
Change-Id: I45446239384cf2813d9ae6ecadb2499eefa86ca8
Start using the media subscriptions model
(based on newly introduced `media_subscription` objects)
parallel to existing model, which is based on
the `call_subscription`.
Change-Id: I1f111ef181b2d698609c0b28dd72431bb3f2cf0a
Introduce `media_unconfirm()` to do a selective handling
of medias to unkernelize the correlated to it streams.
This is analogue of the of the `__monologue_unconfirm()`
but for medias.
Change-Id: Id8ede0fc56412021c301e97764fd5dd070b7d484
Previous implementation assumes that we use the `call_subscription`
objects in:
- `call_offer_answer_ng()`
- `call_update_lookup_udp()`
- `call_request_lookup_tcp()`
when appealing to the `call_get_mono_dialogue()`, in order to
get the `call_subscription` objects, in order to then pass it
for usage in the `monologue_offer_answer()`, where the most important
again is to use monologue references stored inside
the given `call_subscription` objects.
Instead of using the `call_subscription`, just use `call_monologue`
objects as a base data objects for this work,
which will allow us in the coming commits to deprecate
the `call_subscriptions` based model and
get to the subscription model based on medias.
Change-Id: Ia9ee5ba66522929acbceca28854ebccd3705635a
Introduction of the basic functions required for
a handling of the media subscriptions:
- `__unsubscribe_media_link()`
- `__unsubscribe_media()`
- `__unsubscribe_all_medias()`
- `__add_media_subscription()`
- `__subscribe_medias_both_ways()`
- `__subscribe_matched_medias()`
- `call_get_media_subscription()`
- `call_totag_subscribed_to_monologue()`
- `call_viabranch_intact_monologue()`
Change-Id: Iad2af5323b2ea8a10a83064d9ee72106c1d8f9c0
Forking to background kills already created threads, so forking must
happen first and thread creation after.
closes#1695
Change-Id: I743b890b83903d9e0b3248b032844e7e357d2307
Make sure we don't try to send on closed sockets or to endpoints which
haven't been initialised.
Fixes unexpected fallout from 83c7336e
Change-Id: If73d61e52edeb72257515adab7428ecef82c2797
Transcoding is flow-specific, so it doesn't make sense to have a flag
for it in a call_media section. Instead we use the transcoding flag set
on the call_subscription objects (on subscribers), and set/unset a flag
on the monologue struct, depending on whether any media flows (going to
subscribers) have transcoding enabled.
Change-Id: Id671d56e56a22eaa8e56f6d449770b0c7b086cea
Pass the subscription object to codec_handlers_update to eliminate the
need for a return type and the subsequent if/else.
Change-Id: I311b3e8ca14ee5090cf329163975354385cee800
Do a direct lookup of the call subscription object and set the
transcoding flag directly. Remove obsolete function.
Change-Id: I8b8329e53afb641fad80d38b45120efd46c408db
This is a convenience function that does an unnecessary loop iteration.
We have a hash table to perform the exact lookup needed. Turn the
function into a simple wrapper which uses the hash table.
Change-Id: If91976a955dea80e882656849b0b13d426e5748f
We have the subscription objects available now, so we can directly set
the transcoding flag without having to do a hash table lookup.
Change-Id: I2b85f34ca4d03dfaf81d92ea252902d1ee194efd
Instead of just return the monologues involved in an offer/answer,
return the respective subscription objects that have the monologues
pointing to each other. This makes it possible to set flags within these
objects.
Change-Id: Id88e56e1bf164a75e2172d0df04316cde5d8a955
Deprecate increasing/decreasing functionality of
the call timer run duration, because it's not needed anymore,
most of the unnecessary functionality has been moved lately
to separate dedicated threads and the `call_timer`
is simply unloaded for now.
Additionally: remove logging with timestamps, because
we do not need to monitor it anymore.
Change-Id: I8d1fd260472528fcee6a12f48b9a92f195893787
Move the `ice_slow_timer()` functionality to a separate thread,
so that we do the work more efficiently, and not be dependent
on the call_timer runs by poller.
Furthermore it makes more sense to keep in the `ice.c`,
since it obviously has to do with ice timing.
Additionally:
Update the test-stats due to these changes in the `call_timer()`
We have to call the `ice_slow_timer()` now explicitely from
the test-stats.c, because the `call_timer()` is not anymore
responsible for providing stats counters rate calculations.
Change-Id: I03377dd59ea71c27497e1f4d30164075f05165cd
Similarly as for the `stats_rate_min_max()`,
move the `stats_counters_calc_rate()` functionality
to the same separate thread, so that we do the work
more efficiently and not be dependent on the call_timer
runs by poller.
Furthermore it makes more sense to keep in the `statistics.c`,
since it obviously has to do with statistics.
Additionally:
Update the test-stats due to these changes in the `call_timer()`
We have to call the `stats_counters_calc_rate()` now explicitely from
the test-stats.c, because the `call_timer()` is not anymore
responsible for providing stats counters rate calculations.
Change-Id: I1682eb76e3057f0f431c27b9633717d965313a1a
To do the work more efficiently,
and not be dependent on the call_timer runs by poller,
we should move the ports iterations (stats update from the kernel)
functionality to a separate thread, to make it faster and
not be dependent on what happens in the `call_timer` at all.
Since it has nothing to do with the call timers.
As an additional benefit: we unload the `call_timer` runner.
Change-Id: I511529ce504ef3d29f4e9d6d731ffd470d78d27a
To do the work more efficiently,
and not be dependent on the call_timer runs by poller,
we should move the `stats_rate_min_max()` to a separate thread,
to make it faster and not be dependent on what happens in the `call_timer` at all.
Since it has nothing to do with the call timers.
Change-Id: I9a39e1b63cb8741377f5af5b2d52d4f8b428a0ad
To do the work more efficiently and not be dependent on
the `call_timer` runs by poller, we should move
the releasing of sockets to a separate thread, to make it
faster and not be dependent on what happens in the `call_timer`
at all. Since it has nothing to do with the call timers.
Since now we have two queues:
- thread scope (local): ports_to_release
- global one: ports_to_release_glob
`sockets_releaser()` uses the ports_to_release_glob,
meanwhile appending in the `call_timer()` happens using the
ports_to_release.
Change-Id: Iadd966ac895b2dd64f81269d4fdf5d83747fe0b7
Deprecate usage of the bit flags for return.
And instead do:
- only return true/false for the redis update
- check if we have to destroy the whole call using the
`call_monologues_associations_left()` only
Additionally remove unused variables.
Change-Id: Ie858c533d1aa4b74024d65c7064aa56437389882
Check globally left monologues (with associations left) after
the `monologue_delete_iter()` has already done its job.
This is needed to prevent cases, when a recursive call of the
`monologue_delete_iter()` leads to blocking of the whole call
destorying, meanwhile it's required, e.g.:
- A is in progress of destorying
- B gets recursive call of `monologue_delete_iter()` and sees
that A has still one association left with C, which A simply
hasn't manage to remove yet.
This commit introduces new function: `call_monologues_associations_left()`
Change-Id: I0941c18a76fa8c2a78d3864aee9e6433283bec88
This commit: 6f0ad0db0f
introduced an improved behavior of the call deconstruction
when dealing with multiple forked legs. But it also
introduced a regression related to TPCC related calls.
This is because it takes into consideration existing
`->viabranches`, which is not efficient in certain cases.
Instead, we just have to ensure, whether there are
other monologues of the call object, which are not directly
"visible" for this branch being cancelled (so they are not directly
associated to that), but they might have own associations
present, which means the call mustn't be globally destoroyed.
Change-Id: I630f2d88ef3b557af3a95816fc2703daccaff374
Upon calling the `monologue_delete_iter()`, we have to take into account
an amount of forked legs we have now entirely in the call.
If there's more than 1 forked leg, don't mark the whole call for a full destruction,
since other forks might be successful (and they are not in a scope of processing now).
Only destroy this branch and associated to it monologue(s).
Change-Id: I6fdb4ba33ae7582578d84d57d91f9536d932ca47
When the `discard-recording` flag is given in one of the commands to
rtpengine (e.g. in the `delete` command), the metafile is renamed to a
.DISCARD suffix and then deleted.
The recording daemon then, seeing the .DISCARD suffix, proceeds to
immediately close all recordings, delete the files if any, and delete
the entries from the DB.
Change-Id: I3f0cac129f2d56cbccd770d43bf434dea6c0a0db
Rename the original call_delete_branch() to call_delete_branch_by_id()
and provide a new call_delete_branch() which takes a reference to a call
object instead of a call ID.
Change-Id: Ie549e7f550fab5edc6e81472e78565e1925fae67
Move trickle ICE handling out of __media_init_from_flags and into a
higher-level function. This obsoletes the special magic return value to
indicate a trickle ICE failure.
All methods accepting trickle ICE updates must now explicitly call the
trickle ICE update function.
The requirement to have a full dialogue for trickle ICE updates is
removed as trickle ICE only affects one side.
Change-Id: I0850e1858876ca7bcdd39b7144b53b5a4afed53e
Moving code for handling (queuing, dequeuing) trickle ICE fragments into
ice.c, where it makes no sense. No functional changes.
Change-Id: Ib68f82e8d58efe066fdc48cd32ca9869cdeab846
This is slightly more performant as it does the retrieval and removal
with just one lookup instead of two.
Change-Id: Iba702704218ac4689a6788fd23a792ad40460ea8
We're also in controlling role for subscribe answers.
Make sure we don't clobber the source media's ICE options when adding a
subcriptions.
Change-Id: I5361462aefdbbe6411841332b69a8dc4b0e1e013
Using a pointer array instead of a linked lists allows us to directly
reference a media section by index number, without having to spool into
the linked list.
No functional changes.
Change-Id: I8b0e93f0c2e9addbcb4c938894118ed4a6aec768
If a subscribe answer says that it doesn't want to receive any media
(i.e. `inactive` - `recv` flag unset), clear our corresponding `send`
flag so that we actually don't send media there.
Change-Id: I8862cc6f4121a82c723a8303ba70345d064cd243
... which is the more direct way to copy a bit flag in a mirror fashion,
instead of doing an if/else.
Change-Id: I7283d31f7a44e6bf1ee15ea1c14cb3b8fe0293b9
Track audio writes in the mix buffer to set the `active` flag to true
whenever a write occurs, which makes it possible to create the buffer in
an inactivate state and implicitly set it active on demand.
Handle the mix buffer not returning any data in the RTP sending logic
(which is what happens for an inactive buffer) by simply not sending any
packets.
Change-Id: Iaeb0f6deadb3d90020c8c62872735cc94db80504
Similar to the existing media_player, but instead of simply producing
its own standalone output media stream, the audio_player takes over the
entire media stream flowing to the receiver, including media forwarded
from the opposite side of the call, as well as media produced by the
media_player.
Change-Id: Ic34ecf08fc73b04210cfffb1a7d795b462ece5ea
Don't change to a new port for sendonly streams as this causes problems
with NAT. A device receiving a sendonly SDP with a new port won't send
any RTP to the new port, leading to a closed (non existent) NAT mapping.
Change-Id: I2ea2163eb9f1203226bd781b53f421c790a86f0a
The old port latching logic was simply to use the last (newest)
allocated endpoint_map. This turned out to be wrong, because the last
used socket on the monologue could have been one that was allocated
earlier (and older endpoint_map), as it can happen during repeated
re-invites. Add a new function to actually look for the correct
endpoint_map, matching the currently used socket, to make sure the port
doesn't change.
Change-Id: Iae768fe48539264575aed67cbbb6b08ac745130f
Defined in RFC 8842. If a tls-id was previously given and a the new SDP
shows a different tls-id or none at all, we must restart DTLS.
Relevant to #1585
Change-Id: I554234dfcacbd330c7a0c6aea68f24d0449cba21
Rename structs and variables to make it clear that these min/max values
are min/max per-sec rate values.
Carry mins and maxes separately from averages. This changes the meaning
of $command_ps_avg away from an "average of averages" to an actual
average, which is more accurate.
Calculate this average based on per-interval differences and interval
duration (stats_rate_min_max_avg_sample).
Side effect: As rtpe_latest_graphite_interval_start is now set in
print_graphite_data instead of in graphite_loop_run, the test now
reports a different "interval calls duration".
Change-Id: I67b1118c18ca2464a48c4836fca3cfdb4d53c898
Perform accumulation of stats only once (i.e. increasing an actual
counter) and report stats based on differences to previous values,
instead of carrying multiple stats counters for each metric and
resetting each counter to zero whenever stats are reported.
`rtpe_stats` is the global master accumulator.
`_intv` variables are intermediate and local storage for values sampled
from `rtpe_stats` at regular intervals.
`_rate` and `_diff` variables hold stats calculated from `rtpe_stats`
and the respective `_intv` variable whenever the sampling and reporting
occurs.
`stats_counters_calc_diff` is used to calculate stats as differences
between `rtpe_stats` and the last sampled `_intv`
`stats_counters_calc_rate` does the same but calculates a per-second
rate, based on a microsecond duration.
Eliminate now-useless struct global_stats_ax
Change-Id: Ic4ca630161787025219b67e49b41995204d60573
... so that the publishing session gets notified about "webrtcup" and
not the session which created the room.
Change-Id: If7b308df4afa7afb19ecaca1f743f87c3c736007
This is a new option flag, which provides a possiblity
to select specific crypto suite(s) for the offerer from
the given list of crypto suites received in the offer.
This will be used later on, when processing an answer from
the recipient and generating an answer to be sent out towards offerer.
Furthermore, this is being decided not when the answer is processed,
but already when the offer is processed.
Flag usage example:
`SDES-offerer_pref:AES_256_CM_HMAC_SHA;AES_256_CM_HMAC_SHA1_32;`
Change-Id: I2b22b38347d24f27331482e18b92305fbadb2520