Module: kamailio
Branch: master
Commit: 6cd9f310a0af9bf6024696d436b6b96491808832
URL: 
https://github.com/kamailio/kamailio/commit/6cd9f310a0af9bf6024696d436b6b96491808832

Author: Morten Tryfoss <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2023-11-22T09:36:44+01:00

cdp: Add support for re-auth on ro sessions initiated from charging server

- handle missing valid_for in CCA correctly, for chargings server not using it
- add AVP_Time_Quota_Threshold AVP, to support server controlled CCR-U threshold

---

Modified: src/modules/cdp/acctstatemachine.c
Modified: src/modules/cdp/diameter_code_avp.h
Modified: src/modules/cdp/peerstatemachine.c
Modified: src/modules/cdp/session.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/6cd9f310a0af9bf6024696d436b6b96491808832.diff
Patch: 
https://github.com/kamailio/kamailio/commit/6cd9f310a0af9bf6024696d436b6b96491808832.patch

---

diff --git a/src/modules/cdp/acctstatemachine.c 
b/src/modules/cdp/acctstatemachine.c
index 398526d86d7..aad4ca1cc04 100644
--- a/src/modules/cdp/acctstatemachine.c
+++ b/src/modules/cdp/acctstatemachine.c
@@ -176,6 +176,8 @@ int cc_acc_client_stateful_sm_process(
                                        //nothing we can do here, we have sent 
callback, client needs to send CCR Update
                                        LM_DBG("Reservation close to 
expiring\n");
                                        break;
+                               case ACC_CC_EV_SESSION_MODIFIED:
+                                       break;
                                default:
                                        LM_ERR("Received unknown event [%d] in 
state [%d]\n", event,
                                                        x->state);
diff --git a/src/modules/cdp/diameter_code_avp.h 
b/src/modules/cdp/diameter_code_avp.h
index 32987538dee..262ab62c012 100644
--- a/src/modules/cdp/diameter_code_avp.h
+++ b/src/modules/cdp/diameter_code_avp.h
@@ -266,6 +266,8 @@ typedef enum
        AVP_Service_Selection = 493, //RFC5778
        AVP_Call_Id = 494,
 
+       AVP_Time_Quota_Threshold = 868, // 3GPP TS 32.299
+
 } AAA_AVPCodeNr;
 
 enum
diff --git a/src/modules/cdp/peerstatemachine.c 
b/src/modules/cdp/peerstatemachine.c
index 24d5aed959e..74d119b70f2 100644
--- a/src/modules/cdp/peerstatemachine.c
+++ b/src/modules/cdp/peerstatemachine.c
@@ -1350,11 +1350,9 @@ void Rcv_Process(peer *p, AAAMessage *msg)
                switch(session->type) {
                        case ACCT_CC_CLIENT:
                                if(is_req(msg)) {
-                                       LM_WARN("unhandled receive request on 
Credit Control Acct "
-                                                       "session\n");
-                                       AAASessionsUnlock(
-                                                       session->hash); //must 
be called because we don't call state machine here
-                                       session = 0; //we don't call SM here so 
we must not set to 0
+                                       cc_acc_client_stateful_sm_process(
+                                                       session, 
ACC_CC_EV_SESSION_MODIFIED, msg);
+                                       session = 0;
                                } else {
                                        cc_acc_client_stateful_sm_process(
                                                        session, 
ACC_CC_EV_RECV_ANS, msg);
diff --git a/src/modules/cdp/session.c b/src/modules/cdp/session.c
index e6e23fcbcf6..cd169f103ab 100644
--- a/src/modules/cdp/session.c
+++ b/src/modules/cdp/session.c
@@ -491,7 +491,7 @@ int cdp_sessions_timer(time_t now, void *ptr)
                                                                15; //15 
seconds - TODO: add as config parameter
                                                //we should check for 
reservation expiring if the state is open
                                                if(x->u.cc_acc.state == 
ACC_CC_ST_OPEN) {
-                                                       if(last_res_timestamp) {
+                                                       if(last_res_timestamp 
&& res_valid_for) {
                                                                //we have obv 
already started reservations
                                                                
if((last_res_timestamp + res_valid_for)
                                                                                
< (time(0) + last_reservation

_______________________________________________
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to [email protected]

Reply via email to