[Asterisk-Dev] Callingcard (again, sorry!)

C. Maj cmaj-SPAM at freedomcorpse.com
Wed May 19 09:14:45 MST 2004


On Wed, 19 May 2004, Jeremy McNamara waxed:

> Apollon Koutlides wrote:
> > I'm developing a prepaid platform myself on asterisk (will be in a
> > release-able state soon enough, I hope) and encountered the
> > charge-on-termination dilemma myself. Initially I tried to go for the
> > hangup extension, but ended up using the CDRs which I would have to
> > consult anyway. I am currently checking two different approaches: a) use
> > csv CDRs, open the file in pipe mode, capture new records, charge
> > customer and store charging record to database. b) use postgres CDRs and
> > triggers to implement charging. The second approach has some extra
> > merit, since you can host the charging engine outside the asterisk box.
> > I intend to experiment with the radius application too, at some point in
> > time. I am also using pretty complex tariffs, and have created a daemon
> > to do tariff lookups - this helps a whole lote to improve redundancy and
> > offload the * box.
> 
> 
> Both solutions do not scale.  Trying to process CSV's are completely 
> wrong and triggers are going to be a loosing battle for CPU time as your 
> volume increases.

I agree that processing the text file would be a waste of
cycles, but if you aren't happy with Triggers then perhaps
try writing a Rule instead.  This is by no means exactly
what to write:

CREATE RULE rule_charge_on_termination AS ON INSERT TO cdr
DO
INSERT INTO tbl_charged_accounts VALUES (
    NEW.calldate,
    NEW.billsec,
    NEW.accountcode,
    NEW.uniqueid
);

Here's more info:

    http://www.postgresql.org/docs/7.4/interactive/rules.html


> AGI and/or RADIUS are not the solution either. Use the power of 
> Asterisk, don't side step it.

That's kind of silly to say just rely on Asterisk for
everything, even on Asterisk-Dev.  There's other tools that
do a better job of persisting your data -- and let you
de-couple the processing from your * box.

--Chris


-- 
Chris Maj, Rochester
cmaj_at_freedomcorpse_dot_com
Pronunciation Guide: Maj == May



More information about the asterisk-dev mailing list