Can we add a new hook function (credit_hook_credit_update($uid, $status)) to allow gateways to call credit update per individual user. Currently, “credit_hook_rate_update()” runs throught all users which might be a lag in the system if you have many users and you need to update the credit balance each time an sms is sent
rate_update() is ratesmsd part of playsmsd, it runs as daemon, the function called every 30 seconds, not everytime sms is sent
do you want to not using ratesmsd and let the
rate_update() be called by gateway (or something else) everytime sms is sent so that you can just update billing for certain user only (not all) ?
rate_update() runs by playsmsd:
rate_update(), it calls hooks:
credit_hook_rate_update() and friends:
Yes, I want rate_update to be called by the gateway. This will ensure that credit balance is updated instantly and no sms will be sent when credit is not enough.
Optionally, I will then disable ratesmsd or let it continue as it is.
for proof of concept, try to call
_credit_update() directly from gateway, for example from
Will try and revert.Thanks
This does not work still. Or is there a way I can ensure that user credit does not run into negative?
not sure why its not working, it should be as
rate_update basically calls
_credit_update(), perhaps if you can share your modification I can examine, and check logs too
as for negative balance see this:
I added addhoc balance (temp balance) and use that to determine if user can send next SMS or not
the adhoc balance is necessary because the way playSMS bills, it needs to wait for status of each SMS become sent or failed, and since SMS is alot then it takes time
if you found better way let us know