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
This allows us to fetch only specific records that we're interested in,
based on context, instead of all of them and then having to do a second
pass over them.
Change-Id: I5e314fa633f57c79db85476e347a3305b5f585e9
Using an array in this context (to return a list of acc records) is
mostly pointless as it wastes memory and incurs the additional overhead
of having to initialise the array and an extra layer of copying strings
around. This also ultimately allows us to dynamically append to the list
of acc records without having to reallocate the array.
Change-Id: I1039f01861f8d3f82fdc3a80377fd7535fa24bab
Using an array in this context (to return a list of call IDs) is mostly
pointless as it wastes memory and incurs the additional overhead of
having to initialise the array and an extra layer of copying strings
around. This also eliminates the auxiliary type `med_callid_t` and
ultimately allows us to dynamically append to the list of call IDs
without having to reallocate the array.
Use g_strdup for string allocation as it guarantees a non-NULL return
value.
Change-Id: Iae6c97f80c216352ab36de89d361f09ee355b6c8
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
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
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
* 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
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
Revert logic to pick peer id from stop record. This needs a better
approach somehow.
Instead, add logic to always take -pbx_1 and -xfer_1 stop records
into account when searching for stop records, to fix duration of
CDRs on transfer and park/unpark (which is just a special case
of transfer).
Change-Id: Ia80add6d5cb762800c563889c0d95ee25ed74168
When enabled, mediator will look for acc records belonging to the
$ci_pbx-1 call leg and use the stop/bye records from this call leg in
place of the regular one.
Change-Id: I46d326fb30fcf105642d188a07ae771a659ff17f
- Calls info (call_code, period) data is accumulated into $stats_db.'call_info'
table on the cdr insert
- Add stats_db and stats_period options (1=hour, 2=day, 3=month)
Change-Id: I4e1f7655eebfbe45a43e2c34d9c3b3bffe05fb40
Squashed commit of the following:
commit e137454f9d871332ef055b3de8eb9c703caece03
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Fri Jul 25 11:03:17 2014 -0400
MT#8195 lookup peer host ID against peer group/contract ID
commit 47e3509e634d9892fc1e2bc8111df6a90416addc
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Fri Jul 18 11:03:23 2014 -0400
MT#8195 use dst_leg peer id