Update Session Call for Extending Duration Call Purpose

96 views
Skip to first unread message

Asoka Wardhana

unread,
Jul 7, 2025, 3:59:57 AMJul 7
to CGRateS
Hi CGRateS Team, 

How to extending duration call (example Add more Voice Balance), so duration of a live call will extended automatically ? 

Example : 
Account 1001 have 300 second call, when call duration reach 250 second, we add another voice balance or update existing voice balance ID with new balance.

Thank You

Armir Veliaj

unread,
Jul 7, 2025, 11:21:12 AMJul 7
to CGRateS
Hi Asoka,

If CGRateS is in prepaid mode, it will automatically update and look in your accounts,
and it will consider automatically if you *topup.

Hope it helps.
Thanks,
Armir

Asoka Wardhana

unread,
Jul 8, 2025, 1:17:17 AMJul 8
to CGRateS
Hi Armir,

Thanks for your response.

When i test using Actions & ActionTriggers, call is hangup when reach max voice balance (ex: 60 seconds).

{
    "method": "APIerSv1.SetActions",
    "params": [
        {
            "Actions": [
                {
                    "Filter": "",
                    "ExtraParameters": "",
                    "BalanceWeight": 10,
                    "BalanceType": "*voice",
                    "SharedGroups": "",
                    "Categories": "call_out_ABC-000001",
                    "BalanceBlocker": "false",
                    "BalanceId": "BA_VOICE_ABC-000001-",
                    "ExpiryTime": "*unlimited",
                    "RatingSubject": "",
                    "Identifier": "*topup",
                    "DestinationIds": "*any",
                    "Weight": 10,
                    "BalanceDisabled": "false",
                    "Units": 60000000000
                }
            ],
            "Overwrite": true,
            "ActionsId": "ACT_TOPUP_RST_10"
        }
    ]
}

{
    "method": "APIerSv1.AddTriggeredAction",
    "params": [
        {
            "Tenant": "cgrates.org",
            "Account": "ABC-000001",
            "BalanceType": "*voice",
            "ThresholdType": "*min_balance",
            "ThresholdValue": 30000000000,
            "Categories": "call_out_ABC-000001",
            "Weight": 10,
            "ActionsId":  "ACT_TOPUP_RST_10"
        }
    ],
    "id": 0
}

After call hangup, i check back, Balance is become  60000000000  , so the Actions is working, but the live call is not extending automatically to 60 second.

Armir Veliaj

unread,
Jul 11, 2025, 2:02:38 PMJul 11
to CGRateS
Hi Asoka,

To better understand your scenario, please provide your request type, whether it's prepaid or not and if you need to trigger a bonus or just add balance. If your purpose is just to extend the duration of the call by increasing the balance, you can do it without using ActionTriggers but by adding a *topup to that initial balance, and the balance will be increased.
Also, please share your configs and the ngrep if you still may need us to check later.

Thanks,
Armir

Asoka Wardhana

unread,
Jul 14, 2025, 2:32:43 AMJul 14
to CGRateS
Hi Armir,

Our goal is Account 1001 has a 60-second call balance. While on a call, when the remaining duration reaches 30 seconds, we add another 60 seconds of balance. The call duration should automatically extend to 120 seconds within the same call, instead of remaining at 60 seconds.

this is ngrep log , call hangup within 60 seconds.

Screenshot 2025-07-14 132718.png
Screenshot 2025-07-14 132743.png
Screenshot 2025-07-14 132804.png


When call reached 30 seconds we execute action *topup : 

Screenshot 2025-07-14 133105.png

Thanks for your help Armir.

Regards,

Asoka

gezim....@itsyscom.com

unread,
Jul 14, 2025, 12:17:37 PMJul 14
to CGRateS
Hi Asoka ,

Since Armir is on holiday, I will be assisting you in this issue instead.
Based on your logs, the call still seems to hangup at 60s even  though action got executed.
I suspect the reason for this behavior to be the maxusage set to 60s at authorization phase, but for me to check further please send to us the CGRateS config file and ngrep logs in sessions port (default is 2014).

Thanks,
Gezim.

Asoka Wardhana

unread,
Jul 14, 2025, 2:42:50 PMJul 14
to CGRateS
Hi Gezim,

Thank you for your assistance.
Attached is the CGRateS configuration file.
However, when I run ngrep to monitor log sessions on port 2014, no traffic is captured for that port.

Regards,

Asoka
cgrates.json

gezim....@itsyscom.com

unread,
Jul 15, 2025, 5:12:40 AMJul 15
to CGRateS
Hi Asoka,

I forgot to mention that you need to modify connections from Agents towards SessionS to be over network since by default the connection is internal and cannot be traced,  sorry for my oversight in previous reply.
In the agents configuration, like freeswitch_agent or asterisk_agent in your config please add the field below:
"sessions_conns": ["*bijson_localhost"]
After that you should get logs by using ngrep on port 2014.

Thanks,
Gezim.

Asoka Wardhana

unread,
Jul 15, 2025, 10:47:46 AMJul 15
to CGRateS
Hi Gezim

Here is the log .

Port 2014 : 
Screenshot 2025-07-15 214032.png
Screenshot 2025-07-15 214051.png

Port 2012 : 
Screenshot 2025-07-15 214115.png
Screenshot 2025-07-15 214140.pngScreenshot 2025-07-15 214158.png

Port 2080 : 
Screenshot 2025-07-15 214219.png

Last cgrates configuration attached.

Thanks Gezim,

Regards,

Asoka.
cgrates.json

gezim....@itsyscom.com

unread,
Jul 18, 2025, 8:01:55 AMJul 18
to CGRateS
Hi Asoka,

It seems by your logs and config file there isn't a real-time debit happening through sessions, because you didn't specify a debit interval in sessions config and by default it's
"debit_interval": "0s"
changing to larger interval than 0 would cause sessions to debit calls in real time.
But however, it still won't fix your issue because we found out in implementation that fsagent schedules call termination based on authorization request maxusage reply , hence session duration can't be extended later in other session requests or by adding more units to the balance during the call.
You can open an issue on GitHub, and we'll update you in there when coming up with a fix.

Thanks,
Gezim.

Asoka Wardhana

unread,
Jul 21, 2025, 10:50:30 AMJul 21
to CGRateS
Hi Gezim,

I've opened a new issue for this. Your help was much appreciated.

Thanks.
Reply all
Reply to author
Forward
0 new messages