mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-10 09:16:53 +00:00
FB_CALLMONITOR:
- new attribute "country-code" to import phonebook entries with your local country code preceded as a national phonenumber in a correct way. Per default "0049" is used as country code. (by prodigy7, Forum #32663) - new get commands showPhonebookEntries and showCacheEntries to get all related entries. git-svn-id: https://svn.fhem.de/fhem/trunk@8127 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
8426b366a9
commit
83c60e0e0c
@ -1,5 +1,11 @@
|
|||||||
# 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: FB_CALLMONITOR: new attribute "country-code" to import
|
||||||
|
phonebook entries with your local country code preceded as
|
||||||
|
a national phonenumber in a correct way.
|
||||||
|
Per default "0049" is used as country code. (by prodigy7)
|
||||||
|
- feature: FB_CALLMONITOR: new get commands showPhonebookEntries
|
||||||
|
and showCacheEntries to get all related entries
|
||||||
- changed: enabled authentication with the logitech myharmony server
|
- changed: enabled authentication with the logitech myharmony server
|
||||||
for hub firmware version 4.x, version 3.x still works without.
|
for hub firmware version 4.x, version 3.x still works without.
|
||||||
- feature: YAMAHA_BD: support 95_remotecontrol.pm module features
|
- feature: YAMAHA_BD: support 95_remotecontrol.pm module features
|
||||||
|
@ -35,6 +35,7 @@ use Digest::MD5;
|
|||||||
use HttpUtils;
|
use HttpUtils;
|
||||||
use DevIo;
|
use DevIo;
|
||||||
use FritzBoxUtils;
|
use FritzBoxUtils;
|
||||||
|
use utf8;
|
||||||
|
|
||||||
my %connection_type = (
|
my %connection_type = (
|
||||||
0 => "0",
|
0 => "0",
|
||||||
@ -95,6 +96,7 @@ FB_CALLMONITOR_Initialize($)
|
|||||||
"disable:0,1 ".
|
"disable:0,1 ".
|
||||||
"unique-call-ids:0,1 ".
|
"unique-call-ids:0,1 ".
|
||||||
"local-area-code ".
|
"local-area-code ".
|
||||||
|
"country-code ".
|
||||||
"remove-leading-zero:0,1 ".
|
"remove-leading-zero:0,1 ".
|
||||||
"reverse-search-cache-file ".
|
"reverse-search-cache-file ".
|
||||||
"reverse-search:multiple-strict,phonebook,klicktel.de,dasoertliche.de,search.ch,dasschnelle.at ".
|
"reverse-search:multiple-strict,phonebook,klicktel.de,dasoertliche.de,search.ch,dasschnelle.at ".
|
||||||
@ -175,9 +177,53 @@ FB_CALLMONITOR_Get($@)
|
|||||||
|
|
||||||
return $head."\n".("-" x $width)."\n".$table;
|
return $head."\n".("-" x $width)."\n".$table;
|
||||||
}
|
}
|
||||||
|
elsif($arguments[1] eq "showPhonebookEntries" and exists($hash->{helper}{PHONEBOOK}))
|
||||||
|
{
|
||||||
|
my $table = "";
|
||||||
|
|
||||||
|
my $number_width = 0;
|
||||||
|
my $name_width = 0;
|
||||||
|
|
||||||
|
foreach my $number (keys %{$hash->{helper}{PHONEBOOK}})
|
||||||
|
{
|
||||||
|
$number_width = length($number) if($number_width < length($number));
|
||||||
|
$name_width = length($hash->{helper}{PHONEBOOK}{$number}) if($name_width < length($hash->{helper}{PHONEBOOK}{$number}));
|
||||||
|
}
|
||||||
|
my $head = sprintf("%-".$number_width."s %s" ,"Number", "Name");
|
||||||
|
foreach my $number (sort { lc($hash->{helper}{PHONEBOOK}{$a}) cmp lc($hash->{helper}{PHONEBOOK}{$b}) } keys %{$hash->{helper}{PHONEBOOK}})
|
||||||
|
{
|
||||||
|
|
||||||
|
my $string = sprintf("%-".$number_width."s - %s" , $number,$hash->{helper}{PHONEBOOK}{$number});
|
||||||
|
$table .= $string."\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
return $head."\n".("-" x ($number_width + $name_width + 3))."\n".$table;
|
||||||
|
}
|
||||||
|
elsif($arguments[1] eq "showCacheEntries" and exists($hash->{helper}{CACHE}))
|
||||||
|
{
|
||||||
|
my $table = "";
|
||||||
|
|
||||||
|
my $number_width = 0;
|
||||||
|
my $name_width = 0;
|
||||||
|
|
||||||
|
foreach my $number (keys %{$hash->{helper}{CACHE}})
|
||||||
|
{
|
||||||
|
$number_width = length($number) if($number_width < length($number));
|
||||||
|
$name_width = length($hash->{helper}{CACHE}{$number}) if($name_width < length($hash->{helper}{CACHE}{$number}));
|
||||||
|
}
|
||||||
|
my $head = sprintf("%-".$number_width."s %s" ,"Number", "Name");
|
||||||
|
foreach my $number (sort { lc($hash->{helper}{CACHE}{$a}) cmp lc($hash->{helper}{CACHE}{$b}) } keys %{$hash->{helper}{CACHE}})
|
||||||
|
{
|
||||||
|
|
||||||
|
my $string = sprintf("%-".$number_width."s - %s" , $number,$hash->{helper}{CACHE}{$number});
|
||||||
|
$table .= $string."\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
return $head."\n".("-" x ($number_width + $name_width + 3))."\n".$table;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return "unknown argument ".$arguments[1].", choose one of search".(exists($hash->{helper}{PHONEBOOK_NAMES}) ? " showPhonebookIds" : "");
|
return "unknown argument ".$arguments[1].", choose one of search".(exists($hash->{helper}{PHONEBOOK_NAMES}) ? " showPhonebookIds" : "").(exists($hash->{helper}{PHONEBOOK}) ? " showPhonebookEntries" : "").(exists($hash->{helper}{CACHE}) ? " showCacheEntries" : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -801,7 +847,7 @@ sub FB_CALLMONITOR_parsePhonebook($$)
|
|||||||
my $count_contacts = 0;
|
my $count_contacts = 0;
|
||||||
|
|
||||||
my $area_code = AttrVal($name, "local-area-code", "");
|
my $area_code = AttrVal($name, "local-area-code", "");
|
||||||
|
my $country_code = AttrVal($name, "country-code", "0049");
|
||||||
if($phonebook =~ /<contact/ and $phonebook =~ /<realName>/ and $phonebook =~ /<number/ and $phonebook =~ /<phonebook/ and $phonebook =~ /<\/phonebook>/)
|
if($phonebook =~ /<contact/ and $phonebook =~ /<realName>/ and $phonebook =~ /<number/ and $phonebook =~ /<phonebook/ and $phonebook =~ /<\/phonebook>/)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -818,16 +864,17 @@ sub FB_CALLMONITOR_parsePhonebook($$)
|
|||||||
if($1 ne "intern" and $1 ne "memo")
|
if($1 ne "intern" and $1 ne "memo")
|
||||||
{
|
{
|
||||||
$number = $2;
|
$number = $2;
|
||||||
$number =~ s/\s//g;
|
$number =~ s/\s//g; # Remove spaces
|
||||||
$number =~ s/^\+\d\d/0/g; # quick'n'dirty fix in case of international number format.
|
$number =~ s/^\+/00/g; # Convert leading + to 00 country extension
|
||||||
|
$number =~ s/^$country_code/0/g; # Replace own country code with leading 0
|
||||||
|
$number =~ s/^(\#[0-9]{1,10}\#)//g; # Remove phone control codes
|
||||||
|
$number =~ s/\D//g if(not $number =~ /@/); # Remove anything else isn't a number if it is no VoIP number
|
||||||
|
|
||||||
|
if(not $number =~ /^0/ and not $number =~ /@/ and $area_code =~ /^0[1-9]\d+$/)
|
||||||
if(not $number =~ /^0/ and not $number =~ /@/ and $area_code ne "")
|
|
||||||
{
|
{
|
||||||
if($area_code =~ /^0[1-9]\d+$/) {
|
|
||||||
$number = $area_code.$number;
|
$number = $area_code.$number;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
$count_contacts++;
|
$count_contacts++;
|
||||||
Log3 $name, 4, "FB_CALLMONITOR ($name) - found $contact_name with number $number";
|
Log3 $name, 4, "FB_CALLMONITOR ($name) - found $contact_name with number $number";
|
||||||
$hash->{helper}{PHONEBOOK}{$number} = FB_CALLMONITOR_html2txt($contact_name) if(not defined($hash->{helper}{PHONEBOOK}{$number}));
|
$hash->{helper}{PHONEBOOK}{$number} = FB_CALLMONITOR_html2txt($contact_name) if(not defined($hash->{helper}{PHONEBOOK}{$number}));
|
||||||
@ -1287,6 +1334,8 @@ sub FB_CALLMONITOR_readPassword($;$)
|
|||||||
<ul>
|
<ul>
|
||||||
<li><b>search <phone-number></b> - returns the name of the given number via reverse-search (internal phonebook, cache or internet lookup)</li>
|
<li><b>search <phone-number></b> - returns the name of the given number via reverse-search (internal phonebook, cache or internet lookup)</li>
|
||||||
<li><b>showPhonebookIds</b> - returns a list of all available phonebooks on the FritzBox (not available when using telnet to retrieve remote phonebook)</li>
|
<li><b>showPhonebookIds</b> - returns a list of all available phonebooks on the FritzBox (not available when using telnet to retrieve remote phonebook)</li>
|
||||||
|
<li><b>showPhonebookEntries</b> - returns a list of all currently known phonebook entries (only available when using phonebook funktionality)</li>
|
||||||
|
<li><b>showCacheEntries</b> - returns a list of all currently known cache entries (only available when using reverse search caching funktionality)</li>
|
||||||
</ul>
|
</ul>
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
@ -1327,6 +1376,9 @@ sub FB_CALLMONITOR_readPassword($;$)
|
|||||||
Default Value is 0 (off)<br><br>
|
Default Value is 0 (off)<br><br>
|
||||||
<li><a name="local-area-code">local-area-code</a></li>
|
<li><a name="local-area-code">local-area-code</a></li>
|
||||||
Use the given local area code for reverse search in case of a local call (e.g. 0228 for Bonn, Germany)<br><br>
|
Use the given local area code for reverse search in case of a local call (e.g. 0228 for Bonn, Germany)<br><br>
|
||||||
|
<li><a name="country-code">country-code</a></li>
|
||||||
|
Your local country code. This is needed to identify phonenumbers in your phonebook with your local country code as a national phone number instead of an international one (e.g. 0049 for Germany, 0043 for Austria or 001 for USA)<br><br>
|
||||||
|
Default Value is 0049 (Germany)<br><br>
|
||||||
<li><a name="fritzbox-remote-phonebook">fritzbox-remote-phonebook</a></li>
|
<li><a name="fritzbox-remote-phonebook">fritzbox-remote-phonebook</a></li>
|
||||||
If this attribute is activated, the phonebook should be obtained direct from the FritzBox via remote network connection (in case FHEM is not running on a FritzBox). This is only possible if a password (and depending on configuration a username as well) is configured.<br><br>
|
If this attribute is activated, the phonebook should be obtained direct from the FritzBox via remote network connection (in case FHEM is not running on a FritzBox). This is only possible if a password (and depending on configuration a username as well) is configured.<br><br>
|
||||||
Possible values: 0 => off , 1 => on (use remote telnet connection to obtain FritzBox phonebook)<br>
|
Possible values: 0 => off , 1 => on (use remote telnet connection to obtain FritzBox phonebook)<br>
|
||||||
@ -1407,6 +1459,8 @@ sub FB_CALLMONITOR_readPassword($;$)
|
|||||||
<ul>
|
<ul>
|
||||||
<li><b>search <Rufnummer></b> - gibt den Namen der Telefonnummer zurück (aus Cache, Telefonbuch oder Rückwärtssuche)</li>
|
<li><b>search <Rufnummer></b> - gibt den Namen der Telefonnummer zurück (aus Cache, Telefonbuch oder Rückwärtssuche)</li>
|
||||||
<li><b>showPhonebookIds</b> - gibt eine Liste aller verfügbaren Telefonbücher auf der FritzBox zurück (nicht verfügbar wenn das Telefonbuch via Telnet-Verbindung eingelesen wird)</li>
|
<li><b>showPhonebookIds</b> - gibt eine Liste aller verfügbaren Telefonbücher auf der FritzBox zurück (nicht verfügbar wenn das Telefonbuch via Telnet-Verbindung eingelesen wird)</li>
|
||||||
|
<li><b>showPhonebookEntries</b> - gibt eine Liste aller bekannten Telefonbucheinträge zurück (nur verfügbar, wenn eine Rückwärtssuche via Telefonbuch aktiviert ist)</li>
|
||||||
|
<li><b>showCacheEntries</b> - gibt eine Liste aller bekannten Cacheeinträge zurück (nur verfügbar, wenn die Cache-Funktionalität der Rückwärtssuche aktiviert ist))</li>
|
||||||
</ul>
|
</ul>
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
@ -1451,14 +1505,17 @@ sub FB_CALLMONITOR_readPassword($;$)
|
|||||||
Standardwert ist 0 (deaktiviert)<br><br>
|
Standardwert ist 0 (deaktiviert)<br><br>
|
||||||
<li><a name="local-area-code">local-area-code</a></li>
|
<li><a name="local-area-code">local-area-code</a></li>
|
||||||
Verwendet die gesetze Vorwahlnummer bei Rückwärtssuchen von Ortsgesprächen (z.B. 0228 für Bonn)<br><br>
|
Verwendet die gesetze Vorwahlnummer bei Rückwärtssuchen von Ortsgesprächen (z.B. 0228 für Bonn)<br><br>
|
||||||
|
<li><a name="country-code">country-code</a></li>
|
||||||
|
Die Landesvorwahl wird benötigt um Telefonbucheinträge mit lokaler Landesvorwahl als Inlands-Rufnummern zu erkennen (z.B. 0049 für Deutschland, 0043 für Österreich oder 001 für USA).<br><br>
|
||||||
|
Standardwert ist 0049 (Deutschland)<br><br>
|
||||||
<li><a name="fritzbox-remote-phonebook">fritzbox-remote-phonebook</a></li>
|
<li><a name="fritzbox-remote-phonebook">fritzbox-remote-phonebook</a></li>
|
||||||
Wenn dieses Attribut aktiviert ist, wird das FritzBox Telefonbuch direkt von der FritzBox gelesen. Dazu ist das FritzBox Passwort und je nach FritzBox Konfiguration auch ein Username notwendig, der in den entsprechenden Attributen konfiguriert sein muss.<br><br>
|
Wenn dieses Attribut aktiviert ist, wird das FritzBox Telefonbuch direkt von der FritzBox gelesen. Dazu ist das FritzBox Passwort und je nach FritzBox Konfiguration auch ein Username notwendig, der in den entsprechenden Attributen konfiguriert sein muss.<br><br>
|
||||||
Mögliche Werte: 0 => deaktiviert , 1 => aktiviert<br>
|
Mögliche Werte: 0 => deaktiviert , 1 => aktiviert<br>
|
||||||
Standardwert ist 0 (deaktiviert)<br><br>
|
Standardwert ist 0 (deaktiviert)<br><br>
|
||||||
<li><a name="fritzbox-remote-phonebook-via">fritzbox-remote-phonebook-via</a></li>
|
<li><a name="fritzbox-remote-phonebook-via">fritzbox-remote-phonebook-via</a></li>
|
||||||
Setzt die Methode mit der das Telefonbuch von der FritzBox abgefragt werden soll. Bei der Methode "web", werden alle verfügbaren Telefonbücher (lokales sowie alle konfigurierten Online-Telefonbücher) über die Web-Oberfläche eingelesen. Bei der Methode "telnet" wird eine Telnet-Verbindung zur FritzBox aufgebaut um das lokale Telefonbuch abzufragen (keine Online-Telefonbücher). Dazu muss die Telnet-Funktion aktiviert sein (Telefon Kurzwahl: #96*7*)<br><br>
|
Setzt die Methode mit der das Telefonbuch von der FritzBox abgefragt werden soll. Bei der Methode "web", werden alle verfügbaren Telefonbücher (lokales sowie alle konfigurierten Online-Telefonbücher) über die Web-Oberfläche eingelesen. Bei der Methode "telnet" wird eine Telnet-Verbindung zur FritzBox aufgebaut um das lokale Telefonbuch abzufragen (keine Online-Telefonbücher). Dazu muss die Telnet-Funktion aktiviert sein (Telefon Kurzwahl: #96*7*)<br><br>
|
||||||
Mögliche Werte: web,telnet<br>
|
Mögliche Werte: web,telnet<br>
|
||||||
Standardwert ist "web" (retrieve phonebooks via web interface)<br><br>
|
Standardwert ist "web" (Abfrage aller verfügbaren Telefonbücher über die Web-Oberfläche)<br><br>
|
||||||
<li><a name="fritzbox-remote-phonebook-via">fritzbox-remote-phonebook-exclude</a></li>
|
<li><a name="fritzbox-remote-phonebook-via">fritzbox-remote-phonebook-exclude</a></li>
|
||||||
Eine komma-separierte Liste von Telefonbuch-ID's welche beim einlesen übersprungen werden sollen. Dieses Attribut greift nur beim einlesen der Telefonbücher via "web"-Methode (siehe Attribut <i>fritzbox-remote-phonebook-via</i>). Eine Liste aller möglichen Werte kann über das <a href="#FB_CALLMONITORget">Get-Kommando</a> <i>showPhonebookIds</i> angezeigt werden.<br><br>
|
Eine komma-separierte Liste von Telefonbuch-ID's welche beim einlesen übersprungen werden sollen. Dieses Attribut greift nur beim einlesen der Telefonbücher via "web"-Methode (siehe Attribut <i>fritzbox-remote-phonebook-via</i>). Eine Liste aller möglichen Werte kann über das <a href="#FB_CALLMONITORget">Get-Kommando</a> <i>showPhonebookIds</i> angezeigt werden.<br><br>
|
||||||
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>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user