Explorar el Código

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
Morten Tryfoss hace 1 año
padre
commit
6cd9f310a0

+ 2 - 0
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);

+ 2 - 0
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

+ 3 - 5
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);

+ 1 - 1
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