0

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.

fseratti
  • 35
  • 1
  • 3

2 Answers2

1

You shouldn't use AGI() on 'h' exten, you should only use DeadAGI there.

viktike
  • 717
  • 4
  • 7
0

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.

arheops
  • 15,544
  • 1
  • 21
  • 27
  • thanks for your answer, actually i am doing DB lookup for rates, that must be the delay, i will find a way to avoid this delay – fseratti Oct 19 '14 at 15:22
  • If your rate lookup take more then 0.05sec, that mean you have hire architector and change your billing architecture. – arheops Oct 19 '14 at 18:41