[Asterisk-code-review] app_milliwatt: Timing fix (asterisk[19])

N A asteriskteam at digium.com
Thu Aug 19 07:09:40 CDT 2021


N A has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/16336 )


Change subject: app_milliwatt: Timing fix
......................................................................

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
---
M apps/app_milliwatt.c
A doc/CHANGES-staging/app_milliwatt.txt
2 files changed, 29 insertions(+), 5 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/36/16336/1

diff --git a/apps/app_milliwatt.c b/apps/app_milliwatt.c
index 64513fe..1ca6621 100644
--- a/apps/app_milliwatt.c
+++ b/apps/app_milliwatt.c
@@ -40,19 +40,29 @@
 /*** DOCUMENTATION
 	<application name="Milliwatt" language="en_US">
 		<synopsis>
-			Generate a Constant 1004Hz tone at 0dbm (mu-law).
+			Generates a 1004 Hz test tone at 0dbm (mu-law).
 		</synopsis>
 		<syntax>
 			<parameter name="options">
 				<optionlist>
+					<option name="m">
+						<para>Generate a 1004 Hz Milliwatt test tone at 0dbm, with a
+						1 second silent interval. This option must be specified
+						if you are using this for a milliwatt test line.</para>
+					</option>
 					<option name="o">
-						<para>Generate the tone at 1000Hz like previous version.</para>
+						<para>Generate a constant tone at 1000 Hz like previous version.</para>
 					</option>
 				</optionlist>
 			</parameter>
 		</syntax>
 		<description>
-			<para>Previous versions of this application generated the tone at 1000Hz.  If for
+			<para>Generates a 1004 Hz test tone.</para>
+			<para>By default, this application does not provide a Milliwatt test tone. It simply
+			plays a 1004 Hz tone, which is not suitable for performing a milliwatt test.
+			The <literal>m</literal> option should be used so that a real Milliwatt test tone
+			is provided. This will include a 1 second silent interval every 10 seconds.</para>
+			<para>Previous versions of this application generated a constant tone at 1000 Hz. If for
 			some reason you would prefer that behavior, supply the <literal>o</literal> option to get the
 			old behavior.</para>
 		</description>
@@ -155,8 +165,11 @@
 	if (!ast_strlen_zero(options) && strchr(options, 'o')) {
 		return old_milliwatt_exec(chan);
 	}
-
-	res = ast_playtones_start(chan, 23255, "1004/1000", 0);
+	if (!ast_strlen_zero(options) && strchr(options, 'm')) {
+		res = ast_playtones_start(chan, 23255, "1004/9000,0/1000", 0);
+	} else {
+		res = ast_playtones_start(chan, 23255, "1004/1000", 0);
+	}
 
 	while (!res) {
 		res = ast_safe_sleep(chan, 10000);
diff --git a/doc/CHANGES-staging/app_milliwatt.txt b/doc/CHANGES-staging/app_milliwatt.txt
new file mode 100644
index 0000000..434ace2
--- /dev/null
+++ b/doc/CHANGES-staging/app_milliwatt.txt
@@ -0,0 +1,11 @@
+Subject: app_milliwatt
+
+The Milliwatt application's existing behavior is
+incorrect in that it plays a constant tone, which
+is not how digital milliwatt test lines actually
+work.
+
+An option is added so that a proper milliwatt test
+tone can be provided, including a 1 second silent
+interval every 10 seconds. However, for compatability
+reasons, the default behavior remains unchanged.

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/16336
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 19
Gerrit-Change-Id: I73ccc6c6fcaa31931c6fff3b85ad1805b2ce9d8c
Gerrit-Change-Number: 16336
Gerrit-PatchSet: 1
Gerrit-Owner: N A <mail at interlinked.x10host.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20210819/ade55860/attachment-0001.html>


More information about the asterisk-code-review mailing list