week day and time condition possible bug
Its a misconfig you are specifying only 1 second where the first condition can fire 0 thru 0 is just 0 Sent from my iPhone
On Sep 4, 2016, at 8:24 AM, Bipin Patel <bipin@xbipin.com> wrote:
i found one bug today relating to conditions where day and date are used, just wanted to confirm if its a bug or a misconfig
i have a condition as below
<condition wday="1-2" time-of-day="00:00:00-00:00:00" break="never"> <action application="set" data="out-prefix=777" inline="true"/> </condition>
what this does is if its a Sunday to Monday morning then set out-prefix variable to 777 but even though being a Sunday this always parses as fail unless i set wday to 1 and time-of-day to 00:00:00-23:59:59
the reason i use the above is because i have more conditions which r as follows
<condition wday="2-7" time-of-day="7:00-21:00" break="never"> <action application="set" data="out-prefix=888" inline="true"/> </condition> <condition wday="2-7" time-of-day="21:00:00-7:00:00" break="never"> <action application="set" data="out-prefix=777" inline="true"/> </condition>
-- Regards, Bipin
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
Official FreeSWITCH Sites http://www.freeswitch.org http://confluence.freeswitch.org http://www.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 http://www.freeswitch.org
No it tells it second 0 to second 0 on days days 1 and 2 Sent from my iPhone
On Sep 4, 2016, at 8:45 AM, Bipin Patel <bipin@xbipin.com> wrote:
but doesnt specifying 1-2 as weekday tell it Sunday 0 to Monday 0
Regards, Bipin
-------- Original Message -------- Subject: Re: [Freeswitch-users] week day and time condition possible bug From: Ken Rice <krice@freeswitch.org> To: FreeSWITCH Users Help <freeswitch-users@lists.freeswitch.org> Date: 9/4/2016, 5:35:09 PM
Its a misconfig you are specifying only 1 second where the first condition can fire 0 thru 0 is just 0
Sent from my iPhone
On Sep 4, 2016, at 8:24 AM, Bipin Patel <bipin@xbipin.com> wrote:
i found one bug today relating to conditions where day and date are used, just wanted to confirm if its a bug or a misconfig
i have a condition as below
<condition wday="1-2" time-of-day="00:00:00-00:00:00" break="never"> <action application="set" data="out-prefix=777" inline="true"/> </condition>
what this does is if its a Sunday to Monday morning then set out-prefix variable to 777 but even though being a Sunday this always parses as fail unless i set wday to 1 and time-of-day to 00:00:00-23:59:59
the reason i use the above is because i have more conditions which r as follows
<condition wday="2-7" time-of-day="7:00-21:00" break="never"> <action application="set" data="out-prefix=888" inline="true"/> </condition> <condition wday="2-7" time-of-day="21:00:00-7:00:00" break="never"> <action application="set" data="out-prefix=777" inline="true"/> </condition>
-- Regards, Bipin _________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
Official FreeSWITCH Sites http://www.freeswitch.org http://confluence.freeswitch.org http://www.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 http://www.freeswitch.org
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
Official FreeSWITCH Sites http://www.freeswitch.org http://confluence.freeswitch.org http://www.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 http://www.freeswitch.org
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
Official FreeSWITCH Sites http://www.freeswitch.org http://confluence.freeswitch.org http://www.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 http://www.freeswitch.org
Ok lets try to make sense of this. The time-of-day matching in your initial email
<condition wday="1-2" time-of-day="00:00:00-00:00:00"
break="never">
happens in 2 stages... stage 1) does wday fall in the range of 1-2 wday="1-2" wdaymin = 1 wdayamx = 2 so does if (today >= wday-min || today <= wday-max).... if you set this for 0-0 or 1-1 then only day 0 or only day 1 would match. Now the above example is simplified psuedo code just for the sake of explanation... The time-of-day matching works similarly... after the value for the time of day field is parsed the following if statement (actually taken from the code) happens if (range_start <= range_end ? (val >= range_start && val <= range_end) : (val >= range_start || val <= range_end)) { ... } so this allos for the range_end to be a lower value... however the same thing happens does the current time val fall in the range of times... so if you set the start and the end time to 00:00:00 the only time it will match is 00:00:00. lets reduce this for the sake of simplicity from the long date to just seconds of the day... 00:00:00 == second 0 for the day... so range start is <= range_end (in fact its 0) so ... we'll do the true half of the expression?true:false statement there... if (val >= range_start && val <= range_end) where val is the current number of seconds into today... so you have told it that the only range that can match is 0 thru 0 inclusive... how can any other time match... so in your example there are only 2 times that will match 00:00:00 on day 1 and 00:00:00 on day 2... the proper way to include an entire day is 00:00:00-23:59:59 which covers all possible seconds in a range On Sun, Sep 4, 2016 at 9:35 AM, Bipin Patel <bipin@xbipin.com> wrote:
well but if u follow the guide of wrap around time similar to my 3rd condition then doesnt it need to be true or does it only work when 'a' hour is higher than 'b' in a "a-b" time span because if u specify a range of "05:00-05:00" then this would also be zero even though u set a weekday of "1-2"
Regards, Bipin
------------------------------ -------- Original Message -------- Subject: Re: [Freeswitch-users] week day and time condition possible bug From: Ken Rice <krice@freeswitch.org> <krice@freeswitch.org> To: FreeSWITCH Users Help <freeswitch-users@lists.freeswitch.org> <freeswitch-users@lists.freeswitch.org> Date: 9/4/2016, 6:14:44 PM
No it tells it second 0 to second 0 on days days 1 and 2
Sent from my iPhone
On Sep 4, 2016, at 8:45 AM, Bipin Patel <bipin@xbipin.com> wrote:
but doesnt specifying 1-2 as weekday tell it Sunday 0 to Monday 0
Regards, Bipin
------------------------------ -------- Original Message -------- Subject: Re: [Freeswitch-users] week day and time condition possible bug From: Ken Rice <krice@freeswitch.org> <krice@freeswitch.org> To: FreeSWITCH Users Help <freeswitch-users@lists.freeswitch.org> <freeswitch-users@lists.freeswitch.org> Date: 9/4/2016, 5:35:09 PM
Its a misconfig you are specifying only 1 second where the first condition can fire 0 thru 0 is just 0
Sent from my iPhone
On Sep 4, 2016, at 8:24 AM, Bipin Patel <bipin@xbipin.com> wrote:
i found one bug today relating to conditions where day and date are used, just wanted to confirm if its a bug or a misconfig
i have a condition as below
<condition wday="1-2" time-of-day="00:00:00-00:00:00" break="never"> <action application="set" data="out-prefix=777" inline="true"/> </condition>
what this does is if its a Sunday to Monday morning then set out-prefix variable to 777 but even though being a Sunday this always parses as fail unless i set wday to 1 and time-of-day to 00:00:00-23:59:59
the reason i use the above is because i have more conditions which r as follows
<condition wday="2-7" time-of-day="7:00-21:00" break="never"> <action application="set" data="out-prefix=888" inline="true"/> </condition> <condition wday="2-7" time-of-day="21:00:00-7:00:00" break="never"> <action application="set" data="out-prefix=777" inline="true"/> </condition>
-- Regards, Bipin
------------------------------
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
Official FreeSWITCH Sites http://www.freeswitch.org http://confluence.freeswitch.org http://www.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 http://www.freeswitch.org
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.orghttp://www.freeswitchsolutions.com
Official FreeSWITCH Siteshttp://www.freeswitch.orghttp://confluence.freeswitch.orghttp://www.cluecon....
FreeSWITCH-users mailing listFreeSWITCH-users@lists.freeswitch.orghttp://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-usershttp://www.frees...
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
Official FreeSWITCH Sites http://www.freeswitch.org http://confluence.freeswitch.org http://www.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 http://www.freeswitch.org
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.orghttp://www.freeswitchsolutions.com
Official FreeSWITCH Siteshttp://www.freeswitch.orghttp://confluence.freeswitch.orghttp://www.cluecon....
FreeSWITCH-users mailing listFreeSWITCH-users@lists.freeswitch.orghttp://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-usershttp://www.frees...
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
Official FreeSWITCH Sites http://www.freeswitch.org http://confluence.freeswitch.org http://www.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 http://www.freeswitch.org
Wrong there is no wrap around time.. There is only ranges of time on a day... Look back at the code i pasted again. If start time > end time then we check to see if current time < end time OR > start time again i. Seconds and for symplicity we'll use just 60 of them If the rand is 45 through 15 then we do the false part of the exp?true:false which is (val >= range_start || val <= range_end) So now start is 45 and end is 15 so we look for the time to >= 45 or <= 15 again on day 1 or day 2 assuming wday="1-2" So there is no "wrap around time" there is no wday=1-2" and timeofday="9p-5a" and an expectation of that only working from 9p on day 1 to 9p on day 2 thats day 1 from 00:00 to 05:00 and from 21:00 til 23:59:59 then the same thing on day 2. Sent from my iPhone
On Sep 4, 2016, at 10:33 AM, Bipin Patel <bipin@xbipin.com> wrote:
thanks for the detailed explanation :)
so what i make of this is if u use a wrap around time or u want full 24 hours either in same day or across days then u need to set one second lower so "5:00-5:00" should actually be "5:00:00-4:59:59" which would be 5am from today to 4:59:59am tomorrow and same goes for "00:00:00-00:00:00" which should be "00:00:00-23:59:59"
now same if u combine with wday then again u need to specify a second lower in the max time for it to work properly if the start and end time is set same or it will read it as 0
Regards, Bipin
-------- Original Message -------- Subject: Re: [Freeswitch-users] week day and time condition possible bug From: Ken Rice <krice@freeswitch.org> To: FreeSWITCH Users Help <freeswitch-users@lists.freeswitch.org> Date: 9/4/2016, 7:14:25 PM
Ok lets try to make sense of this.
The time-of-day matching in your initial email
<condition wday="1-2" time-of-day="00:00:00-00:00:00" break="never">
happens in 2 stages... stage 1) does wday fall in the range of 1-2 wday="1-2" wdaymin = 1 wdayamx = 2 so does if (today >= wday-min || today <= wday-max).... if you set this for 0-0 or 1-1 then only day 0 or only day 1 would match. Now the above example is simplified psuedo code just for the sake of explanation...
The time-of-day matching works similarly... after the value for the time of day field is parsed the following if statement (actually taken from the code) happens
if (range_start <= range_end ? (val >= range_start && val <= range_end) : (val >= range_start || val <= range_end)) { ... }
so this allos for the range_end to be a lower value... however the same thing happens does the current time val fall in the range of times... so if you set the start and the end time to 00:00:00 the only time it will match is 00:00:00. lets reduce this for the sake of simplicity from the long date to just seconds of the day... 00:00:00 == second 0 for the day... so
range start is <= range_end (in fact its 0) so ... we'll do the true half of the expression?true:false statement there... if (val >= range_start && val <= range_end) where val is the current number of seconds into today...
so you have told it that the only range that can match is 0 thru 0 inclusive... how can any other time match...
so in your example there are only 2 times that will match 00:00:00 on day 1 and 00:00:00 on day 2...
the proper way to include an entire day is 00:00:00-23:59:59 which covers all possible seconds in a range
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
Official FreeSWITCH Sites http://www.freeswitch.org http://confluence.freeswitch.org http://www.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 http://www.freeswitch.org
If you specified 5pm to 5pm it would only fire on the 1 second that is 5 pm as anything else would not match today is not sept 4, 2016 from 00:00:00 until 00:00:00 it is sept 4 2016 from 00:00:00 until 23:59:59 after that we either restarted the day oe went to another day Sent from my iPhone
On Sep 4, 2016, at 11:38 AM, Bipin Patel <bipin@xbipin.com> wrote:
ok so logically in code u dont see it as wrap around so 9pm to 5am would be 0am to 5am and 9pm to 0am and if days 1-2 then on both days because the code evaluate on a per day basis rather than across multiple days and applies the same to the day1 and day2.
do u still agree the to time needs to be one second shorter than the from time for the code to evaluate it properly or else 5pm-5pm would result in 0 and the way to specify full 24 hrs needs to be 5pm-4:59pm
Regards, Bipin
-------- Original Message -------- Subject: Re: [Freeswitch-users] week day and time condition possible bug From: Ken Rice <krice@freeswitch.org> To: FreeSWITCH Users Help <freeswitch-users@lists.freeswitch.org> Date: 9/4/2016, 8:08:31 PM
Wrong there is no wrap around time.. There is only ranges of time on a day...
Look back at the code i pasted again.
If start time > end time then we check to see if current time < end time OR > start time again i. Seconds and for symplicity we'll use just 60 of them
If the rand is 45 through 15 then we do the false part of the exp?true:false which is (val >= range_start || val <= range_end)
So now start is 45 and end is 15 so we look for the time to >= 45 or <= 15 again on day 1 or day 2 assuming wday="1-2"
So there is no "wrap around time" there is no wday=1-2" and timeofday="9p-5a" and an expectation of that only working from 9p on day 1 to 9p on day 2 thats day 1 from 00:00 to 05:00 and from 21:00 til 23:59:59 then the same thing on day 2.
Sent from my iPhone
On Sep 4, 2016, at 10:33 AM, Bipin Patel <bipin@xbipin.com> wrote:
thanks for the detailed explanation :)
so what i make of this is if u use a wrap around time or u want full 24 hours either in same day or across days then u need to set one second lower so "5:00-5:00" should actually be "5:00:00-4:59:59" which would be 5am from today to 4:59:59am tomorrow and same goes for "00:00:00-00:00:00" which should be "00:00:00-23:59:59"
now same if u combine with wday then again u need to specify a second lower in the max time for it to work properly if the start and end time is set same or it will read it as 0
Regards, Bipin
-------- Original Message -------- Subject: Re: [Freeswitch-users] week day and time condition possible bug From: Ken Rice <krice@freeswitch.org> To: FreeSWITCH Users Help <freeswitch-users@lists.freeswitch.org> Date: 9/4/2016, 7:14:25 PM
Ok lets try to make sense of this.
The time-of-day matching in your initial email
<condition wday="1-2" time-of-day="00:00:00-00:00:00" break="never">
happens in 2 stages... stage 1) does wday fall in the range of 1-2 wday="1-2" wdaymin = 1 wdayamx = 2 so does if (today >= wday-min || today <= wday-max).... if you set this for 0-0 or 1-1 then only day 0 or only day 1 would match. Now the above example is simplified psuedo code just for the sake of explanation...
The time-of-day matching works similarly... after the value for the time of day field is parsed the following if statement (actually taken from the code) happens
if (range_start <= range_end ? (val >= range_start && val <= range_end) : (val >= range_start || val <= range_end)) { ... }
so this allos for the range_end to be a lower value... however the same thing happens does the current time val fall in the range of times... so if you set the start and the end time to 00:00:00 the only time it will match is 00:00:00. lets reduce this for the sake of simplicity from the long date to just seconds of the day... 00:00:00 == second 0 for the day... so
range start is <= range_end (in fact its 0) so ... we'll do the true half of the expression?true:false statement there... if (val >= range_start && val <= range_end) where val is the current number of seconds into today...
so you have told it that the only range that can match is 0 thru 0 inclusive... how can any other time match...
so in your example there are only 2 times that will match 00:00:00 on day 1 and 00:00:00 on day 2...
the proper way to include an entire day is 00:00:00-23:59:59 which covers all possible seconds in a range
Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
Official FreeSWITCH Sites http://www.freeswitch.org http://confluence.freeswitch.org http://www.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 http://www.freeswitch.org
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
Official FreeSWITCH Sites http://www.freeswitch.org http://confluence.freeswitch.org http://www.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 http://www.freeswitch.org
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
Official FreeSWITCH Sites http://www.freeswitch.org http://confluence.freeswitch.org http://www.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 http://www.freeswitch.org
OK thanks, understood it now. Added some info to confluence about what I learnt On September 4, 2016 11:07:32 PM Ken Rice <krice@freeswitch.org> wrote:
If you specified 5pm to 5pm it would only fire on the 1 second that is 5 pm as anything else would not match today is not sept 4, 2016 from 00:00:00 until 00:00:00 it is sept 4 2016 from 00:00:00 until 23:59:59 after that we either restarted the day oe went to another day
Sent from my iPhone
On Sep 4, 2016, at 11:38 AM, Bipin Patel <bipin@xbipin.com> wrote:
ok so logically in code u dont see it as wrap around so 9pm to 5am would be 0am to 5am and 9pm to 0am and if days 1-2 then on both days because the code evaluate on a per day basis rather than across multiple days and applies the same to the day1 and day2.
do u still agree the to time needs to be one second shorter than the from time for the code to evaluate it properly or else 5pm-5pm would result in 0 and the way to specify full 24 hrs needs to be 5pm-4:59pm
Regards, Bipin
-------- Original Message -------- Subject: Re: [Freeswitch-users] week day and time condition possible bug From: Ken Rice <krice@freeswitch.org> To: FreeSWITCH Users Help <freeswitch-users@lists.freeswitch.org> Date: 9/4/2016, 8:08:31 PM
Wrong there is no wrap around time.. There is only ranges of time on a day...
Look back at the code i pasted again.
If start time > end time then we check to see if current time < end time OR
start time again i. Seconds and for symplicity we'll use just 60 of them
If the rand is 45 through 15 then we do the false part of the exp?true:false which is (val >= range_start || val <= range_end)
So now start is 45 and end is 15 so we look for the time to >= 45 or <= 15 again on day 1 or day 2 assuming wday="1-2"
So there is no "wrap around time" there is no wday=1-2" and timeofday="9p-5a" and an expectation of that only working from 9p on day 1 to 9p on day 2 thats day 1 from 00:00 to 05:00 and from 21:00 til 23:59:59 then the same thing on day 2.
Sent from my iPhone
On Sep 4, 2016, at 10:33 AM, Bipin Patel <bipin@xbipin.com> wrote:
thanks for the detailed explanation :)
so what i make of this is if u use a wrap around time or u want full 24 hours either in same day or across days then u need to set one second lower so "5:00-5:00" should actually be "5:00:00-4:59:59" which would be 5am from today to 4:59:59am tomorrow and same goes for "00:00:00-00:00:00" which should be "00:00:00-23:59:59"
now same if u combine with wday then again u need to specify a second lower in the max time for it to work properly if the start and end time is set same or it will read it as 0
Regards, Bipin
-------- Original Message -------- Subject: Re: [Freeswitch-users] week day and time condition possible bug From: Ken Rice <krice@freeswitch.org> To: FreeSWITCH Users Help <freeswitch-users@lists.freeswitch.org> Date: 9/4/2016, 7:14:25 PM
Ok lets try to make sense of this.
The time-of-day matching in your initial email
> <condition wday="1-2" time-of-day="00:00:00-00:00:00" break="never">
happens in 2 stages... stage 1) does wday fall in the range of 1-2 wday="1-2" wdaymin = 1 wdayamx = 2 so does if (today >= wday-min || today <= wday-max).... if you set this for 0-0 or 1-1 then only day 0 or only day 1 would match. Now the above example is simplified psuedo code just for the sake of explanation...
The time-of-day matching works similarly... after the value for the time of day field is parsed the following if statement (actually taken from the code) happens
if (range_start <= range_end ? (val >= range_start && val <= range_end) : (val >= range_start || val <= range_end)) { ... }
so this allos for the range_end to be a lower value... however the same thing happens does the current time val fall in the range of times... so if you set the start and the end time to 00:00:00 the only time it will match is 00:00:00. lets reduce this for the sake of simplicity from the long date to just seconds of the day... 00:00:00 == second 0 for the day... so
range start is <= range_end (in fact its 0) so ... we'll do the true half of the expression?true:false statement there... if (val >= range_start && val <= range_end) where val is the current number of seconds into today...
so you have told it that the only range that can match is 0 thru 0 inclusive... how can any other time match...
so in your example there are only 2 times that will match 00:00:00 on day 1 and 00:00:00 on day 2...
the proper way to include an entire day is 00:00:00-23:59:59 which covers all possible seconds in a range
Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
Official FreeSWITCH Sites http://www.freeswitch.org http://confluence.freeswitch.org http://www.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 http://www.freeswitch.org
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
Official FreeSWITCH Sites http://www.freeswitch.org http://confluence.freeswitch.org http://www.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 http://www.freeswitch.org
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
Official FreeSWITCH Sites http://www.freeswitch.org http://confluence.freeswitch.org http://www.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 http://www.freeswitch.org
---------- _________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
Official FreeSWITCH Sites http://www.freeswitch.org http://confluence.freeswitch.org http://www.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 http://www.freeswitch.org
the proper way to include an entire day is 00:00:00-23:59:59 which covers all possible seconds in a range
What about 23:59:60? ;) Bipin, if you're matching on the entire day, why do you need the time-of-day attribute at all? wday would be enough on its own. On 4 September 2016 at 16:14, Ken Rice <krice@freeswitch.org> wrote:
Ok lets try to make sense of this.
The time-of-day matching in your initial email
<condition wday="1-2" time-of-day="00:00:00-00:00:00"
break="never">
happens in 2 stages... stage 1) does wday fall in the range of 1-2 wday="1-2" wdaymin = 1 wdayamx = 2 so does if (today >= wday-min || today <= wday-max).... if you set this for 0-0 or 1-1 then only day 0 or only day 1 would match. Now the above example is simplified psuedo code just for the sake of explanation...
The time-of-day matching works similarly... after the value for the time of day field is parsed the following if statement (actually taken from the code) happens
if (range_start <= range_end ? (val >= range_start && val <= range_end) : (val >= range_start || val <= range_end)) { ... }
so this allos for the range_end to be a lower value... however the same thing happens does the current time val fall in the range of times... so if you set the start and the end time to 00:00:00 the only time it will match is 00:00:00. lets reduce this for the sake of simplicity from the long date to just seconds of the day... 00:00:00 == second 0 for the day... so
range start is <= range_end (in fact its 0) so ... we'll do the true half of the expression?true:false statement there... if (val >= range_start && val <= range_end) where val is the current number of seconds into today...
so you have told it that the only range that can match is 0 thru 0 inclusive... how can any other time match...
so in your example there are only 2 times that will match 00:00:00 on day 1 and 00:00:00 on day 2...
the proper way to include an entire day is 00:00:00-23:59:59 which covers all possible seconds in a range
On Sun, Sep 4, 2016 at 9:35 AM, Bipin Patel <bipin@xbipin.com> wrote:
well but if u follow the guide of wrap around time similar to my 3rd condition then doesnt it need to be true or does it only work when 'a' hour is higher than 'b' in a "a-b" time span because if u specify a range of "05:00-05:00" then this would also be zero even though u set a weekday of "1-2"
Regards, Bipin
------------------------------ -------- Original Message -------- Subject: Re: [Freeswitch-users] week day and time condition possible bug From: Ken Rice <krice@freeswitch.org> <krice@freeswitch.org> To: FreeSWITCH Users Help <freeswitch-users@lists.freeswitch.org> <freeswitch-users@lists.freeswitch.org> Date: 9/4/2016, 6:14:44 PM
No it tells it second 0 to second 0 on days days 1 and 2
Sent from my iPhone
On Sep 4, 2016, at 8:45 AM, Bipin Patel <bipin@xbipin.com> wrote:
but doesnt specifying 1-2 as weekday tell it Sunday 0 to Monday 0
Regards, Bipin
------------------------------ -------- Original Message -------- Subject: Re: [Freeswitch-users] week day and time condition possible bug From: Ken Rice <krice@freeswitch.org> <krice@freeswitch.org> To: FreeSWITCH Users Help <freeswitch-users@lists.freeswitch.org> <freeswitch-users@lists.freeswitch.org> Date: 9/4/2016, 5:35:09 PM
Its a misconfig you are specifying only 1 second where the first condition can fire 0 thru 0 is just 0
Sent from my iPhone
On Sep 4, 2016, at 8:24 AM, Bipin Patel <bipin@xbipin.com> wrote:
i found one bug today relating to conditions where day and date are used, just wanted to confirm if its a bug or a misconfig
i have a condition as below
<condition wday="1-2" time-of-day="00:00:00-00:00:00" break="never"> <action application="set" data="out-prefix=777" inline="true"/> </condition>
what this does is if its a Sunday to Monday morning then set out-prefix variable to 777 but even though being a Sunday this always parses as fail unless i set wday to 1 and time-of-day to 00:00:00-23:59:59
the reason i use the above is because i have more conditions which r as follows
<condition wday="2-7" time-of-day="7:00-21:00" break="never"> <action application="set" data="out-prefix=888" inline="true"/> </condition> <condition wday="2-7" time-of-day="21:00:00-7:00:00" break="never"> <action application="set" data="out-prefix=777" inline="true"/> </condition>
-- Regards, Bipin
------------------------------
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
Official FreeSWITCH Sites http://www.freeswitch.org http://confluence.freeswitch.org http://www.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 http://www.freeswitch.org
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.orghttp://www.freeswitchsolutions.com
Official FreeSWITCH Siteshttp://www.freeswitch.orghttp://confluence.freeswitch.orghttp://www.cluecon....
FreeSWITCH-users mailing listFreeSWITCH-users@lists.freeswitch.orghttp://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-usershttp://www.frees...
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
Official FreeSWITCH Sites http://www.freeswitch.org http://confluence.freeswitch.org http://www.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 http://www.freeswitch.org
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.orghttp://www.freeswitchsolutions.com
Official FreeSWITCH Siteshttp://www.freeswitch.orghttp://confluence.freeswitch.orghttp://www.cluecon....
FreeSWITCH-users mailing listFreeSWITCH-users@lists.freeswitch.orghttp://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-usershttp://www.frees...
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
Official FreeSWITCH Sites http://www.freeswitch.org http://confluence.freeswitch.org http://www.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 http://www.freeswitch.org
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
Official FreeSWITCH Sites http://www.freeswitch.org http://confluence.freeswitch.org http://www.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 http://www.freeswitch.org
If you want to know how something is coded specifically I would suggest reading the source. Its the ultimate documentation Sent from my iPhone
On Sep 5, 2016, at 12:49 AM, Bipin Patel <bipin@xbipin.com> wrote:
Steven, i could use that if the whole day was to be included but the point was the start and end time being same values was read as 0 so just wanted to know how the logic is coded for this
Regards, Bipin
-------- Original Message -------- Subject: Re: [Freeswitch-users] week day and time condition possible bug From: Steven Ayre <steveayre@gmail.com> To: FreeSWITCH Users Help <freeswitch-users@lists.freeswitch.org> Date: 9/5/2016, 1:43:57 AM
the proper way to include an entire day is 00:00:00-23:59:59 which covers all possible seconds in a range
What about 23:59:60? ;)
Bipin, if you're matching on the entire day, why do you need the time-of-day attribute at all? wday would be enough on its own.
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
Official FreeSWITCH Sites http://www.freeswitch.org http://confluence.freeswitch.org http://www.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 http://www.freeswitch.org
participants (3)
-
Bipin Patel
-
Ken Rice
-
Steven Ayre