Re: [asterisk-users] Time of Day Routing

2009-08-14 Thread Neeraj Chand
Asterisk version 1.4



From: Neeraj Chand 
Sent: Friday, 14 August 2009 8:17 PM
To: 'asterisk-users@lists.digium.com'
Subject: [asterisk-users] Time of Day Routing

 

Hi David,

 

With this: 

   ifTime(00:00-12:00|*|*|*)

 

Whatever time you specify at the end, I believe asterisk continues to
evaluate this condition as true for 2 more minutes.

 

So in this case, it will be valid for 00:00-12:02, even though you've
specified 12:00

 

Cheers!

 

Neeraj

 

 

 

  

 

 

 

 

 

 

 

 

 

 

___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

AstriCon 2009 - October 13 - 15 Phoenix, Arizona
Register Now: http://www.astricon.net

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] Time of Day Routing

2009-08-14 Thread Steve Howes

On 14 Aug 2009, at 09:17, Neeraj Chand wrote:

 Asterisk version 1.4
 From: Neeraj Chand
 Sent: Friday, 14 August 2009 8:17 PM
 To: 'asterisk-users@lists.digium.com'
 Subject: [asterisk-users] Time of Day Routing

 Hi David,

 With this:
ifTime(00:00-12:00|*|*|*)

 Whatever time you specify at the end, I believe asterisk continues  
 to evaluate this condition as true for 2 more minutes.

 So in this case, it will be valid for 00:00-12:02, even though  
 you’ve specified 12:00

 Cheers!

 Neeraj


Post a few hours ago..

Actually, that's 12:02, because times before 1.6.2 are only accurate  
down
to the 2-minute interval.  So 12:01 is treated the same as 12:00.   
Starting
with 1.6.2, times are accurate down to the minute.
___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

AstriCon 2009 - October 13 - 15 Phoenix, Arizona
Register Now: http://www.astricon.net

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Time of Day Routing

2009-08-14 Thread Tony Mountifield
In article 05d03313-994b-4892-b045-f61332ddb...@geekinter.net,
Steve Howes st...@geekinter.net wrote:
 
 On 14 Aug 2009, at 09:17, Neeraj Chand wrote:
 
  Asterisk version 1.4
  From: Neeraj Chand
  Sent: Friday, 14 August 2009 8:17 PM
  To: 'asterisk-users@lists.digium.com'
  Subject: [asterisk-users] Time of Day Routing
 
  Hi David,
 
  With this:
 ifTime(00:00-12:00|*|*|*)
 
  Whatever time you specify at the end, I believe asterisk continues  
  to evaluate this condition as true for 2 more minutes.
 
  So in this case, it will be valid for 00:00-12:02, even though  
  you’ve specified 12:00
 
  Cheers!
 
  Neeraj
 
 
 Post a few hours ago..
 
 Actually, that's 12:02, because times before 1.6.2 are only accurate  
 down
 to the 2-minute interval.  So 12:01 is treated the same as 12:00.   
 Starting
 with 1.6.2, times are accurate down to the minute.

Hmm, I would still consider it a bug, whether on 1 or 2 minute resolution.
The example condition should start being true at 00:00 exactly, and stop
being true at 12:00 exactly. So at 12:00:01 it should NOT match:

if (now = start_time  now  end_time)

This then is independent of the resolution, provided the end time is an
exact multiple of that resolution.

After all, if a shop shuts at 5pm prompt, and you get there at 10 seconds
after 5pm, it is shut, not open until 5:00:59.99 or whenever.

Cheers
Tony
-- 
Tony Mountifield
Work: t...@softins.co.uk - http://www.softins.co.uk
Play: t...@mountifield.org - http://tony.mountifield.org

___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

AstriCon 2009 - October 13 - 15 Phoenix, Arizona
Register Now: http://www.astricon.net

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] Time of Day Routing

2009-08-14 Thread Doug Lytle
Tony Mountifield wrote:
 Hmm, I would still consider it a bug, whether on 1 or 2 minute resolution.
   

I haven't seen the 2 minutes issue with the below:


GotoIfTime(07:59-16:59|mon-fri|*|*?office-hours,s,1)


