On Oct 24, 2009 at 10:29, Juha Heinanen jh@tutpro.com wrote:
eu is asking operators to provide all kinds of statistics about their telephone service.
one of the attributes is routing time of sip request, i.e., in/out delay of sip requests.
in order to be able to do something like that, we could have a pseudo variable that provides ms timestamp value or, perhaps better, a way to zero a ms counter and then store its current value to a pseudo variable in onsend_route. the problems seems to be that according to core cookbook, it is not possible to set pseudo variables in onsend_route.
The problem is pseudo-vars can do a lot of stuff, not all of which would be safe from an onsend_route (anything modifying the message is not allowed), so everything is disabled (upon future review). It would be better/safer to write a module function for this.
Besides this I'm not sure it would be useful. I assume the routing time should include the full time between a request being seen on the wire and the forwarded request making back to "the wire" and not only the script routing delay. Most of the times if you don't do a lot of db stuff and the dns lookups hit the cache, you should have very low script running times (not sure ms is enough to measure them). However the send() operation can take a lot of time (both on udp and especially on tcp or sctp). Using onsend_route you won't see the send delay. To be able to see the complete receive and send delays you will need external monitoring. Timing the script execution from the moment the request is seen by sr (which is not always the time the request was received by the network card) to the moment just before the request is sent can be used to raise alarms when script execution takes too much, but I doubt it has any value in calculating the routing delay of the whole box.
Andrei