How to meter each user's minutes on call

I currently have a Jitsi instance and I’m using JWT tokens to authenticate users. However, I’d like to keep track of how many minutes each user is calling for. I’ve made a Prosody module which hooks onto muc-occupant-joined and muc-occupant-left, for now just logging the JWT tokens and later I’ll have it make an HTTP request to my server. This would be fine and I’d be able to store the end time minus start time. The problem is that if Prosody crashes or I restart the service, it doesn’t send a muc-occupant-left event so my HTTP server doesn’t know the call ended. What would be a good way to record how many minutes a user is calling for? The only workable option I could think of is to poll Prosody and fetch the participants list so I know an approximate call end time, but I’m unsure whether this would be workable.

Thank you in advance.

This is what speakerstats module is doing at the moment, you just need extend and add the push to your stats service via http.
The stats are pushed once when meeting ends. Well you should not restart prosody while there are ongoing conferences.

Ah ok, thank you.