Our plant closes at 5pm.  And, at exactly 5pm, the afterhours context 
takes over.  It works just fine.

Doug



-- 
 
Ben Franklin quote:

Those who would give up Essential Liberty to purchase a little Temporary 
Safety, deserve neither Liberty nor Safety.


___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

AstriCon 2009 - October 13 - 15 Phoenix, Arizona
Register Now: http://www.astricon.net

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Time of Day Routing

2009-08-14 Thread SIP
Tony Mountifield wrote:
 In article 05d03313-994b-4892-b045-f61332ddb...@geekinter.net,
 Steve Howes st...@geekinter.net wrote:
   
 On 14 Aug 2009, at 09:17, Neeraj Chand wrote:

 
 Asterisk version 1.4
 From: Neeraj Chand
 Sent: Friday, 14 August 2009 8:17 PM
 To: 'asterisk-users@lists.digium.com'
 Subject: [asterisk-users] Time of Day Routing

 Hi David,

 With this:
ifTime(00:00-12:00|*|*|*)

 Whatever time you specify at the end, I believe asterisk continues  
 to evaluate this condition as true for 2 more minutes.

 So in this case, it will be valid for 00:00-12:02, even though  
 you’ve specified 12:00

 Cheers!

 Neeraj

   
 Post a few hours ago..

 Actually, that's 12:02, because times before 1.6.2 are only accurate  
 down
 to the 2-minute interval.  So 12:01 is treated the same as 12:00.   
 Starting
 with 1.6.2, times are accurate down to the minute.
 

 Hmm, I would still consider it a bug, whether on 1 or 2 minute resolution.
 The example condition should start being true at 00:00 exactly, and stop
 being true at 12:00 exactly. So at 12:00:01 it should NOT match:

 if (now = start_time  now  end_time)

 This then is independent of the resolution, provided the end time is an
 exact multiple of that resolution.

 After all, if a shop shuts at 5pm prompt, and you get there at 10 seconds
 after 5pm, it is shut, not open until 5:00:59.99 or whenever.

 Cheers
 Tony
   
 
We're talking precision here, though. With a 2-minute precision, you
have to understand that there IS no 12:00:01 as far as Asterisk is
concerned. There is simply 12:00 and 12:02. At exactly 12:00, it
evaluates true, just as has been put in the if statement. It checks
again at 12:02 and it evaluates false.

That's not a bug. That's just a lack of precision in checking. It can't
check ALL the time without devoting cycles to checking, which takes
cycles away from other things. Think cron on a unix system. Nothing
happens in 30-second increments. Things happen in 1 minute increments at
the smallest because that's the maximum precision that's built into the
program. You could WRITE a cron that checks every 5 seconds, but it's
not a bug in cron that it only checks every 1 minute. That's simply the
way it works.

N.

___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

AstriCon 2009 - October 13 - 15 Phoenix, Arizona
Register Now: http://www.astricon.net

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Time of Day Routing

2009-08-14 Thread Don Kelly

Tony Mountifield wrote:
 In article 05d03313-994b-4892-b045-f61332ddb...@geekinter.net,
 Steve Howes st...@geekinter.net wrote:
   
 On 14 Aug 2009, at 09:17, Neeraj Chand wrote:

 
 Asterisk version 1.4
 From: Neeraj Chand
 Sent: Friday, 14 August 2009 8:17 PM
 To: 'asterisk-users@lists.digium.com'
 Subject: [asterisk-users] Time of Day Routing

 Hi David,

 With this:
ifTime(00:00-12:00|*|*|*)

 Whatever time you specify at the end, I believe asterisk continues  
 to evaluate this condition as true for 2 more minutes.

 So in this case, it will be valid for 00:00-12:02, even though  
 you've specified 12:00

 Cheers!

 Neeraj

   
 Post a few hours ago..

 Actually, that's 12:02, because times before 1.6.2 are only accurate  
 down
 to the 2-minute interval.  So 12:01 is treated the same as 12:00.   
 Starting
 with 1.6.2, times are accurate down to the minute.
 

 Hmm, I would still consider it a bug, whether on 1 or 2 minute resolution.
 The example condition should start being true at 00:00 exactly, and stop
 being true at 12:00 exactly. So at 12:00:01 it should NOT match:

 if (now = start_time  now  end_time)

 This then is independent of the resolution, provided the end time is an
 exact multiple of that resolution.

 After all, if a shop shuts at 5pm prompt, and you get there at 10 seconds
 after 5pm, it is shut, not open until 5:00:59.99 or whenever.

 Cheers
 Tony
   
 
