[Freeswitch-users] Current timestamp variable in dialplan?

Antony Stone Antony.Stone at freeswitch.open.source.it
Wed Nov 9 13:16:33 UTC 2022


On Wednesday 09 November 2022 at 13:54:07, Gregor Nanger wrote:

> If you would aks me, I would say that this simple functionality is
> available in FS and within 2 minutes I can google it. But now I am
> struggling for hours and can't find a solution to print, log... current
> time in microseconds or nanoseconds. If %q would work in strftime it would
> be a solution, but it doesn't work.
> 
> Is there another tool to display the current time in micro/nano seconds?

The only thing I've come up with is:

<action
   application="set"
   data="now=${regex(${system date '+%F %T.%6N'}|(.+)|%1)}"
/>

Note however that Brian West has said "I'd not recommend doing that, because 
every time you do a get var, you cause a pool allocation and doing this in a 
loop will make your session pool swell at the rate of whatever you're calling 
get_var on.  Doing anything at all inline with the dialplan is not the right 
approach.  your logic and info should be all external, keying off events either 
on ESL or custom modules you wrote."


Antony.

-- 
All generalisations are inaccurate.

                                                   Please reply to the list;
                                                         please *don't* CC me.



More information about the FreeSWITCH-users mailing list