Billing before the comunication start

Hello, I´m using the billing feature of asterisk with mysql, I have a x100p card (one FXO port). When a call is originated from a SIP client to the PSTN the asterisk billing time parameter (billsec) begin the count when the call is not made yet, when the zap channel is executed. So if the destination doesn´t take the call my billing is wrong. There is same way to begin the count when the destination take the call??

Thanks in advence.

Hi.

Yes it will do as you descrbe when using alog lines. If you want accurate billing use ISDN, SIP or IAX all of which have answer supersion.

Ian

Perhaps in the Dial command use the M switch to fire off a Macro when the channel is answered. Not sure how reliable it is with the dumb POTS.

exten = s,1,Dial(Zap/1/${ARG1},30,tTrWwM(startBilling))
exten = s,2,hangup
exten = h,1,Set(finishtime=strftime…)
exten = h,2,Set(billsec=${finishtime} - ${starttime})

[macro-startBilling]
exten = s,1,Set(starttime=strftime…)

The syntax is probably not correct for getting the time, or the billsec arithmetic. Read doc/channelvariables.txt for a bit more info.

Make use of ResetCDR before you use the Dial command

Make use of ResetCDR before you use the Dial command