[asterisk-users] usage of manager events to create custom reports

Steve Edwards asterisk.org at sedwards.com
Sun Nov 1 11:36:03 CST 2009


On Sun, 1 Nov 2009, nik600 wrote:

> due to some custom requirements we are planning to use the manager 
> events for creating some custom reports.
>
> So the call-flow in the events listener will be:
>
> 1) new event detected
> 2) check if the event has an Uniqueid information
> 3) push the event into a stack reserved for Uniqueid
> 4) if the event if Hangup write the information of the stack reserved
> fro Uniqueid and then free memory
>
> I'm planning to write this in php, i think that this code is very
> light to be run even after a lot of events because i free memory after
> the conclusion of each call.

When I think "high load" I don't think PHP, I think C.

Freeing the memory after each call may be exactly the wrong approach. 
Consider if you keep 1,000 bytes of info for each call and can handle 
1,000 simultaneous calls that's only 1MB. If you allocate this array 
statically you have no memory allocation issues and eliminate a lot of 
executing code.

> Then (on a separate server) there will be a re-processing of the file
> extracting all the information required from a call.

Why not write a row to a database (on that separate server) at the end of 
each call and eliminate this step. You will save a bunch of disk I/O on 
you Asterisk system and eliminate a whole bunch of race and failure 
conditions.

-- 
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards       sedwards at sedwards.com      Voice: +1-760-468-3867 PST
Newline                                              Fax: +1-760-731-3000



More information about the asterisk-users mailing list