
On 21/04/15 06:18, Peter Beckman wrote:
A friend suggested this:
* Pipe the live pcap output to something that decodes the SIP packet * If it is an INVITE, write the timestamp to a file named the CallID (may need to be bucketed by the first 3 characters of the callID) e.g. 4/9/9/4991c62d0c46cf37603d3e9675b74d4a-10.9.8.7 contains 1429587621.812380 * If it is a progress message * find the file * read the timestamp in the file * calculate the delta * determine the carrier based on the IP * post the metric * delete the file * Otherwise do nothing (discard)
To keep things cleaned up you could run a cron job every 20 minutes that would delete files older than 3 hours (our max call length).
If I would have to code it and do it in C (for performance reasons), perhaps I would go for patching sngrep (already mentioned here) or sipgrep. sngrep already has options to display duration of singaling and duration of connecting, so could be easy to track the places in the exiting code. On the other hand, I am not sure if it would be easy to just write reports to files instead of displaying with ncurses on the terminal. Main reason for replying here is to point to wireshark/tshark, which has embedded Lua support. That could be handy for non-C programers and the performances are still high. Searching on google for wireshark+sip+lua will reveal several examples that can be used as a starting point. Cheers, Daniel -- Daniel-Constantin Mierla http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda Kamailio World Conference, May 27-29, 2015 Berlin, Germany - http://www.kamailioworld.com