en:online_status_of_internet

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

en:online_status_of_internet [2016/03/28 17:46]
en:online_status_of_internet [2020/07/05 17:13] (current)
Line 1: Line 1:
 +====== Status of Internet connexion ======
 +To verify that your repeater is still online on the internet, we will add a DTMF command that tells you by an announcement on request.
 +===== Create a copy of Logic.tcl file =====
  
 +Copy the file ''Logic.tcl'' in sub-directory ''local''. This allows us to never change the original file ''Local.tcl'' (original file in ''/usr/share/svxlink/events.d/''.)
 +<code bash>
 +cd /usr/share/svxlink/events.d/
 +sudo mkdir local
 +cp Logic.tcl ./local/Logic.tcl
 +</code>
 +===== Modification of the Logic.tcl file =====
 +In ''Logic.tcl'' file, searching the function that will handle our remote commands on receipt of DTMF codes''dtmf_cmd_received'', and copy the following lines (between '' if {$cmd == "25"} {  # DTMF 25'' et '' return 1 }'')
 +
 +<code bash>
 +sudo nano /usr/share/svxlink/events.d/local/Logic.tcl
 +</code>
 +
 +<code tcl>
 +#SEND DTMF CODE 25#
 + if {$cmd == "25"} {
 +  set result [catch {exec ping -c 1 google.com }];
 +  if {$result == 0} {
 +     puts "Internet online :Connected"
 +     playMsg "Default/internet_status" "Internet_Connection_Active";
 +     #speeling of the internet public IP address
 +     set runcmd [exec curl http://ip.42.pl/short 2>&1];  #Internet IP adress
 +     puts "Internet IP Adress : $runcmd"
 +     set splitip [split $runcmd .]
 +     lassign $splitip ip1 ip2 ip3 ip4
 +     spellWord $ip1;
 +     playMsg "Default" "decimal";
 +     spellWord $ip2;
 +     playMsg "Default" "decimal";
 +     spellWord $ip3;
 +     playMsg "Default" "decimal";
 +     spellWord $ip4;
 +} else {
 +     puts "Internet online :Disconnected"
 +     playMsg "Default/internet_status" "Internet_Connection_Inactive";
 +}
 +    return 1
 +  }
 +
 +  return 0
 +}
 +</code>
 +
 +In this TCL code , we also integrate from the line ''#speeling of the internet public IP address'' a few lines that will allow players to play one character at your public IP address . This reading uses the standard function ''spellWord'' .
 +
 +Both read messages are two sound files wav to set up in a subdirectory , eg
 +''/usr/share/svxlink/sounds/fr_FR/internet_status/''.
 +
 +Files available on https://github.com/F8ASB
 +{{youtube>T6ca5rRzYdg?medium}}