From 488b0e13a0d66077a5c56db0d388a7e7ec8f6867 Mon Sep 17 00:00:00 2001 From: tpoitzsch <> Date: Mon, 29 Jun 2015 15:14:36 +0000 Subject: [PATCH] FRITZBOX: docu git-svn-id: https://svn.fhem.de/fhem/trunk@8860 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/72_FRITZBOX.pm | 89 ++++++++++++++++++++++++++-------------- 1 file changed, 59 insertions(+), 30 deletions(-) diff --git a/fhem/FHEM/72_FRITZBOX.pm b/fhem/FHEM/72_FRITZBOX.pm index 67f9f7527..dc759d8ec 100644 --- a/fhem/FHEM/72_FRITZBOX.pm +++ b/fhem/FHEM/72_FRITZBOX.pm @@ -2511,24 +2511,32 @@ sub FRITZBOX_Ring_Run_Web($) # Store current values for fon and dect port my $queryStr = "&dectUser=telcfg:settings/Foncontrol/User/list(Id,Intern,IntRingTone,RadioRingID)"; # DECT Numbers $queryStr .= "&fonPort=telcfg:settings/MSN/Port/list(Name,MSN)"; # Fon ports + $queryStr .= "&dialPort=telcfg:settings/DialPort"; #Dial Port + $queryStr .= "&useClickToDial=telcfg:settings/UseClickToDial"; # Use Click2Dial FRITZBOX_Log $hash, 4, "Read current dect and fon port values from box"; $startValue = FRITZBOX_Web_Query( $hash, $queryStr, 'UTF-8') ; #Preparing 1st command array @webCmdArray = (); + # unless ($startValue->{useClickToDial}) { + # push @webCmdArray, "telcfg:settings/UseClickToDial" => 1; + # FRITZBOX_Log $hash, 3, "Switch ClickToDial on"; + # } + if (int (@FritzFons) == 0 && $ttsLink) { FRITZBOX_Log $hash, 3, "No Fritz!Fon identified, parameter 'say:' will be ignored."; } # Creation fhemRadioStation for ttsLink elsif (int (@FritzFons) && $ttsLink && $hash->{fhem}{radio}{$fhemRadioStation} ne "FHEM") { - FRITZBOX_Log $hash, 3, "Create new internet radio station $fhemRadioStation: 'FHEM' for ringing with text-to-speech"; push @webCmdArray, "configd:settings/WEBRADIO".$fhemRadioStation."/Name" => "FHEM"; push @webCmdArray, "configd:settings/WEBRADIO".$fhemRadioStation."/Bitmap" => "1023"; - #Execute command array - FRITZBOX_Web_PostCmd( $hash, \@webCmdArray ) + FRITZBOX_Log $hash, 3, "Create new internet radio station $fhemRadioStation: 'FHEM' for ringing with text-to-speech"; } + #Execute command array + FRITZBOX_Web_PostCmd( $hash, \@webCmdArray ) if int @webCmdArray; + #Preparing 2nd command array to set ring parameters # Change ring tone of Fritz!Fons if ($ringTone) { @@ -2551,22 +2559,22 @@ sub FRITZBOX_Ring_Run_Web($) if ( $ringWithIntern =~ /^([1-3])$/ ) { if ($startValue->{fonPort}->[$ringWithIntern-1]->{Name}) { push @webCmdArray, "telcfg:settings/MSN/Port".($ringWithIntern-1)."/Name" => $msg; - FRITZBOX_Log $hash, 4, "Change temporarily name of calling number fon$ringWithIntern to '$msg'"; + FRITZBOX_Log $hash, 4, "Change temporarily name of dial port 'fon$ringWithIntern' to '$msg'"; } else { - FRITZBOX_Log $hash, 2, "Error: Current name of calling number fon$ringWithIntern could not be determined -> Did not change the name."; + FRITZBOX_Log $hash, 2, "Error: Current name of dial port 'fon$ringWithIntern' could not be determined -> Did not change the name."; my $temp = Dumper( $startValue ); FRITZBOX_Log $hash, 3, "Debug info: \n".$temp; } push @webCmdArray, "telcfg:settings/DialPort" => $ringWithIntern; - FRITZBOX_Log $hash, 5, "Set dial port to " . $dialPort{$ringWithIntern} . " (MSN ".$startValue->{fonPort}->[$ringWithIntern-1]{MSN} .")."; + FRITZBOX_Log $hash, 4, "Set dial port to '" . $dialPort{$ringWithIntern} . "' (MSN: ".$startValue->{fonPort}->[$ringWithIntern-1]{MSN} .")."; } elsif ($field{show}) { - FRITZBOX_Log $hash, 3, "Parameter 'show:' ignored because attribute 'ringWithIntern' not defined and standard dial port ".$hash->{READINGS}{box_stdDialPort}{VAL}." is used." + FRITZBOX_Log $hash, 3, "Parameter 'show:' ignored because attribute 'ringWithIntern' not defined and standard dial port '".$hash->{READINGS}{box_stdDialPort}{VAL}."' is used." } # use standard dial port else { - FRITZBOX_Log $hash, 5, "Use standard dial port " . $hash->{READINGS}{box_stdDialPort}{VAL}; + FRITZBOX_Log $hash, 5, "Use standard dial port '" . $hash->{READINGS}{box_stdDialPort}{VAL} ."'."; } # Set tts-Message @@ -2595,10 +2603,11 @@ sub FRITZBOX_Ring_Run_Web($) #Preparing 4th command array to stop ringing push @tr064CmdArray, ["X_VoIP:1", "x_voip", "X_AVM-DE_DialHangup"]; $result = FRITZBOX_TR064_Cmd( $hash, 0, \@tr064CmdArray ) if $hash->{SECPORT}; - push( @webCmdArray, "telcfg:command/Hangup" => "" ) unless $hash->{SECPORT}; + push( @webCmdArray, "telcfg:command/Hangup" => "" ) unless $hash->{SECPORT}; #Preparing 5th command array to reset everything - push @webCmdArray, "telcfg:settings/DialPort" => 50 if $ringWithIntern != 0 ; + push @webCmdArray, "telcfg:settings/DialPort" => $startValue->{dialPort} if $ringWithIntern != 0 && defined $startValue->{dialPort}; + FRITZBOX_Log $hash, 4, "Reset dial port to '".$dialPort{$startValue->{dialPort}}."'."; # Reset internal ring tones for the Fritz!Fons if ($ringTone) { foreach (@FritzFons) { @@ -2619,11 +2628,11 @@ sub FRITZBOX_Ring_Run_Web($) my $fonName = $startValue->{fonPort}->[$ringWithIntern-1]->{Name}; if ($fonName) {# darf nie leer sein push( @webCmdArray, "telcfg:settings/MSN/Port".($ringWithIntern-1)."/Name" => $fonName ) ; - FRITZBOX_Log $hash, 4, "Reset name of calling number fon$ringWithIntern to '$fonName'"; + FRITZBOX_Log $hash, 4, "Reset name of dial port fon$ringWithIntern to '$fonName'"; } } -# Switch of Internet Radio stations +# ??? Switch of Internet Radio stations if (!$ttsLink && defined $ringTone && $ringTone ==33 ) { push @webCmdArray, "telcfg:command/Dial **".$intNo; push @webCmdArray, "telcfg:command/Hangup **".$intNo; @@ -3611,7 +3620,7 @@ sub FRITZBOX_TR064_Get_ServiceList($) my $host = AttrVal( $name, "fritzBoxIP", "fritz.box" ); my $url = 'http://'.$host.":49000/tr64desc.xml"; - my $returnStr = "_" x 100 ."\n\n"; + my $returnStr = "_" x 130 ."\n\n"; $returnStr .= " List of TR-064 services and actions that are allowed on the device '$host'\n"; return "TR-064 switched off." if $hash->{READINGS}{box_tr064}{VAL} eq "off"; @@ -3649,26 +3658,28 @@ sub FRITZBOX_TR064_Get_ServiceList($) my $content = $response->content; -# get version + # get version $content =~ /(.*?)<\/major>/isg; my $version = $1; $content =~ /(.*?)<\/minor>/isg; $version .= ".".$1; - $returnStr .= "_" x 100 ."\n\n"; + $returnStr .= "_" x 130 ."\n\n"; $returnStr .= " Service: ".$_->[0]." Control: ".$_->[1]."\n"; $returnStr .= " Spec: http://".$host.":49000".$_->[2]." Version: ".$version."\n"; - $returnStr .= "-" x 100 ."\n"; - + $returnStr .= "-" x 130 ."\n"; + + # get name and arguments of each action while( $content =~ /(.*?)<\/action>/isg ) { - + my $serviceXML = $1; $serviceXML =~ /(.*?)<\/name>/is; my $action = $1; $serviceXML =~ /(.*?)<\/argumentlist>/is; my $argXML = $1; - $returnStr .= " $action ("; + my $lineStr = " $action ("; + my $tab = " " x length( $lineStr ); my @argArray = ($argXML =~ /(.*?)<\/argument>/isg); my @argOut; @@ -3677,16 +3688,28 @@ sub FRITZBOX_TR064_Get_ServiceList($) my $argName = $1; $_ =~ /(.*?)<\/direction>/is; my $argDir = $1; - if ($argDir eq "in") { $returnStr .= " $argName"; } + if ($argDir eq "in") { + # Wrap + if (length ($lineStr.$argName) > 129) { + $returnStr .= $lineStr."\n" ; + $lineStr = $tab; + } + $lineStr .= " $argName"; + } else { push @argOut, $argName; } } - $returnStr .= " )"; - $returnStr .= " = (" if int @argOut; + $lineStr .= " )"; + $lineStr .= " = (" if int @argOut; foreach (@argOut) { - $returnStr .= " $_"; + # Wrap + if (length ($lineStr.$_) > 129) { + $returnStr .= $lineStr."\n" ; + $lineStr = $tab ." " x 6; + } + $lineStr .= " $_"; } - $returnStr .= " )" if int @argOut; - $returnStr .= "\n"; + $lineStr .= " )" if int @argOut; + $returnStr .= $lineStr."\n"; } } @@ -4309,7 +4332,9 @@ sub FRITZBOX_fritztris($)
  • box_powerRate - current power in percent of maximal power
  • box_rateDown - average download rate in the last update interval
  • box_rateUp - average upload rate in the last update interval
  • -
  • box_tr069 - provider remote access TR069 (safety issue!)
  • +
  • box_stdDialPort - standard caller port when using the dial function of the box
  • +
  • box_tr064 - application interface TR-064 (needed by this modul)
  • +
  • box_tr069 - provider remote access TR-069 (safety issue!)
  • box_wlan_2.4GHz - Current state of the 2.4 GHz WLAN
  • box_wlan_5GHz - Current state of the 5 GHz WLAN
  • @@ -4323,8 +4348,9 @@ sub FRITZBOX_fritztris($)
  • dect1_model - Model of the DECT device 1
  • dect1_radio - Current internet radio station ring tone of the DECT device 1
  • -
  • fon1 - Internal name of the analog FON connection 1
  • -
  • fon1_intern - Internal number of the analog FON connection 1
  • +
  • fon1 - Internal name of the analog FON port 1
  • +
  • fon1_intern - Internal number of the analog FON port 1
  • +
  • fon1_out - Outgoing number of the analog FON port 1
  • diversity1 - Own (incoming) phone number of the call diversity 1
  • diversity1_dest - Destination of the call diversity 1
  • @@ -4582,7 +4608,7 @@ sub FRITZBOX_fritztris($)
  • ringWithIntern <1 | 2 | 3>
    - Um ein Telefon klingeln zu lassen, muss eine Anrufer spezifiziert werden. Normalerweise ist dies die Nummer 50 "ISDN:Wählhilfe". + Um ein Telefon klingeln zu lassen, muss in der Fritzbox eine Anrufer (Wählhilfe, Wert 'box_stdDialPort') spezifiziert werden.
    Um während des Klingelns eine Nachricht (Standard: "FHEM") anzuzeigen, kann hier die interne Nummer 1-3 angegeben werden. Der entsprechende analoge Telefonanschluss muss vorhanden sein. @@ -4615,7 +4641,9 @@ sub FRITZBOX_fritztris($)
  • box_powerRate - aktueller Stromverbrauch in Prozent der maximalen Leistung
  • box_rateDown - durchschnittliche Download-Geschwindigkeit in kByte/s des letzten Aktualisierungsintervals
  • box_rateUp - durchschnittliche Upload-Geschwindigkeit in kByte/s des letzten Aktualisierungsintervals
  • -
  • box_tr069 - Provider-Fernwartung TR069 (sicherheitsrelevant!)
  • +
  • box_stdDialPort - Standard-Wählhilfe-Anschluss, der f¨r die Wählfunktion des Gerätes genutzt wird
  • +
  • box_tr064 - Anwendungsschnittstelle TR-064 (wird auch von diesem Modul benötigt)
  • +
  • box_tr069 - Provider-Fernwartung TR-069 (sicherheitsrelevant!)
  • box_wlan_2.4GHz - Aktueller Status des 2.4-GHz-WLAN
  • box_wlan_5GHz - Aktueller Status des 5-GHz-WLAN
  • @@ -4631,6 +4659,7 @@ sub FRITZBOX_fritztris($)
  • fon1 - Name des analogen Telefonanschlusses 1 an der Fritz!Box
  • fon1_intern - Interne Nummer des analogen Telefonanschlusses 1
  • +
  • fon1_out - ausgehende Nummer des Anschlusses 1
  • diversity1 - Eigene Rufnummer der Rufumleitung 1
  • diversity1_dest - Zielnummer der Rufumleitung 1