Convert existing sdp manipulation helpers
to work with arrays directly, independently from
which array is actually given.
Moreover, don't use the `G_N_ELEMENTS()`,
since we already have the `__MT_MAX`
as the size of the array, so we can directly use
that instead of relying on the G_N_ELEMENTS macro
(for array size checks).
Change-Id: I38e71dab30a467b933c213c8157fa06651ebaf04
Not needed any more. All strings reside in the call's memory arena, and
SDP rewriting isn't a thing any more.
Change-Id: I594b85fe26f44fa25312eb97fb65de238fc18920
Convenience wrapper for &STR()
This is useful so that STR() and STR_DUP() can be extended to avoid
duplicate expansion of its macro arguments.
Change-Id: Ieae170807c11b0cdd8b52fac9bab98dccdc2b951
Instead of keeping one global hash/list of all received ICE fragments,
indexed by string call ID and from-tag, move the hash/list of ICE
fragments into the call object, now indxed only by the from-tag.
This requires a call object to exist before an ICE fragment can be
stored. Change the order of operations to always create a call object
first, then parse the SDP, then check for ICE fragment processing. The
determining factor now is only whether the monologue exists.
Duplicate the raw SDP into the call's memory arena instead of onto the
heap.
ICE fragments now don't need to store the pre-parsed SDP any more, and
the trickle ICE handling code is guaranteed to always have the fully
parsed SDP information.
Strings for fragment indexes can now be allocated from the call's memory
arena.
Obsolete the extra thread used to delete old ICE fragments. This is now
done in-line with regular call timeout processing.
Change-Id: I7acbc4c52666c4cdf1c02324bf33cf0bfcb4f0d0
Move the SDP offer/answer model to the sdp_create
approach instead of using the sdp_replace one.
This assumes the SDP body including session level
attributes (s=, o=, t= etc.), as well as the media
attributes, are formatted using currently given
session context.
In other words, rtpengine collects all possible
information during all of the offer/answer exchanges
within the dialog, which in its turn affects each
monologue's context, from which each new SDP message
will be built up.
This approach replaces the older one, which instead
used to go through the currenty processed SDP and
just replace those attributes, that rtpengine
is required to affect, leaving the rest untouched.
Additionally: all of the existing offer/asnwer model
tests were fixed to comply with the currect change.
Most of it is just an offset of attributes, which are
stored a bit higher/lower within the same media or global
SDP session.
Also a good part of unit test fixes targets a move of
`c=` line from the session level to the media one (so
each media has from now on its own `c=` attribute). This
does discontinue a support for session level connection
information.
Change-Id: Iecb4739683d23c4f9341e8a34b71f8ca2070956c
Add `break` statement. Fixes:
*** CID 1600019: Control flow issues (MISSING_BREAK)
/daemon/call_interfaces.c: 1162 in call_ng_flags_flags()
1156 out->strip_extmap = 1;
1157 break;
1158 case CSH_LOOKUP("symmetric-codecs"):
1159 ilog(LOG_INFO, "Ignoring obsolete flag `symmetric-codecs`");
1160 break;
1161 case CSH_LOOKUP("to-tag"):
>>> CID 1600019: Control flow issues (MISSING_BREAK)
>>> The case for value "155" is not terminated by a "break" statement.
1162 case CSH_LOOKUP("to_tag"):
1163 /* including the To tag in the delete message allows to be more selective
1164 * about monologues within a dialog to be torn down. */
1165 out->to_tag_flag = 1;
1166 case CSH_LOOKUP("trickle-ICE"):
1167 case CSH_LOOKUP("trickle-ice"):
Change-Id: I0195341ec70ea623ea7fece3782cfdc030ee4eaf
Add `call_ng_process_flags()` based parsing
as for other opmodes, like offer and answer.
This keeps the backwards compatibility with
the older "flags" parsing approach on the
module side, as well as adds the possibility
to parse rtpp-flags on the daemon side.
As an advantage, there is no need to use
specific local parsing for things like
to/from tags, call-id, delete-delay etc.
Additionally:
- this commit introduces flags-flags parsing
for the "fatal" flag.
However, as before is only taken into account
by the `call_delete_ng()` processing,
so no functional change.
- this commit introduces main-flags parsing
for the "delete-delay" flag, which is also
only taken into account by the `call_delete_ng()`
processing, so no functional change.
- this commit adds To-tag options flag prasing
into the `call_ng_flags_flags()` function,
and is used by `call_delete_ng()` specificially,
for cases when more specific identification of
monologues to be deleted is used.
Change-Id: Ia992e5375a2f86318d9ad193a7857dd589038eed
For trickle ICE updates that need to be queued up, this requires storing
the unparsed SDP in the fragment object, and then doing the parsing when
actually processing the fragment.
This allows the call's memory arena to be used for parsing.
Change-Id: I28ed192c4443cedfa3095007cc8a555e3aa7a17a
Instead of having to explicitly pass the call object to each invocation,
keep one thread-local reference to a call, implicitly set by setting the
logging context.
Add helper functions to set and release the respective reference.
Change-Id: Ic0d82eeaa403467d50dae867e33fdf9b9dd7cec5
... so that the desired wav channel can be controlled when producing a
mixed audio file
When a mixed wav file is created, the channels in the wav container are
currently allocated in the same order as each SSRC is received, meaning
it is impossible to know which channels have been allocated to the offer
or answer side of the call. Furthermore if there is a reinvite or media
file played, these are also allocated in the order that SSRC is received
- so an "answer" could end up sharing a channel with an "offer" with no
way of knowing this.
This patch allows you to specify how many channel slots should be
allocated within the mixer, and allows you to then specify which slot is
assigned to each media in the call (this will usually be 2 slots in
total, slot 1 for answer, slot 2 for offer or vice versa).
Ported from https://github.com/sipwise/rtpengine/pull/1852Closes#1857Closes#1852
Change-Id: I010208427cabc3a48d6ef7bd3a84e9a5bdcfd492
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
`delete-delay` is already parsed using bencode_dictionary_get_int_str()
so we don't need to special-handle string type values
Change-Id: If9758ccfbbe18674b7731aa53b9de5bd3fd87ae4
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
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
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
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
Combine common basic NG checks used in the `call_publish_ng()`
and `call_offer_answer_ng()` functions into a separate func.
Change-Id: I1239c1dafd3b8a4a3ca79879323ce1bf9c3fc9c0
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
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
Keep the default case for the `call_ng_flags_flags()` more
accurate, which makes it easier for reading.
Change-Id: I317656ab964503389f2c84e835dd9db69cc70c3e
Deprecate a usage of intermediate dictionary for parsing
of rtpp flags. Just use the `call_ng_main_flags()` function
directly with a given `bencode_buffer_t` buffer.
Change-Id: I0bea13b94b6e0016799dd07a50061e1367131106
Direction parsing.
Instead of adding key/val flags to the dictionary for
further parsing later via iteration in `call_ng_main_flags()`,
just call the `call_ng_main_flags()` directly.
Change-Id: Ide137aed12a6ba416b59a307a0a11a934f78a858
Codec related flags parsing.
A bencode list for codec related flags keeping (while
parsing in `parse_rtpp_flags()` ), is removed due to no need.
Instead of adding key/val flags to the dictionary for
further parsing later via iteration in `call_ng_main_flags()`,
just call the `call_ng_codec_flags()` directly.
Change-Id: I1adcea84e9254ae35e6480d61426f1434513e779
Instead of adding key/val flags to the dictionary for
further parsing later via iteration in `call_ng_main_flags()`,
just call the `call_ng_main_flags()` directly.
Change-Id: Ia893a6b50db7a0659a42c09463169f2c0f5e595e
Introduced by d7b8ebbc68
*** CID 1584501: Control flow issues (MISSING_BREAK)
/daemon/call_interfaces.c: 1825 in call_ng_main_flags()
1819 call_ng_flags_str_list(out, value, call_ng_flags_replace, NULL);
1820 break;
1821 case CSH_LOOKUP("rtcp-mux"):
1822 case CSH_LOOKUP("RTCP-mux"):
1823 call_ng_flags_str_list(out, value, call_ng_flags_rtcp_mux, NULL);
1824 break;
>>> CID 1584501: Control flow issues (MISSING_BREAK)
>>> The case for value "324" is not terminated by a "break" statement.
1825 case CSH_LOOKUP("rtpp-flags"):;
1826 case CSH_LOOKUP("rtpp_flags"):;
1827 /* new dictionary to store rtpp_flags */
1828 bencode_item_t * dict;
1829 dict = bencode_dictionary(value->buffer);
1830 assert(dict != NULL);
Change-Id: Iaa1d9b3bd31d32e48451c3a47f8e99fa3c755e63
A fix for bullseye/buster and focal:
call_interfaces.c: In function 'call_ng_main_flags':
call_interfaces.c:1828:4: error: a label can only be part of a statement and a declaration is not a statement
1828 | bencode_item_t * dict;
| ^~~~~~~~~~~~~~
make[3]: *** [<builtin>: call_interfaces.strhash.o] Error 1
Switch case has to be followed by a statement, and the declaration
is not, so just follow it by the empty statement.
Change-Id: I7c5ef62dec9ceb404736ec3c4bed84f04b892d24
During the parsing of `rtpp_flags` use the
`call_ng_flags_flags()` directly instead of the
`bencode_list_add_str()`, hence reduce amount
of iterations required to parse generic flags.
Additionally:
`call_ng_flags_flags()` is made visible for usage
within external files.
`helper_arg` union has been moved to the header.
Change-Id: I34399a0d3940a1276feb1210e4421cbcdf656e9d
Is added by:
- explicit generic flag "directionl"; or
- if the "from-tag" flag is used
Introduce the `directional` flag for `sdp_ng_flags` struct.
In use by:
- `media_block_match1()`
Additionally:
add `IS_OP_DIRECTIONAL()` marco check.
Change-Id: Ifd56ea2ad8277d7dec136def1c028c5e2b680ff1
For the sake of proper processing for From/To tags,
we need to know which message type originated interaction
with the rtpengine (from behalf of kamailo module).
This can be of two types:
- request
- reply
This can also be re-used later, if there is a need
to detect whether that was a request or reply.
P.S.: opmode and message type shouldn't be confused,
it's not the same, since SDP offer can come in the request
as well as in the reply message (late offer/answer).
So the opmode reflects what exactly is being done in terms of
rtpengine operations, meanwhile the message type shows, which
message type originated this processing.
Change-Id: I8336175d3cfcf521418ac18b71cb4a6d5730705d
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