Because used only within daemon/sdp.c
makes no sense to keep it visible for other
files (even though there is no even
a declaration in the header).
Change-Id: Ifb4798aa713fec9f787f1422a15ea41ae6c5b190
For the `print_sdp_media_section()` change
parameter naming `message_setup` -> `sdp_create`,
so that other differentiations can also take place
in this function.
E.g. slightly different rtcp handling for the
sdp_create in comparison to the sdp_replace (because
no chopper based approach can be applied here).
Change-Id: I555e0ace04b384d6907f831c2a3de9a0b09777e4
Support session level group attribute
for the sdp_create approach.
Additionally: fix the `testVideoroomWebRTCVideo` test,
because as it turned out it used to lose the `a=group:`
attribute before.
Change-Id: I799dfe0dcc5e0708864150cd0e0262a61dd4cc05
Don't just set always to true (if media is active),
but check if it's a MESSAGE type, which is by default
inactive.
Change-Id: I492e6fb62acb6fb6a112353535171a22e93baf3f
For the `sdp_create` based approach, introduce
`a=setup:` handling in cases with the message media
type processing.
Currently this has to be divided for sdp_replace
and sdp_create users. This is because sdp_replace one
uses chopper based approach, which in combination with
changes in this commit dupplicates the setup attribute.
In order to separate the logic both approaches,
introduce a temporary bool, until the time when
sdp_replace gets fully deprecated.
A move of the check out of the `is_active` condition
is required, because the message media type isn't active
and hence has to be checked out of the active context.
Change-Id: I32b8f3f3928ba22e030ab5a6414b93fcd7c47201
Just keep the `s=` attribute empty, if it is
coming like that in the message being processed.
Current behavior of the sdp_create approach just
inserts the `rtpe_config.software_id`, which is wrong.
Change-Id: I1235081b90786f5d9480fd1cad9f2751c60e7720
Instead of setting it in two lines via temporary variable,
just negate it in one line for laconicity reasons.
Change-Id: Ie65d68ef5b8082f5de544ab2a9833a59d5e01d9a
Added support of the CT (conference total) bandwidth
attribute for the SDP session level. See RFC8866.
Will be required later for the SDP formatting in `sdp_create()`.
Change-Id: Ifc64f68d7acee8ce253882f4fa480bbf7ad7c0bd
Even if the media isn't accepted, still check for the mid
presence and add it, if required. This is the only attribute
to printed, for the media which wasn't previously accepted
(so 0 port added for it).
See: #1361 and #1362.
Change-Id: Ib92930d6e1ec4dfe526fa18869c5f7a8e17f6a4f
Move handling of the usual `m=` line, so printing
of: media type, port, protocol (e.g. RTP/SAVP),
to a separate function to make the `sdp_create()`
implementation be more laconic for reading.
This function is a default alternative for the
`sdp_out_add_osrtp_media()`.
No functional changes.
Change-Id: I469abbbf6e203d2cc655a26bbf44ff3c7a66b1df
Move a check that port isn't 0 to the function itself,
instead of checking each time before calling the func.
Change-Id: Iec43770fc0f5846c63f6e11d8c2dfb2be135aec6
Make the `sdp_create()` implementation be more laconic,
and move the OSRTP related handling into separate funcs:
- `sdp_out_handle_osrtp1()`
- `sdp_out_handle_osrtp2()`
Just refactoring, no functional changes.
Change-Id: Ib3c5f58d215ea3e0622d328656d82919dfa391c5
Move printing of other session level attributes (so taken
from the coming SDP and to be carried out to the outgoing one)
to a dedicated function `sdp_out_add_other()`.
No functional change.
Change-Id: I94713545e7610d74d36a6a5f3027c64407c6750c
Add a function to handle other non specific attributes
for the session level.
E.g.: ice-lite or anti-looper (rtpengine).
Change-Id: I147403ff9e3c3ff8be6718b8b118e405442a9220
In case when the `packet_stream`, selected via the
media being iterated, has no `->selected_sfd`,
just set the port value to 0.
Also skip adding any further attributes, like
connection information or any other, since
this media by fact is not accepted.
This is a usecase for OSRTP related scenarios,
where RTP media session can have 0 port set.
Change-Id: I7784b80e7d51d19106ea30db585143375a5ba050
Move printing of attributes to a separate func,
in order to be able to re-use this print during
the same media section iteration (e.g. with OSRTP).
Later on this func is to be merged with the
`print_sdp_media_section()` function, after
the sdp_replace is fully deprecated.
Change-Id: I15825ed6eecb450b742b31677961fd8ddbf950fb
Added support of the AS bandwidth attribute for the
SDP session level. Will be required later for the SDP
formatting in `sdp_create()`.
Change-Id: I1bde4659679de6e60bdad12c0578ced2c1983300
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
Already checked before in sdp_version_check.
Fixes defect:
/daemon/sdp.c: 2936 in sdp_version_replace()
2930 /* update string unconditionally to keep position tracking intact */
2931 chopper_replace(chop, &origin->version_str, &origin->version_output_pos, version_str, version_len);
2932 }
2933 }
2934 /* for sdp_create */
2935 else {
>>> CID 1598877: Null pointer dereferences (REVERSE_INULL)
>>> Null-checking "src_orig" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
2936 if (!other_orig || !src_orig)
2937 return;
2938
2939 other_orig->version_num = src_orig->version_num;
2940 /* is our new value longer? */
2941 if (version_len > other_orig->version_str.len) {
Change-Id: I068a13ccc454fd61600546d05c78bde979203fc7
Don't treat the `force_inc_sdp_ver` flag as
the `replace_sdp_version` one, but consider
it as a separate option flag.
Correct usage of it accordingly.
Additionally: change sdp_version_check() func signature
to use `force_increase` as bool.
Change-Id: I9ed772a5a3535d887dda5a5a116b6326c8f5f46a
Obsolete str_init(), rename STR_INIT() to just STR(), and replace all
instances of str_init() with STR().
no-op
Change-Id: I981529063ad2ea26089add467f7a84b638dbf423
These helper functions were largely unused or inconsistently used.
Create a new type and streamline usage.
Change-Id: I5cd9756a26994d027dd4ff6a2d01a8c6c3cffe30
Add support of replacements flags:
- replace-origin
- replace-origin-username
- replace-origin-full
Additionally: fix websocket tests, because now
the `-` symbol isn't considered as the one to be
set always when using `replce-origin-full`.
Instead it will use values of the very first parsed SDP.
Change-Id: I7636f020cb92cb760fcd25b0b84509e6d5ba2a9f
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
The option flag `replace-origin-full` should replace whole
origin (o=) line of the SDP body, so that all origin fields
in the `o=` line always remain the same in all SDPs going to a
particular RTP endpoint.
So, not just a straight-forward replacing with own values.
A behavior in relation to the address field is the same
as by the `origin` option flag.
Correct according tests and add one more.
Change-Id: I4bcb740db5cd68a75fb754f5f6b5d21e19b05e1b
Use the `->session_last_sdp_orig` for the version as well as
username type of replacements.
Remove superfluous code.
It's possible to handle it like that, because the last user
of the sdp_replace func, which is the offer/answer model, sets
the `->session_sdp_orig` actually in `__call_monologue_init_from_flags`.
Additionally: add tests for the user type of the origin replacement.
Change-Id: Idd60e628c676840c2e844077303035c0edec67e2
Make the `sdp_replace()` compliant with `sdp_create()` in terms
of the replace `origin-full` flag support.
Also introduce according unit tests.
Change-Id: Ib950a957d5ee3820dbc8a831fe0a7ea570b4c59b
Two version of the origin replace exist from now on:
- `origin-replace` - replaces only the origin address
- `origin-replace-full` - replaces all the values,
so name, id, version and IP family with address.
Values for replacing are taken from the rtpengine instance,
so local values provided by the daemon.
Additionally: documentation updated accordingly.
Additionally: revert changes in pub-sub test.
Change-Id: I4d068944726d1ab82683ca5aa641a954890aefcf
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
For the sake of simplicity in usage and also
visibility for rest of file implementers
via the types.h, turn `strct sdp_origin` into
the typedef `sdp_origin`.
Change-Id: I13e71b9bbc944cf2931afc4fbc2c3f465eea815c
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
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