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 Previous  1, 2
 
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> freeSWITCH Users
View previous topic :: View next topic  
Author Message
gregor at infomedia.si
Guest





PostPosted: Tue Nov 08, 2022 6:00 pm    Post subject: [Freeswitch-users] Current timestamp variable in dialplan? Reply with quote

Anthony, would strftime [format_string] do the job? 


On Sat, 5 Nov 2022 at 21:48, Piotr Gregor <piotr@dataandsignal.com (piotr@dataandsignal.com)> wrote:

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

_________________________________________________________________________

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
Antony.Stone at freesw...
Guest





PostPosted: Wed Nov 09, 2022 4:52 am    Post subject: [Freeswitch-users] Current timestamp variable in dialplan? Reply with quote

On Tuesday 08 November 2022 at 23:55:18, Gregor Nanger wrote:

Quote:
Antony, would strftime [format_string] do the job?

Quite possibly, provided I can find a value of "now" to format with it.

Quote:
On Sat, 5 Nov 2022 at 21:48, Piotr Gregor wrote:
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,


Piotr Gregor

On Fri, Nov 4, 2022 at 7:30 PM Antony Stone 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.

--
<flopsie> yes, but this is #lbw, we don't do normal

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
gregor at infomedia.si
Guest





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

now is by default, if you just use strftime. Try eval ${strftime()}


Do you know how to print now in milliseconds like:
<action application="set" data="var_name=${utcnow}"/>





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

Quote:
On Tuesday 08 November 2022 at 23:55:18, Gregor Nanger wrote:

Quote:
Antony, would strftime [format_string] do the job?

Quite possibly, provided I can find a value of "now" to format with it.

Quote:
On Sat, 5 Nov 2022 at 21:48, Piotr Gregor wrote:
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,


Piotr Gregor

On Fri, Nov 4, 2022 at 7:30 PM Antony Stone 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.

--
<flopsie> yes, but this is #lbw, we don't do normal

                                                   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
Antony.Stone at freesw...
Guest





PostPosted: Wed Nov 09, 2022 6:33 am    Post subject: [Freeswitch-users] Current timestamp variable in dialplan? Reply with quote

On Wednesday 09 November 2022 at 10:31:26, Gregor Nanger wrote:

Quote:
now is by default, if you just use strftime. Try eval ${strftime()}

Aha, yes, that works, and the (undocumented as far as I can see) %q parameter
gives me nanoseconds.

Quote:
Do you know how to print now in milliseconds like:
<action application="set" data="var_name=${utcnow}"/>