We're talking precision here, though. With a 2-minute precision, you
have to understand that there IS no 12:00:01 as far as Asterisk is
concerned. There is simply 12:00 and 12:02. At exactly 12:00, it
evaluates true, just as has been put in the if statement. It checks
again at 12:02 and it evaluates false.

That's not a bug. That's just a lack of precision in checking. It can't
check ALL the time without devoting cycles to checking, which takes
cycles away from other things. Think cron on a unix system. Nothing
happens in 30-second increments. Things happen in 1 minute increments at
the smallest because that's the maximum precision that's built into the
program. You could WRITE a cron that checks every 5 seconds, but it's
not a bug in cron that it only checks every 1 minute. That's simply the
way it works.

N.

This explanation about precision doesn't seem to apply to the case  

ifTime(00:00-12:00|*|*|*)

This expression can be evaluated at the instant of interest--it doesn't
require wasting cycles for checking (as for a poll or cron) at fixed
intervals.

  --Don



___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

AstriCon 2009 - October 13 - 15 Phoenix, Arizona
Register Now: http://www.astricon.net

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Time of Day Routing

2009-08-14 Thread Tony Mountifield
In article 4a855630.5080...@arcdiv.com, SIP s...@arcdiv.com wrote:
 Tony Mountifield wrote:
  In article 05d03313-994b-4892-b045-f61332ddb...@geekinter.net,
  Steve Howes st...@geekinter.net wrote:

  On 14 Aug 2009, at 09:17, Neeraj Chand wrote:
 
  
  Asterisk version 1.4
  From: Neeraj Chand
  Sent: Friday, 14 August 2009 8:17 PM
  To: 'asterisk-users@lists.digium.com'
  Subject: [asterisk-users] Time of Day Routing
 
  Hi David,
 
  With this:
 ifTime(00:00-12:00|*|*|*)
 
  Whatever time you specify at the end, I believe asterisk continues  
  to evaluate this condition as true for 2 more minutes.
 
  So in this case, it will be valid for 00:00-12:02, even though  
  you’ve specified 12:00
 
  Cheers!
 
  Neeraj
 

  Post a few hours ago..
 
  Actually, that's 12:02, because times before 1.6.2 are only accurate  
  down
  to the 2-minute interval.  So 12:01 is treated the same as 12:00.   
  Starting
  with 1.6.2, times are accurate down to the minute.
  
 
  Hmm, I would still consider it a bug, whether on 1 or 2 minute resolution.
  The example condition should start being true at 00:00 exactly, and stop
  being true at 12:00 exactly. So at 12:00:01 it should NOT match:
 
  if (now = start_time  now  end_time)
 
  This then is independent of the resolution, provided the end time is an
  exact multiple of that resolution.
 
  After all, if a shop shuts at 5pm prompt, and you get there at 10 seconds
  after 5pm, it is shut, not open until 5:00:59.99 or whenever.
 
  
 We're talking precision here, though. With a 2-minute precision, you
 have to understand that there IS no 12:00:01 as far as Asterisk is
 concerned. There is simply 12:00 and 12:02. At exactly 12:00, it
 evaluates true, just as has been put in the if statement. It checks
 again at 12:02 and it evaluates false.

I think you have missed what I was saying.

I was saying that comparing with 12:00 should NOT evaluate true.

If you think of set theory, the lower bound (e.g. 00:00) should be
a closed boundary, and the upper bound (e.g. 12:00) should be an
open boundary.

Tony
-- 
Tony Mountifield
Work: t...@softins.co.uk - http://www.softins.co.uk
Play: t...@mountifield.org - http://tony.mountifield.org

___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

AstriCon 2009 - October 13 - 15 Phoenix, Arizona
Register Now: http://www.astricon.net

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] Time of Day Routing

