Module: sip-router
Branch: master
Commit: 355ab783a99e413eb96a385ab067336316aaafda
URL:    
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=355ab783a99e413eb96a385ab067336316aaafda

Author: Richard Good <[email protected]>
Committer: Richard Good <[email protected]>
Date:   Tue Oct 29 12:40:42 2013 +0200

modules/cdp/acctstatemachine.c: fixed incorrect reservation expiry warning
        First check if acc state is OPEN before sending reservation expiry 
warning

---

 modules/cdp/session.c |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/modules/cdp/session.c b/modules/cdp/session.c
index dc41e1f..77a1f45 100644
--- a/modules/cdp/session.c
+++ b/modules/cdp/session.c
@@ -448,13 +448,16 @@ int cdp_sessions_timer(time_t now, void* ptr)
                                                int res_valid_for = 
x->u.cc_acc.reserved_units_validity_time;
                                                int last_reservation = 
x->u.cc_acc.reserved_units;
                                                int buffer_time = 15; //15 
seconds - TODO: add as config parameter
-                                               if (last_res_timestamp) {
-                                                       //we have obv already 
started reservations
-                                                       if ((last_res_timestamp 
+ res_valid_for) < (time(0) + last_reservation + buffer_time)) {
-                                                               
LM_DBG("reservation about to expire, sending callback\n");
-                                                               
cc_acc_client_stateful_sm_process(x, ACC_CC_EV_RSVN_WARNING, 0);
-                                                       }
-
+                                               //we should check for 
reservation expiries if the state is open
+                                               
if(x->u.cc_acc.state==ACC_CC_ST_OPEN){
+                                                   if (last_res_timestamp) {
+                                                           //we have obv 
already started reservations
+                                                           if 
((last_res_timestamp + res_valid_for) < (time(0) + last_reservation + 
buffer_time)) {
+                                                                   
LM_DBG("reservation about to expire, sending callback\n");
+                                                                   
cc_acc_client_stateful_sm_process(x, ACC_CC_EV_RSVN_WARNING, 0);
+                                                           }
+
+                                                   }
                                                }
                                                /* TODO: if reservation has 
expired we need to tear down the session. Ideally 
                                                 * the client application 
(module) should do this but for completeness we should


_______________________________________________
sr-dev mailing list
[email protected]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to