Commit Graph

5458 Commits

Author SHA1 Message Date
ionutboangiu
555a143b79 Take out cdrID from SetCDR parameters 2023-12-12 10:09:18 +01:00
ionutboangiu
d29f84169c Move cdrs to its own package
Moved engine/cdr.go to utils/cdr.go.
Moved engine/cdrs.go and engine/cdrs_test.go to cdrs package.
Moved api functions from cdrs/cdrs.go to cdrs/apis.go. Same for the
tests.
Deleted CDRsV1 type and its methods.
2023-12-12 10:09:18 +01:00
ionutboangiu
1cec3751e4 Update SetCDR signature to include the cdrID
Updated mongo indexing for cdrs to take into consideration only the
opts.*cdrID field.

Fixed cdrs_it_test.go test.

Before storing CDRs in CDR processEvents, we are now temporarily generating
the *cdrID in APIOpts (until we decide where this should happen).
2023-12-12 10:09:18 +01:00
ionutboangiu
2ccd6ca74d Add context.Context in SetCDR func signature 2023-12-12 10:09:18 +01:00
ionutboangiu
ab26ba2d02 Implement RemoveCDRs for MongoStorage (untested and not optimized) 2023-12-12 10:09:18 +01:00
ionutboangiu
fb6b38850c Update mongo SetCDR method to take into account allowUpdate param 2023-12-12 10:09:18 +01:00
ionutboangiu
560f42bf8d Add store block back inside *CDRServer.processEvents
Added *store and *rerate dynamic opts for cdrs.
2023-12-12 10:09:18 +01:00
gezimbll
3fe5f70dc9 Adding OneEvent functionality for stats 2023-12-07 17:44:33 +01:00
ionutboangiu
f0852b645b Rename composeURI func to composeMongoURI
To reflect that it's used exclusively for MongoDB (for now at least).

Also added a descriptive comment to the function.
2023-12-07 16:56:08 +01:00
ionutboangiu
8909786a4b Revise buildURL function
Renamed to composeURI.

Use simple string concatenation to build URI because there is
no need to keep the Parse call as a validation step. Any issue
would be caught when establishing a connection.
2023-12-07 16:56:08 +01:00
gezimbll
cc07c5366a Revise integration tests 2023-11-29 16:25:18 +01:00
gezimbll
ac32b7ce60 Added function to cast custom map types 2023-11-29 16:25:18 +01:00
gezimbll
3403a91a2b Revise integration tests 2023-11-29 16:25:18 +01:00
ionutboangiu
031cf1fe43 Add rpc caching for ProcessStoredEvents API 2023-11-29 16:22:58 +01:00
ionutboangiu
6826f13cc5 Update CDR processEvent to process multiple CGREvents 2023-11-16 15:38:18 +01:00
ionutboangiu
a817f30c2a Rename PrepareFilters to GetFilters 2023-11-16 15:38:18 +01:00
ionutboangiu
f5d69cb41b Implement ProcessStoredEvents API 2023-11-16 15:38:18 +01:00
ionutboangiu
26cdb571b8 Upgrade MongoDB driver to 1.13
- Set (but comment) serverAPI options (currently distinct api and
create.size BSON field are deprecated + possible others that are untested)
- Remove the custom time decoder used for mongo BSON
datetime values. The custom decoder was only converting these values
into UTC and was not any different from the default time.Time
decoder in the MongoDB driver, which also handles BSON string, int64,
and document values.
- Implement 'buildURL' function to connect to mongo (can also be
used for mysql and postgres)
- Update function names, variable names, and comments for clarity
- Replace 'bsonx.Regex' with the Regex primitive (deprecated since 1.12).
- Use simple concatenation instead of Sprintf
- Declare 'decimalType' locally, replace global 'decimalType'
- Simplify several functions without altering functionality
- Converting directly from a D to an M is deprecated. We are now decoding
  directly in a M.
