nik600
2009-Nov-01 09:53 UTC
[asterisk-users] usage of manager events to create custom reports
Dear all due to some custom requirements we are planning to use the manager events for creating some custom reports. I've enabled cdr_manager, then in manager.conf i've enabled timestampevents = yes and in queue.conf eventmemberstatus = yes. I know that these settings can generate a lot of manager events but i'm planning to have a very simple application on the Asterisk server that keep all that events from the manager socket and put them into a separate file for each call. To decide when to write the call file i'm planning to wait for the Hangup event). 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. Then (on a separate server) there will be a re-processing of the file extracting all the information required from a call. I'm writing to you just to know: - what do you think about this kind of approach - if someone else has done something similar and wants to share his experience - how much is affordable the events generation excpecially in system with a high load Thanks to all for any contribute. Hi -- /*************/ nik600 http://www.kumbe.it
Steve Edwards
2009-Nov-01 17:36 UTC
[asterisk-users] usage of manager events to create custom reports
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