Author |
Message |
noiptel Brekeke Talented
Joined: 22 Feb 2010 Posts: 68
Location: USA
|
Posted: Fri Sep 23, 2011 7:33 am Post subject: $time |
|
|
1. Brekeke Product Name and version:Version 2.4.3.9 Advanced
2. Java version:
3. OS type and the version:
4. UA (phone), gateway or other hardware/software involved:
5. Select your network pattern from http://www.brekeke-sip.com/bbs/network/networkpatterns.html :
6. Your problem: I would like to write a rule with the below time window:
From 10:32AM to 1:15PM
Please confirm how this should be written.
Thanks. |
|
Back to top |
|
Laurie Brekeke Master Guru
Joined: 07 Jan 2008 Posts: 245
|
Posted: Tue Sep 27, 2011 10:25 am Post subject: |
|
|
$time( "HH:mm" ) = ^10:3[2-9]|^10:[4-5]|^1[12]|^13:0|^13:1[0-5] |
|
Back to top |
|
noiptel Brekeke Talented
Joined: 22 Feb 2010 Posts: 68
Location: USA
|
Posted: Mon Nov 14, 2011 9:02 pm Post subject: |
|
|
Can you please if the below syntax is correct?
From 2AM to 7:30PM
$time( “HH:mm” ) = ^0[2-9]|^1[0-8]|^19:3[0] |
|
Back to top |
|
ambrosio Brekeke Master Guru
Joined: 27 Mar 2008 Posts: 215
|
Posted: Mon Nov 14, 2011 9:51 pm Post subject: |
|
|
$time( “HH:mm” ) = ^0[2-9]|^1[0-8]|^19:[0-3] |
|
Back to top |
|
noiptel Brekeke Talented
Joined: 22 Feb 2010 Posts: 68
Location: USA
|
Posted: Tue Dec 06, 2011 4:48 pm Post subject: |
|
|
it is not working, can you please verify rule |
|
Back to top |
|
noiptel Brekeke Talented
Joined: 22 Feb 2010 Posts: 68
Location: USA
|
Posted: Mon Jan 02, 2012 12:34 pm Post subject: |
|
|
The below rule works well to block calls from 2AM to 6PM:
$time=^0[2-9]|^1[0-7]
We need the correct rule to block calls from 2AM to 6:30PM
Please help
Thanks |
|
Back to top |
|
Laurie Brekeke Master Guru
Joined: 07 Jan 2008 Posts: 245
|
Posted: Mon Jan 02, 2012 3:22 pm Post subject: |
|
|
try the following dialplan plugin method.
Code: |
static public String range( String[] arg, SIPpacket sippacket, Properties pr ) throws Exception
{
if ( ( arg != null ) && ( arg.length > 1 ) ) {
int i1 = arg[0].indexOf( ':' ) ;
int i2 = arg[1].indexOf( ':' ) ;
if ( ( i1 > 0 ) && ( i2 > 0 ) ) {
int hour1 = Integer.valueOf( arg[0].substring( 0, i1 ) ) ;
int min1 = Integer.valueOf( arg[0].substring( i1 + 1 ) ) ;
long time1 = ( hour1 * 60 ) + min1 ;
int hour2 = Integer.valueOf( arg[1].substring( 0, i2 ) ) ;
int min2 = Integer.valueOf( arg[1].substring( i2 + 1 ) ) ;
long time2 = ( hour2 * 60 ) + min2 ;
Calendar cal = Calendar.getInstance() ;
// time zone
if ( ( arg.length > 2 ) && ( arg[2] != null ) ) {
cal.setTimeZone( TimeZone.getTimeZone( arg[2] ) ) ;
}
int hourNow = cal.get( Calendar.HOUR_OF_DAY ) ;
int minNow = cal.get( Calendar.MINUTE ) ;
long timeNow = ( hourNow * 60 ) + minNow ;
if ( ( time1 <= timeNow ) && ( timeNow <= time2 ) ) {
return ( "true" ) ;
}
}
}
return ( "false" ) ;
}
|
Last edited by Laurie on Mon Jan 02, 2012 3:24 pm; edited 1 time in total |
|
Back to top |
|
Laurie Brekeke Master Guru
Joined: 07 Jan 2008 Posts: 245
|
Posted: Mon Jan 02, 2012 3:23 pm Post subject: |
|
|
>We need the correct rule to block calls from 2AM to 6:30PM
it will be
$plugin.range( "2:00", "18:30" ) = true |
|
Back to top |
|
|