From d5c7036c6799894220c193c511af58658c241831 Mon Sep 17 00:00:00 2001 From: markusbloch <> Date: Sat, 7 Oct 2017 13:45:07 +0000 Subject: [PATCH] FB_CALLMONITOR: fix wrong reverse-search of emergency call numbers (Forum: #40385), fix missing deletion of phonebook on reread (Forum: #77652). git-svn-id: https://svn.fhem.de/fhem/trunk@15210 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 2 ++ fhem/FHEM/72_FB_CALLMONITOR.pm | 14 ++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index b5ceaaef1..3e8e626fe 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,7 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. + - bugfix: 72_FB_CALLMONITOR: fix wrong reverse-search of emergency call + (110/112/...), fix missing deletion of phonebook on reread. - change: 93_DbRep: V5.6.4, use new Blocking.pm abortArg - bugfix: 22_HOMEMODE: v1.1.10 - fix notifydev for HomeEventsHolidayDevices - bugfix: 10_MQTT_DEVICE: fix set arguments diff --git a/fhem/FHEM/72_FB_CALLMONITOR.pm b/fhem/FHEM/72_FB_CALLMONITOR.pm index 89d81cb0b..7654cf923 100755 --- a/fhem/FHEM/72_FB_CALLMONITOR.pm +++ b/fhem/FHEM/72_FB_CALLMONITOR.pm @@ -374,7 +374,7 @@ FB_CALLMONITOR_Read($) $external_number =~ s/^(107\d\d|108\d\d)//g if($country_code eq "0041"); } - if($external_number !~ /^0/ and $area_code ne "") + if($external_number !~ /^0/ and $external_number !~ /^11/ and $area_code ne "") { if($area_code =~ /^0[1-9]\d+$/ and $external_number =~ /^[1-9].+$/) { @@ -628,7 +628,7 @@ FB_CALLMONITOR_reverseSearch($$) # Ask klicktel.de if($method eq "klicktel.de") { - unless(($number =~ /^0[1-9]/ and $country_code eq "0049") or $number =~ /^0049/) + unless(($number =~ /^0?[1-9]/ and $country_code eq "0049") or $number =~ /^0049/) { Log3 $name, 4, "FB_CALLMONITOR ($name) - skip using klicktel.de for reverse search of $number because of non-german number"; } @@ -665,7 +665,7 @@ FB_CALLMONITOR_reverseSearch($$) # Ask dasoertliche.de elsif($method eq "dasoertliche.de") { - unless(($number =~ /^0[1-9]/ and $country_code eq "0049") or $number =~ /^0049/) + unless(($number =~ /^0?[1-9]/ and $country_code eq "0049") or $number =~ /^0049/) { Log3 $name, 4, "FB_CALLMONITOR ($name) - skip using dasoertliche.de for reverse search of $number because of non-german number"; } @@ -707,7 +707,7 @@ FB_CALLMONITOR_reverseSearch($$) # SWITZERLAND ONLY!!! Ask search.ch elsif($method eq "search.ch") { - unless(($number =~ /^0[1-9]/ and $country_code eq "0041") or $number =~ /^0041/) + unless(($number =~ /^0?[1-9]/ and $country_code eq "0041") or $number =~ /^0041/) { Log3 $name, 4, "FB_CALLMONITOR ($name) - skip using search.ch for reverse search of $number because of non-swiss number"; } @@ -764,7 +764,7 @@ FB_CALLMONITOR_reverseSearch($$) # Austria ONLY!!! Ask dasschnelle.at elsif($method eq "dasschnelle.at") { - unless(($number =~ /^0[1-9]/ and $country_code eq "0043") or $number =~ /^0043/) + unless(($number =~ /^0?[1-9]/ and $country_code eq "0043") or $number =~ /^0043/) { Log3 $name, 4, "FB_CALLMONITOR ($name) - skip using dasschnelle.at for reverse search of $number because of non-swiss number"; } @@ -889,6 +889,8 @@ sub FB_CALLMONITOR_readPhonebook($;$) my $name = $hash->{NAME}; my ($err, $count_contacts, @lines, $phonebook); + delete($hash->{helper}{PHONEBOOK}); + if(AttrVal($name, "fritzbox-remote-phonebook", "0") eq "1") { if(AttrVal($name, "fritzbox-remote-phonebook-via", "tr064") eq "telnet") @@ -1791,7 +1793,7 @@ sub FB_CALLMONITOR_normalizePhoneNumber($$) $number =~ s/\D//g if(not $number =~ /@/); # Remove anything else isn't a number if it is no VoIP number $number =~ s/^$country_code/0/g; # Replace own country code with leading 0 - if(not $number =~ /^0/ and not $number =~ /@/ and $area_code =~ /^0[1-9]\d+$/) + if($number !~ /^0/ and $number !~ /^11/ and $number !~ /@/ and $area_code =~ /^0[1-9]\d+$/) { $number = $area_code.$number; }