The `media_player_expire_cache_entry()` appears
to use the `db_expire_us` instead of the `media_expire_us`.
Was most probably a copy-paste typo in the past,
just fix it.
Change-Id: I6a4938406a6fb43459c99a354616d5f5ce10bae2
The only caller of `media_player_get_cache_times()`
does comparisons based on microseconds, but the called
function to calculate `mtime` and `atime` does this in seconds.
Hence the result is used incorrectly, because it compares
that value against `rtpe_now - rtpe_config.db_expire_us`,
which is again in microseconds.
Change-Id: Iea4b5b1c6d36c202bdce477ee8147e84e1974210
The `OP_...` enum is meant to only represent commands list.
Then make the list from the NG commands macro
the actual source of truth for the enum count.
This eliminates human mistakes, when introducing a new command,
because no more need to update enum manually.
Additionally:
- move the command list macro to the header
- existing extern declarations remain untouched
- `OP_OTHER` remains sentinel
- eventually replace the manual enum with macro based one
Change-Id: I33d928367fe0a254571cb0b7d4aafe4445b30b77
Instead of keeping separate arrays (essentially it's
a duplication) for command strings, escaped strings
or short version of commands, just create one single
macro pattern, which keeps these as an array.
And then using designated array initializers,
use the marco pattern to generate accordingly
an array of the required type (usual strings,
those escaped or the short version of them).
This prevents the human mistakes, or at least
makes them less possible in case of new command
introduction.
Change-Id: I27271ed4852f95760424552ce66fc8bc340c76a3
The dict pretty printer advances from key to value
by `chld = chld->sibling` and then prints the `chld`.
If a malformed dict ever reaches this func
with an odd number of child nodes, this can dereference NULL.
Just add guard against NULL.
Change-Id: Ia24671a5eba06dda8c48515fd9dc45fe7a9ec371
If someone wants to stop the media for this particular monologue,
and it already has the MP allocated, which is marked for MoH,
then just ignore the stop media command.
This is to not let the play media/stop media procedures
overlap with potentially (previously) triggered MP via MoH.
Change-Id: If0bf4264b9c640b99f844efe5c2c8bc201a6ad16
Both the play media and the music on hold use
the `media_player::call_play_media_for_ml()` as an entrance
towards the `media_player::media_player_new()` and
`media_player::media_player_play_init()`.
Prevent allocation of new MoH over ongoing one,
as well as the `play media` command over ongoing MoH.
Otherwise a media player will be re-used to override
ongoing activity.
Explicit policy must be used:
First the MoH has to be stopped
by getting back to the SDP `sendrecv` state, before
any other MoH request, or play media request can be fulfilled.
Change-Id: Ia5fdc10cfa8f491109ade9a2225b182ccdaa4778
To show that player has been created.
Additionally: add one more log line
to track that the play media is being requested.
Change-Id: I4e8eb8f282654902a96bffb70c7c241e9c78b8d5
In order to understand whether is must be initialized.
And use a given parser pointer to do so. This can be native or
json parser.
Remove previously introduced bool param, which was used
for differentiation.
Change-Id: I6d0bb083fe4dea5625d40175c8978fffaca6d34f
There is a dedicated JSON parser, so use this.
Also leave some TODO'ers to think about adding own
`parser_arg` for JSON-like formatted data.
Change-Id: I5399ffb6ec74e88887b52fd63b96a8e44428c495
If already having the local ptr, then why not to use it,
instead of using directly the globally visible object.
In the `control_ng_process_payload()` add a pointer
to the `ng_parser_json` parser.
Change-Id: I9d656733991e2d99c18aa1cc6d705ed053f57f0a
When preparing a response, especially for the case of error,
we already make sure to init the resp ctx. So just add
a helper for this, because same routine used.
Also optionally init parser as native (dict) if required.
Some of the cases like data is <= 0 length, or
there has been not dict or JSON format spotted,
then init as native.
Change-Id: I7d13669075525b754e1950e3212b79800b20f85a
In case the data length is <= 0, or there has been
no dictionary-like or json-like format spotted in the
NG incoming control message, then treat parser
as native (so dict) by default.
Otherwise not possible to initilize the command context,
and hence the error treatment wouldn't be
able to prepare the response properly.
Change-Id: I99b9c571a9112a25e474dfc39e21cce15fc5f634
If any caller passes NULL for item callback and
then receives a JSON with a nested object/list/int, this can crash.
Change-Id: I69fbb9fec76305f6e1ed9ea5b25a50a7ee85c454
Allocate dict enough in-time for the `command_ctx.resp`,
because a plenty of the `err_send` gotos, having this alias
appending something to the dict, will use it uninitialized.
Change-Id: I9114e7b02437e47de256b8fc88faf993329f083f
Some of the values aren't actually checked, such as:
`redis_disable_time`, `mqtt_publish_interval`, `dtx_lag`,
`dtx_delay`, `dtx_shift` and `max_dtx`.
Add consistent validation where negative values
are not meaningful.
Change-Id: Ibb6e128ec71253f4e17c1232e3c90de44ded050b
In those initialization paths (where possible)
use the `die()` alternative to the `abort()` one.
`die()` gives an explanatory message,
which is friendlier for configuration/startup failures.
Change-Id: I5d79c26925cf3adaebf83dd6bcac756418745275
The `fill_initial_rtpe_cfg()` func doesn't copy
`RTPE_CONFIG_STR_PARAMS` and `RTPE_CONFIG_CHARPP_PARAMS`,
even though the `unfill_initial_rtpe_cfg()` func frees them.
Globally it starts zeroed and this may never crash,
but then the snapshot is still incomplete.
Change-Id: I448ee6f8b9a22ad066bb57a9acd14134b7a71869
When failing to read the transcode config
for the destiantion codec, log accordingly the destination codec,
not the source one.
Change-Id: I1211cde6e1d055169e809e8a49c6f88b0028e3ec
Resolve file name conflicts between different components
Ensure shared log levels are identical across components
Encapsulates lib/*
Change-Id: If848d6fa0e4cd8eac88ce9e63ee77fc5a7a481fd
When parsing the config validate general
and per-iface port ranges:
- port min < port max
- 1 < port-min and port-max < 65535
Change-Id: I9f336e51f9bb32dcccee965d51dc552f86934fe3
The documented behavior is:
- if not set at all, set to 180s by default
- if set to 0, then will be ignored in media player
- if set to > 0, then will be used to set the value
Current code is inconsistent, 0 is always reset to 180s,
hence 0 value can never lead to ignoring.
Only reset to 180s the `-1` (default value, means never parsed).
Also clarify a little bit more the description of the option.
Change-Id: I5c3e63ffaca6271424783eeba828578e54c819e5
Check that `silence_detect` is in the range 0-100.
Also properly cast to actual `silence_detect_int` type which
is `uint32_t`.
The reason is that in the current code this can exceed `INT_MAX`
(for values near or above 50%) and also, values above 100% are not rejected.
Change-Id: Ic2359402879412926b18125e292c1969cda45203
Since this is parsed as type int, potentially can be given as -1.
Hence don't accept the range < 0 and > 2.
Change-Id: I8cdbf6e7626ec89bcd287742ddfbd49a3e1a3c90
In case when parsing fails in `redis_ep_parse()`
and it returns -1, we never de-allocate the actually
duplicated strings before (using `g_strdup()`).
For example with redis subscribe, where we have a fallback,
will leak and overwrite previous allocations.
So just free what's been allocated on the failure case.
Change-Id: I340f8998de9de80342f293c669719bea7c3a2a97
Already used by `--no-fallback`, so the rest just probably
inherited the same letter when doing copy-paste.
That is ambiguous and may cause option parsing conflicts.
Keep `F` only for the historical(most important) option
and set the rest to 0.
Change-Id: I6e4841f6e6614bfdfcf53d159130d6d676073d47
We indeed already didn't support it, just silently ignored.
Now just completely drop support even in flags parsing.
In the documentation it was removed already a long while ago.
Accordingly update tests and utils.
Change-Id: I2de8ad24b77aa5f43270640559bf809ed1c565bc
First check if the given `command_action` is a dict, and only then
allocate manipulation object. Because otherwise it still creates
an object, but then if the `command_action` isn't a dict,
it just returns. So useless. Hence re-order them.
Change-Id: I50bd334d8b945a5dd5177202168ef21cf2915458