Billing issue in PlaySMS

I have sent messages some of them failed but still billed on them even the report shows charge: 0
but in tblBilling status = 1 not rolled back.

I saw in report page it checks if p_status==2 then shows charge = 0 Isn’t it should check for tblBilling status?

Regards,

which version do you use ?

if not 1.3.1 please upgrade to it, see the difference.

anton

I’m using V 1.3

Will try switching.

Now upgraded to 1.3.1 and same error.
simplerate__deduct # rate deduct failed due to unable to save to db

Didn t solve mine too so made a reconciliation script,

I think the issue is that sometimes it writes in tbl billing without writing in table smsoutgoing so foreign key is missing

Can you share the code?

@Yahia can I get the log entries around that message ? like probably 5-10 log lines before and after quoted line

anton

    • 2015-11-26 11:34:38 PID5657349da354a - L2 sendsms_process # end
    • 2015-11-26 11:34:38 PID5657349da354a - L2 sendsmsd # result queue_code:b142d9058aa1914844711969dd774ca5 to:********* flag:1 smslog_id:23409
    • 2015-11-26 11:34:38 PID5657349d9c59a - L2 credit_hook_rate_setusercredit # saved uid:15 balance:294.572
    • 2015-11-26 11:34:38 PID5657349d9c59a - L2 simplerate__deduct # user uid:15 parent_uid: smslog_id:23310 msglen:321 count:3 rate:0.017 charge:0.051 credit:294.623 balance:294.572
    • 2015-11-26 11:34:38 PID5657349d9c59a - L2 simplebilling__post # saving smslog_id:23310 rate:0.017 credit:294.623 count:3 charge:0.051
    • 2015-11-26 11:34:38 PID5657349d9c719 - L2 credit_hook_rate_setusercredit # unable to save uid:15 balance:294.572
      - - 2015-11-26 11:34:38 PID5657349d9c719 - L3 simplerate__deduct # rate deduct failed due to unable to save to db uid:15 parent_uid: smslog_id:23207
    • 2015-11-26 11:34:38 PID5657349da354a - L2 sendsmsd # sending queue_code:b142d9058aa1914844711969dd774ca5 smslog_id:23410 to:********** sms_count:1449 counter:8
    • 2015-11-26 11:34:38 PID5657349d984fc - L3 simplerate_hook_rate_getbyprefix # found rate id:16 prefix:9665 rate:0.017 description:Saudi Arabia to:*********
    • 2015-11-26 11:34:38 PID5657349d9c719 - L2 sendsms_process # end
    • 2015-11-26 11:34:38 PID5657349d9c59a - L2 simplebilling__post # saved smslog_id:23310 id:10573
    • 2015-11-26 11:34:38 PID5657349d984fc - L3 simplerate_hook_rate_getcharges # uid:15 u:******* len:321 unicode:1 to:********* enable_credit_unicode:1 count:3 rate:0.017 charge:0.051
    • 2015-11-26 11:34:38 PID5657349d9c719 - L2 sendsmsd # result queue_code:b142d9058aa1914844711969dd774ca5 to:********* flag:1 smslog_id:23207
    • 2015-11-26 11:34:38 PID5657349d9c59a - L3 simplerate__deduct # deduct successful uid:15 parent_uid: smslog_id:23310
    • 2015-11-26 11:34:38 PID5657349d9c59a - L3 simplerate__deduct # credit_lowest_limit:5 balance:294.572 charge:0.051
    • 2015-11-26 11:34:38 PID5657349d9c59a - L2 sendsms_process # end

ah ic, theres a race condition between sendsmsd, both reading and saving credit at the same time.

this is a design flaw on playSMS, looks like it will need a major changes on this side, I hope not.

oh well, bugs come and go, I will fix this one as soon as possible, but can’t tell when it’ll be ready.

I open a bug issue for this, and schedule it for upcoming release:

anton

@Yahia @anton rebuild.php (5.5 KB)reconcile.php (1.7 KB)

Sorry for getting back so late, was also sorting this script and making it safe… it will only reconcile the billable messages and not failed or pending,

How to set up

Upload both to a gateway plugin of your choice.

Open reconcile.php and replace ::: chdir(“plugin/gateway/ak/”); with ::: chdir(“plugin/gateway/YOURGATEWAY/”);

done!

You can then call it via CURL on your server or make a cron job to do : curl http://127.0.0.1/plugin/gateway/YOURGATEWAY/reconcile.php every hour or so …

Tell me how it goes.

We are waiting for a solution to that issue.
:slightly_smiling:

Hi,
Would this update help fixing the issue?

No, its part of several adjustments I made to fix billing issue.

Last week I just pushed more fixes by adding new daemon that updates user’s credits. But I haven’t announce it as I forgot to correctly handle the parent credits.

anton