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

Terence Parker terence at parker.com.hk
Fri May 28 04:15:06 MST 2004


Hi again,

Sorry for the late reply (not that anyone was necessarily waiting for 
one) - and thanks as well for all the replies to my original query. I 
went away on a short trip, hence my disappearance.

Using the CDR is a good idea, so I went and toyed around with this. 
Using the time stamp made by my AGI application isn't feasible since 
the problem at hand is the time stamp being made irrespective of 
whether the user actually continues with the call or not (hence billing 
them even though they bailed out before continuing). I have two 
comments regarding the CDR however, which perhaps someone can comment 
on :

1. I notice AGI documentation saying that calls should be 'Answered'. 
Doing this results in the call duration and bill seconds being exactly 
the same - rendering it useless since I want the bill seconds of the 
call only, not the speech output of the calling card itself. Turning 
off the 'answer' seems to still work (so it's not really needed then is 
it?) , and also fixes this problem.

2. In the newer versions of Asterisk one is warned to use DeadAGI and 
not AGI when hanging up. So I did. And as a result the CDR changes all 
the logged calls to having dialed extension 'h', rather than the 
original number dialed. Which is stupid. I want the original number 
dialed. So now I ignore the warning and continue to use AGI on hangup 
instead of DeadAGI and this addresses my problem. Can someone tell me 
again what DeadAGI is actually supposed to achieve? Seems pretty 
useless to me.

And yeah, doing it in C is definitely better than running a PHP script 
every time but... well... I know know PHP :-(

- Terence



On 19 May 04, at 7:44 PM, Apollon Koutlides wrote:

> Terence Parker wrote:
>
>> app_agi.c:1511 agi_exec: If you want to run AGI on hungup channels you
>> should use DeadAGI!
>>
> 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.
>
> Just my Eu 0,02 :)
>
> Apollon Koutlides




More information about the asterisk-dev mailing list