[SR-Users] Prepaid system using dialog and sqlops

Infinicalls Infinicalls infinicalls at gmail.com
Thu Aug 4 17:17:39 CEST 2016


Hi Daniel,
  Thanks. I have added credits in Subscriber. But where exactly should
I insert the SQL statements in kamailio.cfg so that it gets executed
for each and every call. The rate_unit multiplied with time_unit in
billing_rates should be done in realtime, I guess.

Also is it possible to check for credits > 0 in Auth and disconnect
the user if this condition is not met.

regards
Ganesh Kumar

On 8/3/16, Daniel-Constantin Mierla <miconda at gmail.com> wrote:
> Hello,
>
>
> On 02/08/16 07:36, Infinicalls Infinicalls wrote:
>> Hi,
>>  I am still struggling to get a prepaid system for my service.
>>
>> After installing SIREMIS, I am able to get the CDRs updated. But even
>> after adding the cron settings, the call duration doesn't get updated.
>>
>> And also in
>>
>> http://lists.sip-router.org/pipermail/sr-users/2012-January/071517.html
>>
>> it has been mentioned that
>>
>> "If it is the case of 1 call per user at a time, then practically can
>> be done from kamailio config only. When call starts, compute the max
>> duration for that call based on caller/destination (e.g., call a
>> stored procedure via sqlops) and set the dialog timeout to that
>> duration. When call ends (BYE in main route or timeout route) update
>> the credit accordingly."
>>
>> Can somebody let me know if my understanding is correct.
>>
>> 1) Add a field called "credits" in the database. And topup that field.
>>
>> 2) First compute max permitted duration for that user by multiplying
>> the cost for number prefix (say +91) and pulse.
>>
>> 3) And finally add this value to timeout of dialog. modparam("dialog",
>> "default_timeout", 100000)
>> $dlg_ctx(timeout_bye) = 1;
>>
>> Will this work? Any help would be appreciated.
>>
> That should work, you also need to deduct the used credit when the call
> is ended.
>
> Cheers,
> Daniel
>



More information about the sr-users mailing list