No :(

I wanted microseconds, but %6q gives nothing, as does %3q (which I would
expect to give milliseconds).

So, %S.%q gives seconds + nanoseconds, but I don't see a way to reduce the
resolution (interestingly, Asterisk's strftime function does support this,
also with the %q parameter).


Antony.

Quote:
On Wed, 9 Nov 2022 at 10:22, Antony Stone wrote:
Quote:
On Tuesday 08 November 2022 at 23:55:18, Gregor Nanger wrote:
Quote:
Antony, would strftime [format_string] do the job?

Quite possibly, provided I can find a value of "now" to format with it.

Quote:
On Sat, 5 Nov 2022 at 21:48, Piotr Gregor wrote:
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,


Piotr Gregor

--
You can spend the whole of your life trying to be popular,
but at the end of the day the size of the crowd at your funeral
will be largely dictated by the weather.

- Frank Skinner

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
gregor at infomedia.si
Guest





PostPosted: Wed Nov 09, 2022 8:05 am    Post subject: [Freeswitch-users] Current timestamp variable in dialplan? Reply with quote

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?


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

Quote:
On Wednesday 09 November 2022 at 10:31:26, Gregor Nanger wrote:

Quote:
now is by default, if you just use strftime. Try eval ${strftime()}

Aha, yes, that works, and the (undocumented as far as I can see) %q parameter
gives me nanoseconds.

Quote:
Do you know how to print now in milliseconds like:
<action application="set" data="var_name=${utcnow}"/>

No Sad

I wanted microseconds, but %6q gives nothing, as does %3q (which I would
expect to give milliseconds).

So, %S.%q gives seconds + nanoseconds, but I don't see a way to reduce the
resolution (interestingly, Asterisk's strftime function does support this,
also with the %q parameter).


Antony.

Quote:
On Wed, 9 Nov 2022 at 10:22, Antony Stone wrote:
Quote:
On Tuesday 08 November 2022 at 23:55:18, Gregor Nanger wrote:
Quote:
Antony, would strftime [format_string] do the job?

Quite possibly, provided I can find a value of "now" to format with it.

Quote:
On Sat, 5 Nov 2022 at 21:48, Piotr Gregor wrote:
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,


Piotr Gregor

--
You can spend the whole of your life trying to be popular,
but at the end of the day the size of the crowd at your funeral
will be largely dictated by the weather.

 - Frank Skinner

                                                   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



--
Gregor Nanger 
CTO
t./f.: 00386 (0) 7 6000 308/309 • m:. 00386 (0)41 756485
• Infomedia d.o.o. • Jerebova 3, Novo mesto, Slovenia
www.infomedia.si
Back to top
Antony.Stone at freesw...
Guest





PostPosted: Wed Nov 09, 2022 8:35 am    Post subject: [Freeswitch-users] Current timestamp variable in dialplan? Reply with quote

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

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

_________________________________________________________________________

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
gregor at infomedia.si
Guest





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

What does ${regex(${system date '+%F %T.%6N'}|(.+)|%1)} returns? If I try it in CLI I don't get anything.


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

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

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

_________________________________________________________________________

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
Antony.Stone at freesw...
Guest





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

On Wednesday 09 November 2022 at 15:49:04, Gregor Nanger wrote:

Quote:
What does ${regex(${system date '+%F %T.%6N'}|(.+)|%1)} returns? If I try
it in CLI I don't get anything.

I haven't tried it in the CLI - I need it in the dialplan.

The log output of that shows me:

[2022-11-09 14:00:23.682026]
helen eac89f23-fd7b-4514-b473-a3effb857b84
2022-11-09 14:00:23.663775 89.47%
[INFO] switch_core_session.c:2897
EXECUTE [depth=0] sofia/trunk/0x3x1x2x0x0@195.51.100.56
set(now=2022-11-09 14:00:23.679399)

I then have a variable ${now} which I can use later.


Antony.

--
"Life is just a lot better if you feel you're having 10 [small] wins a day
rather than a [big] win every 10 years or so."

- Chris Hadfield, former skiing (and ski racing) instructor

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 09, 2022 2:36 pm    Post subject: [Freeswitch-users] Current timestamp variable in dialplan? Reply with quote

All of this is already present in the XML CDR, each action, every step all time stamped down to microseconds and more accurate than setting variables.  Did you happen to load xml_cdr and do a call and see the information?

/b





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

Quote:
On Wednesday 09 November 2022 at 15:49:04, Gregor Nanger wrote:

Quote:
What does ${regex(${system date '+%F %T.%6N'}|(.+)|%1)} returns? If I try
it in CLI I don't get anything.

I haven't tried it in the CLI - I need it in the dialplan.

The log output of that shows me:

[2022-11-09 14:00:23.682026]
helen eac89f23-fd7b-4514-b473-a3effb857b84
2022-11-09 14:00:23.663775 89.47%
[INFO] switch_core_session.c:2897
EXECUTE [depth=0] sofia/trunk/0x3x1x2x0x0@195.51.100.56 (0x3x1x2x0x0@195.51.100.56)
set(now=2022-11-09 14:00:23.679399)

I then have a variable ${now} which I can use later.


Antony.

--
"Life is just a lot better if you feel you're having 10 [small] wins a day
rather than a [big] win every 10 years or so."

 - Chris Hadfield, former skiing (and ski racing) instructor

                                                   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 09, 2022 3:05 pm    Post subject: [Freeswitch-users] Current timestamp variable in dialplan? Reply with quote

On Wednesday 09 November 2022 at 20:23:50, Brian West wrote:

Quote:
All of this is already present in the XML CDR, each action, every step all
time stamped down to microseconds and more accurate than setting
variables. Did you happen to load xml_cdr and do a call and see the
information?

I have not done that yet, no; I have been busy with other things, but in the
meantime I simply wanted to answer Gregor's questions as far as I could.


Antony.

Quote:
On Wed, Nov 9, 2022 at 10:08 AM Antony Stone wrote:
Quote:
On Wednesday 09 November 2022 at 15:49:04, Gregor Nanger wrote:
Quote:
What does ${regex(${system date '+%F %T.%6N'}|(.+)|%1)} returns? If I
try it in CLI I don't get anything.

I haven't tried it in the CLI - I need it in the dialplan.

The log output of that shows me:

[2022-11-09 14:00:23.682026]
helen eac89f23-fd7b-4514-b473-a3effb857b84
2022-11-09 14:00:23.663775 89.47%
[INFO] switch_core_session.c:2897
EXECUTE [depth=0] sofia/trunk/0x3x1x2x0x0@195.51.100.56
set(now=2022-11-09 14:00:23.679399)

I then have a variable ${now} which I can use later.

--
Heisenberg, Gödel, and Chomsky walk in to a bar.
Heisenberg says, "Clearly this is a joke, but how can we work out if it's
funny or not?"
Gödel replies, "We can't know that because we're inside the joke."
Chomsky says, "Of course it's funny. You're just saying it wrong."

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 11, 2022 6:05 am    Post subject: [Freeswitch-users] Current timestamp variable in dialplan? Reply with quote

On Wednesday 09 November 2022 at 20:23:50, Brian West wrote:

Quote:
All of this is already present in the XML CDR, each action, every step all
time stamped down to microseconds and more accurate than setting
variables. Did you happen to load xml_cdr and do a call and see the
information?

So, I have this morning had a chance to get back to this, and it turns out
that <load module="mod_xml_cdr"/> was already in modules,conf.xml and I have a
large number of large files under /var/log/freeswitch/xml_cdr from previously
placed calls.

Comments / questions:

1. Aside from the timestamp variable assignment which I have put into the
dialplan myself (the one which has already been discussed and you say is a bad
idea because of session pool swell) I do not see any timestamps anywhere in
the xml file - how do I enable these?

2. The xml file is enormous (20kbytes for a single call) and would take
considerable parsing - where do I find the options to limit what information
goes in there?

3. https://freeswitch.org/confluence/display/FREESWITCH/mod_xml_cdr tells me
that this module can log to a file or using an HTTP POST. Does this mean there
is no way to get it to write to syslog?

I do nearly all logging (of everything that's running) to syslog, forward this
with no further processing to a central syslog server, and then process /
parse / aggregate / filter the data there, so as to reduce the workload on
"worker" machines which generate the logs.

This also makes it easy to combine log output from different applications which
are running independently (sometimes on different machines) but whose actions
in processing one "transaction" (for want of a better word) are important to
see in sequence.


So, I still wonder what is the best way to get microsecond-resolution
timestamps for key events ("key" being defined by me) in FreeSwitch during the
processing of a call.

Any suggestions on how to do this (preferably efficiently and without longer-
term drawbacks such as session pool swell) are welcome.


Thanks,


Antony.

--
"Remember: the S in IoT stands for Security."

- Jan-Piet Mens

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 11, 2022 7:28 am    Post subject: [Freeswitch-users] Current timestamp variable in dialplan? Reply with quote

On Friday 11 November 2022 at 11:54:26, Antony Stone wrote:

Quote:
On Wednesday 09 November 2022 at 20:23:50, Brian West wrote:
Quote:
All of this is already present in the XML CDR, each action, every step
all time stamped down to microseconds and more accurate than setting
variables. Did you happen to load xml_cdr and do a call and see the
information?

So, I have this morning had a chance to get back to this, and it turns out
that <load module="mod_xml_cdr"/> was already in modules,conf.xml and I
have a large number of large files under /var/log/freeswitch/xml_cdr from
previously placed calls.

Comments / questions:

1. Aside from the timestamp variable assignment which I have put into the
dialplan myself (the one which has already been discussed and you say is a
bad idea because of session pool swell) I do not see any timestamps
anywhere in the xml file - how do I enable these?

Ah, I do now see that some of the lines have "app_stamp" fields, containing an
epoch-format timestamp. Not the format I need for feeding into syslog (all
other applications use ISO 8601 format), but I guess it might be post-
processable, if there's no option to specify the format?

The next two items look like bigger problems for now, though:

Quote:
2. The xml file is enormous (20kbytes for a single call) and would take
considerable parsing - where do I find the options to limit what
information goes in there?

3. https://freeswitch.org/confluence/display/FREESWITCH/mod_xml_cdr tells
me that this module can log to a file or using an HTTP POST. Does this
mean there is no way to get it to write to syslog?

I do nearly all logging (of everything that's running) to syslog, forward
this with no further processing to a central syslog server, and then
process / parse / aggregate / filter the data there, so as to reduce the
workload on "worker" machines which generate the logs.

This also makes it easy to combine log output from different applications
which are running independently (sometimes on different machines) but
whose actions in processing one "transaction" (for want of a better word)
are important to see in sequence.


So, I still wonder what is the best way to get microsecond-resolution
timestamps for key events ("key" being defined by me) in FreeSwitch during
the processing of a call.

Any suggestions on how to do this (preferably efficiently and without
longer- term drawbacks such as session pool swell) are welcome.

While I'm at it, can anyone tell me quite what a session pool is (or refer me
to the documentation for it), what causes swell, and how to avoid it (whilst
still getting the dialplan to do what you need)?

Quote:
Thanks,


Antony.

--
A user interface is like a joke.
If you have to explain it, it means it doesn't work.

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 11, 2022 10:33 am    Post subject: [Freeswitch-users] Current timestamp variable in dialplan? Reply with quote

Inline.

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

Quote:
On Wednesday 09 November 2022 at 20:23:50, Brian West wrote:

Quote:
All of this is already present in the XML CDR, each action, every step all
time stamped down to microseconds and more accurate than setting
variables.  Did you happen to load xml_cdr and do a call and see the
information?

So, I have this morning had a chance to get back to this, and it turns out
that <load module="mod_xml_cdr"/> was already in modules,conf.xml and I have a
large number of large files under /var/log/freeswitch/xml_cdr from previously
placed calls.

Comments / questions:

1. Aside from the timestamp variable assignment which I have put into the
dialplan myself (the one which has already been discussed and you say is a bad
idea because of session pool swell) I do not see any timestamps anywhere in
the xml file - how do I enable these?


You found app_stamp, that's microseconds epoch
 
Quote:
2. The xml file is enormous (20kbytes for a single call) and would take
considerable parsing - where do I find the options to limit what information
goes in there?


No way to limit the info, also this info is very handy for figuring out what took place after the fact.
 
Quote:
3. https://freeswitch.org/confluence/display/FREESWITCH/mod_xml_cdr tells me
that this module can log to a file or using an HTTP POST.  Does this mean there
is no way to get it to write to syslog?


Syslog for CDR? Just load mod_syslog and configure it for logging.  You should use the post method with fallback and isolate the CDR processing infrastructure and not intermingle that into syslog.
 
Quote:
I do nearly all logging (of everything that's running) to syslog, forward this
with no further processing to a central syslog server, and then process /
parse / aggregate / filter the data there, so as to reduce the workload on
"worker" machines which generate the logs.


Do you currently experience this 'workload' that is impacting anything?  I want to make sure you're not wasting your time trying to wax your car to get better gas mileage.
 
Quote:

This also makes it easy to combine log output from different applications which
are running independently (sometimes on different machines) but whose actions
in processing one "transaction" (for want of a better word) are important to
see in sequence.


So, I still wonder what is the best way to get microsecond-resolution
timestamps for key events ("key" being defined by me) in FreeSwitch during the
processing of a call.

Any suggestions on how to do this (preferably efficiently and without longer-
term drawbacks such as session pool swell) are welcome.


Thanks,


Antony.

--
"Remember: the S in IoT stands for Security."

 - Jan-Piet Mens

                                                   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 11, 2022 11:05 am    Post subject: [Freeswitch-users] Current timestamp variable in dialplan? Reply with quote

On Friday 11 November 2022 at 16:08:29, Brian West wrote:

Quote:
Inline.

Thanks :)

Quote:
On Fri, Nov 11, 2022 at 5:03 AM Antony Stone wrote:
Quote:

So, I have this morning had a chance to get back to this, and it turns
out that <load module="mod_xml_cdr"/> was already in modules,conf.xml
and I have a large number of large files under /var/log/freeswitch/xml_cdr
from previously placed calls.

Comments / questions:

1. Aside from the timestamp variable assignment which I have put into the
dialplan myself (the one which has already been discussed and you say is
a bad idea because of session pool swell) I do not see any timestamps
anywhere in the xml file - how do I enable these?

You found app_stamp, that's microseconds epoch

So, I take it that that is the only format available - no chance of ISO 8601?

Quote:
Quote:
2. The xml file is enormous (20kbytes for a single call) and would take
considerable parsing - where do I find the options to limit what
information goes in there?

No way to limit the info, also this info is very handy for figuring out
what took place after the fact.

I regard that as "debug level logging" and I wouldn't run a production server
with debugging permanently enabled.

I'd say I'm looking for the "info" equivalent.

Quote:
Quote:
3. https://freeswitch.org/confluence/display/FREESWITCH/mod_xml_cdr tells
me that this module can log to a file or using an HTTP POST. Does this
mean there is no way to get it to write to syslog?

Syslog for CDR? Just load mod_syslog and configure it for logging.

Already doing that - doesn't output the timestamps I see in xml_cdr.

Quote:
You should use the post method with fallback and isolate the CDR processing
infrastructure and not intermingle that into syslog.

As I've said previously, I am not trying to do this logging for any purpose to
do with billing, so although we've got onto the topic of CDRs here, I'm not
trying to use them for any "traditional" purpose of CDRs - it just seems that
that's the way to get this sort of data out of FreeSwitch.

Quote:
Quote:
I do nearly all logging (of everything that's running) to syslog, forward
this with no further processing to a central syslog server, and then
process / parse / aggregate / filter the data there, so as to reduce the
workload on "worker" machines which generate the logs.

Do you currently experience this 'workload' that is impacting anything?

1. I don't know, but every little helps - if I can focus one machine on
processing phone calls, and another one on analysing the timing data of those
calls, I think that's a better approach than trying to do everything on one
server.

2. There are already multiple machines handling phone calls, all forwarding
syslog data to a central aggregator (partly because I need to combine timing
data from different machines which interact with each other during call
processing, so that the entire call flow (across several machines) is visible
in a single log).

3. The system needs to be scaleable, and one of my approaches to that is to
separate different tasks to different machines, so that if the workload of one
type of task increases, I can implement more of that type of machine, without
its workload having been driven up by something that should have been handled
elsewhere.

Quote:
I want to make sure you're not wasting your time trying to wax your car to
get better gas mileage.

I'm half-way between a development and a production environment with this.
There are already production servers handling "real-world" calls and I don't
intend to perform such detailed logging (although still some, and requiring
good timestamps) on those. On the development machines, though, I want the
timestamps at many more stages during call processing (across several machines
which interact to handle a single call) so that I can actually measure the
aerodynamics (to extend your analogy) of the system and identify where it
might be worth reshaping some body part.

Until I get the data, I don't know where to focus the effort, so I'm currently
trying to collect the data in the best way possible.


Is there somewhere I can read up on what session pools are and what sorts of
things cause them to swell? I hadn't come across the term bofore you
mentioned it a couple of days ago.


Antony.

--
"Measuring average network latency is about as useful as measuring the mean
temperature of patients in a hospital."

- Stéphane Bortzmeyer

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
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 Previous  1, 2
Page 2 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