Current timestamp variable in dialplan?
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.
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> wrote:
Hi.
I'm looking for a variable I can access in the dialplan (I use XML if it matters) which will tell me the current time (when I read the variable) in the format 2022-11-02 12:34:56.789789
If that's not available, but a microsecond-resolution Epoch timestamp is, what would be the function to convert this to the above human format?
https://freeswitch.org/confluence/display/FREESWITCH/Switch+core+variables tells me about variables which are set after a channel is hung up, so they're no use during call setup, and
https://freeswitch.org/confluence/display/FREESWITCH/Channel+Variables doesn't seem to have anything which represents "now".
Can anyone suggest where I should be looking to find such variables?
Thanks,
Antony.
-- 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
-- Brian West | Co-founder and Developer Need Commercial support? email sales@freeswitch.com FreeSWITCH Solutions | 17345 Civic Drive #2531 Brookfield, WI 53045 <https://maps.google.com/?q=17345+Civic+Drive+%232531+Brookfield,+WI+53045&entry=gmail&source=g> Email: brian@freeswitch.com Mobile: 918-424-9378 Website: https://www.FreeSWITCH.com <https://www.freeswitch.com/> [image: https://www.facebook.com/signalwireinc?src=email] <https://www.facebook.com/freeswitch> [image: https://twitter.com/freeswitch] <https://twitter.com/freeswitch>
On Wednesday 02 November 2022 at 16:12:22, Brian West wrote:
Are you trying to do something like billing? If so using variables or anything getvar related will result in pool swell.
Billing is out of band, or inband with things like nibble bill, which is just an implementation of a core idea of being able to nibble from a balance using the session heartbeats.
No, this is nothing to do with billing. I'm basically just looking for the same value which would be logged in a verbose logfile output against each dialplan action.
On Wed, Nov 2, 2022 at 9:55 AM Antony Stone wrote:
Hi.
I'm looking for a variable I can access in the dialplan (I use XML if it matters) which will tell me the current time (when I read the variable) in the format 2022-11-02 12:34:56.789789
If that's not available, but a microsecond-resolution Epoch timestamp is, what would be the function to convert this to the above human format?
https://freeswitch.org/confluence/display/FREESWITCH/Switch+core+variables tells me about variables which are set after a channel is hung up, so they're no use during call setup, and
https://freeswitch.org/confluence/display/FREESWITCH/Channel+Variables doesn't seem to have anything which represents "now".
Can anyone suggest where I should be looking to find such variables?
Thanks,
Antony.
-- 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.
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> wrote:
On Wednesday 02 November 2022 at 16:12:22, Brian West wrote:
Are you trying to do something like billing? If so using variables or anything getvar related will result in pool swell.
Billing is out of band, or inband with things like nibble bill, which is just an implementation of a core idea of being able to nibble from a balance using the session heartbeats.
No, this is nothing to do with billing.
I'm basically just looking for the same value which would be logged in a verbose logfile output against each dialplan action.
On Wed, Nov 2, 2022 at 9:55 AM Antony Stone wrote:
Hi.
I'm looking for a variable I can access in the dialplan (I use XML if it matters) which will tell me the current time (when I read the variable) in the format 2022-11-02 12:34:56.789789
If that's not available, but a microsecond-resolution Epoch timestamp is, what would be the function to convert this to the above human format?
https://freeswitch.org/confluence/display/FREESWITCH/Switch+core+variables
tells me about variables which are set after a channel is hung up, so they're no use during call setup, and
https://freeswitch.org/confluence/display/FREESWITCH/Channel+Variables doesn't seem to have anything which represents "now".
Can anyone suggest where I should be looking to find such variables?
Thanks,
Antony.
-- 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
-- Brian West | Co-founder and Developer Need Commercial support? email sales@freeswitch.com FreeSWITCH Solutions | 17345 Civic Drive #2531 Brookfield, WI 53045 <https://maps.google.com/?q=17345+Civic+Drive+%232531+Brookfield,+WI+53045&entry=gmail&source=g> Email: brian@freeswitch.com Mobile: 918-424-9378 Website: https://www.FreeSWITCH.com <https://www.freeswitch.com/> [image: https://www.facebook.com/signalwireinc?src=email] <https://www.facebook.com/freeswitch> [image: https://twitter.com/freeswitch] <https://twitter.com/freeswitch>
On Wednesday 02 November 2022 at 17:18:26, Brian West wrote:
Ok let's step back, what do you mean by this?
I mean that I wish either to assign the current timestamp to a variable in the format 2022-11-02 12:34:56.789789, or to find a system variable which will provide this when I reference something like ${now}. I hope that's clear? As a workaround until I find out how to do this the correct way, the following command does what I want, however I suspect it's not very efficient: <action application="set" data="now=${regex(${system date '+%F %T.%N'}|(.+)|%1)}" /> I got the somewhat complicated syntax of that command from https://freeswitch.org/confluence/display/FREESWITCH/mod_dptools:+system Antony.
On Wed, Nov 2, 2022 at 11:15 AM Antony Stone wrote:
On Wednesday 02 November 2022 at 16:12:22, Brian West wrote:
Are you trying to do something like billing? If so using variables or anything getvar related will result in pool swell.
Billing is out of band, or inband with things like nibble bill, which is just an implementation of a core idea of being able to nibble from a balance using the session heartbeats.
No, this is nothing to do with billing.
I'm basically just looking for the same value which would be logged in a verbose logfile output against each dialplan action.
On Wed, Nov 2, 2022 at 9:55 AM Antony Stone wrote:
Hi.
I'm looking for a variable I can access in the dialplan (I use XML if it matters) which will tell me the current time (when I read the variable) in the format 2022-11-02 12:34:56.789789
If that's not available, but a microsecond-resolution Epoch timestamp is, what would be the function to convert this to the above human format? https://freeswitch.org/confluence/display/FREESWITCH/Switch+core+ variables tells me about variables which are set after a channel is hung up, so they're no use during call setup, and
https://freeswitch.org/confluence/display/FREESWITCH/Channel+Variables doesn't seem to have anything which represents "now".
Can anyone suggest where I should be looking to find such variables?
Thanks,
Antony.
-- Someone has stolen all the toilets from New Scotland Yard. Police say they have absolutely nothing to go on. Please reply to the list; please *don't* CC me.
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> wrote:
On Wednesday 02 November 2022 at 17:18:26, Brian West wrote:
Ok let's step back, what do you mean by this?
I mean that I wish either to assign the current timestamp to a variable in the format 2022-11-02 12:34:56.789789, or to find a system variable which will provide this when I reference something like ${now}.
I hope that's clear?
As a workaround until I find out how to do this the correct way, the following command does what I want, however I suspect it's not very efficient:
<action application="set" data="now=${regex(${system date '+%F %T.%N'}|(.+)|%1)}" />
I got the somewhat complicated syntax of that command from https://freeswitch.org/confluence/display/FREESWITCH/mod_dptools:+system
Antony.
On Wed, Nov 2, 2022 at 11:15 AM Antony Stone wrote:
On Wednesday 02 November 2022 at 16:12:22, Brian West wrote:
Are you trying to do something like billing? If so using variables or anything getvar related will result in pool swell.
Billing is out of band, or inband with things like nibble bill, which is just an implementation of a core idea of being able to nibble from a balance using the session heartbeats.
No, this is nothing to do with billing.
I'm basically just looking for the same value which would be logged in a verbose logfile output against each dialplan action.
On Wed, Nov 2, 2022 at 9:55 AM Antony Stone wrote:
Hi.
I'm looking for a variable I can access in the dialplan (I use XML if it matters) which will tell me the current time (when I read the variable) in the format 2022-11-02 12:34:56.789789
If that's not available, but a microsecond-resolution Epoch timestamp is, what would be the function to convert this to the above human format? https://freeswitch.org/confluence/display/FREESWITCH/Switch+core+ variables tells me about variables which are set after a channel is hung up, so they're no use during call setup, and
https://freeswitch.org/confluence/display/FREESWITCH/Channel+Variables
doesn't seem to have anything which represents "now".
Can anyone suggest where I should be looking to find such variables?
Thanks,
Antony.
-- Someone has stolen all the toilets from New Scotland Yard. Police say they have absolutely nothing to go on.
Please reply to the list; please *don't* CC me.
_________________________________________________________________________
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
-- Brian West | Co-founder and Developer Need Commercial support? email sales@freeswitch.com FreeSWITCH Solutions | 17345 Civic Drive #2531 Brookfield, WI 53045 <https://maps.google.com/?q=17345+Civic+Drive+%232531+Brookfield,+WI+53045&entry=gmail&source=g> Email: brian@freeswitch.com Mobile: 918-424-9378 Website: https://www.FreeSWITCH.com <https://www.freeswitch.com/> [image: https://www.facebook.com/signalwireinc?src=email] <https://www.facebook.com/freeswitch> [image: https://twitter.com/freeswitch] <https://twitter.com/freeswitch>
On Wednesday 02 November 2022 at 18:25:52, Brian West wrote:
What problem are you trying to solve? I still can't clearly understand what you're trying to accomplish.
Oh, I didn't realise you wanted to know what I planned to *do* with the information - I thought you were just trying to understand exactly what information I need. So, to answer your question about why I need these timestamps, I have specific points throughout the dialplan where I need to know the current (accurate) timestamp, in order to collect statistics on the efficiency of different parts of the dialplan (basically, how long does *this* section take to complete, how long does *that* section take, etc). These timing values are then combined with similar timestamps from other parts of the system (which includes Asterisk, database lookups, and other external services) to give an overall measure of the performance of individual parts of the whole thing. Ultimately I do not intend to collect this quantity of data from production systems, but on development and test systems I need to be able to spot quickly when some part of what FreeSwitch is doing, or anything else we are collecting these timestamps from, changes (for better or for worse) in how long the processing takes. Does that answer your question sufficiently to be able to guide to me where I can find the current timestamp inside the dialplan? I didn't realise that this could be a complicated question, but perhaps the fact that I didn't find the answer easily indicates that it is?
On Wed, Nov 2, 2022 at 12:12 PM Antony Stone wrote:
On Wednesday 02 November 2022 at 17:18:26, Brian West wrote:
Ok let's step back, what do you mean by this?
I mean that I wish either to assign the current timestamp to a variable in the format 2022-11-02 12:34:56.789789, or to find a system variable which will provide this when I reference something like ${now}.
I hope that's clear?
As a workaround until I find out how to do this the correct way, the following command does what I want, however I suspect it's not very efficient:
<action application="set" data="now=${regex(${system date '+%F %T.%N'}|(.+)|%1)}" />
I got the somewhat complicated syntax of that command from https://freeswitch.org/confluence/display/FREESWITCH/mod_dptools:+system
Antony.
-- "A person lives in the UK, but commutes to France daily for work. He belongs in the UK." - From UK Revenue & Customs notice 741, page 13, paragraph 3.5.1 - http://tinyurl.com/o7gnm4 Please reply to the list; please *don't* CC me.
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> wrote:
On Wednesday 02 November 2022 at 18:25:52, Brian West wrote:
What problem are you trying to solve? I still can't clearly understand what you're trying to accomplish.
Oh, I didn't realise you wanted to know what I planned to *do* with the information - I thought you were just trying to understand exactly what information I need.
So, to answer your question about why I need these timestamps, I have specific points throughout the dialplan where I need to know the current (accurate) timestamp, in order to collect statistics on the efficiency of different parts of the dialplan (basically, how long does *this* section take to complete, how long does *that* section take, etc).
These timing values are then combined with similar timestamps from other parts of the system (which includes Asterisk, database lookups, and other external services) to give an overall measure of the performance of individual parts of the whole thing.
Ultimately I do not intend to collect this quantity of data from production systems, but on development and test systems I need to be able to spot quickly when some part of what FreeSwitch is doing, or anything else we are collecting these timestamps from, changes (for better or for worse) in how long the processing takes.
Does that answer your question sufficiently to be able to guide to me where I can find the current timestamp inside the dialplan?
I didn't realise that this could be a complicated question, but perhaps the fact that I didn't find the answer easily indicates that it is?
On Wed, Nov 2, 2022 at 12:12 PM Antony Stone wrote:
On Wednesday 02 November 2022 at 17:18:26, Brian West wrote:
Ok let's step back, what do you mean by this?
I mean that I wish either to assign the current timestamp to a variable in the format 2022-11-02 12:34:56.789789, or to find a system variable which will provide this when I reference something like ${now}.
I hope that's clear?
As a workaround until I find out how to do this the correct way, the following command does what I want, however I suspect it's not very efficient:
<action application="set" data="now=${regex(${system date '+%F %T.%N'}|(.+)|%1)}" />
I got the somewhat complicated syntax of that command from
https://freeswitch.org/confluence/display/FREESWITCH/mod_dptools:+system
Antony.
-- "A person lives in the UK, but commutes to France daily for work. He belongs in the UK."
- From UK Revenue & Customs notice 741, page 13, paragraph 3.5.1 - http://tinyurl.com/o7gnm4
Please reply to the list; please *don't* CC me.
_________________________________________________________________________
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
-- *Andrew Cassidy BSc (Hons) MBCS* Managing Director 0330 44 55 960 <+443304455960> andrew@cassidyweb.co.uk www.cassidyweb.co.uk
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> wrote:
On Wednesday 02 November 2022 at 18:25:52, Brian West wrote:
What problem are you trying to solve? I still can't clearly understand what you're trying to accomplish.
Oh, I didn't realise you wanted to know what I planned to *do* with the information - I thought you were just trying to understand exactly what information I need.
So, to answer your question about why I need these timestamps, I have specific points throughout the dialplan where I need to know the current (accurate) timestamp, in order to collect statistics on the efficiency of different parts of the dialplan (basically, how long does *this* section take to complete, how long does *that* section take, etc).
These timing values are then combined with similar timestamps from other parts of the system (which includes Asterisk, database lookups, and other external services) to give an overall measure of the performance of individual parts of the whole thing.
Ultimately I do not intend to collect this quantity of data from production systems, but on development and test systems I need to be able to spot quickly when some part of what FreeSwitch is doing, or anything else we are collecting these timestamps from, changes (for better or for worse) in how long the processing takes.
Does that answer your question sufficiently to be able to guide to me where I can find the current timestamp inside the dialplan?
I didn't realise that this could be a complicated question, but perhaps the fact that I didn't find the answer easily indicates that it is?
On Wed, Nov 2, 2022 at 12:12 PM Antony Stone wrote:
On Wednesday 02 November 2022 at 17:18:26, Brian West wrote:
Ok let's step back, what do you mean by this?
I mean that I wish either to assign the current timestamp to a variable in the format 2022-11-02 12:34:56.789789, or to find a system variable which will provide this when I reference something like ${now}.
I hope that's clear?
As a workaround until I find out how to do this the correct way, the following command does what I want, however I suspect it's not very efficient:
<action application="set" data="now=${regex(${system date '+%F %T.%N'}|(.+)|%1)}" />
I got the somewhat complicated syntax of that command from
https://freeswitch.org/confluence/display/FREESWITCH/mod_dptools:+system
Antony.
-- "A person lives in the UK, but commutes to France daily for work. He belongs in the UK."
- From UK Revenue & Customs notice 741, page 13, paragraph 3.5.1 - http://tinyurl.com/o7gnm4
Please reply to the list; please *don't* CC me.
_________________________________________________________________________
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
-- Brian West | Co-founder and Developer Need Commercial support? email sales@freeswitch.com FreeSWITCH Solutions | 17345 Civic Drive #2531 Brookfield, WI 53045 <https://maps.google.com/?q=17345+Civic+Drive+%232531+Brookfield,+WI+53045&entry=gmail&source=g> Email: brian@freeswitch.com Mobile: 918-424-9378 Website: https://www.FreeSWITCH.com <https://www.freeswitch.com/> [image: https://www.facebook.com/signalwireinc?src=email] <https://www.facebook.com/freeswitch> [image: https://twitter.com/freeswitch] <https://twitter.com/freeswitch>
On Friday 04 November 2022 at 16:05:39, Brian West wrote:
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.
On Wed, Nov 2, 2022 at 2:03 PM Antony Stone wrote:
On Wednesday 02 November 2022 at 18:25:52, Brian West wrote:
What problem are you trying to solve? I still can't clearly understand what you're trying to accomplish.
Oh, I didn't realise you wanted to know what I planned to *do* with the information - I thought you were just trying to understand exactly what information I need.
So, to answer your question about why I need these timestamps, I have specific points throughout the dialplan where I need to know the current (accurate) timestamp, in order to collect statistics on the efficiency of different parts of the dialplan (basically, how long does *this* section take to complete, how long does *that* section take, etc).
These timing values are then combined with similar timestamps from other parts of the system (which includes Asterisk, database lookups, and other external services) to give an overall measure of the performance of individual parts of the whole thing.
Ultimately I do not intend to collect this quantity of data from production systems, but on development and test systems I need to be able to spot quickly when some part of what FreeSwitch is doing, or anything else we are collecting these timestamps from, changes (for better or for worse) in how long the processing takes.
Does that answer your question sufficiently to be able to guide to me where I can find the current timestamp inside the dialplan?
I didn't realise that this could be a complicated question, but perhaps the fact that I didn't find the answer easily indicates that it is?
On Wed, Nov 2, 2022 at 12:12 PM Antony Stone wrote:
On Wednesday 02 November 2022 at 17:18:26, Brian West wrote:
Ok let's step back, what do you mean by this?
I mean that I wish either to assign the current timestamp to a variable in the format 2022-11-02 12:34:56.789789, or to find a system variable which will provide this when I reference something like ${now}.
I hope that's clear?
As a workaround until I find out how to do this the correct way, the following command does what I want, however I suspect it's not very efficient:
<action
application="set" data="now=${regex(${system date '+%F %T.%N'}|(.+)|%1)}"
/>
I got the somewhat complicated syntax of that command from
https://freeswitch.org/confluence/display/FREESWITCH/mod_dptools:+system
Antony.
-- .evah I serutangis sseltniop tsom eht fo eno eb tsum sihT Please reply to the list; please *don't* CC me.
Inline below. On Fri, Nov 4, 2022 at 11:06 AM Antony Stone < Antony.Stone@freeswitch.open.source.it> wrote:
On Friday 04 November 2022 at 16:05:39, Brian West wrote:
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.
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.
Antony.
On Wed, Nov 2, 2022 at 2:03 PM Antony Stone wrote:
On Wednesday 02 November 2022 at 18:25:52, Brian West wrote:
What problem are you trying to solve? I still can't clearly understand what you're trying to accomplish.
Oh, I didn't realise you wanted to know what I planned to *do* with the information - I thought you were just trying to understand exactly what information I need.
So, to answer your question about why I need these timestamps, I have specific points throughout the dialplan where I need to know the current (accurate) timestamp, in order to collect statistics on the efficiency of different parts of the dialplan (basically, how long does *this* section take to complete, how long does *that* section take, etc).
These timing values are then combined with similar timestamps from other parts of the system (which includes Asterisk, database lookups, and other external services) to give an overall measure of the performance of individual parts of the whole thing.
Ultimately I do not intend to collect this quantity of data from production systems, but on development and test systems I need to be able to spot quickly when some part of what FreeSwitch is doing, or anything else we are collecting these timestamps from, changes (for better or for worse) in how long the processing takes.
Does that answer your question sufficiently to be able to guide to me where I can find the current timestamp inside the dialplan?
I didn't realise that this could be a complicated question, but perhaps the fact that I didn't find the answer easily indicates that it is?
On Wed, Nov 2, 2022 at 12:12 PM Antony Stone wrote:
On Wednesday 02 November 2022 at 17:18:26, Brian West wrote:
Ok let's step back, what do you mean by this?
I mean that I wish either to assign the current timestamp to a variable in the format 2022-11-02 12:34:56.789789, or to find a system variable which will provide this when I reference something like ${now}.
I hope that's clear?
As a workaround until I find out how to do this the correct way, the following command does what I want, however I suspect it's not very efficient:
<action
application="set" data="now=${regex(${system date '+%F %T.%N'}|(.+)|%1)}"
/>
I got the somewhat complicated syntax of that command from
https://freeswitch.org/confluence/display/FREESWITCH/mod_dptools:+system
Antony.
-- .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
-- Brian West | Co-founder and Developer Need Commercial support? email sales@freeswitch.com FreeSWITCH Solutions | 17345 Civic Drive #2531 Brookfield, WI 53045 <https://maps.google.com/?q=17345+Civic+Drive+%232531+Brookfield,+WI+53045&entry=gmail&source=g> Email: brian@freeswitch.com Mobile: 918-424-9378 Website: https://www.FreeSWITCH.com <https://www.freeswitch.com/> [image: https://www.facebook.com/signalwireinc?src=email] <https://www.facebook.com/freeswitch> [image: https://twitter.com/freeswitch] <https://twitter.com/freeswitch>
On Friday 04 November 2022 at 18:25:21, Brian West wrote:
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.
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.
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> wrote:
On Friday 04 November 2022 at 18:25:21, Brian West wrote:
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.
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
-- Brian West | Co-founder and Developer Need Commercial support? email sales@freeswitch.com FreeSWITCH Solutions | 17345 Civic Drive #2531 Brookfield, WI 53045 <https://maps.google.com/?q=17345+Civic+Drive+%232531+Brookfield,+WI+53045&entry=gmail&source=g> Email: brian@freeswitch.com Mobile: 918-424-9378 Website: https://www.FreeSWITCH.com <https://www.freeswitch.com/> [image: https://www.facebook.com/signalwireinc?src=email] <https://www.facebook.com/freeswitch> [image: https://twitter.com/freeswitch] <https://twitter.com/freeswitch>
On Friday 04 November 2022 at 19:13:27, Brian West wrote:
Antony,
Maybe you can come to our next office hours?
Er, what? Where are you?
On Fri, Nov 4, 2022 at 1:05 PM Antony Stone wrote:
On Friday 04 November 2022 at 18:25:21, Brian West wrote:
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 :)
Antony. -- "Black holes are where God divided by zero." - Steven Wright Please reply to the list; please *don't* CC me.
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 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> wrote:
On Friday 04 November 2022 at 19:13:27, Brian West wrote:
Antony,
Maybe you can come to our next office hours?
Er, what? Where are you?
On Fri, Nov 4, 2022 at 1:05 PM Antony Stone wrote:
On Friday 04 November 2022 at 18:25:21, Brian West wrote:
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 :)
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
Anthony, would strftime [format_string] do the job? On Sat, 5 Nov 2022 at 21:48, Piotr Gregor <piotr@dataandsignal.com> wrote:
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 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> wrote:
On Friday 04 November 2022 at 19:13:27, Brian West wrote:
Antony,
Maybe you can come to our next office hours?
Er, what? Where are you?
On Fri, Nov 4, 2022 at 1:05 PM Antony Stone wrote:
On Friday 04 November 2022 at 18:25:21, Brian West wrote:
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 :)
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
_________________________________________________________________________
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
On Tuesday 08 November 2022 at 23:55:18, Gregor Nanger wrote:
Antony, would strftime [format_string] do the job?
Quite possibly, provided I can find a value of "now" to format with it.
On Sat, 5 Nov 2022 at 21:48, Piotr Gregor wrote:
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:
On Friday 04 November 2022 at 19:13:27, Brian West wrote:
Antony,
Maybe you can come to our next office hours?
Er, what? Where are you?
On Fri, Nov 4, 2022 at 1:05 PM Antony Stone wrote:
On Friday 04 November 2022 at 18:25:21, Brian West wrote:
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 :)
Antony.
-- <flopsie> yes, but this is #lbw, we don't do normal Please reply to the list; please *don't* CC me.
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> wrote:
On Tuesday 08 November 2022 at 23:55:18, Gregor Nanger wrote:
Antony, would strftime [format_string] do the job?
Quite possibly, provided I can find a value of "now" to format with it.
On Sat, 5 Nov 2022 at 21:48, Piotr Gregor wrote:
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:
On Friday 04 November 2022 at 19:13:27, Brian West wrote:
Antony,
Maybe you can come to our next office hours?
Er, what? Where are you?
On Fri, Nov 4, 2022 at 1:05 PM Antony Stone wrote:
On Friday 04 November 2022 at 18:25:21, Brian West wrote: > 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 :)
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
On Wednesday 09 November 2022 at 10:31:26, Gregor Nanger wrote:
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.
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.
On Wed, 9 Nov 2022 at 10:22, Antony Stone wrote:
On Tuesday 08 November 2022 at 23:55:18, Gregor Nanger wrote:
Antony, would strftime [format_string] do the job?
Quite possibly, provided I can find a value of "now" to format with it.
On Sat, 5 Nov 2022 at 21:48, Piotr Gregor wrote:
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.
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> wrote:
On Wednesday 09 November 2022 at 10:31:26, Gregor Nanger wrote:
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.
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.
On Wed, 9 Nov 2022 at 10:22, Antony Stone wrote:
On Tuesday 08 November 2022 at 23:55:18, Gregor Nanger wrote:
Antony, would strftime [format_string] do the job?
Quite possibly, provided I can find a value of "now" to format with it.
On Sat, 5 Nov 2022 at 21:48, Piotr Gregor wrote:
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
-- 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
On Wednesday 09 November 2022 at 13:54:07, Gregor Nanger wrote:
If you would aks me, I would say that this simple functionality is available in FS and within 2 minutes I can google it. But now I am struggling for hours and can't find a solution to print, log... current time in microseconds or nanoseconds. If %q would work in strftime it would be a solution, but it doesn't work.
Is there another tool to display the current time in micro/nano seconds?
The only thing I've come up with is: <action application="set" data="now=${regex(${system date '+%F %T.%6N'}|(.+)|%1)}" /> Note however that Brian West has said "I'd not recommend doing that, because every time you do a get var, you cause a pool allocation and doing this in a loop will make your session pool swell at the rate of whatever you're calling get_var on. Doing anything at all inline with the dialplan is not the right approach. your logic and info should be all external, keying off events either on ESL or custom modules you wrote." Antony. -- All generalisations are inaccurate. Please reply to the list; please *don't* CC me.
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> wrote:
On Wednesday 09 November 2022 at 13:54:07, Gregor Nanger wrote:
If you would aks me, I would say that this simple functionality is available in FS and within 2 minutes I can google it. But now I am struggling for hours and can't find a solution to print, log... current time in microseconds or nanoseconds. If %q would work in strftime it would be a solution, but it doesn't work.
Is there another tool to display the current time in micro/nano seconds?
The only thing I've come up with is:
<action application="set" data="now=${regex(${system date '+%F %T.%6N'}|(.+)|%1)}" />
Note however that Brian West has said "I'd not recommend doing that, because every time you do a get var, you cause a pool allocation and doing this in a loop will make your session pool swell at the rate of whatever you're calling get_var on. Doing anything at all inline with the dialplan is not the right approach. your logic and info should be all external, keying off events either on ESL or custom modules you wrote."
Antony.
-- All generalisations are inaccurate.
Please reply to the list; please *don't* CC me.
_________________________________________________________________________
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
On Wednesday 09 November 2022 at 15:49:04, Gregor Nanger wrote:
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.
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> wrote:
On Wednesday 09 November 2022 at 15:49:04, Gregor Nanger wrote:
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
-- Brian West | Co-founder and Developer Need Commercial support? email sales@freeswitch.com FreeSWITCH Solutions | 17345 Civic Drive #2531 Brookfield, WI 53045 <https://maps.google.com/?q=17345+Civic+Drive+%232531+Brookfield,+WI+53045&entry=gmail&source=g> Email: brian@freeswitch.com Mobile: 918-424-9378 Website: https://www.FreeSWITCH.com <https://www.freeswitch.com/> [image: https://www.facebook.com/signalwireinc?src=email] <https://www.facebook.com/freeswitch> [image: https://twitter.com/freeswitch] <https://twitter.com/freeswitch>
On Wednesday 09 November 2022 at 20:23:50, Brian West wrote:
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.
On Wed, Nov 9, 2022 at 10:08 AM Antony Stone wrote:
On Wednesday 09 November 2022 at 15:49:04, Gregor Nanger wrote:
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.
On Wednesday 09 November 2022 at 20:23:50, Brian West wrote:
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.
On Friday 11 November 2022 at 11:54:26, Antony Stone wrote:
On Wednesday 09 November 2022 at 20:23:50, Brian West wrote:
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:
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)?
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.
Inline. On Fri, Nov 11, 2022 at 5:03 AM Antony Stone < Antony.Stone@freeswitch.open.source.it> wrote:
On Wednesday 09 November 2022 at 20:23:50, Brian West wrote:
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
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.
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.
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.
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
-- Brian West | Co-founder and Developer Need Commercial support? email sales@freeswitch.com FreeSWITCH Solutions | 17345 Civic Drive #2531 Brookfield, WI 53045 <https://maps.google.com/?q=17345+Civic+Drive+%232531+Brookfield,+WI+53045&entry=gmail&source=g> Email: brian@freeswitch.com Mobile: 918-424-9378 Website: https://www.FreeSWITCH.com <https://www.freeswitch.com/> [image: https://www.facebook.com/signalwireinc?src=email] <https://www.facebook.com/freeswitch> [image: https://twitter.com/freeswitch] <https://twitter.com/freeswitch>
On Friday 11 November 2022 at 16:08:29, Brian West wrote:
Inline.
Thanks :)
On Fri, Nov 11, 2022 at 5:03 AM Antony Stone wrote:
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?
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.
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.
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.
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.
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.
participants (5)
-
Andrew Cassidy
-
Antony Stone
-
Brian West
-
Gregor Nanger
-
Piotr Gregor