2009-08-14 Thread Tilghman Lesher
On Friday 14 August 2009 08:15:55 Tony Mountifield wrote:
 In article 4a855630.5080...@arcdiv.com, SIP s...@arcdiv.com wrote:
  Tony Mountifield wrote:
   In article 05d03313-994b-4892-b045-f61332ddb...@geekinter.net,
  
   Steve Howes st...@geekinter.net wrote:
   On 14 Aug 2009, at 09:17, Neeraj Chand wrote:
   Asterisk version 1.4
   From: Neeraj Chand
   Sent: Friday, 14 August 2009 8:17 PM
   To: 'asterisk-users@lists.digium.com'
   Subject: [asterisk-users] Time of Day Routing
  
   Hi David,
  
   With this:
  ifTime(00:00-12:00|*|*|*)
  
   Whatever time you specify at the end, I believe asterisk continues
   to evaluate this condition as true for 2 more minutes.
  
   So in this case, it will be valid for 00:00-12:02, even though
   you’ve specified 12:00
  
   Cheers!
  
   Neeraj
  
   Post a few hours ago..
  
   Actually, that's 12:02, because times before 1.6.2 are only accurate
   down
   to the 2-minute interval.  So 12:01 is treated the same as 12:00.
   Starting
   with 1.6.2, times are accurate down to the minute.
  
   Hmm, I would still consider it a bug, whether on 1 or 2 minute
   resolution. The example condition should start being true at 00:00
   exactly, and stop being true at 12:00 exactly. So at 12:00:01 it should
   NOT match:
  
   if (now = start_time  now  end_time)
  
   This then is independent of the resolution, provided the end time is an
   exact multiple of that resolution.
  
   After all, if a shop shuts at 5pm prompt, and you get there at 10
   seconds after 5pm, it is shut, not open until 5:00:59.99 or
   whenever.
  
   ---
  -
 
  We're talking precision here, though. With a 2-minute precision, you
  have to understand that there IS no 12:00:01 as far as Asterisk is
  concerned. There is simply 12:00 and 12:02. At exactly 12:00, it
  evaluates true, just as has been put in the if statement. It checks
  again at 12:02 and it evaluates false.

 I think you have missed what I was saying.

 I was saying that comparing with 12:00 should NOT evaluate true.

 If you think of set theory, the lower bound (e.g. 00:00) should be
 a closed boundary, and the upper bound (e.g. 12:00) should be an
 open boundary.

Regardless of how you think it should work, the poster above described
precisely the way it works.  If your end boundary is 12:00, it will evaluate
as true all the way up until 12:01:59.  If you don't want that, another poster
has suggested using 11:59, which will work fine.

Given backwards compatibility concerns, this is unlikely to change.

-- 
Tilghman  Teryl
with Peter, Cottontail, Midnight, Thumper,  Johnny (bunnies)
and Harry, BB,  George (dogs)

___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

AstriCon 2009 - October 13 - 15 Phoenix, Arizona
Register Now: http://www.astricon.net

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Time of Day Routing

2009-08-14 Thread Rob Hillis
Tilghman Lesher wrote:
 Regardless of how you think it should work, the poster above described
 precisely the way it works.  If your end boundary is 12:00, it will evaluate
 as true all the way up until 12:01:59.  If you don't want that, another poster
 has suggested using 11:59, which will work fine.

 Given backwards compatibility concerns, this is unlikely to change.
Forgive me for saying so, but since when has Digium concerned itself
with backwards compatibility in the past?  I'm sure I don't need to tell
you how much stuff gets broken between major releases.


___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

AstriCon 2009 - October 13 - 15 Phoenix, Arizona
Register Now: http://www.astricon.net

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Time of Day Routing

2009-08-13 Thread Danny Nicholas
My “Assumption” would be that 00:00-12:00 actually covers midnight to
12:00:59.   I would verify this by hitting this dialplan at 30 seconds after
noon local time.  Since I’m still on 1.4, this one is academic to me.

 

  _  

