[Freeswitch-users] Current timestamp variable in dialplan?
Antony Stone
Antony.Stone at freeswitch.open.source.it
Wed Nov 2 16:31:40 UTC 2022
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.
> On Wed, Nov 2, 2022 at 11:15 AM Antony Stone wrote:
> > On Wednesday 02 November 2022 at 16:12:22, Brian West wrote:
> > > Are you trying to do something like billing? If so using variables or
> > > anything getvar related will result in pool swell.
> > >
> > > Billing is out of band, or inband with things like nibble bill, which
> > > is just an implementation of a core idea of being able to nibble from
> > > a balance using the session heartbeats.
> >
> > No, this is nothing to do with billing.
> >
> > I'm basically just looking for the same value which would be logged in a
> > verbose logfile output against each dialplan action.
> >
> > > On Wed, Nov 2, 2022 at 9:55 AM Antony Stone wrote:
> > > > Hi.
> > > >
> > > > I'm looking for a variable I can access in the dialplan (I use XML if
> > > > it matters) which will tell me the current time (when I read the
> > > > variable) in the format 2022-11-02 12:34:56.789789
> > > >
> > > > If that's not available, but a microsecond-resolution Epoch timestamp
> > > > is, what would be the function to convert this to the above human
> > > > format?
> > > > https://freeswitch.org/confluence/display/FREESWITCH/Switch+core+
> > > > variables tells me about variables which are set after a channel is
> > > > hung up, so they're no use during call setup, and
> > > >
> > > > https://freeswitch.org/confluence/display/FREESWITCH/Channel+Variables
> > > > doesn't seem to have anything which represents "now".
> > > >
> > > >
> > > > Can anyone suggest where I should be looking to find such variables?
> > > >
> > > >
> > > > Thanks,
> > > >
> > > >
> > > > Antony.
--
Someone has stolen all the toilets from New Scotland Yard. Police say they
have absolutely nothing to go on.
Please reply to the list;
please *don't* CC me.
More information about the FreeSWITCH-users
mailing list