diff --git a/hardware/devices/cisco/ces/restapi/mode/callsrt.pm b/hardware/devices/cisco/ces/restapi/mode/callsrt.pm index 0176edd85..6c8737955 100644 --- a/hardware/devices/cisco/ces/restapi/mode/callsrt.pm +++ b/hardware/devices/cisco/ces/restapi/mode/callsrt.pm @@ -29,6 +29,11 @@ use Digest::MD5 qw(md5_hex); sub custom_traffic_calc { my ($self, %options) = @_; + if (!defined($options{delta_time})) { + $self->{error_msg} = 'Buffer creation'; + return -1; + } + my $total_bytes = 0; foreach (keys %{$options{new_datas}}) { if (/\Q$self->{instance}\E_.*_bytes/) { diff --git a/hardware/devices/cisco/ces/restapi/mode/callssummary.pm b/hardware/devices/cisco/ces/restapi/mode/callssummary.pm index 6d78955db..f55bab412 100644 --- a/hardware/devices/cisco/ces/restapi/mode/callssummary.pm +++ b/hardware/devices/cisco/ces/restapi/mode/callssummary.pm @@ -157,17 +157,18 @@ sub manage_selection { $self->{global_video_outgoing} = { loss => 0, pkts => 0, loss_prct => 0, maxjitter => 0, label => 'video outgoing' }; $self->{global_audio_incoming} = { loss => 0, pkts => 0, loss_prct => 0, maxjitter => 0, label => 'audio incoming' }; $self->{global_audio_outgoing} = { loss => 0, pkts => 0, loss_prct => 0, maxjitter => 0, label => 'audio outgoing' }; - $self->{global_roomanalytics} = { peoplecount => 0 }; + $self->{global_roomanalytics} = {}; return if (!defined($result->{CallHistoryGetResult}->{Entry})); my $save_last_time = 0; foreach (@{$result->{CallHistoryGetResult}->{Entry}}) { - my $end_time = Date::Parse::str2time($_->{EndTimeUTC}); + my $end_time_utc = ref($_->{EndTimeUTC}) eq 'HASH' ? $_->{EndTimeUTC}->{content} : $_->{EndTimeUTC}; + my $end_time = Date::Parse::str2time($end_time_utc); if (!defined($end_time)) { $self->{output}->output_add( severity => 'UNKNOWN', - short_msg => "can't parse date '" . $_->{EndTimeUTC} . "'" + short_msg => "can't parse date '" . $end_time_utc . "'" ); next; } @@ -177,17 +178,21 @@ sub manage_selection { $self->{global}->{new_calls}++; foreach my $type (('Video', 'Audio')) { foreach my $direction (('Incoming', 'Outgoing')) { - $self->{'global_' . lc($type) . '_' . lc($direction)}->{maxjitter} = $_->{$type}->{$direction}->{MaxJitter} - if ($self->{'global_' . lc($type) . '_' . lc($direction)}->{maxjitter} < $_->{$type}->{$direction}->{MaxJitter}); - if ($_->{$type}->{$direction}->{PacketLoss} =~ /^(\d+)\/(\d+)/) { + my $max_jitter = ref($_->{$type}->{$direction}->{MaxJitter}) eq 'HASH' ? $_->{$type}->{$direction}->{MaxJitter}->{content} : $_->{$type}->{$direction}->{MaxJitter}; + my $packet_loss = ref($_->{$type}->{$direction}->{PacketLoss}) eq 'HASH' ? $_->{$type}->{$direction}->{PacketLoss}->{content} : $_->{$type}->{$direction}->{PacketLoss}; + $self->{'global_' . lc($type) . '_' . lc($direction)}->{maxjitter} = $max_jitter + if ($self->{'global_' . lc($type) . '_' . lc($direction)}->{maxjitter} < $max_jitter); + if ($packet_loss =~ /^(\d+)\/(\d+)/) { $self->{'global_' . lc($type) . '_' . lc($direction)}->{loss} += $1; $self->{'global_' . lc($type) . '_' . lc($direction)}->{pkts} += $2; } } } - $self->{global_roomanalytics}->{peoplecount} = $_->{RoomAnalytics}->{PeopleCount}; - if ($_->{RoomAnalytics}->{PeopleCount} =~ /^N\/A$/) { - $self->{global_roomanalytics}->{peoplecount} = 0; + if (defined($_->{RoomAnalytics}->{PeopleCount})) { + $self->{global_roomanalytics}->{peoplecount} = $_->{RoomAnalytics}->{PeopleCount}; + if ($_->{RoomAnalytics}->{PeopleCount} =~ /^N\/A$/) { + $self->{global_roomanalytics}->{peoplecount} = 0; + } } } diff --git a/hardware/devices/cisco/ces/restapi/plugin.pm b/hardware/devices/cisco/ces/restapi/plugin.pm index 6ad3cd935..37a03baf8 100644 --- a/hardware/devices/cisco/ces/restapi/plugin.pm +++ b/hardware/devices/cisco/ces/restapi/plugin.pm @@ -31,7 +31,7 @@ sub new { bless $self, $class; $self->{version} = '1.0'; - $self->{modes}} = { + $self->{modes} = { 'components' => 'hardware::devices::cisco::ces::restapi::mode::components', 'calls-summary' => 'hardware::devices::cisco::ces::restapi::mode::callssummary', 'calls-rt' => 'hardware::devices::cisco::ces::restapi::mode::callsrt',