2778 Commits

Author SHA1 Message Date
ionutboangiu
1f7e0b33a2 Update *alter_sessions action
Will now support two extra parameters: address and codec. For *internal
connections, the birpc.Service object will be retrieved from rpcParamsMap
from utils. Supported codecs: <*gob|*json|*http_jsonrpc> (ingored for
*internal address).

Action does not bother with setting defaults anymore, lets the API
handle them.

Improve action comments.

Add unit tests for the action. UnregisterRpcParams' implementation was
required.

Updated *alter_sessions action tariffplan for radius coa integration test
to include address and codec.

Some birpc clients that are set up in integration tests were still registering
a SessionSv1 object. Updated them to register an AgentV1 object instead.
2024-02-27 16:28:48 +01:00
ionutboangiu
c67ec00baa Implement *alter_sessions action 2024-02-21 18:43:53 +01:00
ionutboangiu
838832c2b2 Rename agents API object: SessionSv1 to AgentV1 2024-02-21 18:43:53 +01:00
ionutboangiu
f9d1c0f0e1 Refactor ReAuthorize to AlterSessions 2024-02-21 18:43:53 +01:00
Bas Couwenberg
0785141218 Pass commit date and hash to -ldflags separately. 2024-02-20 16:52:59 +01:00
DanB
556060817c Dynamic templates for Radius CoA out of APIOpts 2024-02-20 16:21:13 +01:00
ionutboangiu
e50d71808a Optimize TransferBalanceAPI and test *cdrlog functionality 2024-02-20 11:11:39 +01:00
ionutboangiu
87da08f7fd Revise *transfer_balance action and its API
Ensure parameter fields are not abbreviated.

The action will not depend on balance type anymore. It will go through all
balances.

*default balance from source balance can go negative during transfer.
2024-02-19 11:28:52 +01:00
ionutboangiu
0c32f1761c Implement APIerSv1.TransferBalance API 2024-02-19 11:28:52 +01:00
ionutboangiu
267e6109e1 Implement CDRsv1.ProcessEvents API 2024-02-19 11:28:52 +01:00
arberkatellari
8ab43944a2 Update readthedocs tutorial 2024-02-15 17:02:41 +01:00
ionutboangiu
d8ad760dbb Update both ReAuthorize API signatures
The one from sessions takes an additional event alongside the
SessionFilter, while the one from agents will accept a CGREvent
instead of a simple originID string

The additional event sent to SessionSv1ReAuthorize will be merged
with the EventStart event from the matched session and can be used
when building server initiated requests from the *req map. The
initial packet which was initially inside *req, will be moved to
the *oreq ExtraDP (stands for original request).
2024-02-14 10:15:51 +01:00
ionutboangiu
3ff7007421 Revise failing tests after CoA update 2024-02-09 15:57:25 +01:00
ionutboangiu
0dc1567a7a Ensure event is cloned before being sent to attributes
Also the exporter ID has been added in APIOpts under the *exporterID
key.
2024-02-09 15:57:25 +01:00
ionutboangiu
02c8ed11c1 Implement support for RADIUS CoA 2024-02-07 18:28:17 +01:00
ionutboangiu
9991b29cae Implement DisconnectSession API for RADIUS Agent
Updated radigo library to latest version.

Updated RadiusAgent to satisfy the birpc client interface.

Added *radDAdiscMsg OrderedNavigableMap type field within AgentRequest.
This one is similar to *diamreq, as it is used for building RADIUS
server-initiated Disconnect Requests.

radReplyAppendAttributes: refactored to reflect that it can now be
used to also append attributes to request packets, not only reply.

Added bidirectional support for session related RadiusAgent methods.

For Dynamic Authorization to be possible, a new field was added within RadiusAgent
that holds dicts and secrets only for the clients that support it. They are used
to create the DA Client sending Disconnect Requests.

Added a new cache partition to store Access-Request packets with the purpose
of using them to build the Disconnect Requests. They are identified by sessionID.
It defaults to the value of 'Acct-Session-id'.

Added a predefined '*dmr' template as well as a 'dmr_template' config option within
the 'radius_agent' config section. This will map to a custom or to the predefined
template and will be used to build the Disconnect Request. By default, it doesn't
point to any template (this also means that the Access-Request packets will not be
cached).

Another option added to 'radius_agent' is 'client_da_addresses', which lists the
RADIUS clients supporting Dynamic Authorization. The key represents the host of
the client, while the value represents the address to which we will send the
Disconnect Request.

Added integration test.
2024-02-07 18:28:17 +01:00
ionutboangiu
8c0bee1a1a Add error constant for INSUFFICIENT_CREDIT_BALANCE_BLOCKER 2024-01-29 09:57:49 +01:00
ionutboangiu
36bdc41e97 Add support for kafka ssl encryption
For both poster and reader.
Added integration test.
2024-01-23 14:12:33 +01:00
gezimbll
584a55ab25 added *http filter type 2024-01-15 16:17:02 +01:00
ionutboangiu
b76d61281c Implement new *transfer_balance action
Added possibility to mock datamanager account functions.

Fixed typo in SubtractValue function name.

Added unit & integration tests.
2024-01-15 16:15:18 +01:00
arberkatellari
d5d873b851 Add caching_delay flag to cgr-loader 2024-01-06 17:15:33 +01:00
gezimbll
422d9196b4 Added new filter "*contains" 2023-12-18 17:30:15 +01:00
ionutboangiu
b4ef61d6f2 Update eventcost FieldAsInterface methods
Rating map is now accessible from Accounting.