From: asterisk-users-boun...@lists.digium.com
[mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Dáibhéad
Antoine O'Reilligh
Sent: Thursday, August 13, 2009 3:43 PM
To: asterisk-users@lists.digium.com
Subject: [asterisk-users] Time of Day Routing

 

Hi everybody

I have a logic question that is confusing me.

 ifTime(00:00-12:00|*|*|*) {

Playback(welcome-morning);

 } else {
ifTime(12:00-18:00|*|*|*) {

Playback(welcome-afternoon);

} else {
Playback(welcome-evening);

}
}


Does that cover the entire day? The question arose because of the time as
follows:

   ifTime(00:00-12:00|*|*|*) {  so midnight to noon fine--but should it
be 11:59 or 12:00

and ifTime(12:00-18:00|*|*|*) {   -- should it be from 12:01

However doing that I assume will miss a minute.

Anybody know :)

D


-- 
_

Mr. David Anthony O'Reilly, M.Sc, B.Sc

Researcher @ MISL Group, University College Cork (Current)

M.Sc MOB Postgraduate @ University College Cork - M.Sc (Mobile Networking
and Computing) - 2009

Computer Science Graduate of The University of Dublin, Trinity College -
B.Sc (Computer Science) 2008

Email: oreil...@tcd.ie/d...@student.cs.ucc.ie
Tel: +353 (0) 86 030 60 32
_

___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

AstriCon 2009 - October 13 - 15 Phoenix, Arizona
Register Now: http://www.astricon.net

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] Time of Day Routing

2009-08-13 Thread Edwin Lam
Dáibhéad Antoine O'Reilligh wrote:
 I have a logic question that is confusing me.
 
  ifTime(00:00-12:00|*|*|*) {
 
 Playback(welcome-morning);
 
  } else {
 ifTime(12:00-18:00|*|*|*) {
 
 Playback(welcome-afternoon);
 
 } else {
 Playback(welcome-evening);
 
 }
 }
 
 
 Does that cover the entire day? The question arose because of the time 
 as follows:
 
ifTime(00:00-12:00|*|*|*) {  so midnight to noon fine--but should 
 it be 11:59 or 12:00
 
 and ifTime(12:00-18:00|*|*|*) {   -- should it be from 12:01
 
 However doing that I assume will miss a minute.

according to the wiki pages:
minute = a number, 0 to 59, inclusive
so. look back at your logic, your welcome-morning message will
be played before 12:01. and your welcome-afternoon message will
be played on  after 12:01.


-- 
Edwin Lam edwin@officegeneral.com
Systems Engineer, Office General, Inc.
Ph: +1 415 439 4988 Fax: +1 415 283 3370
http://pgpkeys.mit.edu:11371/pks/lookup?op=getsearch=0xD6506D20


___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

AstriCon 2009 - October 13 - 15 Phoenix, Arizona
Register Now: http://www.astricon.net

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] Time of Day Routing

2009-08-13 Thread Tilghman Lesher
On Thursday 13 August 2009 19:18:44 Edwin Lam wrote:
 Dáibhéad Antoine O'Reilligh wrote:
  I have a logic question that is confusing me.
 
   ifTime(00:00-12:00|*|*|*) {
 
  Playback(welcome-morning);
 
   } else {
  ifTime(12:00-18:00|*|*|*) {
 
  Playback(welcome-afternoon);
 
  } else {
  Playback(welcome-evening);
 
  }
  }
 
 
  Does that cover the entire day? The question arose because of the time
  as follows:
 
 ifTime(00:00-12:00|*|*|*) {  so midnight to noon fine--but should
  it be 11:59 or 12:00
 
  and ifTime(12:00-18:00|*|*|*) {   -- should it be from 12:01
 
  However doing that I assume will miss a minute.

 according to the wiki pages:
 minute = a number, 0 to 59, inclusive
 so. look back at your logic, your welcome-morning message will
 be played before 12:01. and your welcome-afternoon message will
 be played on  after 12:01.

Actually, that's 12:02, because times before 1.6.2 are only accurate down
to the 2-minute interval.  So 12:01 is treated the same as 12:00.  Starting
with 1.6.2, times are accurate down to the minute.

-- 
Tilghman  Teryl
with Peter, Cottontail, Midnight, Thumper,  Johnny (bunnies)
and Harry, BB,  George (dogs)

___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

AstriCon 2009 - October 13 - 15 Phoenix, Arizona
Register Now: http://www.astricon.net

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users