[sr-dev] git:master:581912f5: ims_charging: Properly check final_unit_action-flag for initial requests
Carsten Bock
carsten at ng-voice.com
Mon Jan 11 15:19:08 CET 2016
Module: kamailio
Branch: master
Commit: 581912f5ed117bb56087668aa7ac60a7b667d525
URL: https://github.com/kamailio/kamailio/commit/581912f5ed117bb56087668aa7ac60a7b667d525
Author: Carsten Bock <carsten at ng-voice.com>
Committer: Carsten Bock <carsten at ng-voice.com>
Date: 2016-01-11T15:14:37+01:00
ims_charging: Properly check final_unit_action-flag for initial requests
If final_unit_action flag is set in initial ccr response, kamailio need to send terminate request after the granted time instead of sending an CCR-UPDATE request.
Patch by DileepNunna <dileepn30 at gmail.com>
Closes Github #467 (Kamailio sending update ccr request instead of terminate request for initial ccr response having final_unit_action flag)
---
Modified: modules/ims_charging/ims_ro.c
Modified: modules/ims_charging/ro_session_hash.h
Modified: modules/ims_charging/ro_timer.c
---
Diff: https://github.com/kamailio/kamailio/commit/581912f5ed117bb56087668aa7ac60a7b667d525.diff
Patch: https://github.com/kamailio/kamailio/commit/581912f5ed117bb56087668aa7ac60a7b667d525.patch
---
diff --git a/modules/ims_charging/ims_ro.c b/modules/ims_charging/ims_ro.c
index adb536d..8864788 100644
--- a/modules/ims_charging/ims_ro.c
+++ b/modules/ims_charging/ims_ro.c
@@ -1255,6 +1255,10 @@ static void resume_on_initial_ccr(int is_timeout, void *param, AAAMessage *cca,
ssd->ro_session->event_type = pending;
ssd->ro_session->reserved_secs = ro_cca_data->mscc->granted_service_unit->cc_time;
ssd->ro_session->valid_for = ro_cca_data->mscc->validity_time;
+ ssd->ro_session->is_final_allocation = 0;
+
+ if (ro_cca_data->mscc->final_unit_action && (ro_cca_data->mscc->final_unit_action->action == 0))
+ ssd->ro_session->is_final_allocation = 1;
Ro_free_CCA(ro_cca_data);
diff --git a/modules/ims_charging/ro_session_hash.h b/modules/ims_charging/ro_session_hash.h
index 7aa1b89..fa92ed9 100644
--- a/modules/ims_charging/ro_session_hash.h
+++ b/modules/ims_charging/ro_session_hash.h
@@ -71,6 +71,7 @@ struct ro_session {
str mac;
int rating_group;
int service_identifier;
+ unsigned int is_final_allocation;
};
/*! entries in the main ro_session table */
diff --git a/modules/ims_charging/ro_timer.c b/modules/ims_charging/ro_timer.c
index f5978d6..40f3c42 100644
--- a/modules/ims_charging/ro_timer.c
+++ b/modules/ims_charging/ro_timer.c
@@ -400,6 +400,19 @@ void ro_session_ontimeout(struct ro_tl *tl) {
// return;
// }
+
+ if(ro_session->is_final_allocation) {
+ now = get_current_time_micro();
+ used_secs = now - ro_session->last_event_timestamp;
+ if((ro_session->reserved_secs - used_secs) > 0) {
+ update_ro_timer(&ro_session->ro_tl, (ro_session->reserved_secs - used_secs));
+ return;
+ }
+ else {
+ ro_session->event_type = no_more_credit;
+ }
+ }
+
switch (ro_session->event_type) {
case answered:
now = get_current_time_micro();
More information about the sr-dev
mailing list