Commit Graph

657 Commits

Author SHA1 Message Date
ionutboangiu
897d6f0da1 integrate IPs with SessionS 2025-12-16 13:23:17 +01:00
ionutboangiu
f0b65f0797 cfg: make sessions jsoncfg object fields camelcase 2025-12-05 13:15:52 +01:00
ionutboangiu
8443af3a89 Relicense from GPLv3 to AGPLv3 2025-10-29 19:42:40 +01:00
gezimbll
c233daef58 replaced sched_hangup with sched_transfer 2025-09-09 17:32:01 +02:00
armirveliaj
c9972c62f9 Add coverage tests on actions && sessions 2025-09-08 17:51:56 +02:00
arberkatellari
2385597155 Add route_profile option to switch agents in config 2025-06-25 19:11:15 +02:00
arberkatellari
746846eaaf Revise tests 2025-06-24 17:57:09 +02:00
ionutboangiu
676900b4c3 update DB casing for InitDB helpers 2025-05-29 15:41:53 +02:00
ionutboangiu
5f47df6927 close db connections in test flush helpers
Previously, database connections would stay alive until "go test"
would finish, sometimes leading to max conn errors.
2025-05-29 15:41:53 +02:00
arberkatellari
d03e62c5a7 Add tests for Session Update TotalUsage 2025-05-06 09:29:57 +02:00
DanB
fa42fc1213 Do not ignore the not found error for totalUsage of sessions 2025-05-05 21:00:46 +02:00
DanB
342d50cdb1 Cleanup testSessionsVoiceTotalUsage 2025-05-05 09:32:28 +02:00
DanB
82ec0dbbca Adding TotalUsage support for update events in sessions 2025-05-05 09:26:58 +02:00
arberkatellari
5463eb61c6 Adjust tests to InternalDB constructor 2025-04-11 13:09:50 +02:00
arberkatellari
ed584364d1 Add tests for internal DB dump and restore 2025-04-06 12:08:40 +02:00
gezimbll
260b32323d added option to pass UpdateSession event through stats or thresholds 2025-03-18 20:08:05 +01:00
arberkatellari
9163d96ece Improve *dynaprepaid for Sessions ProcessEvent 2025-02-24 12:11:12 +01:00
arberkatellari
ce764e48bb Add dynaprepaid functionality to AuthorizeEvent 2025-02-19 14:14:55 +01:00
arberkatellari
39bca3495a Improve *dynaperpaid events for sessions 2025-02-17 08:02:20 +01:00
arberkatellari
2f05395ec1 Add cgr_max_usage variable to fsagent 2024-10-14 17:05:46 +02:00
ionutboangiu
486fdf54a1 sessions: auth pseudoprepaid ProcessMessage requests
Previously, only *prepaid requests were authorized, for every other
request type, the default usage was used.
2024-09-17 18:16:45 +02:00
armirveliaj
07390d8624 Add new unit tests on ees and sessions 2024-08-21 21:07:15 +02:00
arberkatellari
7ca9d89fbe Revize session_indexes 2024-08-06 23:04:58 +02:00
arberkatellari
5ccb77c5dc Add mongo support for sessions backup 2024-07-22 15:31:02 +02:00
ionutboangiu
eb3bd5cc1d Add redisPoolPipelineLimit configuration field for datadb
Sets the maximum number of commands that can be pipelined before flushing.
0 means no limit and pipelines will only be limited by the time window.
2024-07-05 11:21:16 +02:00
ionutboangiu
ed3fa0d294 Add redisPoolPipelineWindow configuration field for datadb
Sets the duration after which internal pipelines are flushed.
0 disabled implicit pipelining.
2024-07-02 19:58:03 +02:00
arberkatellari
f46b37bdf8 Make minor improvements to sessions backup 2024-06-12 18:21:50 +02:00
arberkatellari
a0f94c6804 Add/Update unit and integration tests adjusting for sessions backup 2024-06-12 18:21:50 +02:00
arberkatellari
f356695f6f Add active sessions backup functionalitiy 2024-06-12 18:21:50 +02:00
ionutboangiu
c91fbafe36 Restore compatibility with OpenSIPS
For OpenSIPS 3.x, set "client_protocol" to 1.0 in the json configuration
under the "sessions" section. The current default protocol version is 2.0.

Addresses #4339
2024-05-16 10:29:05 +02:00
ionutboangiu
e025a0dc89 Revise tests
-ensure failure messages are useful
-optimize tests with needlessly large sleep times
-enforce a stricter margin for error
2024-04-12 13:13:17 +02:00
ionutboangiu
3062113a61 Make go vet pass
The rpcclient constructor could not see the centralized
Encoding flag because it didn't have the necessary build
constraints. Added the constraints in lib_test.go files
where it wasn't alone. In all the other cases, it was
moved to the first file where it was needed.
2024-04-08 13:14:02 +02:00
ionutboangiu
16eb745f00 Centralize test flags in utils for shared use across tests 2024-04-08 13:14:02 +02:00
ionutboangiu
ee98dbe0ca Update AgentV1DisconnectSession api signature
Will accept utils.CGREvent instead of utils.AttrDisconnectSession as a
parameter.

SessionSv1.ForceDisconnect will take utils.SessionFilterWithEvent as a
parameter instead of *utils.SessionFilter.

Added possibility to pass DisconnectCause as an Event parameter.

The forceSTerminate that's called when the session timer expires will
have DisconnectCause 'SESSION_TIMEOUT' instead of 'FORCED_DISCONNECT'.

Added Dispatcher methods for AlterSessions.

Event will be merged with EventStart of the session before being sent to
AgentV1DisconnectSession.
2024-03-07 17:20:23 +01:00
ionutboangiu
98265a122a Refactor function names and error msgs related to AlterSessions 2024-03-06 16:15:36 +01:00
ionutboangiu
0aea8ac641 Revert "Move CGREvent from utils to engine"
This reverts commit 02195c47ed.
2024-03-04 09:49:15 +01:00
ionutboangiu
02195c47ed Move CGREvent from utils to engine 2024-02-27 17:16:57 +01:00
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
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
DanB
556060817c Dynamic templates for Radius CoA out of APIOpts 2024-02-20 16:21:13 +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
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
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
2d137915c1 Avoid potential deadlock in session test 2023-11-02 19:40:03 +01:00
gezimbll
5a85c119c8 Replacing IsSliceMember ,CloneStringSlice and SliceStringEqual with slices package equivalent functions 2023-11-01 21:52:50 +01:00
ionutboangiu
da6a2ee92f Pass clnt as a parameter to the goroutine in syncSessions
This prevents the clnt loop variable to be captured by the
func literal.
2023-10-09 21:09:27 +02:00
ionutboangiu
d396da9214 Remove deprecated rand.Seed function 2023-10-02 21:04:00 +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