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
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
Set real values instead of just: -1, 0 or 1.
This affects: AS (per media) and RR, RS (per media/sdp session).
Change-Id: I9cf565548726c96c2ce74c86c1cbfe7920d8d943
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 media session level
bandwidth, if given, when creating SDP using `sdp_create()`:
- AS
- RR
- RS
All of them can be presented simultaneously.
Adjust existing function `sdp_out_add_bandwidth()` to comply
with media session level demands.
Change-Id: I9599df051109ec05c4549ae79fae906fb5980dad
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
As the standard assumes, that the bandwidth
can be also controlled per media, it makes
sense to support it, so introduce `b=AS:` attr
parsing.
Change-Id: Id4b344c10bbd45b1f3ba14a882d58072a4e43c68
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
In all the cases (apart PUBLISH) ensure to set the actual
media connection when creating SDP using `sdp_create()`.
A new dedicated func `sdp_out_add_media_connection()`
introduced for that.
Change-Id: I26e9b123aad95e2d335aef903d441ecc2cae2605
To prepare the deprecation of session level connection
usage (so the `c=` attribute of the session level),
deprecate first the `replace-session-connection` flag
support, because it will have essentially no use.
Change-Id: I9f9cb8f06d03d1c107a5c928054a79409642bb5b
Rework the `sdp_out_add_origin()` func so, that
it's compatible with offer/answer model.
Additionally it uses the previously existing logic
for the PUBLISH operations always, regardless any
conditions.
Additionally: fix auto-daemon-tests-websocket accordingly.
Change-Id: I0bddc67f4ebe47a24063ccc82428929aeb6cc37a
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
Always ensure to set the origin name properly when
creating SDP using `sdp_create()`.
A new dedicated func `sdp_out_add_oirigin()` introduced
for that.
Additionally: fix auto-daemon-tests-websocket accordingly.
Change-Id: I671f7b54f8bed9c4b78d6532c0072836d77173e6
In order to be able to use similar attributes manipulations
as in the `sdp_replace()` (based on the `sdp_ng_flags`)
a non-const parameter is required.
Change-Id: I4dce1edfa16b0c2dcd9315a2a3d8cc585f32858f
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
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
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
Make 'extmap' attributes another type of OTHER attribute, which are
printed verbatim, but instead of skipping over them when parsing them
and "strip extmap" is requested, always parse and store them and then
skip over them when printing them.
Change-Id: I9f8e9c468ea0d1b20d82ae563c334513a8c0c43e
All OTHER attributes are printed verbatim as strings, but we still want
to be able to distinguish between different types of them. Introduce an
extra enum for that purpose.
Change-Id: I24351c26a45ffbbe1dec9299faa5d0ea65cada29
Even though both true and false are set in different calls to the
function, there's no effective difference in output.
Change-Id: I0d29dbf2d8041523b6b28bb0c0270bb6b414dcb5
Make sure sdp_attributes is only used for _received_ SDP attributes, and
not ones that we want to send out. The only places where self-generated
attributes are being used is the T.38 gateway.
Change-Id: I1f035cd42a35fa250ea477700a1a88ad59efcc38
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
Create a separate smaller struct that contains only the relevant pieces
of the attribute string. Embed this into the larger `sdp_attribute`
struct, which also contains all the parsed-out information, which is
needed only during initial processing.
Functional no-op.
Change-Id: I5a70f8b7c9922c312aa03782f85e7db40f054092
Fix up tests to match reordered attributes.
Remove 10-year-old a=ssrc parsing code completely as it's unused.
Change-Id: I78064b1b2f27a442fe8bf4b448c7174c5458d3b1
For tagged attributes using a `a=name:tag value` format, extend pattern
matching so that just `name` matches as well as `name:tag`. Only support
this for removal (not substitution) as these attributes generally can
appear multiple times, and doing a static substitution on all of them is
kinda pointless.
Change-Id: I07c7f6e9075e862902bffe679d5de8618162eb8f
As we don't directly append to an existing GString any more anyway,
simplify the function signature by just returning a new GString if the
format string is known.
Change-Id: I9f8e6fbd93ea063eecb519cd57366effd4022f75
For attributes that have a value, consider both the full attribute
string `a=name:value` and just the attribute name itself `a=name` when
checking for removal and substitution instructions.
Change-Id: Ia648a4db8c80a5c23abf44f75b45e29acdf1b91d
With attributes names separated from their values, we can implicitly add
the separator ':' instead of having to include it in the attribute name.
Change-Id: Ie47aa5b76aa3261f4171707f88a203c911536ede
Where the attribute name is known, only pass the name itself as "name"
and pass the rest as "value" for clearer indication of what is what.
Change-Id: I564ce894b1d14b1acfd1f1b351ad2a316688a714