Skip to content

Commit 314d877

Browse files
InterLinked1kharwell
authored andcommitted
app_milliwatt: Timing fix
The Milliwatt application uses incorrect tone timings that cause it to play the 1004 Hz tone constantly. This adds an option to enable the correct timing behavior, so that the Milliwatt application can be used for milliwatt test lines. The default behavior remains unchanged for compatability reasons, even though it is incorrect. ASTERISK-29575 #close Change-Id: I73ccc6c6fcaa31931c6fff3b85ad1805b2ce9d8c
1 parent 85ef06d commit 314d877

File tree

2 files changed

+29
-5
lines changed

2 files changed

+29
-5
lines changed

apps/app_milliwatt.c

+18-5
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,29 @@
4040
/*** DOCUMENTATION
4141
<application name="Milliwatt" language="en_US">
4242
<synopsis>
43-
Generate a Constant 1004Hz tone at 0dbm (mu-law).
43+
Generates a 1004 Hz test tone at 0dbm (mu-law).
4444
</synopsis>
4545
<syntax>
4646
<parameter name="options">
4747
<optionlist>
48+
<option name="m">
49+
<para>Generate a 1004 Hz Milliwatt test tone at 0dbm, with a
50+
1 second silent interval. This option must be specified
51+
if you are using this for a milliwatt test line.</para>
52+
</option>
4853
<option name="o">
49-
<para>Generate the tone at 1000Hz like previous version.</para>
54+
<para>Generate a constant tone at 1000 Hz like previous version.</para>
5055
</option>
5156
</optionlist>
5257
</parameter>
5358
</syntax>
5459
<description>
55-
<para>Previous versions of this application generated the tone at 1000Hz. If for
60+
<para>Generates a 1004 Hz test tone.</para>
61+
<para>By default, this application does not provide a Milliwatt test tone. It simply
62+
plays a 1004 Hz tone, which is not suitable for performing a milliwatt test.
63+
The <literal>m</literal> option should be used so that a real Milliwatt test tone
64+
is provided. This will include a 1 second silent interval every 10 seconds.</para>
65+
<para>Previous versions of this application generated a constant tone at 1000 Hz. If for
5666
some reason you would prefer that behavior, supply the <literal>o</literal> option to get the
5767
old behavior.</para>
5868
</description>
@@ -155,8 +165,11 @@ static int milliwatt_exec(struct ast_channel *chan, const char *data)
155165
if (!ast_strlen_zero(options) && strchr(options, 'o')) {
156166
return old_milliwatt_exec(chan);
157167
}
158-
159-
res = ast_playtones_start(chan, 23255, "1004/1000", 0);
168+
if (!ast_strlen_zero(options) && strchr(options, 'm')) {
169+
res = ast_playtones_start(chan, 23255, "1004/9000,0/1000", 0);
170+
} else {
171+
res = ast_playtones_start(chan, 23255, "1004/1000", 0);
172+
}
160173

161174
while (!res) {
162175
res = ast_safe_sleep(chan, 10000);

doc/CHANGES-staging/app_milliwatt.txt

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Subject: app_milliwatt
2+
3+
The Milliwatt application's existing behavior is
4+
incorrect in that it plays a constant tone, which
5+
is not how digital milliwatt test lines actually
6+
work.
7+
8+
An option is added so that a proper milliwatt test
9+
tone can be provided, including a 1 second silent
10+
interval every 10 seconds. However, for compatability
11+
reasons, the default behavior remains unchanged.

0 commit comments

Comments
 (0)