<p>George Joseph <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/16295">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Sean Bright: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
Joshua Colp: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">app_nbscat: Remove deprecated module.<br><br>ASTERISK-29590<br><br>Change-Id: I87cf0f536b77d222c8eda003376ac47fae86ed43<br>---<br>D apps/app_nbscat.c<br>A doc/UPGRADE-staging/app_nbscat_removal.txt<br>2 files changed, 6 insertions(+), 225 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/apps/app_nbscat.c b/apps/app_nbscat.c</span><br><span>deleted file mode 100644</span><br><span>index c714cbb..0000000</span><br><span>--- a/apps/app_nbscat.c</span><br><span>+++ /dev/null</span><br><span>@@ -1,225 +0,0 @@</span><br><span style="color: hsl(0, 100%, 40%);">-/*</span><br><span style="color: hsl(0, 100%, 40%);">- * Asterisk -- An open source telephony toolkit.</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * Copyright (C) 1999 - 2005, Digium, Inc.</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * Mark Spencer <markster@digium.com></span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * See http://www.asterisk.org for more information about</span><br><span style="color: hsl(0, 100%, 40%);">- * the Asterisk project. Please do not directly contact</span><br><span style="color: hsl(0, 100%, 40%);">- * any of the maintainers of this project for assistance;</span><br><span style="color: hsl(0, 100%, 40%);">- * the project provides a web site, mailing lists and IRC</span><br><span style="color: hsl(0, 100%, 40%);">- * channels for your use.</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * This program is free software, distributed under the terms of</span><br><span style="color: hsl(0, 100%, 40%);">- * the GNU General Public License Version 2. See the LICENSE file</span><br><span style="color: hsl(0, 100%, 40%);">- * at the top of the source tree.</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-/*! \file</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * \brief Silly application to play an NBScat file -- uses nbscat8k</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * \author Mark Spencer <markster@digium.com></span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * \ingroup applications</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-/*** MODULEINFO</span><br><span style="color: hsl(0, 100%, 40%);">- <support_level>deprecated</support_level></span><br><span style="color: hsl(0, 100%, 40%);">- <deprecated_in>16</deprecated_in></span><br><span style="color: hsl(0, 100%, 40%);">- <removed_in>19</removed_in></span><br><span style="color: hsl(0, 100%, 40%);">- ***/</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-#include "asterisk.h"</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-#include <fcntl.h></span><br><span style="color: hsl(0, 100%, 40%);">-#include <sys/time.h></span><br><span style="color: hsl(0, 100%, 40%);">-#include <sys/socket.h></span><br><span style="color: hsl(0, 100%, 40%);">-#include <signal.h></span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-#include "asterisk/lock.h"</span><br><span style="color: hsl(0, 100%, 40%);">-#include "asterisk/file.h"</span><br><span style="color: hsl(0, 100%, 40%);">-#include "asterisk/channel.h"</span><br><span style="color: hsl(0, 100%, 40%);">-#include "asterisk/frame.h"</span><br><span style="color: hsl(0, 100%, 40%);">-#include "asterisk/pbx.h"</span><br><span style="color: hsl(0, 100%, 40%);">-#include "asterisk/module.h"</span><br><span style="color: hsl(0, 100%, 40%);">-#include "asterisk/translate.h"</span><br><span style="color: hsl(0, 100%, 40%);">-#include "asterisk/app.h"</span><br><span style="color: hsl(0, 100%, 40%);">-#include "asterisk/format_cache.h"</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-/*** DOCUMENTATION</span><br><span style="color: hsl(0, 100%, 40%);">- <application name="NBScat" language="en_US"></span><br><span style="color: hsl(0, 100%, 40%);">- <synopsis></span><br><span style="color: hsl(0, 100%, 40%);">- Play an NBS local stream.</span><br><span style="color: hsl(0, 100%, 40%);">- </synopsis></span><br><span style="color: hsl(0, 100%, 40%);">- <syntax /></span><br><span style="color: hsl(0, 100%, 40%);">- <description></span><br><span style="color: hsl(0, 100%, 40%);">- <para>Executes nbscat to listen to the local NBS stream.</span><br><span style="color: hsl(0, 100%, 40%);">- User can exit by pressing any key.</para></span><br><span style="color: hsl(0, 100%, 40%);">- </description></span><br><span style="color: hsl(0, 100%, 40%);">- </application></span><br><span style="color: hsl(0, 100%, 40%);">- ***/</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-#define LOCAL_NBSCAT "/usr/local/bin/nbscat8k"</span><br><span style="color: hsl(0, 100%, 40%);">-#define NBSCAT "/usr/bin/nbscat8k"</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-#ifndef AF_LOCAL</span><br><span style="color: hsl(0, 100%, 40%);">-#define AF_LOCAL AF_UNIX</span><br><span style="color: hsl(0, 100%, 40%);">-#endif</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-static char *app = "NBScat";</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-static int NBScatplay(int fd)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- int res;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_safe_fork(0);</span><br><span style="color: hsl(0, 100%, 40%);">- if (res < 0) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING, "Fork failed\n");</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (res) {</span><br><span style="color: hsl(0, 100%, 40%);">- return res;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (ast_opt_high_priority)</span><br><span style="color: hsl(0, 100%, 40%);">- ast_set_priority(0);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- dup2(fd, STDOUT_FILENO);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_close_fds_above_n(STDERR_FILENO);</span><br><span style="color: hsl(0, 100%, 40%);">- /* Most commonly installed in /usr/local/bin */</span><br><span style="color: hsl(0, 100%, 40%);">- execl(NBSCAT, "nbscat8k", "-d", (char *)NULL);</span><br><span style="color: hsl(0, 100%, 40%);">- execl(LOCAL_NBSCAT, "nbscat8k", "-d", (char *)NULL);</span><br><span style="color: hsl(0, 100%, 40%);">- fprintf(stderr, "Execute of nbscat8k failed\n");</span><br><span style="color: hsl(0, 100%, 40%);">- _exit(0);</span><br><span style="color: hsl(0, 100%, 40%);">-}</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-static int timed_read(int fd, void *data, int datalen)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- int res;</span><br><span style="color: hsl(0, 100%, 40%);">- struct pollfd fds[1];</span><br><span style="color: hsl(0, 100%, 40%);">- fds[0].fd = fd;</span><br><span style="color: hsl(0, 100%, 40%);">- fds[0].events = POLLIN;</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_poll(fds, 1, 2000);</span><br><span style="color: hsl(0, 100%, 40%);">- if (res < 1) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_NOTICE, "Selected timed out/errored out with %d\n", res);</span><br><span style="color: hsl(0, 100%, 40%);">- return -1;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- return read(fd, data, datalen);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-}</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-static int NBScat_exec(struct ast_channel *chan, const char *data)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- int res=0;</span><br><span style="color: hsl(0, 100%, 40%);">- int fds[2];</span><br><span style="color: hsl(0, 100%, 40%);">- int ms = -1;</span><br><span style="color: hsl(0, 100%, 40%);">- int pid = -1;</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_format *owriteformat;</span><br><span style="color: hsl(0, 100%, 40%);">- struct timeval next;</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_frame *f;</span><br><span style="color: hsl(0, 100%, 40%);">- struct myframe {</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_frame f;</span><br><span style="color: hsl(0, 100%, 40%);">- char offset[AST_FRIENDLY_OFFSET];</span><br><span style="color: hsl(0, 100%, 40%);">- short frdata[160];</span><br><span style="color: hsl(0, 100%, 40%);">- } myf;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (socketpair(AF_LOCAL, SOCK_STREAM, 0, fds)) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING, "Unable to create socketpair\n");</span><br><span style="color: hsl(0, 100%, 40%);">- return -1;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- ast_stopstream(chan);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- owriteformat = ao2_bump(ast_channel_writeformat(chan));</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_set_write_format(chan, ast_format_slin);</span><br><span style="color: hsl(0, 100%, 40%);">- if (res < 0) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING, "Unable to set write format to signed linear\n");</span><br><span style="color: hsl(0, 100%, 40%);">- ao2_cleanup(owriteformat);</span><br><span style="color: hsl(0, 100%, 40%);">- return -1;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- myf.f.frametype = AST_FRAME_VOICE;</span><br><span style="color: hsl(0, 100%, 40%);">- myf.f.subclass.format = ast_format_slin;</span><br><span style="color: hsl(0, 100%, 40%);">- myf.f.mallocd = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- myf.f.offset = AST_FRIENDLY_OFFSET;</span><br><span style="color: hsl(0, 100%, 40%);">- myf.f.src = __PRETTY_FUNCTION__;</span><br><span style="color: hsl(0, 100%, 40%);">- myf.f.delivery.tv_sec = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- myf.f.delivery.tv_usec = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- myf.f.data.ptr = myf.frdata;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- res = NBScatplay(fds[1]);</span><br><span style="color: hsl(0, 100%, 40%);">- /* Wait 1000 ms first */</span><br><span style="color: hsl(0, 100%, 40%);">- next = ast_tvnow();</span><br><span style="color: hsl(0, 100%, 40%);">- next.tv_sec += 1;</span><br><span style="color: hsl(0, 100%, 40%);">- if (res >= 0) {</span><br><span style="color: hsl(0, 100%, 40%);">- pid = res;</span><br><span style="color: hsl(0, 100%, 40%);">- /* Order is important -- there's almost always going to be mp3... we want to prioritize the</span><br><span style="color: hsl(0, 100%, 40%);">- user */</span><br><span style="color: hsl(0, 100%, 40%);">- for (;;) {</span><br><span style="color: hsl(0, 100%, 40%);">- ms = ast_tvdiff_ms(next, ast_tvnow());</span><br><span style="color: hsl(0, 100%, 40%);">- if (ms <= 0) {</span><br><span style="color: hsl(0, 100%, 40%);">- res = timed_read(fds[0], myf.frdata, sizeof(myf.frdata));</span><br><span style="color: hsl(0, 100%, 40%);">- if (res > 0) {</span><br><span style="color: hsl(0, 100%, 40%);">- myf.f.datalen = res;</span><br><span style="color: hsl(0, 100%, 40%);">- myf.f.samples = res / 2;</span><br><span style="color: hsl(0, 100%, 40%);">- if (ast_write(chan, &myf.f) < 0) {</span><br><span style="color: hsl(0, 100%, 40%);">- res = -1;</span><br><span style="color: hsl(0, 100%, 40%);">- break;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- } else {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_debug(1, "No more mp3\n");</span><br><span style="color: hsl(0, 100%, 40%);">- res = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- break;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- next = ast_tvadd(next, ast_samp2tv(myf.f.samples, 8000));</span><br><span style="color: hsl(0, 100%, 40%);">- } else {</span><br><span style="color: hsl(0, 100%, 40%);">- ms = ast_waitfor(chan, ms);</span><br><span style="color: hsl(0, 100%, 40%);">- if (ms < 0) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_debug(1, "Hangup detected\n");</span><br><span style="color: hsl(0, 100%, 40%);">- res = -1;</span><br><span style="color: hsl(0, 100%, 40%);">- break;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- if (ms) {</span><br><span style="color: hsl(0, 100%, 40%);">- f = ast_read(chan);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!f) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_debug(1, "Null frame == hangup() detected\n");</span><br><span style="color: hsl(0, 100%, 40%);">- res = -1;</span><br><span style="color: hsl(0, 100%, 40%);">- break;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- if (f->frametype == AST_FRAME_DTMF) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_debug(1, "User pressed a key\n");</span><br><span style="color: hsl(0, 100%, 40%);">- ast_frfree(f);</span><br><span style="color: hsl(0, 100%, 40%);">- res = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- break;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- ast_frfree(f);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- close(fds[0]);</span><br><span style="color: hsl(0, 100%, 40%);">- close(fds[1]);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_frfree(&myf.f);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (pid > -1)</span><br><span style="color: hsl(0, 100%, 40%);">- kill(pid, SIGKILL);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res && owriteformat)</span><br><span style="color: hsl(0, 100%, 40%);">- ast_set_write_format(chan, owriteformat);</span><br><span style="color: hsl(0, 100%, 40%);">- ao2_cleanup(owriteformat);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- return res;</span><br><span style="color: hsl(0, 100%, 40%);">-}</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-static int unload_module(void)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- return ast_unregister_application(app);</span><br><span style="color: hsl(0, 100%, 40%);">-}</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-static int load_module(void)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- return ast_register_application_xml(app, NBScat_exec);</span><br><span style="color: hsl(0, 100%, 40%);">-}</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-AST_MODULE_INFO_STANDARD_DEPRECATED(ASTERISK_GPL_KEY, "Silly NBS Stream Application");</span><br><span>diff --git a/doc/UPGRADE-staging/app_nbscat_removal.txt b/doc/UPGRADE-staging/app_nbscat_removal.txt</span><br><span>new file mode 100644</span><br><span>index 0000000..a1d15d8</span><br><span>--- /dev/null</span><br><span>+++ b/doc/UPGRADE-staging/app_nbscat_removal.txt</span><br><span>@@ -0,0 +1,6 @@</span><br><span style="color: hsl(120, 100%, 40%);">+Subject: app_nbscat</span><br><span style="color: hsl(120, 100%, 40%);">+Master-Only: True</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+This module was deprecated in Asterisk 16</span><br><span style="color: hsl(120, 100%, 40%);">+and is now being removed in accordance with</span><br><span style="color: hsl(120, 100%, 40%);">+the Asterisk Module Deprecation policy.</span><br><span></span><br></pre><div style="white-space:pre-wrap"></div><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/16295">change 16295</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/16295"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 19 </div>
<div style="display:none"> Gerrit-Change-Id: I87cf0f536b77d222c8eda003376ac47fae86ed43 </div>
<div style="display:none"> Gerrit-Change-Number: 16295 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Sean Bright <sean@seanbright.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>