Switch from specialised handling of config sections (used to load
signalling templates) to a more general approach using a callback
mechanism. This allows us to add more information to the config file
while keeping the details of the underlying GKeyFile hidden. Use a typed
hash table for type safety.
Change-Id: I71ddfda0202b47df363bcc5acf1725078774f8f1
Add a semicolon only for the last switch statement
going in a row.
Fixes this Coverity Scan detected defect:
*** CID 1621493: Control flow issues (MISSING_BREAK)
/daemon/call_interfaces.c: 1063 in call_ng_flags_flags()
1057 out->allow_no_codec_media = 1;
1058 break;
1059 case CSH_LOOKUP("allow-transcoding"):
1060 case CSH_LOOKUP("allow transcoding"):
1061 out->allow_transcoding = 1;
1062 break;
>>> CID 1621493: Control flow issues (MISSING_BREAK)
>>> The case for value "15" is not terminated by a "break" statement.
1063 case CSH_LOOKUP("always-transcode"):;
1064 case CSH_LOOKUP("always transcode"):;
1065 static const str str_all = STR_CONST("all");
1066 call_ng_flags_esc_str_list((str *) &str_all, 0, &out->codec_accept);
1067 break;
1068 case CSH_LOOKUP("asymmetric"):
Change-Id: I4d6bc56d8149acd2d0d69f122e420c5a8c6ae2e1
Instead of lumping all strings of a file into a single hash function,
split them up into their respective sections, as there is no point in
matching against strings that aren't part of the switch statement. This
should give a bit of a performance boost.
Nested hash sections require special handling as the wrapper script
isn't smart enough to hande them automaticaly.
Change-Id: I74863dfe6ca412d58101d37f9c9c85078826f1a4
Change old code to directly return `str` objects instead of pointers to
allocated ones. Largely a no-op change but makes some code easier and
eliminates some old kludges.
Change-Id: I2be19dd24bb7ff046d86cc32a3af235283e65dd0
Make `moh-max-duration` available for both
music-on-hold functionality as well as
for the media player.
For that to work, do the following:
- keep `moh-max-duration` config option only for MoH,
if not set (so 0) by default is 1800000ms (half an hour)
- for the play media functionality introduce flag option
`repeat-duration`, by default is disabled
Policy changes:
- duration counter can be used in common with repeats
counter, but then takes a precedence over it.
Hence if first a duration is underflown, then EOF triggered.
Otherwise if the duration counter is still positive, but
repeats are negative, then do EOF based on repeats.
- the repeats counter will always count down during each
iteration, even when used together with the duration counter
For MoH to survive, the repeats counter is simple set to 999
to let the duration counter always win over repeats one
- MoH cannot take duration disabled, since otherwise
would make no sense for it. Hence always takes internally
defined value 1800000ms (half an hour) if not defined
by the configuration option
Backwards compatibility:
- is kept in regards of repeats counter
- is kept in regards of the play media functionality
Change-Id: I48ff3c17c9bed31f80c3106b275b703a9ccb4b26
Sendrecv mode flag controls whether the sendrecv
state is forced to sendrecv, instead of the default
one sendonly, in the SDP body going towards recipient
(the one who will receive the MoH media).
Is declared as: moh=[mode=sendrecv]
Can be useful for corner cases, where the remote side
wants to see sendrecv state for whatever reason,
when getting MoH media and hence also remain in sendrecv
state in regards of the MoH originator.
Must be advertised once during the session origination,
nd then will affect the SDP body as soon as SDP sendonly
body is received (from the behalf of one, who advertised MoH
capabilities).
Backwards compatibility: doesn't affect non-MoH calls.
And doesn't affect offer/answer exchanges within MoH calls,
which do not put the remote side on hold.
Additionally: introduce a common function for the MoH flags
handling: `call_ml_moh_handle_flags()`, which does all
the required iterations/checks for the whole bunch of flags
at once.
Additionally: previously existing MoH tests adopted.
Additionally: new test introduced to check the SDP content,
when using mode sendrecv flag.
Remark: this flag is not mutually exclusive with
the zero-connection MoH flag.
Change-Id: I5bf6699f6890d8b927107cc143a18116efe45087
Zero-connection flag controls whether the connection
address offered in the SDP body going towards recipient
(the one who will receive the MoH media), is set
to all zeroes.
Is declared as: moh=[connection=zero]
Can be useful for older client implementations,
who want to see zeroed media when receiving sendonly
and getting put on hold.
Must be advertised once during the session origination,
and then will affect the SDP body as soon as SDP sendonly
body is received (from the behalf of one, who advertised MoH
capabilities).
SDP body recovers to the real IP addresses being inserted
into recipient's SDP, as soon as the media gets unheld.
Backwards compatibility: doesn't affect non-MoH calls.
And doesn't affect offer/answer exchanges within MoH calls,
which do not put the remote side on hold.
Additionally: previously existing MoH test adopted.
Additionally: new test introduced to check the SDP content,
when using zero-connection flag.
Change-Id: If0c38a3d294e6d5fe3886bee19ff2382e5705f9a
Move conditioning and handling of MoH
into a separate helper to make code a bit
more laconic.
No functional changes.
Change-Id: I89502bbdfe75e0b96c42ac0bde405e3ed04403fa
Add duration limit for the moh functionality.
This is required due to a possibility to get
monologues and hence packet streams stuck
forever and sending audio to recipients
which already don't exist.
A configuration option that controls that:
`moh-max-duration` - gets a value in milliseconds.
By default is set to 1800000 (half an hour).
Change-Id: Id50a0a10ce5b52b3876a3122fb16a71accec90ff
Introduced Music on Hold functionality:
- available only for the offer/answer model,
no other scenarios (publish, subscriber etc.)
are covered with it
- it gets advertised always at the beginning of
the call (original offer/answer exchange)
- can be added for both sides: offerer/answerer
- the one who advertises its MoH capabilities
with its SDP offer or answer, can later trigger
MoH using sendonly SDP and unhold remote
party using sendrecv SDP
- MoH covers only audio type of media sessions
- there is no specific selection of media sections
to be held, thus, if one audio media puts the
call on hold, the whole call is held
- list of parameters to be given when advertising
MoH capabilities: a sound source (file, blob or db source);
sendonly/sendrecv hold; zero-connection hold;
At least an audio file source must be given
- MoH cannot be mixed with the play media functionality,
the last one triggered will override previous one
- MoH must be unheld to stop the media being sent
towards a recipient, otherwise only a termination
of monologues will stop this packets stream
Change-Id: Iefd83ced79c14dadad936348a1d529007d6e7b3b
Move part of the `call_stop_media_ng` function body
to a separate function, to let it be available
for external function calls not particularly related
to play media NG function call.
Change-Id: I278f7bc5a6663e9232e812d10f6902616c67c497
Pass file, blob and db_id via `media_player_opts_t`
structure members instead of using separate arguments
in `call_play_media_for_ml()`.
Change-Id: I8c3b9b7f5ab61238d35463c304246f31a922ac6f
Move part of the `call_play_media_ng` function body
to a separate function, to let it be available
for external function calls not particularly related
to play media NG function call.
Change-Id: Iaf4e8f72f1492446508fd6b49ba36434cae5f5f0
The opmode is already determined uniquely when processing the NG
command. There is no need to explicitly set it again elsewhere. Simply
carry along the originally determined opmode.
Change-Id: I16924264b0337423aff6763c70a4b2c6dd3687db
There is enough overlap between the two enums that it doesn't make sense
to carry along both. Unify.
Change-Id: I9de8fbdb8d78a2002d8c1b62cea57188c937d61d
Allow to-tag updates in answers only until a non-provisional response is
received. Add a flag to optionally suppress this feature.
Change-Id: I67110ede662f618ba5a355500d3d84050e6318cc
If we receive an answer from a to-tag that hasn't previously seen and no
corresponding monologue exists (created from a previous offer),
previously we would treat this is a separate and new call branch, create
a brand new monologue and dissociate the previous one. This may lead to
unexpected results as this new monologue has been created without the
same initialisation as was done for the original one, and so may be left
with incorrect or incomplete data (e.g. SRTP keys, codec information,
interface bindings, etc).
Improve this by treating an unexpected and unseen to-tag as an alias to
the already existing to-tag. Going forward both tags can be used
interchangeably to refer to the same monologue.
Add a flag to suppress this new behaviour, in case some situation is
made worse by it.
Change-Id: Ie8f838eebd50d29d3549031998a2eb1f610b04bb
In order to be able to control, which media types
one wants to have in the call session,
add support of the "sdp-media-remove" flag.
Syntax:
"sdp-media-remove" : ["<media-type>", "<media-type>", ...]
Additionally, add according unit tests.
Change-Id: Ic52456f8124319992ea9ca8c161daefb1df46b59
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