Search code examples
asteriskbillingagicdr

Asterisk CDR duration difference on DB and h exten


I'm using an AGI script on 'h' extension to compute call cost and save it on CDR(userfield) variable.

The problem is I'm getting duration differences between CDR(duration) variable and the value stored on MySQL. Mainly, duration stored on DB is 1 or 2 seconds greater than variable, like the inserting process delays and duration keeps counting.

I need to know why I am having this duration difference and how should I avoid it to bill on the right way.

Thank you very much.


Solution

  • Example:

    You are asking CDR(duration),it return you 5

    You do something for in your script for 2 more seconds

    In database will be saved 7.

    Something like that happens with your cdr. Not use long-running scripts in h-extensions. Just record event in db or file and use external thread to process event.