Alex,
Thanks so much for that. A lot to play with in the morning.
I did set up an rtimer that called a route that then did checks if the
number of dialogs > 1.
I think I will keep playing with the time slices as the user may divert,
conference etc so keeping the charging real time is my goal. There is also
the potential of data usage at the same time. The credit is calculated on
set up for the dialled path (mo and term costs) if each call and the
charging calculator will then "reserve" money for 30 seconds and allow
connection. Every 30 seconds it would request another 30 using a uuid
passed in set up.
I am hoping this will minimise Balance inconsistency for multiple calls +
sms + data, with the actual accounting being done upon completion.
I did not even think of jsonrpc, that will keep me reading tomorrow!
Thanks,
Steve
On Sat, 25 May 2019 at 00:17, Alex Balashov <abalashov(a)evaristesys.com>
wrote:
Well, the generic answer to the question of how
to periodically do
something in the background is 'rtimer':
https://kamailio.org/docs/modules/5.2.x/modules/rtimer.html
This can be combined with putting dialogs in an `htable` (perhaps using
the dialog module's start/end event_routes) and walking over the
entries in a background rtimer route:
https://kamailio.org/docs/modules/5.2.x/modules/htable.html#htable.f.sht_it…
Alternately, one can use jsonrpc_exec()
https://kamailio.org/docs/modules/5.2.x/modules/jsonrpcs.html#jsonrpcs.f.js…
to run 'dlg.list':
https://kamailio.org/docs/modules/5.2.x/modules/dialog.html#dlg.r.list
... and iterate over the output with the help of the 'jansson' module
(JSON parser):
https://kamailio.org/docs/modules/5.2.x/modules/jansson.html
But honestly, I'd ask yourself whether this extra layer of complexity is
truly worth it. For a lot of prepaid setups, live balance decrementing
isn't worth the bother.
An alternate and simpler approach is to just let the call be initiated
if the balance is > 0 at the time the call is made, then deduct from the
balance when the call ends.
Yeah, it means someone's free to make a 4 hour call without the prepaid
credit to support it, and worse yet, possibly a number of 4 hour calls
initiated simultaneously. But most calls aren't like that, and from a
business perspective, is it really worth the headache of live
decrementing and all the moving parts involved?
Maybe it is, but I would at least ask the question.
-- Alex
On Fri, May 24, 2019 at 06:18:19PM +0100, Steve Bucklin wrote:
Hello all (again),
I am looking at a 'good' method to start a call with "chunks" of time
allocated. I wish the initial call to check a credit, and if credit is
good,
allow a small amount of time (say 30 seconds). I
have enabled DIALOG and
have looked at CNXCC, but am confused!
When the initial 30 seconds runs out, I want to authorise another 30
seconds, etc, etc, etc. I have started to play and set a dialog timer
that
expires to a route, and then can 'return'
allowing the call to continue
-
BUT was not able to reset the dialog timer to
trip again after another
30
seconds.
I tried to 'set_max_time' on cnxcc, but this did not seem to trip the
event
route upon timeout?
Does anyone have a pointer to any examples? I also am unsure of how to
update the timer and keep a call in play!
Steve
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users(a)lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
--
Alex Balashov | Principal | Evariste Systems LLC
Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free)
Web:
http://www.evaristesys.com/,
http://www.csrpswitch.com/
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users(a)lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users(a)lists.kamailio.org