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.

pv_time.c

int pv_get_timenows2(struct sip_msg *msg, pv_param_t *param,
                pv_value_t *res)
{
        struct timeval tv;
        char buf[30];
        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 ? 

Thanks,
Mino





On Thu, Feb 7, 2013 at 11:00 AM, Mino Haluz <mino.haluz@gmail.com> wrote:
Hi,

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?

Mino