ExtraCharges struct is accessible from Accounting.

RatingUnit fields that did not represent the id of another event cost struct
are now retrievable.
2023-12-13 20:32:27 +01:00
ionutboangiu
17fbc2d51b Rename mongoScheme opt to mongoConnScheme 2023-12-12 10:10:26 +01:00
ionutboangiu
24cbe49d90 Add support for mongodb+srv conn format
Option can be found in db opts under the name 'mongoSchema'.
2023-12-11 17:15:40 +01:00
ionutboangiu
1154cad0df Rename max_recursion_depth cfg param to fallback_depth 2023-12-07 17:08:22 +01:00
ionutboangiu
ff53446e41 Make recursion_max_depth a configurable option
Also added an integration test checking the recursion depth functionality.
2023-12-07 17:08:22 +01:00
ionutboangiu
0c91933065 Revise ERs event exporting
Add ees_success_ids and ees_failed_ids fields in reader config. The
former will be used to set EeIDs when the event processing returns
no error, while the latter will be used otherwise.

Add config sanity checks for the added options.

Remove Processed opts and everything related to them since they should
not be used anymore.

Fixed test compilation errors caused by the change.
2023-11-29 16:21:51 +01:00
arberkatellari
c6c4b17316 Improve default case for DurationFormatConverter 2023-11-16 09:05:45 +01:00
arberkatellari
e32ebe8415 Add duration format data converter 2023-11-15 17:24:44 +01:00
arberkatellari
054c584775 Create APIerSV1GetAccountCost 2023-11-09 09:37:34 +01:00
arberkatellari
681cd3c58a Add dryrun for CDRsV2ProcessEvent 2023-11-09 09:37:34 +01:00
Varun Dhand
5e513d130d fix: typo in rjreader.go 2023-11-09 09:37:34 +01:00
ionutboangiu
a30e261260 Remove go type limits constants
They can be retrieved directly from the std math package.
Slightly optimize the Fib functions and improve comments.
2023-11-08 18:31:07 +01:00
ionutboangiu
9771377b51 Implement additional retrieval methods for ordered map
Map() is used to return a shallow copy of the underlying map.
GetByIndex() is used to return the key-value pair at the specified index.
2023-11-08 18:31:07 +01:00
gezimbll
09e5088262 Removed warnings from go staticcheck 2023-11-08 17:10:13 +01:00
gezimbll
c2dacc42c1 Removed warnings from go staticcheck 2023-11-08 17:10:13 +01:00
gezimbll
5a85c119c8 Replacing IsSliceMember ,CloneStringSlice and SliceStringEqual with slices package equivalent functions 2023-11-01 21:52:50 +01:00
ionutboangiu
889ec93288 Rename prefix to isAbsolute inside HP.AsString() 2023-10-17 17:40:43 +02:00
ionutboangiu
12779560ca Handle empty relative path case in HP.AsString()
Return '.' when HierarchyPath is empty and prefix is false.
2023-10-17 17:40:43 +02:00
ionutboangiu
6c41ebe0de 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 the prefix is set to true, when calling the AsString
method on a nil HierarchyPath, only the separator will
be returned. 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 xml_root_path. The field
will remain commented in config_defaults for reference.

Add tests for HierarchyPath.AsString function.

Add comments for XmlProvider and xml_root_path opt.
2023-10-16 13:18:12 +03:00
arberkatellari
47e75fab13 Update radigo, add multiple folder functionality 2023-10-11 11:18:32 +02:00
ionutboangiu
6cfb934c9b Update *strip converter implementation and its tests
Added in-depth comments to the constructor.
Added test cases for most edge cases (if not all).
Updated the test to verify not only if an error occurs, but to also
check whether it matches the one we expect.
Added 3 more sanity checks that were missed.
2023-10-09 21:09:27 +02:00
ionutboangiu
3678c620d6 Add constants for *nil, *space and *char 2023-10-06 18:51:35 +02:00
ionutboangiu
f0fea43a41 Update to new *strip data converter 2023-10-06 09:38:08 +02:00
ionutboangiu
3e56a5aac7 Implement *strip data converter 2023-10-06 09:38:08 +02:00
DanB
a0a508d667 SessionS - adding stale_chan_max_extra_usage configuration to randomize the usage of stale sessions 2023-10-01 13:32:09 +02:00
ionutboangiu
bac73aa2c6 Migrate to new jetstream API
Updated ees/ers implementation to use the jetstream package which
separates the jetstream context from Core NATS.

Removed the jsOpts fields from the NatsEE struct. We are now using the
jetStreamMaxWait option directly through a timeout context.

Added streamName option for NATS reader since it is now required to be
specified when creating a consumer (it is not inferred based on subject
anymore).

Updated nats ers integration test.

Removed deprecated birpc unit test.

Updated tests to also use the new jetstream package.

Updated tests to start the nats-server using their official driver
instead of using the std go exec package. time.Sleeps are now not
required anymore to wait for the server.

In test configurations for nats readers, made sure that natsStreamName
option is populated. It is now required for consumers to know where to
subscribe.

Fixed potential panic that happened when jetstreamMaxWait option would
not be set.
2023-09-28 20:48:07 +02:00
NikolasPetriti
5d75b0e096 Add coverage tests for utils 2023-09-12 18:10:02 +02:00
NikolasPetriti
aac80e76b9 Add coverage tests for utils 2023-09-12 18:10:02 +02:00