]> git.evergreen-ils.org Git - working/SIPServer.git/blob - Sip/Configuration/Institution.pm
LP#1528301: Add a config check to hold phone extention
[working/SIPServer.git] / Sip / Configuration / Institution.pm
1 #
2 # Copyright (C) 2006-2008  Georgia Public Library Service
3
4 # Author: David J. Fiander
5
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 #
19
20 package Sip::Configuration::Institution;
21
22 use strict;
23 use warnings;
24
25 sub new {
26     my ($class, $obj) = @_;
27     my $type = ref($class) || $class;
28
29     if (ref($obj) eq "HASH") {
30         return bless $obj, $type;   # Just bless the object
31     }
32
33     return bless {}, $type;
34 }
35
36 sub name {
37     my $self = shift;
38     return $self->{name};
39 }
40
41 sub relais_extensions_to_msg24 {
42     my $self = shift;
43     return (
44         exists $self->{'relais_extensions_to_msg24'} &&
45         $self->{'relais_extensions_to_msg24'}->{'enabled'} =~ /true|yes|enabled/i
46     ) ? 1 : 0;
47 }
48
49 sub phone_ext_to_msg10 {
50     my $self = shift;
51     return (
52         exists $self->{'phone_ext_to_msg10'} &&
53         $self->{'phone_ext_to_msg10'}->{'enabled'} =~ /true|yes|enabled/i
54     ) ? 1 : 0;
55 }
56
57 1;