Sponsor: VoiceMeUp - Corporate & Wholesale VoIP Services

VoIP Mailing List Archives
Mailing list archives for the VoIP community
 SearchSearch 

[Freeswitch-users] Current timestamp variable in dialplan?

Goto page 1, 2  Next
 
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> freeSWITCH Users
View previous topic :: View next topic  
Author Message
Antony.Stone at freesw...
Guest





PostPosted: Wed Nov 02, 2022 9:38 am    Post subject: [Freeswitch-users] Current timestamp variable in dialplan? Reply with quote

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.

--
There's no such thing as bad weather - only the wrong clothes.

- Billy Connolly

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

_________________________________________________________________________

The FreeSWITCH project is sponsored by SignalWire https://signalwire.com
Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services.
Build your next product on our scalable cloud platform.

Join our online community to chat in real time https://signalwire.community

Professional FreeSWITCH Services
sales@freeswitch.com
https://freeswitch.com

Official FreeSWITCH Sites
https://freeswitch.com/oss
https://freeswitch.org/confluence
https://cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
https://freeswitch.com
Back to top
brian at freeswitch.com
Guest





PostPosted: Wed Nov 02, 2022 10:31 am    Post subject: [Freeswitch-users] Current timestamp variable in dialplan? Reply with quote

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.


/b






On Wed, Nov 2, 2022 at 9:55 AM Antony Stone <Antony.Stone@freeswitch.open.source.it (Antony.Stone@freeswitch.open.source.it)> wrote:

Quote:
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.

--
There's no such thing as bad weather - only the wrong clothes.

 - Billy Connolly

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

_________________________________________________________________________

The FreeSWITCH project is sponsored by SignalWire https://signalwire.com
Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services.
Build your next product on our scalable cloud platform.

Join our online community to chat in real time https://signalwire.community

Professional FreeSWITCH Services
sales@freeswitch.com (sales@freeswitch.com)
https://freeswitch.com

Official FreeSWITCH Sites
https://freeswitch.com/oss
https://freeswitch.org/confluence
https://cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org (FreeSWITCH-users@lists.freeswitch.org)
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
https://freeswitch.com



--



