We ship /lib/systemd/system/mediator.service as symlink pointing
to ngcp-mediator.service, ignore in lintian as reported by
lintian v2.118.1 as present in current Debian/testing AKA trixie.
Fixes:
| E: ngcp-mediator: service-file-is-not-a-file [lib/systemd/system/mediator.service]
Change-Id: Ib27cfddefaeb95f52703f695e938736e91fc9939
New field "header_ppi" is now managed and inserted into
cdr_tag_data mysql table.
This field will store into the aggregated cdr data the
P-Preferred-Identity header of the INVITE.
Change-Id: Ib875976fd7332e80ae100f257c7af701ffe9f661
New added acc data are usually added without strick check of
their presence to avoid that ACC generated before the upgrade
fails and get dropped.
In the code there are some very old cases for upgrades from
mr8.x to mr9.x versions that now are removed.
Change-Id: I295547cd11656adf015a4fe5b6038a792f8cf532
This fixes a bug which incorrectly used strlen(callid) instead of
strlen(esc_callid) to determine the size of the VLA to hold the complete
query string.
Take this opportunity to eliminate the VLA and switch to an allocated
printf string instead.
Change-Id: I4a64d05180832f3471249acf354bec6b5a3ba15e
Using redisCommand directly has the problem that it accepts a format
string as its first argument, which means that if we do not escape that
string, it will try parse potentially-looking format arguments, which
can end up accessing garbage on the stack and causing either parse
errors, triggering stack protector checks or injecting parsed garbage
from the stack into the resulting formatted string.
Instead we switch to use redisvCommand() and pass explicitly any
values to be formatted as additional variable arguments. We still
duplicate the formatting to be able to report errors and to have a
minimal fix that can be backported, but that part of the code should
be improved to reduce the useless reformatting.
Analyzed-by: Alessio Garzi <agarzi@sipwise.com>
Change-Id: I7ce3d4450cc93df02778120b9c43ff5984624742
If acc is generated with flag acc_dont_clean_suffix dont strip suffix
since the originally generated call was generated with _pbx-1 suffix and
removing it would result in leftovers on redis db.
Change-Id: I0ac2cba7fa625470e6801180e63118b2c3a6daa0
New field "r_ua" is now managed and inserted into
cdr_tag_data mysql table.
This field will store into the aggregated cdr data the user agent
relative to the first 2xx response of an INVITE.
Change-Id: Icf8e80d0d2b63f4b9db006c8a224335989057e86
New field "r_user" is now managed and inserted into
cdr_tag_data mysql table.
This field will store into the aggregated cdr data table the user part
of the RURI relative to the first 2xx response of an INVITE.
Change-Id: Ie61809e9245adfa09c6babb4b3fa328da8c56cbb
To allow mediator to continue to run after an SQL insert failure, retry
the inserts one by one after the bulk insert failed. This makes it
possible to 1) narrow down which row caused the error and make this
clearly visible in the log, and 2) allow for a small number of failed
inserts that can be ignored. The latter is needed to allow for broken
acc records that need to be discarded anyway.
Change-Id: Idf233cac3c05be108abbba061f4661255525c468
Use a queue to keep track of the position of each CDR entry as it is
added into the SQL string. This allows us to inspect each entry
individually if the insert goes wrong.
Change-Id: I2f95e35030c3f55f8ccd3efb3ef20684f301af2e
All `medmysql_str` except CDRs have an associated queue, kept separately
in `medmysql_cdr_batch`. Move it directly into `medmysql_str` to make
things easier.
Change-Id: Idd6d31596e5e121a44c9b7922be66c24e7a43518
New field "hg_ext_response" is now managed and inserted into
cdr_tag_data mysql table.
This field will store into the aggregated cdr data the number
of the extention picking up the call after an HG.
Change-Id: I816eba4a6a227e1a809c2db1ab5ae0665d4c1aa1
Attempt to parse each src/dst leg only once (which is a JSON document
these days) and use the same logic for determining whether to create a
CDR for both intermediate and final CDRs.
Change-Id: If8afae812585cb8624799b0d2f4e6be64980cea9
The MySQL INSERT statements to move processed Redis acc records from
Redis to the respective backup/trash MySQL tables are always issued
within a MySQL transaction (med_handler via medmysql_batch_start), but
the deletions from Redis were done immediately. Therefore if mediator
were to abort within a processing loop, the MySQL transaction would be
rolled back after the entries had already been deleted from Redis,
therefore losing the acc entries.
Solve this by using an internal queue for Redis entries to hold the
lists of entries to be deleted until the MySQL transaction is commited.
Change-Id: Ib41d0e2ca722c66f9e078ca31f7e5ca2b9d9fe2d
Use a struct with globally defined instances instead of a literal string
name to distinguish the two destination tables. This makes it possible
to unify record handling between the two tables.
Change-Id: I900debf3a28f262b4503d79562d69b69502b7aa8
This makes it possible to trace which CDR record was created from which
acc records and at which point.
Change-Id: I3645ccf244bf7d86b6f70181c57e47dfa204f7b9
json_tokener_parse returns a newly created JSON object (tree) which must
be freed by decreasing the ref count before the variable goes out of
scope.
Fix-up for Ia7e8446fe4953d1391f99ea1530990e3d385c056
Change-Id: I2e4b17086df468f66401a71a836d37ed821944e5
The `cdr_index` variable already tracks the number of created CDRs, as
it points to the slot for the next CDR record to be inserted. It's
increased by one at the start of the processing loop, so if we end up
skipping over an entry after it's been increased, it must be decreased
again, which keeps the count intact and prevents empty CDR records from
being created.
Fix-up for Ia7e8446fe4953d1391f99ea1530990e3d385c056
Change-Id: Ibb650a4b00978a272ef8f60751f6efda0491a912
* If there are multiple call leg acc records for a call, ones
that do not contain valid src + dst leg data (either JSON or th
old format), these acc records are skipped and intermediate cdrs
are created for the remaining records that contain valid src and dst
leg data
Change-Id: Ia7e8446fe4953d1391f99ea1530990e3d385c056
KeyDB notifies systemd prematurely about its readiness, while it might
still be loading data from persistent storage or from its replication
master. It refuses access to its databases during that time, so make
mediator sleep/retry a few times to handle this.
Change-Id: Ieff52bc9f92697385f300c6fba26ace03fde78f6