- Used errors.As and errors.Is for proper error comparison and assertion
- Revised sloppy reassignments and added missing error checks
2023-11-14 18:24:21 +01:00
ionutboangiu
e5ab21def5 Implement AdminSv1 Get/RemoveCDRs APIs for CDRs
Addition of storDB to AdminSv1 was required.
2023-11-09 20:50:36 +01:00
ionutboangiu
d5039b3ce8 Add CDRs CRUD queries back and remove TP functions 2023-11-09 20:50:36 +01:00
ionutboangiu
d7679e2e9a Add negative filters to filter type string sets 2023-11-09 20:50:36 +01:00
gezimbll
32ed816de7 Replacing IsSliceMember ,CloneStringSlice and SliceStringEqual with slices package functions 2023-11-01 21:38:27 +01:00
ionutboangiu
65310e7437 Move benchmark relying on redis to it_test file 2023-10-27 18:52:05 +02:00
gezimbll
c6571492fc Make go vet pass 2023-10-26 15:59:34 +02:00
ionutboangiu
4c34d321de Add sanity check to prevent xml reader panic
HierarchyPath parser now returns nil when
the path is empty (instead of a string slice with one
EmptyString element).

If isAbsolute is set to true, when calling the AsString
method on a nil HierarchyPath, only the separator will
be returned. Alternatively, if isAbsolute is false, it
will just return . to signal that the path currently
being processed is the one required.This avoids a nil
expr error coming from the xmlquery library.

Use the Query and QueryAll functions from the xmlquery
package to be able to handle the errors ourselves and
avoid panics.

Remove config default value for xmlRootPath. The field
will remain commented in config_defaults for reference.

Add tests for HierarchyPath.AsString function.

Add comments for XmlProvider and xmlRootPath opt.

Update XmlProvider String() func based on the comment
which specifies that it should display the already
parsed values out of cache.
2023-10-19 17:19:30 +02:00
ionutboangiu
efcb32741a Run gofmt 2023-09-28 20:48:39 +02:00
NikolasPetriti
61a781675c Fix comment in models 2023-08-29 17:00:14 +02:00
NikolasPetriti
039b4269e8 Add tests for msgpack encoding/decoding for all basic go types that we are using in 1.0 2023-08-29 17:00:14 +02:00
NikolasPetriti
512f0a7c2d Revise struct tags for tp models 2023-08-29 17:00:14 +02:00
arberkatellari
770454c007 Renew DlgList, DNSAgent & add SRV/A support 2023-08-28 12:27:53 +02:00
gezimbll
5b5a159706 Added sentrypeer filter type 2023-08-02 16:49:33 +02:00
arberkatellari
d501e3d34a Add coverage tests in engine 2023-05-31 17:03:50 +02:00
arberkatellari
4cc5fa8a01 Add coverage tests for engine 2023-05-31 17:03:50 +02:00
arberkatellari
245a27acb1 Add coverage tests for engine 2023-05-31 17:03:50 +02:00
ionutboangiu
113e2a2bdf Replace interface{} with any 2023-05-31 10:22:28 +02:00
arberkatellari
61fa86126f Add coverage tests for engine 2023-05-25 08:51:59 +02:00
arberkatellari
23d026a7f9 Add coverage tests for engine 2023-05-23 08:22:14 +02:00
arberkatellari
6d167af009 Add coverage tests for engine 2023-05-18 19:29:02 +02:00
arberkatellari
ad6f3be8cb Add coverage tests for engine 2023-05-18 19:29:02 +02:00
arberkatellari
cfc8bc3dfd Add coverage tests for engine 2023-05-18 19:29:02 +02:00
arberkatellari
060961c6c0 Add coverage tests for engine 2023-05-18 19:29:02 +02:00
arberkatellari
59aad8dea4 Add coverage tests to engine 2023-05-18 19:29:02 +02:00
arberkatellari
9b5f594402 Add coverage tests for engine 2023-05-10 10:40:29 +02:00
arberkatellari
29e66e0390 Add coverage tests for engine 2023-05-10 10:40:29 +02:00
arberkatellari
f57a659b7b Add coverage tests for engine 2023-05-07 19:26:16 +02:00
arberkatellari
44690a658d Add coverage tests for engine 2023-05-07 19:26:16 +02:00
arberkatellari
5561ac6f9e Add coverage tests for engine 2023-05-07 19:26:16 +02:00
ionutboangiu
5227b4d447 Solve compilation errors in tests after CDRs service update 2023-05-03 10:05:28 +02:00
ionutboangiu
df1dc5e838 Add StorDB service
Add StorDB to config and services.

Put back the store_cdrs option under cdrs and update the CDRs
service to depend on StorDB.

Define the StorDB interface and add a constructor for it.

Add a constructor for postgres storage.

Add a config sanity check to validate SSL modes for postgres.

Update cgr-engine to consider StorDB on startup.
2023-05-03 10:05:28 +02:00
arberkatellari
0cd4ee5ca8 Add coverage tests for engine 2023-05-03 10:04:08 +02:00