FB_CALLMONITOR: fixing non-equal call id's when using unique call id's

git-svn-id: svn://svn.code.sf.net/p/fhem/code/trunk@6445 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
markusbloch
2014-08-22 20:27:56 +00:00
parent ca6f9c5a16
commit e782ed1979

View File

@@ -237,7 +237,11 @@ FB_CALLMONITOR_Read($)
if($array[1] eq "CALL" or $array[1] eq "RING")
{
delete($hash->{helper}{TEMP}{$array[2]}) if(exists($hash->{helper}{TEMP}{$array[2]}));
if(AttrVal($name, "unique-call-ids", "0") eq "1")
{
$hash->{helper}{TEMP}{$array[2]}{call_id} = Digest::MD5::md5_hex($data);
}
}
if($array[1] eq "CALL")
@@ -280,22 +284,25 @@ FB_CALLMONITOR_Read($)
foreach my $key (keys %{$hash->{helper}{TEMP}{$array[2]}})
{
readingsBulkUpdate($hash, $key, $hash->{helper}{TEMP}{$array[2]}{$key});
readingsBulkUpdate($hash, $key, $hash->{helper}{TEMP}{$array[2]}{$key}) unless($key eq "call_id");
}
if(AttrVal($name, "unique-call-ids", "0") eq "1" and exists($hash->{helper}{TEMP}{$array[2]}{call_id}))
{
readingsBulkUpdate($hash, "call_id", $hash->{helper}{TEMP}{$array[2]}{call_id});
}
else
{
readingsBulkUpdate($hash, "call_id", $array[2]);
}
if($array[1] eq "DISCONNECT")
{
delete($hash->{helper}{TEMP}{$array[2]}) if(exists($hash->{helper}{TEMP}{$array[2]}));
}
if(AttrVal($name, "unique-call-ids", "0") eq "1")
{
readingsBulkUpdate($hash, "call_id" ,Digest::MD5::md5_hex($data));
}
else
{
readingsBulkUpdate($hash, "call_id", $array[2]);
}
readingsEndUpdate($hash, 1);
}