[Freeswitch-users] Current timestamp variable in dialplan?

Antony Stone Antony.Stone at freeswitch.open.source.it
Wed Nov 2 18:28:05 UTC 2022


On Wednesday 02 November 2022 at 18:25:52, Brian West wrote:

> What problem are you trying to solve?  I still can't clearly
> understand what you're trying to accomplish.

Oh, I didn't realise you wanted to know what I planned to *do* with the 
information - I thought you were just trying to understand exactly what 
information I need.

So, to answer your question about why I need these timestamps, I have specific 
points throughout the dialplan where I need to know the current (accurate) 
timestamp, in order to collect statistics on the efficiency of different parts of 
the dialplan (basically, how long does *this* section take to complete, how 
long does *that* section take, etc).

These timing values are then combined with similar timestamps from other parts 
of the system (which includes Asterisk, database lookups, and other external 
services) to give an overall measure of the performance of individual parts of 
the whole thing.

Ultimately I do not intend to collect this quantity of data from production 
systems, but on development and test systems I need to be able to spot quickly 
when some part of what FreeSwitch is doing, or anything else we are collecting 
these timestamps from, changes (for better or for worse) in how long the 
processing takes.

Does that answer your question sufficiently to be able to guide to me where I 
can find the current timestamp inside the dialplan?

I didn't realise that this could be a complicated question, but perhaps the 
fact that I didn't find the answer easily indicates that it is?

> On Wed, Nov 2, 2022 at 12:12 PM Antony Stone wrote:
> > On Wednesday 02 November 2022 at 17:18:26, Brian West wrote:
> > > Ok let's step back, what do you mean by this?
> > 
> > I mean that I wish either to assign the current timestamp to a variable
> > in the format 2022-11-02 12:34:56.789789, or to find a system variable
> > which will provide this when I reference something like ${now}.
> > 
> > I hope that's clear?
> > 
> > As a workaround until I find out how to do this the correct way, the
> > following command does what I want, however I suspect it's not very
> > efficient:
> > 
> > <action
> >         application="set"
> >         data="now=${regex(${system date '+%F %T.%N'}|(.+)|%1)}"
> > />
> > 
> > I got the somewhat complicated syntax of that command from
> > https://freeswitch.org/confluence/display/FREESWITCH/mod_dptools:+system
> > 
> > 
> > Antony.

-- 
"A person lives in the UK, but commutes to France daily for work.
He belongs in the UK."

 - From UK Revenue & Customs notice 741, page 13, paragraph 3.5.1
 - http://tinyurl.com/o7gnm4

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



More information about the FreeSWITCH-users mailing list