[sr-dev] How to get dialog duration in miliseconds?
miconda at gmail.com
Fri Feb 8 22:14:06 CET 2013
The problem is that buf is allocated on the stack, on a zone reserved
for pv_get_timenows2() function, which is destroyed as soon as the
function execution ends.
You either define buf as static, or you allocate it dynamically in the
function and free it later.
On 2/7/13 7:25 PM, Mino Haluz wrote:
> I added new pseudovariale $TMS which gives time in miliseconds. If I
> print $TMS value it is ok, but when I assign it to avp, it gives
> strange values.
> int pv_get_timenows2(struct sip_msg *msg, pv_param_t *param,
> pv_value_t *res)
> struct timeval tv;
> char buf;
> str _s;
> gettimeofday(&tv, NULL);
> unsigned long long msEpoch =
> (unsigned long long)(tv.tv_sec) * 1000 +
> (unsigned long long)(tv.tv_usec) / 1000;
> _s.len = sprintf(buf, "%lld", msEpoch);
> _s.s = buf; //<------- I think problem is here
> return pv_get_strval(msg, param, res, &_s);
> So how should I properly copy buf to _s ?
> On Thu, Feb 7, 2013 at 11:00 AM, Mino Haluz <mino.haluz at gmail.com
> <mailto:mino.haluz at gmail.com>> wrote:
> I assume there is no avp or function which could give me duration
> of ended dialog in miliseconds (I have to send it in RADIUS
> message). I can run some bash script which could return me this
> value but seems to me bit awkward.
> How you would do it? To adjust dialog module so that it could
> return it to some avp value within dialog-end event route and thus
> save it to radius?
> sr-dev mailing list
> sr-dev at lists.sip-router.org
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio World Conference, April 16-17, 2013, Berlin
- http://conference.kamailio.com -
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the sr-dev