Skip to content

Commit

Permalink
cgrates: make MaxUsage optional for InitiateSession reply
Browse files Browse the repository at this point in the history
In newer versions of CGRateS, MaxUsage is no longer returned - this
means that the session should be allowed without any duration
limitation.
  • Loading branch information
razvancrainea committed Sep 10, 2021
1 parent 0ae682e commit ae596cc
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions modules/cgrates/cgrates_acc.c
Expand Up @@ -244,9 +244,10 @@ static int cgr_proc_start_acc_reply(struct cgr_conn *c, json_object *jobj,
}
/* we are only interested in the MaxUsage token */
if (!json_object_object_get_ex(jorig, "MaxUsage", &jobj)) {
LM_ERR("CGRateS did not return an MaxUsage in InitiateSession reply: %d %s\n",
json_object_get_type(jorig), json_object_to_json_string(jorig));
return -4;
LM_DBG("CGRateS did not return an MaxUsage in InitiateSession reply: %d %s"
"- allow unlimited!\n", json_object_get_type(jorig),
json_object_to_json_string(jorig));
return 1;
}
if (json_object_get_type(jobj) != json_type_int) {
LM_ERR("CGRateS returned a non-int type for MaxUsage InitiateSession reply: %d %s\n",
Expand All @@ -258,6 +259,10 @@ static int cgr_proc_start_acc_reply(struct cgr_conn *c, json_object *jobj,
val.n = timeout / 1000000000;
else
val.n = timeout;
} else if (!jobj) {
LM_DBG("CGRateS did not return an MaxUsage in InitiateSession reply "
"- allow unlimited!\n");
return 1;
} else {
if (json_object_get_type(jobj) != json_type_int) {
LM_ERR("CGRateS returned a non-int type for InitiateSession reply: %d %s\n",
Expand Down

0 comments on commit ae596cc

Please sign in to comment.