Sometimes you want to interact with the repeater system so you can do things like automate connections to echolink nodes. This guide will show you the basics for how to send dtmf commands from the console.

STEP 1 – Ensure your system is setup to interpret the DTMF commands, depending on the functionality you want to implement, there is different requirements here.

  • svxlink.conf variables such as the ‘ONLINE_COMMAND’ which can be used to enable or disable logics. This can be used to automate linking and unlinking nodes for nets.
  • /usr/share/svxlink/events.d/local/Logic.tcl; Custom responses to incoming dtmf commands can be added to the general purpose DTMF handler, the template is copied here for reference, just add this code to the path above, and then add the new commands here as desired
proc dtmf_cmd_received {cmd} {
  #global active_module

  # Example: Ignore all commands starting with 3 in the EchoLink module.
  #          Allow commands that have four or more digits.
  #if {$active_module == "EchoLink"} {
  #  if {[string length $cmd] < 4 && [string index $cmd 0] == "3"} {
  #    puts "Ignoring random connect command for module EchoLink: $cmd"
  #    return 1
  #  }
  #}

  # Handle the "force core command" mode where a command is forced to be
  # executed by the core command processor instead of by an active module.
  # The "force core command" mode is entered by prefixing a command by a star.
  #if {$active_module != "" && [string index $cmd 0] != "*"} {
  #  return 0
  #}
  #if {[string index $cmd 0] == "*"} {
  #  set cmd [string range $cmd 1 end]
  #}

  # Example: Custom command executed when DTMF 99 is received
  #if {$cmd == "99"} {
  #  puts "Executing external command"
  #  playMsg "Core" "online"
  #  exec ls &
  #  return 1
  #}

  return 0
}

STEP 2 – enable a virtual serial port to send the commands though to the controller. This is done by adding a path to the svxlink.conf file in the logic section. Typically you will have a single RX section and a single TX section for a repeater logic. This new entry goes into the repeater logic section that pairs them up as a repeater.

[ORP_FullDuplexLogic_Port1]
TYPE=Repeater
RX=RX_Port1
TX=TX_Port1
DTMF_CTRL_PTY=/tmp/svxlink_dtmf
...

STEP 3 – Now that your controller knows how to interpret the DTMF commands, you can send them via the system console. KEY POINT – YOU MUST BE USING THE RIGHT USER ON THE CONSOLE. enter the command to switch to the svxlink user

su svxlink

Now you can use the ‘echo’ command to send the commands to the controller, typically you will need to prepend the DTMF command with an “*” which forces the controller core to listen, if your commands are buried in a module, you may not want the “*” prefix, you will need to experiment and see what is required for your application. ALWAYS SUFFIX WITH A ‘#’ to terminate the command for processing

echo '<dtmf code>#' > /tmp/svxlink_dtmf

Example:

echo '*123450#' > /tmp/svxlink_dtmf