Skip to content

How to trigger a custom sound recording, tone, morse or event with DTMF

hayden-t edited this page Aug 17, 2021 · 2 revisions

This is just a quick way, by editing your logic event code.

This will be for example /usr/share/svxlink/events.d/RepeaterLogic.tcl as specified by your logic name in svxlink.conf (however copy this to /usr/share/svxlink/events.d/local folder first before editing if not already)

In tcl file change dtmf_cmd_received function as so :

#
# Executed when a DTMF command has been received
#   cmd - The command
#
# Return 1 to hide the command from further processing is SvxLink or
# return 0 to make SvxLink continue processing as normal.
#
proc dtmf_cmd_received {cmd} {
  return [Logic::dtmf_cmd_received $cmd];
}

to for example play the time on DTMF code 123# - note the "return 1" assuming you dont want that command to continue any further. Also if you started to have several of these you would likely give each a dedicated function, rather than put all their code in dtmf_cmd_received

proc dtmf_cmd_received {cmd} {
	puts "command received";
	if {$cmd == "123"} {
		puts "play time";

		set epoch [clock seconds];
		set hour [clock format $epoch -format "%k"];
		regexp {([1-5]?\d)$} [clock format $epoch -format "%M"] -> minute;

		playSilence 250;
		playMsg "Core" "the_time_is";
		playTime $hour $minute;
		playSilence 250;	
		return 1;
	}
  return [Logic::dtmf_cmd_received $cmd];
}

see https://github.com/sm0svx/svxlink/wiki/Events-Handling-System for further event functions

Clone this wiki locally