diff --git a/fhem/FHEM/72_FB_CALLMONITOR.pm b/fhem/FHEM/72_FB_CALLMONITOR.pm index 35b51f127..6ed4fdbad 100755 --- a/fhem/FHEM/72_FB_CALLMONITOR.pm +++ b/fhem/FHEM/72_FB_CALLMONITOR.pm @@ -250,6 +250,34 @@ FB_CALLMONITOR_Read($) readingsBulkUpdate($hash, "internal_connection", $connection_type{$array[3]}) if($array[1] eq "CALL" or $array[1] eq "CONNECT" and defined($connection_type{$array[3]})); readingsBulkUpdate($hash, "call_duration", $array[3]) if($array[1] eq "DISCONNECT"); + + if ($array[1] eq "RING") + { + $hash->{helper}{MISSED_CALL_DETECTION}{$array[2]}{EVENT} = $array[1]; + my $no = "unknown"; + + if (defined($external_number)) + { + $no = $external_number; + if (defined($reverse_search)) + { + $no .= " (".$reverse_search.")"; + } + } + + $hash->{helper}{MISSED_CALL_DETECTION}{$array[2]}{NUMBER} = $no; + } + elsif ($array[1] eq "DISCONNECT") + { + if (($array[3] eq "0") and ($hash->{helper}{MISSED_CALL_DETECTION}{$array[2]}{EVENT} eq "RING")) + { + readingsBulkUpdate($hash, "missed_call", $hash->{helper}{MISSED_CALL_DETECTION}{$array[2]}{NUMBER}) + } + + delete($hash->{helper}{MISSED_CALL_DETECTION}{$array[2]}) if(defined($hash->{helper}{MISSED_CALL_DETECTION}{$array[2]})); + } + + if(AttrVal($name, "unique-call-ids", "0") eq "1") { if($array[1] eq "RING" or $array[1] eq "CALL") @@ -730,6 +758,7 @@ sub FB_CALLMONITOR_loadCacheFile($)