1 package SL::Controller::CTI;
6 use SL::DB::AuthUserConfig;
8 use SL::Locale::String;
10 use parent qw(SL::Controller::Base);
12 use Rose::Object::MakeMethods::Generic (
13 'scalar --get_set_init' => [ qw(internal_extensions) ],
20 my $res = SL::CTI->call(number => $::form->{number}, internal => $::form->{internal});
21 flash('info', t8('Calling #1 now', $::form->{number}));
27 $self->render('cti/calling');
30 sub action_list_internal_extensions {
33 $self->render('cti/list_internal_extensions', title => t8('Internal Phone List'));
40 sub init_internal_extensions {
43 my $user_configs = SL::DB::Manager::AuthUserConfig->get_all(
45 cfg_key => 'phone_extension',
46 '!cfg_value' => undef,
49 with_objects => [ qw(user) ],
53 foreach my $config (@{ $user_configs }) {
54 $users{$config->user_id} ||= {
55 name => $config->user->get_config_value('name') || $config->user->login,
56 phone_extension => $config->cfg_value,
57 call_link => SL::CTI->call_link(number => $config->cfg_value, internal => 1),
62 sort { lc($a->{name}) cmp lc($b->{name}) } values %users