Prosody installation guide: test programs: tonedet

This is a comprehensive tone detection application. It allows all the tone detection parameters to be specified and is suitable for testing non-standard tables of tones. For testing basic tone detection, there are two simpler programs, detraw and detect.

Go to directory $(TiNG)/test.

You must have these firmware modules loaded:

Run tonedet with the appropriate options (the program is gen-LINUX_V6/tonedet or gen-WINNT_V6/tonedet depending on which operating system you are using).

Command line options are:

-t <timeslot> timeslot to use (see Test program timeslots).
-x <modspec> Use these Prosody processor modules, specified as described in Test programs: Specifying Prosody Processor modules

For example,

	gen-WINNT_V6/tonedet -x x:1.2.3.4/mykey -t 64:0

would start the program with timeslot 64:0 configured as the timeslot to listen on. It does not yet start listening - it prints a prompt and waits for commands to be entered. The prompt looks like this:

	mx:1.2.3.4/mykey[0]

which shows the Prosody processor module is correctly selected (in this example, module 0 on card with address 1.2.3.4). Each line entered is one command, which consists of one character followed by any parameters. The commands are:

CharacterMeaning
f FREQ1 FREQ2 Perform sm_add_input_freq_coeffs() to add a new frequency to the tone table. The parameters are:
ParameterField
FREQ1 lower_limit
FREQ2 upper_limit
For example,
		f 679.6875 710.9375
		
would add the lowest frequency used by DTMF tones. This command responds by printing the tone id returned.
t ID1+N1 ID2+N2 3RD SNR MINPWR TWIST Perform sm_add_input_tone_set() to add a new frequency to the tone table. The parameters are:
ParameterField
ID1 band1_first_freq_coeffs_id
N1 band1_freq_count
ID2 band2_first_freq_coeffs_id
N2 band2_freq_count
3RD req_third_peak
SNR req_signal_to_noise_ratio
MINPWR req_minimum_power
TWIST req_minimum_twist_for_dual_tone
For example,
		t 0+4 4+4 0.0794 0.7556 1e8 10
		
would add a tone set equivalent to the prefedined DTMF tone set (tone set 0). This command responds by printing the tone set id returned.
j TSID WHAT VAL Perform sm_adjust_input_tone_set() to change a tone detection setting. The parameters are:
ParameterField
TSID tone_set_id
WHAT parameter_id. This value may be a symbolic name (such as 3rdPeak). The symbolic names are the names that would be used in a program with the kAdjustToneSet*Param part omitted. Alternatively, this value can be specified as a number and a letter, with the letter indicating whether it sets an integer (i) or floating-point (f) value.
VAL parameter_value. This is interpreted as either an integer or a floating-point value depending on the WHAT parameter.
For example,
		j 0 3rdPeak 0.0794
		
would set the 'third peak' value for toneset 0 to its default. This could also be done numerically with j 0 0f 0.0794
r TSID Perform sm_reset_input_cptones() to clear the set of call-progress tones and specify the tone set for new ones.
c TID [ FID MAX MIN ]* Perform sm_add_input_cptone() to add a new call-progress tone. The TID paramter is the new tone ID, and the remaining parameters specify the cadence of the new tone, and are repeated for each element in the tone. They are:
ParameterField
FID freq_id
MIN minimum_cadence
MAX maximum_cadence
For example,
		c 4 1 288 512 0 128 256 1 288 512
		
would add a call-progress tone the same as the predefined U. K. ring tone (tone 4).
m MODSPEC Select the Prosody processor module to use. Subsequent commands will operate on the specified module. See Test programs: Specifying Prosody Processor modules for details.
l c (letter 'l') Start listening for call progress tones. Listening continue until another 'l' command or until the program is terminated.
l {1,40,64}[EL] [m] [sN] (letter 'l') Start listening for call progress tones. Listening continue until another 'l' command or until the program is terminated. The parameters control the fields passed to sm_listen_for().
ParameterField
1 tone_detection_mode = kSMTone*DetectionNoMinDuration
40 tone_detection_mode = kSMTone*DetectionMinDuration40
64 tone_detection_mode = kSMTone*DetectionMinDuration64
E tone_detection_mode = kSMToneEndDetection*
L tone_detection_mode = kSMToneLenDetection*
m map_tones_to_digits = kSMDTMFToneSetDigitMapping
sN active_tone_set_id = N
For example,
		l 40E m s2
		
would start listening for tones in toneset 2 with minimum duration 40 mS, reporting at the end of each tone and mapping the tones to digits.
# anythingDo nothing. This is intended for use in files of commands for comments.
' testPrint the text. This is intended for use in files of commands so that it's possible to tell how much of the file has been read.

When it detects anything, it prints a description of what was detected. For example:

	Digit *: 42 0

means that it detected the DTMF digit * and that the param0 and param1 fields from sm_get_recognised() were 42 and 0 respectively. .

The source code for this program is provided (detect.c).


This is one of the Prosody test programs .