mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-10 09:16:53 +00:00
FB_CALLMONITOR: new attributes apiKeyKlicktelDe and apiKeySearchCh to configure necessary API keys for reverse search via klicktel.de or search.ch
git-svn-id: https://svn.fhem.de/fhem/trunk@15986 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
e93ad55e80
commit
42049d941c
@ -1,5 +1,8 @@
|
|||||||
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
# 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.
|
# Do not insert empty lines here, update check depends on it.
|
||||||
|
- change: 72_FB_CALLMONITOR: new attribute apiKeyKlicktelDe and
|
||||||
|
apiKeySearchCh to configure own private API keys
|
||||||
|
for reverse search via klicktel.de or search.ch
|
||||||
- feature: 93_DbRep: V7.5.4, dumpFilesKeep can be set to "0", new attribute
|
- feature: 93_DbRep: V7.5.4, dumpFilesKeep can be set to "0", new attribute
|
||||||
"ftpDumpFilesKeep" for version management on FTP,
|
"ftpDumpFilesKeep" for version management on FTP,
|
||||||
delSeqDoublets optimized for consumption of resources
|
delSeqDoublets optimized for consumption of resources
|
||||||
|
@ -74,7 +74,12 @@ FB_CALLMONITOR_Initialize($)
|
|||||||
"fritzbox-remote-phonebook-exclude ".
|
"fritzbox-remote-phonebook-exclude ".
|
||||||
"fritzbox-remote-timeout ".
|
"fritzbox-remote-timeout ".
|
||||||
"fritzbox-user ".
|
"fritzbox-user ".
|
||||||
|
"apiKeySearchCh ".
|
||||||
|
"apiKeyKlicktelDe ".
|
||||||
$readingFnAttributes;
|
$readingFnAttributes;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#####################################
|
#####################################
|
||||||
@ -352,19 +357,25 @@ FB_CALLMONITOR_Read($)
|
|||||||
44 => "Answering_Machine_5"
|
44 => "Answering_Machine_5"
|
||||||
);
|
);
|
||||||
|
|
||||||
my $buf = DevIo_SimpleRead($hash);
|
my $received = DevIo_SimpleRead($hash);
|
||||||
|
my $buffer = $hash->{PARTIAL};
|
||||||
|
|
||||||
return "" if(!defined($buf) or IsDisabled($hash->{NAME}));
|
return "" if(!defined($received) or IsDisabled($hash->{NAME}));
|
||||||
|
|
||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
my @array;
|
my @array;
|
||||||
|
|
||||||
my $data = $buf;
|
|
||||||
my $area_code = AttrVal($name, "local-area-code", "");
|
my $area_code = AttrVal($name, "local-area-code", "");
|
||||||
my $country_code = AttrVal($name, "country-code", "0049");
|
my $country_code = AttrVal($name, "country-code", "0049");
|
||||||
|
|
||||||
foreach $data (split(/;\r\n/m, $buf))
|
$buffer .= $received;
|
||||||
|
|
||||||
|
while($buffer =~ m/\n/)
|
||||||
{
|
{
|
||||||
|
my $data;
|
||||||
|
|
||||||
|
($data, $buffer) = split("\n", $buffer, 2);
|
||||||
|
|
||||||
chomp $data;
|
chomp $data;
|
||||||
|
|
||||||
my $external_number = undef;
|
my $external_number = undef;
|
||||||
@ -493,7 +504,7 @@ FB_CALLMONITOR_Read($)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#####################################
|
#####################################
|
||||||
# Reconnects to FritzBox in case of disconnects
|
# catches error message during connection setup
|
||||||
sub
|
sub
|
||||||
FB_CALLMONITOR_DevIoCallback($$)
|
FB_CALLMONITOR_DevIoCallback($$)
|
||||||
{
|
{
|
||||||
@ -672,10 +683,22 @@ FB_CALLMONITOR_reverseSearch($$)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
my $api_key = AttrVal($name, "apiKeyKlicktelDe", undef);
|
||||||
|
|
||||||
|
unless(defined($api_key))
|
||||||
|
{
|
||||||
|
Log3 $name, 1, "FB_CALLMONITOR ($name) - WARNING! no API key for klicktel.de configured. Please obtain an API key from http://openapi.klicktel.de and set attribute apiKeyKlicktelDe with your key";
|
||||||
|
|
||||||
|
# use old key
|
||||||
|
Log3 $name, 1, "FB_CALLMONITOR ($name) - using generic API key for reverse search via klicktel.de. WILL BE REMOVED IN A FUTURE RELEASE!";
|
||||||
|
$api_key = "0de6139a49055c37b9b2d7bb3933cb7b";
|
||||||
|
}
|
||||||
|
|
||||||
$number =~ s/^0049/0/; # remove country code
|
$number =~ s/^0049/0/; # remove country code
|
||||||
Log3 $name, 4, "FB_CALLMONITOR ($name) - using klicktel.de for reverse search of $number";
|
Log3 $name, 4, "FB_CALLMONITOR ($name) - using klicktel.de for reverse search of $number";
|
||||||
|
|
||||||
$result = GetFileFromURL("http://openapi.klicktel.de/searchapi/invers?key=0de6139a49055c37b9b2d7bb3933cb7b&number=".$number, 5, undef, 1);
|
$result = GetFileFromURL("http://openapi.klicktel.de/searchapi/invers?key=".urlEncode($api_key)."&number=".$number, 5, undef, 1);
|
||||||
|
|
||||||
if(not defined($result))
|
if(not defined($result))
|
||||||
{
|
{
|
||||||
if(AttrVal($name, "reverse-search-cache", "0") eq "1")
|
if(AttrVal($name, "reverse-search-cache", "0") eq "1")
|
||||||
@ -751,11 +774,22 @@ FB_CALLMONITOR_reverseSearch($$)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
my $api_key = AttrVal($name, "apiKeySearchCh", undef);
|
||||||
|
|
||||||
|
unless(defined($api_key))
|
||||||
|
{
|
||||||
|
Log3 $name, 1, "FB_CALLMONITOR ($name) - WARNING! no API key for swiss.ch configured. Please obtain an API key from https://tel.search.ch/api/getkey and set attribute apiKeySearchCh with your key";
|
||||||
|
|
||||||
|
# use old key
|
||||||
|
Log3 $name, 1, "FB_CALLMONITOR ($name) - using generic API key for reverse search via search.ch. WILL BE REMOVED IN A FUTURE RELEASE";
|
||||||
|
$api_key = "b0b1207cb7c9d0048867de887aa9a4fd";
|
||||||
|
}
|
||||||
|
|
||||||
$number =~ s/^0041/0/; # remove country code
|
$number =~ s/^0041/0/; # remove country code
|
||||||
|
|
||||||
Log3 $name, 4, "FB_CALLMONITOR ($name) - using search.ch for reverse search of $number";
|
Log3 $name, 4, "FB_CALLMONITOR ($name) - using search.ch for reverse search of $number";
|
||||||
|
|
||||||
$result = GetFileFromURL("http://tel.search.ch/api/?key=b0b1207cb7c9d0048867de887aa9a4fd&maxnum=1&was=".$number, 5, undef, 1);
|
$result = GetFileFromURL("http://tel.search.ch/api/?key=".urlEncode($api_key)."&maxnum=1&was=".$number, 5, undef, 1);
|
||||||
if(not defined($result))
|
if(not defined($result))
|
||||||
{
|
{
|
||||||
if(AttrVal($name, "reverse-search-cache", "0") eq "1")
|
if(AttrVal($name, "reverse-search-cache", "0") eq "1")
|
||||||
@ -2060,7 +2094,11 @@ sub FB_CALLMONITOR_checkNumberForDeflection($$)
|
|||||||
Default Value: <i>empty</i> (all phonebooks should be used, no exclusions)<br><br>
|
Default Value: <i>empty</i> (all phonebooks should be used, no exclusions)<br><br>
|
||||||
<li><a name="FB_CALLMONITOR_fritzbox-user">fritzbox-user</a> <username></li>
|
<li><a name="FB_CALLMONITOR_fritzbox-user">fritzbox-user</a> <username></li>
|
||||||
Use the given user for remote connect to obtain the phonebook (see <a href="#FB_CALLMONITOR_fritzbox-remote-phonebook">fritzbox-remote-phonebook</a>). This attribute is only needed, if you use multiple users on your FritzBox.<br><br>
|
Use the given user for remote connect to obtain the phonebook (see <a href="#FB_CALLMONITOR_fritzbox-remote-phonebook">fritzbox-remote-phonebook</a>). This attribute is only needed, if you use multiple users on your FritzBox.<br><br>
|
||||||
</ul>
|
<li><a name="FB_CALLMONITOR_apiKeyKlicktelDe">apiKeyKlicktelDe</a> <API-Key></li>
|
||||||
|
A private API key from <a href="http://openapi.klicktel.de" target="_new">klicktel Open API</a> to perform a reverse search via klicktel.de (see attribute <a href=#FB_CALLMONITOR_reverse-search">reverse-search</a>). Without an API key, no reverse search via klicktel.de is not possible<br><br>
|
||||||
|
<li><a name="FB_CALLMONITOR_apiKeySearchCh">apiKeySearchCh</a> <API-Key></li>
|
||||||
|
A private API key from <a href="https://tel.search.ch/api/getkey" target="_new">tel.search.ch</a> to perform a reverse search via search.ch (see attribute <a href=#FB_CALLMONITOR_reverse-search">reverse-search</a>). Without an API key, no reverse search via search.ch is not possible<br><br>
|
||||||
|
</ul>
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<a name="FB_CALLMONITOR_events"></a>
|
<a name="FB_CALLMONITOR_events"></a>
|
||||||
@ -2227,6 +2265,10 @@ sub FB_CALLMONITOR_checkNumberForDeflection($$)
|
|||||||
Standardmäßig ist diese Funktion deaktiviert (alle Telefonbücher werden eingelesen)<br><br>
|
Standardmäßig ist diese Funktion deaktiviert (alle Telefonbücher werden eingelesen)<br><br>
|
||||||
<li><a name="FB_CALLMONITOR_fritzbox-user">fritzbox-user</a> <Username></li>
|
<li><a name="FB_CALLMONITOR_fritzbox-user">fritzbox-user</a> <Username></li>
|
||||||
Der Username für das Telnet-Interface, sofern das Telefonbuch direkt von der FritzBox geladen werden soll (siehe Attribut: <a href="#FB_CALLMONITOR_fritzbox-remote-phonebook">fritzbox-remote-phonebook</a>). Dieses Attribut ist nur notwendig, wenn mehrere Benutzer auf der FritzBox konfiguriert sind.<br><br>
|
Der Username für das Telnet-Interface, sofern das Telefonbuch direkt von der FritzBox geladen werden soll (siehe Attribut: <a href="#FB_CALLMONITOR_fritzbox-remote-phonebook">fritzbox-remote-phonebook</a>). Dieses Attribut ist nur notwendig, wenn mehrere Benutzer auf der FritzBox konfiguriert sind.<br><br>
|
||||||
|
<li><a name="FB_CALLMONITOR_apiKeyKlicktelDe">apiKeyKlicktelDe</a> <API-Key></li>
|
||||||
|
Der private API-Key von <a href="http://openapi.klicktel.de" target="_new">klicktel Open API</a> um eine Rückwärtssuche via klicktel.de durchzuführen (siehe Attribut <a href=#FB_CALLMONITOR_reverse-search">reverse-search</a>). Ohne einen solchen API-Key ist eine Rückwärtssuche via klicktel.de nicht möglich<br><br>
|
||||||
|
<li><a name="FB_CALLMONITOR_apiKeySearchCh">apiKeySearchCh</a> <API-Key></li>
|
||||||
|
Der private API-Key von <a href="https://tel.search.ch/api/getkey" target="_new">tel.search.ch</a> um eine Rückwärtssuche via search.ch durchzuführen (siehe Attribut <a href=#FB_CALLMONITOR_reverse-search">reverse-search</a>). Ohne einen solchen API-Key ist eine Rückwärtssuche via search.ch nicht möglich<br><br>
|
||||||
</ul>
|
</ul>
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user