Olivier
2012-May-18 12:57 UTC
[asterisk-users] Best practices to route calls according holidays
Hi, At the moment, I'm mostly using a "Day/Night toggle" button to let users deal with week-ends, holidays and opening hours. As Asterisk 1.8 introduces Calendar capabilities, I'm wondering if better alternatives now exist. Is it possible, safe, reliable and easy to refer from Asterisk to a public calendar resource listing holidays, for a given country ? Should you instead refer to a private resource, to avoid depending on an externaly managed resource ? If you go this way, which tools would you recommend to build and update a private calendar ? Suggestions ? Regards
Dale Noll
2012-May-18 14:05 UTC
[asterisk-users] Best practices to route calls according holidays
On 05/18/2012 07:57 AM, Olivier wrote:> Hi, > > At the moment, I'm mostly using a "Day/Night toggle" button to let > users deal with week-ends, holidays and opening hours. > As Asterisk 1.8 introduces Calendar capabilities, I'm wondering if > better alternatives now exist. > > Is it possible, safe, reliable and easy to refer from Asterisk to a > public calendar resource listing holidays, for a given country ? > Should you instead refer to a private resource, to avoid depending on > an externaly managed resource ? If you go this way, which tools would > you recommend to build and update a private calendar ? >What we determined to work best for our organization was to have a database of holidays that we observe. This allows several benefits. We define which holidays actually cause the offices to be closed. We can also define what time the office closes so half days for Good Friday and New Years Eve when we close at noon. Some departments may not actually close the same hours as others so there are different calendars for different Queues and Auto Attendants. If a holiday falls on a weekend, we may observe it on a different date so if Christmas falls on Saturday, we are closed on Friday. (We all do not close for Christmas Eve when this happens) We have a special holiday called emergency that can be easily triggered remotely in the case of a major event, typically weather, that would force the offices to be closed. All you need for this is a database, we use MySQL, and a way to query that database, we use func_odbc. Management of the database can be command line, phpmyadmin or a custom front end. Dale
Ing CIP. Alejandro Celi MariƔtegui
2012-May-18 16:35 UTC
[asterisk-users] Best practices to route calls according holidays
I have not seen a schedule of holidays by country. We usually do is to enter a MySQL database with the holidays in each country. This will have to work in a particular way because, as happened for example with a client who is an embassy, they celebrate the country holidays and also the country where they are. Remember that the same company also has its holiday (anniversary of the company). Regards, -- Ing CIP. Alejandro Celi Mari?tegui <alex at linux.org.pe> http://cipher.pe/web/asterisk.html El vie, 18-05-2012 a las 14:57 +0200, Olivier escribi?:> Hi, > > At the moment, I'm mostly using a "Day/Night toggle" button to let > users deal with week-ends, holidays and opening hours. > As Asterisk 1.8 introduces Calendar capabilities, I'm wondering if > better alternatives now exist. > > Is it possible, safe, reliable and easy to refer from Asterisk to a > public calendar resource listing holidays, for a given country ? > Should you instead refer to a private resource, to avoid depending on > an externaly managed resource ? If you go this way, which tools would > you recommend to build and update a private calendar ? > > Suggestions ? > > Regards-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20120518/239b4319/attachment.htm>
Ron Bergin
2012-May-19 13:54 UTC
[asterisk-users] Best practices to route calls according holidays
Olivier wrote:> Hi, > > At the moment, I'm mostly using a "Day/Night toggle" button to let > users deal with week-ends, holidays and opening hours. > As Asterisk 1.8 introduces Calendar capabilities, I'm wondering if > better alternatives now exist. > > Is it possible, safe, reliable and easy to refer from Asterisk to a > public calendar resource listing holidays, for a given country ? > Should you instead refer to a private resource, to avoid depending on > an externaly managed resource ? If you go this way, which tools would > you recommend to build and update a private calendar ? > > Suggestions ? > > Regards > > --The database approach that others have suggested sounds pretty good. What I did was to write a simple agi script that dispatches a subroutine based on the holiday. I hard coded the holidays in the script, but they could just as easily be stored in a db. Here's the key portion of the script. (The formatting may get goofed up in the email). #!/usr/bin/perl use strict; use warnings; use Asterisk::AGI; use Date::Calendar; $|++; my ($min, $hr, $day, $mo, $yr, $dow) = (localtime)[1..6]; $mo++; $yr += 1900; my $today = sprintf("%d%02d%02d", $yr,$mo,$day); my $holidays = { "New Year's Day" => "#Jan/1", "Easter" => "+0", "Memorial Day" => "5/Mon/May", "Independence Day" => "#Jul/4", "Labor Day" => "1/Mon/Sep", "Thanksgiving" => "4/Thu/Nov", "Black Friday" => "4/Fri/Nov", "Christmas Eve" => "#Dec/24", "Christmas Day" => "#Dec/25", "Christmas Dayafter" => "#Dec/26", "New Year's Eve" => "#Dec/31" }; my %dispatch = ( "New Year's Day" => \&new_years_day, "Easter" => \&easter, "Memorial Day" => \&memorial_day, "Independence Day" => \&july4, "Labor Day" => \&labor_day, "Thanksgiving" => \&thanksgiving, "Black Friday" => \&black_friday, "Blackout Period" => \&blackout_hrs, "Christmas Eve" => \&christmas_eve, "Christmas Day" => \&christmas_day, "Christmas Dayafter" => \&christmas_dayafter, "New Year's Eve" => \&new_years_eve, ); my $agi = Asterisk::AGI->new; my $calendar = Date::Calendar->new( $holidays ); $calendar->year( $yr ); foreach my $holiday ( keys %$holidays ) { my @holiday = $calendar->search( $holiday ); my $holidaydate = sprintf("%d%02d%02d", $holiday[0]->year, $holiday[0]->month, $holiday[0]->day ); if ( $today == $holidaydate ) { $dispatch{ $holiday }->($agi); exit; } } if ( in_blkout_period( $today ) ) { $dispatch{"Blackout Period"}->( $agi, $dow, $hr ); exit; } ########################################################################## sub playback { my ($agi, $holiday, $hrs) = @_; $agi->stream_file([ 'frys/thank_you_for_calling', "frys/$holiday", "frys/$hrs", 'frys/enjoy', 'frys/frys_goodbye' ] ); } sub new_years_day { my $agi = shift; $agi->exec('noop', "Incoming call on New Year's Day"); if ($hr < 10 or $hr >= 19) { playback($agi, 'new_years_day', '10to7'); $agi->hangup(); } else { $agi->exec('Goto', 'welcome'); } } -- Ron Bergin Network Operations Administrator Fry's Electronics, Inc.