Brian West | Co-founder and Developer
Need Commercial support? email sales@freeswitch.com (sales@freeswitch.com)
FreeSWITCH Solutions | 17345 Civic Drive #2531 Brookfield, WI 53045
Email: brian@freeswitch.com (brian@freeswitch.com)
Mobile: 918-424-9378
Website: https://www.FreeSWITCH.com
[/url] [url=https://twitter.com/freeswitch]
Back to top
Antony.Stone at freesw...
Guest





PostPosted: Wed Nov 02, 2022 11:07 am    Post subject: [Freeswitch-users] Current timestamp variable in dialplan? Reply with quote

On Wednesday 02 November 2022 at 16:12:22, Brian West wrote:

Quote:
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.

Quote:
On Wed, Nov 2, 2022 at 9:55 AM Antony Stone wrote:
Quote:
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.

--
I own three Windows books, published by O'Reilly. They are "Windows
Annoyances", "Office 97 Annoyances" and "Windows 98 Annoyances". That pretty
much sums it up for me.

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

_________________________________________________________________________

The FreeSWITCH project is sponsored by SignalWire https://signalwire.com
Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services.
Build your next product on our scalable cloud platform.

Join our online community to chat in real time https://signalwire.community

Professional FreeSWITCH Services
sales@freeswitch.com
https://freeswitch.com

Official FreeSWITCH Sites
https://freeswitch.com/oss
https://freeswitch.org/confluence
https://cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
https://freeswitch.com
Back to top
brian at freeswitch.com
Guest





PostPosted: Wed Nov 02, 2022 11:40 am    Post subject: [Freeswitch-users] Current timestamp variable in dialplan? Reply with quote

Ok let's step back, what do you mean by this?

On Wed, Nov 2, 2022 at 11:15 AM Antony Stone <Antony.Stone@freeswitch.open.source.it (Antony.Stone@freeswitch.open.source.it)> wrote:

Quote:
On Wednesday 02 November 2022 at 16:12:22, Brian West wrote:

Quote:
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.

Quote:
On Wed, Nov 2, 2022 at 9:55 AM Antony Stone wrote:
Quote:
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.

--
I own three Windows books, published by O'Reilly.   They are "Windows
Annoyances", "Office 97 Annoyances" and "Windows 98 Annoyances".   That pretty
much sums it up for me.

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

_________________________________________________________________________

The FreeSWITCH project is sponsored by SignalWire https://signalwire.com
Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services.
Build your next product on our scalable cloud platform.

Join our online community to chat in real time https://signalwire.community

Professional FreeSWITCH Services
sales@freeswitch.com (sales@freeswitch.com)
https://freeswitch.com

Official FreeSWITCH Sites
https://freeswitch.com/oss
https://freeswitch.org/confluence
https://cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org (FreeSWITCH-users@lists.freeswitch.org)
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
https://freeswitch.com



--



Brian West | Co-founder and Developer
Need Commercial support? email sales@freeswitch.com (sales@freeswitch.com)
FreeSWITCH Solutions | 17345 Civic Drive #2531 Brookfield, WI 53045
Email: brian@freeswitch.com (brian@freeswitch.com)
Mobile: 918-424-9378
Website: https://www.FreeSWITCH.com
[/url] [url=https://twitter.com/freeswitch]
Back to top
Antony.Stone at freesw...
Guest





PostPosted: Wed Nov 02, 2022 12:27 pm    Post subject: [Freeswitch-users] Current timestamp variable in dialplan? Reply with quote

On Wednesday 02 November 2022 at 17:18:26, Brian West wrote:

Quote:
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.

Quote:
On Wed, Nov 2, 2022 at 11:15 AM Antony Stone wrote:
Quote:
On Wednesday 02 November 2022 at 16:12:22, Brian West wrote:
Quote:
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.

Quote:
On Wed, Nov 2, 2022 at 9:55 AM Antony Stone wrote:
Quote:
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.

_________________________________________________________________________

The FreeSWITCH project is sponsored by SignalWire https://signalwire.com
Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services.
Build your next product on our scalable cloud platform.

Join our online community to chat in real time https://signalwire.community

Professional FreeSWITCH Services
sales@freeswitch.com
https://freeswitch.com

Official FreeSWITCH Sites
https://freeswitch.com/oss
https://freeswitch.org/confluence
https://cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
https://freeswitch.com
Back to top
brian at freeswitch.com
Guest





PostPosted: Wed Nov 02, 2022 12:28 pm    Post subject: [Freeswitch-users] Current timestamp variable in dialplan? Reply with quote

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

/b




On Wed, Nov 2, 2022 at 12:12 PM Antony Stone <Antony.Stone@freeswitch.open.source.it (Antony.Stone@freeswitch.open.source.it)> wrote:

Quote:
On Wednesday 02 November 2022 at 17:18:26, Brian West wrote:

Quote:
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.

Quote:
On Wed, Nov 2, 2022 at 11:15 AM Antony Stone  wrote:
Quote:
On Wednesday 02 November 2022 at 16:12:22, Brian West wrote:
Quote:
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.

Quote:
On Wed, Nov 2, 2022 at 9:55 AM Antony Stone wrote:
Quote:
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.

_________________________________________________________________________

The FreeSWITCH project is sponsored by SignalWire https://signalwire.com
Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services.
Build your next product on our scalable cloud platform.

Join our online community to chat in real time https://signalwire.community

Professional FreeSWITCH Services
sales@freeswitch.com (sales@freeswitch.com)
https://freeswitch.com

Official FreeSWITCH Sites
https://freeswitch.com/oss
https://freeswitch.org/confluence
https://cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org (FreeSWITCH-users@lists.freeswitch.org)
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
https://freeswitch.com



--



Brian West | Co-founder and Developer
Need Commercial support? email sales@freeswitch.com (sales@freeswitch.com)
FreeSWITCH Solutions | 17345 Civic Drive #2531 Brookfield, WI 53045
Email: brian@freeswitch.com (brian@freeswitch.com)
Mobile: 918-424-9378
Website: https://www.FreeSWITCH.com
[/url] [url=https://twitter.com/freeswitch]
Back to top
Antony.Stone at freesw...
Guest





PostPosted: Wed Nov 02, 2022 2:30 pm    Post subject: [Freeswitch-users] Current timestamp variable in dialplan? Reply with quote

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

Quote:
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?

Quote:
On Wed, Nov 2, 2022 at 12:12 PM Antony Stone wrote:
Quote:
On Wednesday 02 November 2022 at 17:18:26, Brian West wrote:
Quote:
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.

_________________________________________________________________________

The FreeSWITCH project is sponsored by SignalWire https://signalwire.com
Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services.
Build your next product on our scalable cloud platform.

Join our online community to chat in real time https://signalwire.community

Professional FreeSWITCH Services
sales@freeswitch.com
https://freeswitch.com

Official FreeSWITCH Sites
https://freeswitch.com/oss
https://freeswitch.org/confluence
https://cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
https://freeswitch.com
Back to top
andrew at cassidywebse...
Guest





PostPosted: Fri Nov 04, 2022 10:07 am    Post subject: [Freeswitch-users] Current timestamp variable in dialplan? Reply with quote

Set logging to debug, then every dialplan instruction, all parameters, and microsecond timings are recorded in the log file. 

You can also add your own log entries, which will also have that information.


https://freeswitch.org/confluence/display/FREESWITCH/mod_logfile







On Wed, 2 Nov 2022 at 19:00, Antony Stone <Antony.Stone@freeswitch.open.source.it (Antony.Stone@freeswitch.open.source.it)> wrote:

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

Quote:
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?

Quote:
On Wed, Nov 2, 2022 at 12:12 PM Antony Stone wrote:
Quote:
On Wednesday 02 November 2022 at 17:18:26, Brian West wrote:
Quote:
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.

_________________________________________________________________________

The FreeSWITCH project is sponsored by SignalWire https://signalwire.com
Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services.
Build your next product on our scalable cloud platform.

Join our online community to chat in real time https://signalwire.community

Professional FreeSWITCH Services
sales@freeswitch.com (sales@freeswitch.com)
https://freeswitch.com

Official FreeSWITCH Sites
https://freeswitch.com/oss
https://freeswitch.org/confluence
https://cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org (FreeSWITCH-users@lists.freeswitch.org)
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
https://freeswitch.com



--
Andrew Cassidy BSc (Hons) MBCSManaging Director
[img]https://ci3.googleusercontent.com/mail-sig/AIorK4wHpOncjIqmQm_yAkhZgJMwSjv1-8vUU9LKfIsYKBkdt5TYckG1RlBGeGZFZUwtv0WVIiMTjQI[/img]

andrew@cassidyweb.co.uk (andrew@cassidyweb.co.uk) www.cassidyweb.co.uk
Back to top
Antony.Stone at freesw...
Guest





PostPosted: Fri Nov 04, 2022 11:00 am    Post subject: [Freeswitch-users] Current timestamp variable in dialplan? Reply with quote

On Friday 04 November 2022 at 16:05:39, Brian West wrote:

Quote:
The way the dial plan is compiled and executed will vary depending on a lot
of factors, what purpose are you using this for? because it's a metric that
will show little to no variance, your best bet is to turn on xml_cdr and
use that it has all the info and history of what and when things took
place. Don't burden the dialplan with these sorts of tasks as freeswitch
wasn't designed to be used like that.

Okay, I'll look at xml_cdr.

I'm currently using cdr_odbc - do you see any problem in using both?

Also, just for a definitive answer, do I take it that there is no variable
which the dialplan can reference in order to get the current timestamp?


Antony.

Quote:
On Wed, Nov 2, 2022 at 2:03 PM Antony Stone wrote:
Quote:
On Wednesday 02 November 2022 at 18:25:52, Brian West wrote:
Quote:
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?

Quote:
On Wed, Nov 2, 2022 at 12:12 PM Antony Stone wrote:
Quote:
On Wednesday 02 November 2022 at 17:18:26, Brian West wrote:
Quote:
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

Quote:
Quote:
Antony.

--
.evah I serutangis sseltniop tsom eht fo eno eb tsum sihT

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

_________________________________________________________________________

The FreeSWITCH project is sponsored by SignalWire https://signalwire.com
Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services.
Build your next product on our scalable cloud platform.

Join our online community to chat in real time https://signalwire.community

Professional FreeSWITCH Services
sales@freeswitch.com
https://freeswitch.com

Official FreeSWITCH Sites
https://freeswitch.com/oss
https://freeswitch.org/confluence
https://cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
https://freeswitch.com
Back to top
brian at freeswitch.com
Guest





PostPosted: Fri Nov 04, 2022 11:02 am    Post subject: [Freeswitch-users] Current timestamp variable in dialplan? Reply with quote

The way the dial plan is compiled and executed will vary depending on a lot of factors, what purpose are you using this for? because it's a metric that will show little to no variance, your best bet is to turn on xml_cdr and use that it has all the info and history of what and when things took place.  Don't burden the dialplan with these sorts of tasks as freeswitch wasn't designed to be used like that.

/b




On Wed, Nov 2, 2022 at 2:03 PM Antony Stone <Antony.Stone@freeswitch.open.source.it (Antony.Stone@freeswitch.open.source.it)> wrote:

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

Quote:
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?

Quote:
On Wed, Nov 2, 2022 at 12:12 PM Antony Stone wrote:
Quote:
On Wednesday 02 November 2022 at 17:18:26, Brian West wrote:
Quote:
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.

_________________________________________________________________________

The FreeSWITCH project is sponsored by SignalWire https://signalwire.com
Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services.
Build your next product on our scalable cloud platform.

Join our online community to chat in real time https://signalwire.community

Professional FreeSWITCH Services
sales@freeswitch.com (sales@freeswitch.com)
https://freeswitch.com

Official FreeSWITCH Sites
https://freeswitch.com/oss
https://freeswitch.org/confluence
https://cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org (FreeSWITCH-users@lists.freeswitch.org)
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
https://freeswitch.com



--



Brian West | Co-founder and Developer
Need Commercial support? email sales@freeswitch.com (sales@freeswitch.com)
FreeSWITCH Solutions | 17345 Civic Drive #2531 Brookfield, WI 53045
Email: brian@freeswitch.com (brian@freeswitch.com)
Mobile: 918-424-9378
Website: https://www.FreeSWITCH.com
[/url] [url=https://twitter.com/freeswitch]
Back to top
brian at freeswitch.com
Guest





PostPosted: Fri Nov 04, 2022 12:35 pm    Post subject: [Freeswitch-users] Current timestamp variable in dialplan? Reply with quote

Inline below.

On Fri, Nov 4, 2022 at 11:06 AM Antony Stone <Antony.Stone@freeswitch.open.source.it (Antony.Stone@freeswitch.open.source.it)> wrote:

Quote:
On Friday 04 November 2022 at 16:05:39, Brian West wrote:

Quote:
The way the dial plan is compiled and executed will vary depending on a lot
of factors, what purpose are you using this for? because it's a metric that
will show little to no variance, your best bet is to turn on xml_cdr and
use that it has all the info and history of what and when things took
place.  Don't burden the dialplan with these sorts of tasks as freeswitch
wasn't designed to be used like that.

Okay, I'll look at xml_cdr.

I'm currently using cdr_odbc - do you see any problem in using both?


No issue at all, cdr_odbc gives you a fraction of the info that xml_cdr does.
 
Quote:

Also, just for a definitive answer, do I take it that there is no variable
which the dialplan can reference in order to get the current timestamp?


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.
 
Quote:


Antony.

Quote:
On Wed, Nov 2, 2022 at 2:03 PM Antony Stone wrote:
Quote:
On Wednesday 02 November 2022 at 18:25:52, Brian West wrote:
Quote:
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?

Quote:
On Wed, Nov 2, 2022 at 12:12 PM Antony Stone wrote:
Quote:
On Wednesday 02 November 2022 at 17:18:26, Brian West wrote:
Quote:
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

Quote:
Quote:
Antony.

--
.evah I serutangis sseltniop tsom eht fo eno eb tsum sihT

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

_________________________________________________________________________

The FreeSWITCH project is sponsored by SignalWire https://signalwire.com
Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services.
Build your next product on our scalable cloud platform.

Join our online community to chat in real time https://signalwire.community

Professional FreeSWITCH Services
sales@freeswitch.com (sales@freeswitch.com)
https://freeswitch.com

Official FreeSWITCH Sites
https://freeswitch.com/oss
https://freeswitch.org/confluence
https://cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org (FreeSWITCH-users@lists.freeswitch.org)
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
https://freeswitch.com



--



Brian West | Co-founder and Developer
Need Commercial support? email sales@freeswitch.com (sales@freeswitch.com)
FreeSWITCH Solutions | 17345 Civic Drive #2531 Brookfield, WI 53045
Email: brian@freeswitch.com (brian@freeswitch.com)
Mobile: 918-424-9378
Website: https://www.FreeSWITCH.com
[/url] [url=https://twitter.com/freeswitch]
Back to top
Antony.Stone at freesw...
Guest





PostPosted: Fri Nov 04, 2022 12:58 pm    Post subject: [Freeswitch-users] Current timestamp variable in dialplan? Reply with quote

On Friday 04 November 2022 at 18:25:21, Brian West wrote:

Quote:
Quote:
I'm currently using cdr_odbc - do you see any problem in using both?

No issue at all, cdr_odbc gives you a fraction of the info that xml_cdr
does.

Okay, thanks.

Quote:
Quote:
Also, just for a definitive answer, do I take it that there is no
variable which the dialplan can reference in order to get the current
timestamp?

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.

Hm, this sounds like an interesting and important conceptual aspect of the way
FreeSwitch works which I suspect I haven't fully "got".

Can you point me at the documentation which explains this, for people who are
more used to procedural programming, and show how we should be thinking about
FreeSwitch dialplans instead?

I'm certainly keen on using FreeSwitch in as efficient a manner as possible :)


Thanks,


Antony.

--
In the Beginning there was nothing, which exploded.

- Terry Pratchett

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

_________________________________________________________________________

The FreeSWITCH project is sponsored by SignalWire https://signalwire.com
Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services.
Build your next product on our scalable cloud platform.

Join our online community to chat in real time https://signalwire.community

Professional FreeSWITCH Services
sales@freeswitch.com
https://freeswitch.com

Official FreeSWITCH Sites
https://freeswitch.com/oss
https://freeswitch.org/confluence
https://cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
https://freeswitch.com
Back to top
Antony.Stone at freesw...
Guest





PostPosted: Fri Nov 04, 2022 1:33 pm    Post subject: [Freeswitch-users] Current timestamp variable in dialplan? Reply with quote

On Friday 04 November 2022 at 19:13:27, Brian West wrote:

Quote:
Antony,

Maybe you can come to our next office hours?

Er, what? Where are you?

Quote:
On Fri, Nov 4, 2022 at 1:05 PM Antony Stone wrote:
Quote:
On Friday 04 November 2022 at 18:25:21, Brian West wrote:

Quote:
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.

Hm, this sounds like an interesting and important conceptual aspect of
the way FreeSwitch works which I suspect I haven't fully "got".

Can you point me at the documentation which explains this, for people who
are more used to procedural programming, and show how we should be
thinking about FreeSwitch dialplans instead?

I'm certainly keen on using FreeSwitch in as efficient a manner as
possible Smile


Antony.

--
"Black holes are where God divided by zero."

- Steven Wright

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

_________________________________________________________________________

The FreeSWITCH project is sponsored by SignalWire https://signalwire.com
Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services.
Build your next product on our scalable cloud platform.

Join our online community to chat in real time https://signalwire.community

Professional FreeSWITCH Services
sales@freeswitch.com
https://freeswitch.com

Official FreeSWITCH Sites
https://freeswitch.com/oss
https://freeswitch.org/confluence
https://cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
https://freeswitch.com
Back to top
brian at freeswitch.com
Guest





PostPosted: Fri Nov 04, 2022 1:41 pm    Post subject: [Freeswitch-users] Current timestamp variable in dialplan? Reply with quote

Antony,

Maybe you can come to our next office hours?


On Fri, Nov 4, 2022 at 1:05 PM Antony Stone <Antony.Stone@freeswitch.open.source.it (Antony.Stone@freeswitch.open.source.it)> wrote:

Quote:
On Friday 04 November 2022 at 18:25:21, Brian West wrote:

Quote:
Quote:
I'm currently using cdr_odbc - do you see any problem in using both?

No issue at all, cdr_odbc gives you a fraction of the info that xml_cdr
does.

Okay, thanks.

Quote:
Quote:
Also, just for a definitive answer, do I take it that there is no
variable which the dialplan can reference in order to get the current
timestamp?

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.

Hm, this sounds like an interesting and important conceptual aspect of the way
FreeSwitch works which I suspect I haven't fully "got".

Can you point me at the documentation which explains this, for people who are
more used to procedural programming, and show how we should be thinking about
FreeSwitch dialplans instead?

I'm certainly keen on using FreeSwitch in as efficient a manner as possible Smile


Thanks,


Antony.

--
In the Beginning there was nothing, which exploded.

 - Terry Pratchett

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

_________________________________________________________________________

The FreeSWITCH project is sponsored by SignalWire https://signalwire.com
Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services.
Build your next product on our scalable cloud platform.

Join our online community to chat in real time https://signalwire.community

Professional FreeSWITCH Services
sales@freeswitch.com (sales@freeswitch.com)
https://freeswitch.com

Official FreeSWITCH Sites
https://freeswitch.com/oss
https://freeswitch.org/confluence
https://cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org (FreeSWITCH-users@lists.freeswitch.org)
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
https://freeswitch.com



--



Brian West | Co-founder and Developer
Need Commercial support? email sales@freeswitch.com (sales@freeswitch.com)
FreeSWITCH Solutions | 17345 Civic Drive #2531 Brookfield, WI 53045
Email: brian@freeswitch.com (brian@freeswitch.com)
Mobile: 918-424-9378
Website: https://www.FreeSWITCH.com
[/url] [url=https://twitter.com/freeswitch]
Back to top
piotr at dataandsignal...
Guest





PostPosted: Sat Nov 05, 2022 4:08 pm    Post subject: [Freeswitch-users] Current timestamp variable in dialplan? Reply with quote

Antony,

This sounds like a job for a module, especially that you mentioned you would like to upload/send it somewhere and combine it with data from other services.
You create a module that exports one or more applications, you can call them from dialplan.


best,


[img]https://ci3.googleusercontent.com/mail-sig/AIorK4wE8rSMg277YOGBrgEQayYWXH2G53bMgBu7uf-k-vU6x5SD1T6YWorVfbkDegPbnXcFyHwBODg[/img]



Piotr Gregor
Software Engineer


M: (+44) 07483 866 525     L: (+44) 01256 597 470     www: dataandsignal.com





















On Fri, Nov 4, 2022 at 7:30 PM Antony Stone <Antony.Stone@freeswitch.open.source.it (Antony.Stone@freeswitch.open.source.it)> wrote:

Quote:
On Friday 04 November 2022 at 19:13:27, Brian West wrote:

Quote:
Antony,

Maybe you can come to our next office hours?

Er, what?  Where are you?

Quote:
On Fri, Nov 4, 2022 at 1:05 PM Antony Stone wrote:
Quote:
On Friday 04 November 2022 at 18:25:21, Brian West wrote:

Quote:
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.

Hm, this sounds like an interesting and important conceptual aspect of
the way FreeSwitch works which I suspect I haven't fully "got".

Can you point me at the documentation which explains this, for people who
are more used to procedural programming, and show how we should be
thinking about FreeSwitch dialplans instead?

I'm certainly keen on using FreeSwitch in as efficient a manner as
possible Smile


Antony.

--
"Black holes are where God divided by zero."

 - Steven Wright

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

_________________________________________________________________________

The FreeSWITCH project is sponsored by SignalWire https://signalwire.com
Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services.
Build your next product on our scalable cloud platform.

Join our online community to chat in real time https://signalwire.community

Professional FreeSWITCH Services
sales@freeswitch.com (sales@freeswitch.com)
https://freeswitch.com

Official FreeSWITCH Sites
https://freeswitch.com/oss
https://freeswitch.org/confluence
https://cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org (FreeSWITCH-users@lists.freeswitch.org)
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
https://freeswitch.com
Back to top
Display posts from previous:   
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> freeSWITCH Users All times are GMT - 5 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

VoiceMeUp - Corporate & Wholesale VoIP Services