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
This makes it possible to reuse the data from the JSON object in several
places in the code without having to re-parse it.
Change-Id: I62f3b2b814acc52ae3fb84c88b7b4f99bff9232f
Use strdup/free for string fields in med_entry_t that are highly
variable in length. This elimiates future problems if one of these
fields ever has its length extended.
Use g_strdup as it guarantees a non-NULL return value.
Change-Id: Ia0f5883547feb62f04fcd4c5353850eb9d815413
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
/var/lock was deprecated with Debian/wheezy (see
https://wiki.debian.org/ReleaseGoals/RunDirectory), so
/var/lock/mediator.lock is actually /run/lock/mediator.lock.
Reflect this in the definition of MEDIATOR_LOCK_FILE.
Change-Id: If50a5fdcfafb289d59ae828f750388e103b5b3ad
Kamailio writes src_leg and dst_leg information of ACCs
in json format. Mediator has been adapted to read them
in this new format.
Due to that the size of src_leg and dst_leg has been
increased from char(256) to char (1024).
For backward compatibility the old format has been preserved
and used if the src_leg and dst_leg are not in json format.
This change is transparent for the final CDR's output.
Change-Id: I4de9c61a5bfe5855628412f6aca988ffc9406a59
* 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
We need a new configuration file for multiple reasons. For security
purposes, to avoid passing passwords as part of the program arguments,
which are publicly visible. And to be able to use systemd services
files, because there's at least the maintenance configuration that's set
conditionally, and that's not easily supported in systemd service files.
Refactor the code to make it easier to add a simple config file parser,
based on a key or key=value per line, with support for comments starting
with # on the first column.
In addition this also gives us long command-line options for the
existing short options.
Change-Id: I611f262847fa2ec4e3c569ca27e01b691e585fcc
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
- use separate user,pass,port,db for the stats database connection
- cosmetic change in the DEFAULT_STATS definition names
- add db connection info logging for PROV and STATS
Change-Id: I389bed46c634ac973616335581d7a7495d5866a3
- 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