As the number of subscribers grows, the current approach of doing a full
table dump of the subscribers DB and caching it in memory becomes less
and less feasible. The new approach is to simply do a straight DB query
for each subscriber as records are processed, and then cache the result
in memory for a little while.
Change-Id: I19a6271d779bd0abccc29e3548e7bcdb2e00baa3
While the code is not threaded, better be future-proof and use safer
APIs, which in addition has less side-effects as it does not set the
global TZ related variables.
Change-Id: I57fbe6683590cc2fbc0da508819553c040764739
Warned-by: lgtm
While MariaDB uses my_bool here, MySQL uses the standard bool type. Both
are compatible, so use the more standard one.
Change-Id: I648bc8eb55f7617f6b4eb796a33bc77ce15ca34b
With the increased length of src/dst_leg strings, we must also increase
the buffer size for the insert string.
Did I mention that we should really move to dynamic strings here...
Change-Id: I0e77155d36f434055e36124d37bf699179f887b1
Due to the movement of call transfer handling from sems pbx to
standard sems, in case of blind call transfer the BYE ACC is
generated with call_id suffix '_pbx-1_xfer-1' instead of '_xfer-1'.
To be more precise, currently we creates 2 ACCs for INVITEs:
- one without any suffix
- one with '_xfer-1" suffix
and just one for the BYE:
- with '_xfer-1' suffix
Mediator is able to use the BYE to close both the INVITEs
With the new implementation we creats 2 ACCs for INVITEs:
- one without any suffix
- one with '_pbx-1_xfer-1" suffix
and just one for the BYE:
- with '_pbx-1_xfer-1' suffix
The sinlge BYE record is not used to close both the ACC INVITEs.
Change-Id: Id7a68fab8d84ffe987084e925fecc1e051cbaccd
Strings, in particular call IDs, that are coming from Redis are not
necessarily valid UTF-8 since Redis doesn't really do UTF-8. The MySQL
DB schema expects strings in valid UTF-8 however (even though call IDs
really should be raw binary strings), resulting in an error if an
UTF-8 invalid string is attempted to be inserted.
Solve this by verifying each string's UTF-8 correctness before inserting
it, and forcing it to be interpreted as the 100% permissive latin1
charset if it isn't.
Change-Id: I5a218083bc4e3d7a47d1f77911f7ef9a88ce9bd2
In a cluster setup, intermediate CDRs might be written to a different
host than the final CDRs (central vs pair).
Change-Id: I56716d2a96857d52715e48f513ee1d75676b1e52
Since medmysql_flush_med_str() takes the handler from the
_medmysql_batch_definition structure, the last retrieved insert ID must
also be taken from the same handler.
Change-Id: Ieaee3313d94cf41d8953591dd88a12e42be601d5
The DB schema allows for certain columns to be NULL. Handle this
appropriately to elminiate failed assertions from g_strlcpy.
Change-Id: I8768847b96b169dfad94b2ca448cc2af5058d38b
To prepare for a second kind of CDR records, we refactor the SQL batch
string handling to include the statement definition and data queues in
the string object, and stop passing them around as arguments everywhere.
Change-Id: I2e3b278e859ce0cc22e7827c91d284b39fc34ecc
* cdr_tag_data value is now escaped
* simplified cdr_group group escaping code to
bring in line with how it is in the other places
Change-Id: Ie10242fed9d4430247f8ac534b19679d38206fee
* callid that is used in sql statements is now escaped,
for scenarios where there are calls with quotes in callids
Change-Id: I3061a73fe944ec911e84031a1cff40043b7e174c
These produce too much output, and spam the log files. Make them debug
level output so that we can still see them if desired, but not shown by
default.
Change-Id: Iec8037c0c60d3f221811a4baeabdbb4daeed95ce
Instead of hardcoding -I/usr/include/mysql for CFLAGS and -lmysqlclient
for LDFLAGS, let's use mariadb_config if available (e.g. on
Debian/buster), try mysql_config otherwise (e.g. on Debian/stretch) or
if neither of them is available, fallback to -I/usr/include/mysql +
-lmysqlclient.
No longer include `m_string.h`, it was moved towards
/usr/include/mariadb/server/m_string.h and is no longer compatible when
used as such:
| /usr/include/mariadb/server/m_string.h:89:23: error: unknown type name 'uchar'; did you mean 'char'?
| extern void bmove_upp(uchar *dst,const uchar *src,size_t len);
Also no longer use libmysqlclient15-dev as alternative Build-Depend,
it's not available in neither stretch nor buster.
While at it drop include for my_global.h, since it shouldn't be included
anymore (and it doesn't seem to be relevant for us, compiling fine as-is
on Debian/stretch and Debian/buster):
| /usr/include/mariadb/my_global.h:3:2: warning: #warning This file should not be included by clients, include only <mysql.h> [-Wcpp]
Change-Id: I74a75ea24f72880adb8117ae5808095f03bc0edb
* type=id values are pre-fetched from cdr_tag_data on init
* 3 new data columns are stored in cdr_tag_data
furnished_charing_info,
header=P-Asserted-Identity
header=Diversion
Change-Id: I228743beb05cc09cc28d7df8dedc90dd3cdbcfed
* Fetch acc records both from mysql and redis
* Backup/trash redis acc records into mysql
* Introduce loglevel config option and log macros
Change-Id: I9bc55ed72502feaff03550c99ce481aea33e5e58
The variable is a uint8_t and it can hold up to 255 values, so we need
possibly up to 3 digits plus the ending NUL.
Warned-by: gcc-7
Change-Id: I1b0ae3ad141c048ae924b421d2266a8e37a669c5
* added acc fields: source_lnp_type, destination_lnp_type
* source_lnp_type is stored as NULL if the string is empty
* destination_lnp_type is stored as NULL if the string is empty
Change-Id: Ia81debf9ff56aca87e4f1bcc4a82f8c8b9c1edec
In parsing config options, it might be possible that an option is
provided more than once, where the allocated string buffer is then
overwritten without being free'd.
When copying call codes, assume a fixed length size of 3.
Check return code of open() when opening /dev/null for std* re-
directs.
Fixed spaces vs tabs in intendations.
Use fropen() for daemonization.
Refactor medmysql_fetch_callids to return malloc'd array.
Change-Id: I51ab7ebc01bdd747c8b5bb320998a5c13d64009e