<p>George Joseph <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/19564">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span></span><br></pre><div style="white-space:pre-wrap">Approvals:
George Joseph: Looks good to me, approved; Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">chan_alsa: Remove deprecated module.<br><br>ASTERISK-30298<br><br>Change-Id: I5c8afb781528afdf55d237e3bffa5e4a862ae8c7<br>---<br>M agi/jukebox.agi<br>M build_tools/menuselect-deps.in<br>D channels/chan_alsa.c<br>M channels/chan_console.c<br>D configs/samples/alsa.conf.sample<br>M configs/samples/modules.conf.sample<br>M configure<br>M configure.ac<br>M contrib/scripts/install_prereq<br>A doc/UPGRADE-staging/chan_alsa_removal.txt<br>M include/asterisk/autoconfig.h.in<br>M include/asterisk/doxygen/licensing.h<br>M makeopts.in<br>M menuselect/example_menuselect-tree<br>M menuselect/test/menuselect-tree<br>M tests/CI/buildAsterisk.sh<br>16 files changed, 31 insertions(+), 1,291 deletions(-)<br><br></pre>
<pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/agi/jukebox.agi b/agi/jukebox.agi</span><br><span>index 43d8978..3e83110 100755</span><br><span>--- a/agi/jukebox.agi</span><br><span>+++ b/agi/jukebox.agi</span><br><span>@@ -51,8 +51,7 @@</span><br><span> # going to http://www.mpg123.de/cgi-bin/sitexplorer.cgi?/mpg123/</span><br><span> # Be sure to download mpg123-0.59r.tar.gz because it is known to</span><br><span> # work with Asterisk and hopefully isn't the release with that</span><br><span style="color: hsl(0, 100%, 40%);">-# awful security problem. If you're using Fedora Core 3 with</span><br><span style="color: hsl(0, 100%, 40%);">-# Alsa like me, make linux-alsa isn't going to work. Do make</span><br><span style="color: hsl(120, 100%, 40%);">+# awful security problem. If you're using Fedora Core 3 do make</span><br><span> # linux-devel and you're peachy keen.</span><br><span> #</span><br><span> # - You won't get nifty STDERR debug messages if you're using a</span><br><span>diff --git a/build_tools/menuselect-deps.in b/build_tools/menuselect-deps.in</span><br><span>index 9a07214..f616f64 100644</span><br><span>--- a/build_tools/menuselect-deps.in</span><br><span>+++ b/build_tools/menuselect-deps.in</span><br><span>@@ -1,4 +1,3 @@</span><br><span style="color: hsl(0, 100%, 40%);">-ALSA=@PBX_ALSA@</span><br><span> BLUETOOTH=@PBX_BLUETOOTH@</span><br><span> BEANSTALK=@PBX_BEANSTALK@</span><br><span> COROSYNC=@PBX_COROSYNC@</span><br><span>diff --git a/channels/chan_alsa.c b/channels/chan_alsa.c</span><br><span>deleted file mode 100644</span><br><span>index 35bb34b..0000000</span><br><span>--- a/channels/chan_alsa.c</span><br><span>+++ /dev/null</span><br><span>@@ -1,1047 +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%);">- * By Matthew Fredrickson <creslin@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%);">- * \brief ALSA sound card channel driver</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * \author Matthew Fredrickson <creslin@digium.com></span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * \ingroup channel_drivers</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%);">-/*! \li \ref chan_alsa.c uses the configuration file \ref alsa.conf</span><br><span style="color: hsl(0, 100%, 40%);">- * \addtogroup configuration_file</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%);">-/*! \page alsa.conf alsa.conf</span><br><span style="color: hsl(0, 100%, 40%);">- * \verbinclude alsa.conf.sample</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%);">- <depend>alsa</depend></span><br><span style="color: hsl(0, 100%, 40%);">- <defaultenabled>no</defaultenabled></span><br><span style="color: hsl(0, 100%, 40%);">- <support_level>deprecated</support_level></span><br><span style="color: hsl(0, 100%, 40%);">- <replacement>chan_console</replacement></span><br><span style="color: hsl(0, 100%, 40%);">- <deprecated_in>19</deprecated_in></span><br><span style="color: hsl(0, 100%, 40%);">- <removed_in>21</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 <errno.h></span><br><span style="color: hsl(0, 100%, 40%);">-#ifndef ESTRPIPE</span><br><span style="color: hsl(0, 100%, 40%);">-#define ESTRPIPE EPIPE</span><br><span style="color: hsl(0, 100%, 40%);">-#endif</span><br><span style="color: hsl(0, 100%, 40%);">-#include <fcntl.h></span><br><span style="color: hsl(0, 100%, 40%);">-#include <sys/ioctl.h></span><br><span style="color: hsl(0, 100%, 40%);">-#include <sys/time.h></span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-#define ALSA_PCM_NEW_HW_PARAMS_API</span><br><span style="color: hsl(0, 100%, 40%);">-#define ALSA_PCM_NEW_SW_PARAMS_API</span><br><span style="color: hsl(0, 100%, 40%);">-#include <alsa/asoundlib.h></span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-#include "asterisk/frame.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/module.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/config.h"</span><br><span style="color: hsl(0, 100%, 40%);">-#include "asterisk/cli.h"</span><br><span style="color: hsl(0, 100%, 40%);">-#include "asterisk/utils.h"</span><br><span style="color: hsl(0, 100%, 40%);">-#include "asterisk/causes.h"</span><br><span style="color: hsl(0, 100%, 40%);">-#include "asterisk/endian.h"</span><br><span style="color: hsl(0, 100%, 40%);">-#include "asterisk/stringfields.h"</span><br><span style="color: hsl(0, 100%, 40%);">-#include "asterisk/abstract_jb.h"</span><br><span style="color: hsl(0, 100%, 40%);">-#include "asterisk/musiconhold.h"</span><br><span style="color: hsl(0, 100%, 40%);">-#include "asterisk/poll-compat.h"</span><br><span style="color: hsl(0, 100%, 40%);">-#include "asterisk/stasis_channels.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%);">-/*! Global jitterbuffer configuration - by default, jb is disabled</span><br><span style="color: hsl(0, 100%, 40%);">- * \note Values shown here match the defaults shown in alsa.conf.sample */</span><br><span style="color: hsl(0, 100%, 40%);">-static struct ast_jb_conf default_jbconf = {</span><br><span style="color: hsl(0, 100%, 40%);">- .flags = 0,</span><br><span style="color: hsl(0, 100%, 40%);">- .max_size = 200,</span><br><span style="color: hsl(0, 100%, 40%);">- .resync_threshold = 1000,</span><br><span style="color: hsl(0, 100%, 40%);">- .impl = "fixed",</span><br><span style="color: hsl(0, 100%, 40%);">- .target_extra = 40,</span><br><span style="color: hsl(0, 100%, 40%);">-};</span><br><span style="color: hsl(0, 100%, 40%);">-static struct ast_jb_conf global_jbconf;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-#define DEBUG 0</span><br><span style="color: hsl(0, 100%, 40%);">-/* Which device to use */</span><br><span style="color: hsl(0, 100%, 40%);">-#define ALSA_INDEV "default"</span><br><span style="color: hsl(0, 100%, 40%);">-#define ALSA_OUTDEV "default"</span><br><span style="color: hsl(0, 100%, 40%);">-#define DESIRED_RATE 8000</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-/* Lets use 160 sample frames, just like GSM. */</span><br><span style="color: hsl(0, 100%, 40%);">-#define FRAME_SIZE 160</span><br><span style="color: hsl(0, 100%, 40%);">-#define PERIOD_FRAMES 80 /* 80 Frames, at 2 bytes each */</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-/* When you set the frame size, you have to come up with</span><br><span style="color: hsl(0, 100%, 40%);">- the right buffer format as well. */</span><br><span style="color: hsl(0, 100%, 40%);">-/* 5 64-byte frames = one frame */</span><br><span style="color: hsl(0, 100%, 40%);">-#define BUFFER_FMT ((buffersize * 10) << 16) | (0x0006);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-/* Don't switch between read/write modes faster than every 300 ms */</span><br><span style="color: hsl(0, 100%, 40%);">-#define MIN_SWITCH_TIME 600</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-#if __BYTE_ORDER == __LITTLE_ENDIAN</span><br><span style="color: hsl(0, 100%, 40%);">-static snd_pcm_format_t format = SND_PCM_FORMAT_S16_LE;</span><br><span style="color: hsl(0, 100%, 40%);">-#else</span><br><span style="color: hsl(0, 100%, 40%);">-static snd_pcm_format_t format = SND_PCM_FORMAT_S16_BE;</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 indevname[50] = ALSA_INDEV;</span><br><span style="color: hsl(0, 100%, 40%);">-static char outdevname[50] = ALSA_OUTDEV;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-static int silencesuppression = 0;</span><br><span style="color: hsl(0, 100%, 40%);">-static int silencethreshold = 1000;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-AST_MUTEX_DEFINE_STATIC(alsalock);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-static const char tdesc[] = "ALSA Console Channel Driver";</span><br><span style="color: hsl(0, 100%, 40%);">-static const char config[] = "alsa.conf";</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-static char context[AST_MAX_CONTEXT] = "default";</span><br><span style="color: hsl(0, 100%, 40%);">-static char language[MAX_LANGUAGE] = "";</span><br><span style="color: hsl(0, 100%, 40%);">-static char exten[AST_MAX_EXTENSION] = "s";</span><br><span style="color: hsl(0, 100%, 40%);">-static char mohinterpret[MAX_MUSICCLASS];</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-static int hookstate = 0;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-static struct chan_alsa_pvt {</span><br><span style="color: hsl(0, 100%, 40%);">- /* We only have one ALSA structure -- near sighted perhaps, but it</span><br><span style="color: hsl(0, 100%, 40%);">- keeps this driver as simple as possible -- as it should be. */</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_channel *owner;</span><br><span style="color: hsl(0, 100%, 40%);">- char exten[AST_MAX_EXTENSION];</span><br><span style="color: hsl(0, 100%, 40%);">- char context[AST_MAX_CONTEXT];</span><br><span style="color: hsl(0, 100%, 40%);">- snd_pcm_t *icard, *ocard;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-} alsa;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-/* Number of buffers... Each is FRAMESIZE/8 ms long. For example</span><br><span style="color: hsl(0, 100%, 40%);">- with 160 sample frames, and a buffer size of 3, we have a 60ms buffer,</span><br><span style="color: hsl(0, 100%, 40%);">- usually plenty. */</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-#define MAX_BUFFER_SIZE 100</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-/* File descriptors for sound device */</span><br><span style="color: hsl(0, 100%, 40%);">-static int readdev = -1;</span><br><span style="color: hsl(0, 100%, 40%);">-static int writedev = -1;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-static int autoanswer = 1;</span><br><span style="color: hsl(0, 100%, 40%);">-static int mute = 0;</span><br><span style="color: hsl(0, 100%, 40%);">-static int noaudiocapture = 0;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-static struct ast_channel *alsa_request(const char *type, struct ast_format_cap *cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *data, int *cause);</span><br><span style="color: hsl(0, 100%, 40%);">-static int alsa_digit(struct ast_channel *c, char digit, unsigned int duration);</span><br><span style="color: hsl(0, 100%, 40%);">-static int alsa_text(struct ast_channel *c, const char *text);</span><br><span style="color: hsl(0, 100%, 40%);">-static int alsa_hangup(struct ast_channel *c);</span><br><span style="color: hsl(0, 100%, 40%);">-static int alsa_answer(struct ast_channel *c);</span><br><span style="color: hsl(0, 100%, 40%);">-static struct ast_frame *alsa_read(struct ast_channel *chan);</span><br><span style="color: hsl(0, 100%, 40%);">-static int alsa_call(struct ast_channel *c, const char *dest, int timeout);</span><br><span style="color: hsl(0, 100%, 40%);">-static int alsa_write(struct ast_channel *chan, struct ast_frame *f);</span><br><span style="color: hsl(0, 100%, 40%);">-static int alsa_indicate(struct ast_channel *chan, int cond, const void *data, size_t datalen);</span><br><span style="color: hsl(0, 100%, 40%);">-static int alsa_fixup(struct ast_channel *oldchan, struct ast_channel *newchan);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-static struct ast_channel_tech alsa_tech = {</span><br><span style="color: hsl(0, 100%, 40%);">- .type = "Console",</span><br><span style="color: hsl(0, 100%, 40%);">- .description = tdesc,</span><br><span style="color: hsl(0, 100%, 40%);">- .requester = alsa_request,</span><br><span style="color: hsl(0, 100%, 40%);">- .send_digit_end = alsa_digit,</span><br><span style="color: hsl(0, 100%, 40%);">- .send_text = alsa_text,</span><br><span style="color: hsl(0, 100%, 40%);">- .hangup = alsa_hangup,</span><br><span style="color: hsl(0, 100%, 40%);">- .answer = alsa_answer,</span><br><span style="color: hsl(0, 100%, 40%);">- .read = alsa_read,</span><br><span style="color: hsl(0, 100%, 40%);">- .call = alsa_call,</span><br><span style="color: hsl(0, 100%, 40%);">- .write = alsa_write,</span><br><span style="color: hsl(0, 100%, 40%);">- .indicate = alsa_indicate,</span><br><span style="color: hsl(0, 100%, 40%);">- .fixup = alsa_fixup,</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 snd_pcm_t *alsa_card_init(char *dev, snd_pcm_stream_t stream)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- int err;</span><br><span style="color: hsl(0, 100%, 40%);">- int direction;</span><br><span style="color: hsl(0, 100%, 40%);">- snd_pcm_t *handle = NULL;</span><br><span style="color: hsl(0, 100%, 40%);">- snd_pcm_hw_params_t *hwparams = NULL;</span><br><span style="color: hsl(0, 100%, 40%);">- snd_pcm_sw_params_t *swparams = NULL;</span><br><span style="color: hsl(0, 100%, 40%);">- struct pollfd pfd;</span><br><span style="color: hsl(0, 100%, 40%);">- snd_pcm_uframes_t period_size = PERIOD_FRAMES * 4;</span><br><span style="color: hsl(0, 100%, 40%);">- snd_pcm_uframes_t buffer_size = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- unsigned int rate = DESIRED_RATE;</span><br><span style="color: hsl(0, 100%, 40%);">- snd_pcm_uframes_t start_threshold, stop_threshold;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- err = snd_pcm_open(&handle, dev, stream, SND_PCM_NONBLOCK);</span><br><span style="color: hsl(0, 100%, 40%);">- if (err < 0) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_ERROR, "snd_pcm_open failed: %s\n", snd_strerror(err));</span><br><span style="color: hsl(0, 100%, 40%);">- return NULL;</span><br><span style="color: hsl(0, 100%, 40%);">- } else {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_debug(1, "Opening device %s in %s mode\n", dev, (stream == SND_PCM_STREAM_CAPTURE) ? "read" : "write");</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%);">- hwparams = ast_alloca(snd_pcm_hw_params_sizeof());</span><br><span style="color: hsl(0, 100%, 40%);">- memset(hwparams, 0, snd_pcm_hw_params_sizeof());</span><br><span style="color: hsl(0, 100%, 40%);">- snd_pcm_hw_params_any(handle, hwparams);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- err = snd_pcm_hw_params_set_access(handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED);</span><br><span style="color: hsl(0, 100%, 40%);">- if (err < 0)</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_ERROR, "set_access failed: %s\n", snd_strerror(err));</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- err = snd_pcm_hw_params_set_format(handle, hwparams, format);</span><br><span style="color: hsl(0, 100%, 40%);">- if (err < 0)</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_ERROR, "set_format failed: %s\n", snd_strerror(err));</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- err = snd_pcm_hw_params_set_channels(handle, hwparams, 1);</span><br><span style="color: hsl(0, 100%, 40%);">- if (err < 0)</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_ERROR, "set_channels failed: %s\n", snd_strerror(err));</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- direction = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- err = snd_pcm_hw_params_set_rate_near(handle, hwparams, &rate, &direction);</span><br><span style="color: hsl(0, 100%, 40%);">- if (rate != DESIRED_RATE)</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING, "Rate not correct, requested %d, got %u\n", DESIRED_RATE, rate);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- direction = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- err = snd_pcm_hw_params_set_period_size_near(handle, hwparams, &period_size, &direction);</span><br><span style="color: hsl(0, 100%, 40%);">- if (err < 0)</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_ERROR, "period_size(%lu frames) is bad: %s\n", period_size, snd_strerror(err));</span><br><span style="color: hsl(0, 100%, 40%);">- else {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_debug(1, "Period size is %d\n", err);</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%);">- buffer_size = 4096 * 2; /* period_size * 16; */</span><br><span style="color: hsl(0, 100%, 40%);">- err = snd_pcm_hw_params_set_buffer_size_near(handle, hwparams, &buffer_size);</span><br><span style="color: hsl(0, 100%, 40%);">- if (err < 0)</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING, "Problem setting buffer size of %lu: %s\n", buffer_size, snd_strerror(err));</span><br><span style="color: hsl(0, 100%, 40%);">- else {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_debug(1, "Buffer size is set to %d frames\n", err);</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%);">- err = snd_pcm_hw_params(handle, hwparams);</span><br><span style="color: hsl(0, 100%, 40%);">- if (err < 0)</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_ERROR, "Couldn't set the new hw params: %s\n", snd_strerror(err));</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- swparams = ast_alloca(snd_pcm_sw_params_sizeof());</span><br><span style="color: hsl(0, 100%, 40%);">- memset(swparams, 0, snd_pcm_sw_params_sizeof());</span><br><span style="color: hsl(0, 100%, 40%);">- snd_pcm_sw_params_current(handle, swparams);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (stream == SND_PCM_STREAM_PLAYBACK)</span><br><span style="color: hsl(0, 100%, 40%);">- start_threshold = period_size;</span><br><span style="color: hsl(0, 100%, 40%);">- else</span><br><span style="color: hsl(0, 100%, 40%);">- start_threshold = 1;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- err = snd_pcm_sw_params_set_start_threshold(handle, swparams, start_threshold);</span><br><span style="color: hsl(0, 100%, 40%);">- if (err < 0)</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_ERROR, "start threshold: %s\n", snd_strerror(err));</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (stream == SND_PCM_STREAM_PLAYBACK)</span><br><span style="color: hsl(0, 100%, 40%);">- stop_threshold = buffer_size;</span><br><span style="color: hsl(0, 100%, 40%);">- else</span><br><span style="color: hsl(0, 100%, 40%);">- stop_threshold = buffer_size;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- err = snd_pcm_sw_params_set_stop_threshold(handle, swparams, stop_threshold);</span><br><span style="color: hsl(0, 100%, 40%);">- if (err < 0)</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_ERROR, "stop threshold: %s\n", snd_strerror(err));</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- err = snd_pcm_sw_params(handle, swparams);</span><br><span style="color: hsl(0, 100%, 40%);">- if (err < 0)</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_ERROR, "sw_params: %s\n", snd_strerror(err));</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- err = snd_pcm_poll_descriptors_count(handle);</span><br><span style="color: hsl(0, 100%, 40%);">- if (err <= 0)</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_ERROR, "Unable to get a poll descriptors count, error is %s\n", snd_strerror(err));</span><br><span style="color: hsl(0, 100%, 40%);">- if (err != 1) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_debug(1, "Can't handle more than one device\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%);">- snd_pcm_poll_descriptors(handle, &pfd, err);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_debug(1, "Acquired fd %d from the poll descriptor\n", pfd.fd);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (stream == SND_PCM_STREAM_CAPTURE)</span><br><span style="color: hsl(0, 100%, 40%);">- readdev = pfd.fd;</span><br><span style="color: hsl(0, 100%, 40%);">- else</span><br><span style="color: hsl(0, 100%, 40%);">- writedev = pfd.fd;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- return handle;</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 soundcard_init(void)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- if (!noaudiocapture) {</span><br><span style="color: hsl(0, 100%, 40%);">- alsa.icard = alsa_card_init(indevname, SND_PCM_STREAM_CAPTURE);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!alsa.icard) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_ERROR, "Problem opening alsa capture device\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%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- alsa.ocard = alsa_card_init(outdevname, SND_PCM_STREAM_PLAYBACK);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (!alsa.ocard) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_ERROR, "Problem opening ALSA playback device\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%);">- return writedev;</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 alsa_digit(struct ast_channel *c, char digit, unsigned int duration)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- ast_mutex_lock(&alsalock);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_verbose(" << Console Received digit %c of duration %u ms >> \n",</span><br><span style="color: hsl(0, 100%, 40%);">- digit, duration);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_mutex_unlock(&alsalock);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- return 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 alsa_text(struct ast_channel *c, const char *text)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- ast_mutex_lock(&alsalock);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_verbose(" << Console Received text %s >> \n", text);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_mutex_unlock(&alsalock);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- return 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 void grab_owner(void)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- while (alsa.owner && ast_channel_trylock(alsa.owner)) {</span><br><span style="color: hsl(0, 100%, 40%);">- DEADLOCK_AVOIDANCE(&alsalock);</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 alsa_call(struct ast_channel *c, const char *dest, int timeout)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_frame f = { AST_FRAME_CONTROL };</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- ast_mutex_lock(&alsalock);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_verbose(" << Call placed to '%s' on console >> \n", dest);</span><br><span style="color: hsl(0, 100%, 40%);">- if (autoanswer) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_verbose(" << Auto-answered >> \n");</span><br><span style="color: hsl(0, 100%, 40%);">- if (mute) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_verbose( " << Muted >> \n" );</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- grab_owner();</span><br><span style="color: hsl(0, 100%, 40%);">- if (alsa.owner) {</span><br><span style="color: hsl(0, 100%, 40%);">- f.subclass.integer = AST_CONTROL_ANSWER;</span><br><span style="color: hsl(0, 100%, 40%);">- ast_queue_frame(alsa.owner, &f);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_channel_unlock(alsa.owner);</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_verbose(" << Type 'answer' to answer, or use 'autoanswer' for future calls >> \n");</span><br><span style="color: hsl(0, 100%, 40%);">- grab_owner();</span><br><span style="color: hsl(0, 100%, 40%);">- if (alsa.owner) {</span><br><span style="color: hsl(0, 100%, 40%);">- f.subclass.integer = AST_CONTROL_RINGING;</span><br><span style="color: hsl(0, 100%, 40%);">- ast_queue_frame(alsa.owner, &f);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_channel_unlock(alsa.owner);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_indicate(alsa.owner, AST_CONTROL_RINGING);</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 (!noaudiocapture) {</span><br><span style="color: hsl(0, 100%, 40%);">- snd_pcm_prepare(alsa.icard);</span><br><span style="color: hsl(0, 100%, 40%);">- snd_pcm_start(alsa.icard);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- ast_mutex_unlock(&alsalock);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- return 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 alsa_answer(struct ast_channel *c)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- ast_mutex_lock(&alsalock);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_verbose(" << Console call has been answered >> \n");</span><br><span style="color: hsl(0, 100%, 40%);">- ast_setstate(c, AST_STATE_UP);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!noaudiocapture) {</span><br><span style="color: hsl(0, 100%, 40%);">- snd_pcm_prepare(alsa.icard);</span><br><span style="color: hsl(0, 100%, 40%);">- snd_pcm_start(alsa.icard);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- ast_mutex_unlock(&alsalock);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- return 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 alsa_hangup(struct ast_channel *c)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- ast_mutex_lock(&alsalock);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_channel_tech_pvt_set(c, NULL);</span><br><span style="color: hsl(0, 100%, 40%);">- alsa.owner = NULL;</span><br><span style="color: hsl(0, 100%, 40%);">- ast_verbose(" << Hangup on console >> \n");</span><br><span style="color: hsl(0, 100%, 40%);">- ast_module_unref(ast_module_info->self);</span><br><span style="color: hsl(0, 100%, 40%);">- hookstate = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- if (!noaudiocapture) {</span><br><span style="color: hsl(0, 100%, 40%);">- snd_pcm_drop(alsa.icard);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- ast_mutex_unlock(&alsalock);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- return 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 alsa_write(struct ast_channel *chan, struct ast_frame *f)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- static char sizbuf[8000];</span><br><span style="color: hsl(0, 100%, 40%);">- static int sizpos = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- int len = sizpos;</span><br><span style="color: hsl(0, 100%, 40%);">- int res = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- /* size_t frames = 0; */</span><br><span style="color: hsl(0, 100%, 40%);">- snd_pcm_state_t state;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- ast_mutex_lock(&alsalock);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- /* We have to digest the frame in 160-byte portions */</span><br><span style="color: hsl(0, 100%, 40%);">- if (f->datalen > sizeof(sizbuf) - sizpos) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING, "Frame too large\n");</span><br><span style="color: hsl(0, 100%, 40%);">- res = -1;</span><br><span style="color: hsl(0, 100%, 40%);">- } else {</span><br><span style="color: hsl(0, 100%, 40%);">- memcpy(sizbuf + sizpos, f->data.ptr, f->datalen);</span><br><span style="color: hsl(0, 100%, 40%);">- len += f->datalen;</span><br><span style="color: hsl(0, 100%, 40%);">- state = snd_pcm_state(alsa.ocard);</span><br><span style="color: hsl(0, 100%, 40%);">- if (state == SND_PCM_STATE_XRUN)</span><br><span style="color: hsl(0, 100%, 40%);">- snd_pcm_prepare(alsa.ocard);</span><br><span style="color: hsl(0, 100%, 40%);">- while ((res = snd_pcm_writei(alsa.ocard, sizbuf, len / 2)) == -EAGAIN) {</span><br><span style="color: hsl(0, 100%, 40%);">- usleep(1);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- if (res == -EPIPE) {</span><br><span style="color: hsl(0, 100%, 40%);">-#if DEBUG</span><br><span style="color: hsl(0, 100%, 40%);">- ast_debug(1, "XRUN write\n");</span><br><span style="color: hsl(0, 100%, 40%);">-#endif</span><br><span style="color: hsl(0, 100%, 40%);">- snd_pcm_prepare(alsa.ocard);</span><br><span style="color: hsl(0, 100%, 40%);">- while ((res = snd_pcm_writei(alsa.ocard, sizbuf, len / 2)) == -EAGAIN) {</span><br><span style="color: hsl(0, 100%, 40%);">- usleep(1);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- if (res != len / 2) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_ERROR, "Write error: %s\n", snd_strerror(res));</span><br><span style="color: hsl(0, 100%, 40%);">- res = -1;</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (res < 0) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_ERROR, "Write error %s\n", snd_strerror(res));</span><br><span style="color: hsl(0, 100%, 40%);">- res = -1;</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%);">- if (res == -ESTRPIPE)</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_ERROR, "You've got some big problems\n");</span><br><span style="color: hsl(0, 100%, 40%);">- else if (res < 0)</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_NOTICE, "Error %d on write\n", 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%);">- ast_mutex_unlock(&alsalock);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- return res >= 0 ? 0 : 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%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-static struct ast_frame *alsa_read(struct ast_channel *chan)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- static struct ast_frame f;</span><br><span style="color: hsl(0, 100%, 40%);">- static short __buf[FRAME_SIZE + AST_FRIENDLY_OFFSET / 2];</span><br><span style="color: hsl(0, 100%, 40%);">- short *buf;</span><br><span style="color: hsl(0, 100%, 40%);">- static int readpos = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- static int left = FRAME_SIZE;</span><br><span style="color: hsl(0, 100%, 40%);">- snd_pcm_state_t state;</span><br><span style="color: hsl(0, 100%, 40%);">- int r = 0;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- ast_mutex_lock(&alsalock);</span><br><span style="color: hsl(0, 100%, 40%);">- f.frametype = AST_FRAME_NULL;</span><br><span style="color: hsl(0, 100%, 40%);">- f.subclass.integer = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- f.samples = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- f.datalen = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- f.data.ptr = NULL;</span><br><span style="color: hsl(0, 100%, 40%);">- f.offset = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- f.src = "Console";</span><br><span style="color: hsl(0, 100%, 40%);">- f.mallocd = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- f.delivery.tv_sec = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- f.delivery.tv_usec = 0;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (noaudiocapture) {</span><br><span style="color: hsl(0, 100%, 40%);">- /* Return null frame to asterisk*/</span><br><span style="color: hsl(0, 100%, 40%);">- ast_mutex_unlock(&alsalock);</span><br><span style="color: hsl(0, 100%, 40%);">- return &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%);">- state = snd_pcm_state(alsa.icard);</span><br><span style="color: hsl(0, 100%, 40%);">- if ((state != SND_PCM_STATE_PREPARED) && (state != SND_PCM_STATE_RUNNING)) {</span><br><span style="color: hsl(0, 100%, 40%);">- snd_pcm_prepare(alsa.icard);</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%);">- buf = __buf + AST_FRIENDLY_OFFSET / 2;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- r = snd_pcm_readi(alsa.icard, buf + readpos, left);</span><br><span style="color: hsl(0, 100%, 40%);">- if (r == -EPIPE) {</span><br><span style="color: hsl(0, 100%, 40%);">-#if DEBUG</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_ERROR, "XRUN read\n");</span><br><span style="color: hsl(0, 100%, 40%);">-#endif</span><br><span style="color: hsl(0, 100%, 40%);">- snd_pcm_prepare(alsa.icard);</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (r == -ESTRPIPE) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_ERROR, "-ESTRPIPE\n");</span><br><span style="color: hsl(0, 100%, 40%);">- snd_pcm_prepare(alsa.icard);</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (r < 0) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_ERROR, "Read error: %s\n", snd_strerror(r));</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%);">- /* Return NULL frame on error */</span><br><span style="color: hsl(0, 100%, 40%);">- if (r < 0) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_mutex_unlock(&alsalock);</span><br><span style="color: hsl(0, 100%, 40%);">- return &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%);">- /* Update positions */</span><br><span style="color: hsl(0, 100%, 40%);">- readpos += r;</span><br><span style="color: hsl(0, 100%, 40%);">- left -= r;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (readpos >= FRAME_SIZE) {</span><br><span style="color: hsl(0, 100%, 40%);">- /* A real frame */</span><br><span style="color: hsl(0, 100%, 40%);">- readpos = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- left = FRAME_SIZE;</span><br><span style="color: hsl(0, 100%, 40%);">- if (ast_channel_state(chan) != AST_STATE_UP) {</span><br><span style="color: hsl(0, 100%, 40%);">- /* Don't transmit unless it's up */</span><br><span style="color: hsl(0, 100%, 40%);">- ast_mutex_unlock(&alsalock);</span><br><span style="color: hsl(0, 100%, 40%);">- return &f;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- if (mute) {</span><br><span style="color: hsl(0, 100%, 40%);">- /* Don't transmit if muted */</span><br><span style="color: hsl(0, 100%, 40%);">- ast_mutex_unlock(&alsalock);</span><br><span style="color: hsl(0, 100%, 40%);">- return &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%);">- f.frametype = AST_FRAME_VOICE;</span><br><span style="color: hsl(0, 100%, 40%);">- f.subclass.format = ast_format_slin;</span><br><span style="color: hsl(0, 100%, 40%);">- f.samples = FRAME_SIZE;</span><br><span style="color: hsl(0, 100%, 40%);">- f.datalen = FRAME_SIZE * 2;</span><br><span style="color: hsl(0, 100%, 40%);">- f.data.ptr = buf;</span><br><span style="color: hsl(0, 100%, 40%);">- f.offset = AST_FRIENDLY_OFFSET;</span><br><span style="color: hsl(0, 100%, 40%);">- f.src = "Console";</span><br><span style="color: hsl(0, 100%, 40%);">- f.mallocd = 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%);">- ast_mutex_unlock(&alsalock);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- return &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%);">-static int alsa_fixup(struct ast_channel *oldchan, struct ast_channel *newchan)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- struct chan_alsa_pvt *p = ast_channel_tech_pvt(newchan);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- ast_mutex_lock(&alsalock);</span><br><span style="color: hsl(0, 100%, 40%);">- p->owner = newchan;</span><br><span style="color: hsl(0, 100%, 40%);">- ast_mutex_unlock(&alsalock);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- return 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 alsa_indicate(struct ast_channel *chan, int cond, const void *data, size_t datalen)</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%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- ast_mutex_lock(&alsalock);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- switch (cond) {</span><br><span style="color: hsl(0, 100%, 40%);">- case AST_CONTROL_BUSY:</span><br><span style="color: hsl(0, 100%, 40%);">- case AST_CONTROL_CONGESTION:</span><br><span style="color: hsl(0, 100%, 40%);">- case AST_CONTROL_RINGING:</span><br><span style="color: hsl(0, 100%, 40%);">- case AST_CONTROL_INCOMPLETE:</span><br><span style="color: hsl(0, 100%, 40%);">- case AST_CONTROL_PVT_CAUSE_CODE:</span><br><span style="color: hsl(0, 100%, 40%);">- case -1:</span><br><span style="color: hsl(0, 100%, 40%);">- res = -1; /* Ask for inband indications */</span><br><span style="color: hsl(0, 100%, 40%);">- break;</span><br><span style="color: hsl(0, 100%, 40%);">- case AST_CONTROL_PROGRESS:</span><br><span style="color: hsl(0, 100%, 40%);">- case AST_CONTROL_PROCEEDING:</span><br><span style="color: hsl(0, 100%, 40%);">- case AST_CONTROL_VIDUPDATE:</span><br><span style="color: hsl(0, 100%, 40%);">- case AST_CONTROL_SRCUPDATE:</span><br><span style="color: hsl(0, 100%, 40%);">- break;</span><br><span style="color: hsl(0, 100%, 40%);">- case AST_CONTROL_HOLD:</span><br><span style="color: hsl(0, 100%, 40%);">- ast_verbose(" << Console Has Been Placed on Hold >> \n");</span><br><span style="color: hsl(0, 100%, 40%);">- ast_moh_start(chan, data, mohinterpret);</span><br><span style="color: hsl(0, 100%, 40%);">- break;</span><br><span style="color: hsl(0, 100%, 40%);">- case AST_CONTROL_UNHOLD:</span><br><span style="color: hsl(0, 100%, 40%);">- ast_verbose(" << Console Has Been Retrieved from Hold >> \n");</span><br><span style="color: hsl(0, 100%, 40%);">- ast_moh_stop(chan);</span><br><span style="color: hsl(0, 100%, 40%);">- break;</span><br><span style="color: hsl(0, 100%, 40%);">- default:</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING, "Don't know how to display condition %d on %s\n", cond, ast_channel_name(chan));</span><br><span style="color: hsl(0, 100%, 40%);">- res = -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_mutex_unlock(&alsalock);</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 struct ast_channel *alsa_new(struct chan_alsa_pvt *p, int state, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_channel *tmp = NULL;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (!(tmp = ast_channel_alloc(1, state, 0, 0, "", p->exten, p->context, assignedids, requestor, 0, "ALSA/%s", indevname)))</span><br><span style="color: hsl(0, 100%, 40%);">- return NULL;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- ast_channel_stage_snapshot(tmp);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- ast_channel_tech_set(tmp, &alsa_tech);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_channel_set_fd(tmp, 0, readdev);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_channel_set_readformat(tmp, ast_format_slin);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_channel_set_writeformat(tmp, ast_format_slin);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_channel_nativeformats_set(tmp, alsa_tech.capabilities);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- ast_channel_tech_pvt_set(tmp, p);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!ast_strlen_zero(p->context))</span><br><span style="color: hsl(0, 100%, 40%);">- ast_channel_context_set(tmp, p->context);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!ast_strlen_zero(p->exten))</span><br><span style="color: hsl(0, 100%, 40%);">- ast_channel_exten_set(tmp, p->exten);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!ast_strlen_zero(language))</span><br><span style="color: hsl(0, 100%, 40%);">- ast_channel_language_set(tmp, language);</span><br><span style="color: hsl(0, 100%, 40%);">- p->owner = tmp;</span><br><span style="color: hsl(0, 100%, 40%);">- ast_module_ref(ast_module_info->self);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_jb_configure(tmp, &global_jbconf);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- ast_channel_stage_snapshot_done(tmp);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_channel_unlock(tmp);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (state != AST_STATE_DOWN) {</span><br><span style="color: hsl(0, 100%, 40%);">- if (ast_pbx_start(tmp)) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING, "Unable to start PBX on %s\n", ast_channel_name(tmp));</span><br><span style="color: hsl(0, 100%, 40%);">- ast_hangup(tmp);</span><br><span style="color: hsl(0, 100%, 40%);">- tmp = NULL;</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%);">- return tmp;</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 struct ast_channel *alsa_request(const char *type, struct ast_format_cap *cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *data, int *cause)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_channel *tmp = NULL;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (ast_format_cap_iscompatible_format(cap, ast_format_slin) == AST_FORMAT_CMP_NOT_EQUAL) {</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_str *codec_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_NOTICE, "Asked to get a channel of format '%s'\n", ast_format_cap_get_names(cap, &codec_buf));</span><br><span style="color: hsl(0, 100%, 40%);">- return NULL;</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_mutex_lock(&alsalock);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (alsa.owner) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_NOTICE, "Already have a call on the ALSA channel\n");</span><br><span style="color: hsl(0, 100%, 40%);">- *cause = AST_CAUSE_BUSY;</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (!(tmp = alsa_new(&alsa, AST_STATE_DOWN, assignedids, requestor))) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING, "Unable to create new ALSA channel\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%);">- ast_mutex_unlock(&alsalock);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- return tmp;</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 char *console_autoanswer(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- char *res = CLI_SUCCESS;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- switch (cmd) {</span><br><span style="color: hsl(0, 100%, 40%);">- case CLI_INIT:</span><br><span style="color: hsl(0, 100%, 40%);">- e->command = "console autoanswer [on|off]";</span><br><span style="color: hsl(0, 100%, 40%);">- e->usage =</span><br><span style="color: hsl(0, 100%, 40%);">- "Usage: console autoanswer [on|off]\n"</span><br><span style="color: hsl(0, 100%, 40%);">- " Enables or disables autoanswer feature. If used without\n"</span><br><span style="color: hsl(0, 100%, 40%);">- " argument, displays the current on/off status of autoanswer.\n"</span><br><span style="color: hsl(0, 100%, 40%);">- " The default value of autoanswer is in 'alsa.conf'.\n";</span><br><span style="color: hsl(0, 100%, 40%);">- return NULL;</span><br><span style="color: hsl(0, 100%, 40%);">- case CLI_GENERATE:</span><br><span style="color: hsl(0, 100%, 40%);">- return NULL;</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 ((a->argc != 2) && (a->argc != 3))</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_SHOWUSAGE;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- ast_mutex_lock(&alsalock);</span><br><span style="color: hsl(0, 100%, 40%);">- if (a->argc == 2) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_cli(a->fd, "Auto answer is %s.\n", autoanswer ? "on" : "off");</span><br><span style="color: hsl(0, 100%, 40%);">- } else {</span><br><span style="color: hsl(0, 100%, 40%);">- if (!strcasecmp(a->argv[2], "on"))</span><br><span style="color: hsl(0, 100%, 40%);">- autoanswer = -1;</span><br><span style="color: hsl(0, 100%, 40%);">- else if (!strcasecmp(a->argv[2], "off"))</span><br><span style="color: hsl(0, 100%, 40%);">- autoanswer = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- else</span><br><span style="color: hsl(0, 100%, 40%);">- res = CLI_SHOWUSAGE;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- ast_mutex_unlock(&alsalock);</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 char *console_answer(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- char *res = CLI_SUCCESS;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- switch (cmd) {</span><br><span style="color: hsl(0, 100%, 40%);">- case CLI_INIT:</span><br><span style="color: hsl(0, 100%, 40%);">- e->command = "console answer";</span><br><span style="color: hsl(0, 100%, 40%);">- e->usage =</span><br><span style="color: hsl(0, 100%, 40%);">- "Usage: console answer\n"</span><br><span style="color: hsl(0, 100%, 40%);">- " Answers an incoming call on the console (ALSA) channel.\n";</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- return NULL;</span><br><span style="color: hsl(0, 100%, 40%);">- case CLI_GENERATE:</span><br><span style="color: hsl(0, 100%, 40%);">- return NULL;</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 (a->argc != 2)</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_SHOWUSAGE;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- ast_mutex_lock(&alsalock);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (!alsa.owner) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_cli(a->fd, "No one is calling us\n");</span><br><span style="color: hsl(0, 100%, 40%);">- res = CLI_FAILURE;</span><br><span style="color: hsl(0, 100%, 40%);">- } else {</span><br><span style="color: hsl(0, 100%, 40%);">- if (mute) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_verbose( " << Muted >> \n" );</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- hookstate = 1;</span><br><span style="color: hsl(0, 100%, 40%);">- grab_owner();</span><br><span style="color: hsl(0, 100%, 40%);">- if (alsa.owner) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_queue_control(alsa.owner, AST_CONTROL_ANSWER);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_channel_unlock(alsa.owner);</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%);">- if (!noaudiocapture) {</span><br><span style="color: hsl(0, 100%, 40%);">- snd_pcm_prepare(alsa.icard);</span><br><span style="color: hsl(0, 100%, 40%);">- snd_pcm_start(alsa.icard);</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_mutex_unlock(&alsalock);</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 char *console_sendtext(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- int tmparg = 3;</span><br><span style="color: hsl(0, 100%, 40%);">- char *res = CLI_SUCCESS;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- switch (cmd) {</span><br><span style="color: hsl(0, 100%, 40%);">- case CLI_INIT:</span><br><span style="color: hsl(0, 100%, 40%);">- e->command = "console send text";</span><br><span style="color: hsl(0, 100%, 40%);">- e->usage =</span><br><span style="color: hsl(0, 100%, 40%);">- "Usage: console send text <message>\n"</span><br><span style="color: hsl(0, 100%, 40%);">- " Sends a text message for display on the remote terminal.\n";</span><br><span style="color: hsl(0, 100%, 40%);">- return NULL;</span><br><span style="color: hsl(0, 100%, 40%);">- case CLI_GENERATE:</span><br><span style="color: hsl(0, 100%, 40%);">- return NULL;</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 (a->argc < 3)</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_SHOWUSAGE;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- ast_mutex_lock(&alsalock);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (!alsa.owner) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_cli(a->fd, "No channel active\n");</span><br><span style="color: hsl(0, 100%, 40%);">- res = CLI_FAILURE;</span><br><span style="color: hsl(0, 100%, 40%);">- } else {</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_frame f = { AST_FRAME_TEXT };</span><br><span style="color: hsl(0, 100%, 40%);">- char text2send[256] = "";</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- while (tmparg < a->argc) {</span><br><span style="color: hsl(0, 100%, 40%);">- strncat(text2send, a->argv[tmparg++], sizeof(text2send) - strlen(text2send) - 1);</span><br><span style="color: hsl(0, 100%, 40%);">- strncat(text2send, " ", sizeof(text2send) - strlen(text2send) - 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%);">- text2send[strlen(text2send) - 1] = '\n';</span><br><span style="color: hsl(0, 100%, 40%);">- f.data.ptr = text2send;</span><br><span style="color: hsl(0, 100%, 40%);">- f.datalen = strlen(text2send) + 1;</span><br><span style="color: hsl(0, 100%, 40%);">- grab_owner();</span><br><span style="color: hsl(0, 100%, 40%);">- if (alsa.owner) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_queue_frame(alsa.owner, &f);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_queue_control(alsa.owner, AST_CONTROL_ANSWER);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_channel_unlock(alsa.owner);</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%);">- ast_mutex_unlock(&alsalock);</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 char *console_hangup(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- char *res = CLI_SUCCESS;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- switch (cmd) {</span><br><span style="color: hsl(0, 100%, 40%);">- case CLI_INIT:</span><br><span style="color: hsl(0, 100%, 40%);">- e->command = "console hangup";</span><br><span style="color: hsl(0, 100%, 40%);">- e->usage =</span><br><span style="color: hsl(0, 100%, 40%);">- "Usage: console hangup\n"</span><br><span style="color: hsl(0, 100%, 40%);">- " Hangs up any call currently placed on the console.\n";</span><br><span style="color: hsl(0, 100%, 40%);">- return NULL;</span><br><span style="color: hsl(0, 100%, 40%);">- case CLI_GENERATE:</span><br><span style="color: hsl(0, 100%, 40%);">- return NULL;</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%);">- if (a->argc != 2)</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_SHOWUSAGE;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- ast_mutex_lock(&alsalock);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (!alsa.owner && !hookstate) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_cli(a->fd, "No call to hangup\n");</span><br><span style="color: hsl(0, 100%, 40%);">- res = CLI_FAILURE;</span><br><span style="color: hsl(0, 100%, 40%);">- } else {</span><br><span style="color: hsl(0, 100%, 40%);">- hookstate = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- grab_owner();</span><br><span style="color: hsl(0, 100%, 40%);">- if (alsa.owner) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_queue_hangup_with_cause(alsa.owner, AST_CAUSE_NORMAL_CLEARING);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_channel_unlock(alsa.owner);</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%);">- ast_mutex_unlock(&alsalock);</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 char *console_dial(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- char tmp[256], *tmp2;</span><br><span style="color: hsl(0, 100%, 40%);">- char *mye, *myc;</span><br><span style="color: hsl(0, 100%, 40%);">- const char *d;</span><br><span style="color: hsl(0, 100%, 40%);">- char *res = CLI_SUCCESS;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- switch (cmd) {</span><br><span style="color: hsl(0, 100%, 40%);">- case CLI_INIT:</span><br><span style="color: hsl(0, 100%, 40%);">- e->command = "console dial";</span><br><span style="color: hsl(0, 100%, 40%);">- e->usage =</span><br><span style="color: hsl(0, 100%, 40%);">- "Usage: console dial [extension[@context]]\n"</span><br><span style="color: hsl(0, 100%, 40%);">- " Dials a given extension (and context if specified)\n";</span><br><span style="color: hsl(0, 100%, 40%);">- return NULL;</span><br><span style="color: hsl(0, 100%, 40%);">- case CLI_GENERATE:</span><br><span style="color: hsl(0, 100%, 40%);">- return NULL;</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 ((a->argc != 2) && (a->argc != 3))</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_SHOWUSAGE;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- ast_mutex_lock(&alsalock);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (alsa.owner) {</span><br><span style="color: hsl(0, 100%, 40%);">- if (a->argc == 3) {</span><br><span style="color: hsl(0, 100%, 40%);">- if (alsa.owner) {</span><br><span style="color: hsl(0, 100%, 40%);">- for (d = a->argv[2]; *d; d++) {</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_frame f = { .frametype = AST_FRAME_DTMF, .subclass.integer = *d };</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- ast_queue_frame(alsa.owner, &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%);">- } else {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_cli(a->fd, "You're already in a call. You can use this only to dial digits until you hangup\n");</span><br><span style="color: hsl(0, 100%, 40%);">- res = CLI_FAILURE;</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%);">- mye = exten;</span><br><span style="color: hsl(0, 100%, 40%);">- myc = context;</span><br><span style="color: hsl(0, 100%, 40%);">- if (a->argc == 3) {</span><br><span style="color: hsl(0, 100%, 40%);">- char *stringp = NULL;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- ast_copy_string(tmp, a->argv[2], sizeof(tmp));</span><br><span style="color: hsl(0, 100%, 40%);">- stringp = tmp;</span><br><span style="color: hsl(0, 100%, 40%);">- strsep(&stringp, "@");</span><br><span style="color: hsl(0, 100%, 40%);">- tmp2 = strsep(&stringp, "@");</span><br><span style="color: hsl(0, 100%, 40%);">- if (!ast_strlen_zero(tmp))</span><br><span style="color: hsl(0, 100%, 40%);">- mye = tmp;</span><br><span style="color: hsl(0, 100%, 40%);">- if (!ast_strlen_zero(tmp2))</span><br><span style="color: hsl(0, 100%, 40%);">- myc = tmp2;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- if (ast_exists_extension(NULL, myc, mye, 1, NULL)) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_copy_string(alsa.exten, mye, sizeof(alsa.exten));</span><br><span style="color: hsl(0, 100%, 40%);">- ast_copy_string(alsa.context, myc, sizeof(alsa.context));</span><br><span style="color: hsl(0, 100%, 40%);">- hookstate = 1;</span><br><span style="color: hsl(0, 100%, 40%);">- alsa_new(&alsa, AST_STATE_RINGING, NULL, NULL);</span><br><span style="color: hsl(0, 100%, 40%);">- } else</span><br><span style="color: hsl(0, 100%, 40%);">- ast_cli(a->fd, "No such extension '%s' in context '%s'\n", mye, myc);</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_mutex_unlock(&alsalock);</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 char *console_mute(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- int toggle = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- char *res = CLI_SUCCESS;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- switch (cmd) {</span><br><span style="color: hsl(0, 100%, 40%);">- case CLI_INIT:</span><br><span style="color: hsl(0, 100%, 40%);">- e->command = "console {mute|unmute} [toggle]";</span><br><span style="color: hsl(0, 100%, 40%);">- e->usage =</span><br><span style="color: hsl(0, 100%, 40%);">- "Usage: console {mute|unmute} [toggle]\n"</span><br><span style="color: hsl(0, 100%, 40%);">- " Mute/unmute the microphone.\n";</span><br><span style="color: hsl(0, 100%, 40%);">- return NULL;</span><br><span style="color: hsl(0, 100%, 40%);">- case CLI_GENERATE:</span><br><span style="color: hsl(0, 100%, 40%);">- return NULL;</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%);">- if (a->argc > 3) {</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_SHOWUSAGE;</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 (a->argc == 3) {</span><br><span style="color: hsl(0, 100%, 40%);">- if (strcasecmp(a->argv[2], "toggle"))</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_SHOWUSAGE;</span><br><span style="color: hsl(0, 100%, 40%);">- toggle = 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%);">- if (a->argc < 2) {</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_SHOWUSAGE;</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 (!strcasecmp(a->argv[1], "mute")) {</span><br><span style="color: hsl(0, 100%, 40%);">- mute = toggle ? !mute : 1;</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (!strcasecmp(a->argv[1], "unmute")) {</span><br><span style="color: hsl(0, 100%, 40%);">- mute = toggle ? !mute : 0;</span><br><span style="color: hsl(0, 100%, 40%);">- } else {</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_SHOWUSAGE;</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_cli(a->fd, "Console mic is %s\n", mute ? "off" : "on");</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 struct ast_cli_entry cli_alsa[] = {</span><br><span style="color: hsl(0, 100%, 40%);">- AST_CLI_DEFINE(console_answer, "Answer an incoming console call"),</span><br><span style="color: hsl(0, 100%, 40%);">- AST_CLI_DEFINE(console_hangup, "Hangup a call on the console"),</span><br><span style="color: hsl(0, 100%, 40%);">- AST_CLI_DEFINE(console_dial, "Dial an extension on the console"),</span><br><span style="color: hsl(0, 100%, 40%);">- AST_CLI_DEFINE(console_sendtext, "Send text to the remote device"),</span><br><span style="color: hsl(0, 100%, 40%);">- AST_CLI_DEFINE(console_autoanswer, "Sets/displays autoanswer"),</span><br><span style="color: hsl(0, 100%, 40%);">- AST_CLI_DEFINE(console_mute, "Disable/Enable mic input"),</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%);">- ast_channel_unregister(&alsa_tech);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_cli_unregister_multiple(cli_alsa, ARRAY_LEN(cli_alsa));</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (alsa.icard)</span><br><span style="color: hsl(0, 100%, 40%);">- snd_pcm_close(alsa.icard);</span><br><span style="color: hsl(0, 100%, 40%);">- if (alsa.ocard)</span><br><span style="color: hsl(0, 100%, 40%);">- snd_pcm_close(alsa.ocard);</span><br><span style="color: hsl(0, 100%, 40%);">- if (alsa.owner)</span><br><span style="color: hsl(0, 100%, 40%);">- ast_softhangup(alsa.owner, AST_SOFTHANGUP_APPUNLOAD);</span><br><span style="color: hsl(0, 100%, 40%);">- if (alsa.owner)</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%);">- ao2_cleanup(alsa_tech.capabilities);</span><br><span style="color: hsl(0, 100%, 40%);">- alsa_tech.capabilities = NULL;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- return 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%);">-/*!</span><br><span style="color: hsl(0, 100%, 40%);">- * \brief Load the module</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * Module loading including tests for configuration or dependencies.</span><br><span style="color: hsl(0, 100%, 40%);">- * This function can return AST_MODULE_LOAD_FAILURE, AST_MODULE_LOAD_DECLINE,</span><br><span style="color: hsl(0, 100%, 40%);">- * or AST_MODULE_LOAD_SUCCESS. If a dependency or environment variable fails</span><br><span style="color: hsl(0, 100%, 40%);">- * tests return AST_MODULE_LOAD_FAILURE. If the module can not load the</span><br><span style="color: hsl(0, 100%, 40%);">- * configuration file or other non-critical problem return</span><br><span style="color: hsl(0, 100%, 40%);">- * AST_MODULE_LOAD_DECLINE. On success return AST_MODULE_LOAD_SUCCESS.</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%);">- struct ast_config *cfg;</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_variable *v;</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_flags config_flags = { 0 };</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (!(alsa_tech.capabilities = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT))) {</span><br><span style="color: hsl(0, 100%, 40%);">- return AST_MODULE_LOAD_DECLINE;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- ast_format_cap_append(alsa_tech.capabilities, ast_format_slin, 0);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- /* Copy the default jb config over global_jbconf */</span><br><span style="color: hsl(0, 100%, 40%);">- memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf));</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- strcpy(mohinterpret, "default");</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (!(cfg = ast_config_load(config, config_flags))) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_ERROR, "Unable to read ALSA configuration file %s. Aborting.\n", config);</span><br><span style="color: hsl(0, 100%, 40%);">- return AST_MODULE_LOAD_DECLINE;</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (cfg == CONFIG_STATUS_FILEINVALID) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_ERROR, "%s is in an invalid format. Aborting.\n", config);</span><br><span style="color: hsl(0, 100%, 40%);">- return AST_MODULE_LOAD_DECLINE;</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%);">- v = ast_variable_browse(cfg, "general");</span><br><span style="color: hsl(0, 100%, 40%);">- for (; v; v = v->next) {</span><br><span style="color: hsl(0, 100%, 40%);">- /* handle jb conf */</span><br><span style="color: hsl(0, 100%, 40%);">- if (!ast_jb_read_conf(&global_jbconf, v->name, v->value)) {</span><br><span style="color: hsl(0, 100%, 40%);">- continue;</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 (!strcasecmp(v->name, "autoanswer")) {</span><br><span style="color: hsl(0, 100%, 40%);">- autoanswer = ast_true(v->value);</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (!strcasecmp(v->name, "mute")) {</span><br><span style="color: hsl(0, 100%, 40%);">- mute = ast_true(v->value);</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (!strcasecmp(v->name, "noaudiocapture")) {</span><br><span style="color: hsl(0, 100%, 40%);">- noaudiocapture = ast_true(v->value);</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (!strcasecmp(v->name, "silencesuppression")) {</span><br><span style="color: hsl(0, 100%, 40%);">- silencesuppression = ast_true(v->value);</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (!strcasecmp(v->name, "silencethreshold")) {</span><br><span style="color: hsl(0, 100%, 40%);">- silencethreshold = atoi(v->value);</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (!strcasecmp(v->name, "context")) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_copy_string(context, v->value, sizeof(context));</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (!strcasecmp(v->name, "language")) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_copy_string(language, v->value, sizeof(language));</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (!strcasecmp(v->name, "extension")) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_copy_string(exten, v->value, sizeof(exten));</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (!strcasecmp(v->name, "input_device")) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_copy_string(indevname, v->value, sizeof(indevname));</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (!strcasecmp(v->name, "output_device")) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_copy_string(outdevname, v->value, sizeof(outdevname));</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (!strcasecmp(v->name, "mohinterpret")) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_copy_string(mohinterpret, v->value, sizeof(mohinterpret));</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_config_destroy(cfg);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (soundcard_init() < 0) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_verb(2, "No sound card detected -- console channel will be unavailable\n");</span><br><span style="color: hsl(0, 100%, 40%);">- ast_verb(2, "Turn off ALSA support by adding 'noload=chan_alsa.so' in /etc/asterisk/modules.conf\n");</span><br><span style="color: hsl(0, 100%, 40%);">- unload_module();</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- return AST_MODULE_LOAD_DECLINE;</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_channel_register(&alsa_tech)) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_ERROR, "Unable to register channel class 'Console'\n");</span><br><span style="color: hsl(0, 100%, 40%);">- unload_module();</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- return AST_MODULE_LOAD_DECLINE;</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_cli_register_multiple(cli_alsa, ARRAY_LEN(cli_alsa));</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- return AST_MODULE_LOAD_SUCCESS;</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(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "ALSA Console Channel Driver",</span><br><span style="color: hsl(0, 100%, 40%);">- .support_level = AST_MODULE_SUPPORT_DEPRECATED,</span><br><span style="color: hsl(0, 100%, 40%);">- .load = load_module,</span><br><span style="color: hsl(0, 100%, 40%);">- .unload = unload_module,</span><br><span style="color: hsl(0, 100%, 40%);">- .load_pri = AST_MODPRI_CHANNEL_DRIVER,</span><br><span style="color: hsl(0, 100%, 40%);">-);</span><br><span>diff --git a/channels/chan_console.c b/channels/chan_console.c</span><br><span>index 1d1d94c..5189212 100644</span><br><span>--- a/channels/chan_console.c</span><br><span>+++ b/channels/chan_console.c</span><br><span>@@ -35,11 +35,9 @@</span><br><span> * - svn co https://www.portaudio.com/repos/portaudio/branches/v19-devel</span><br><span> *</span><br><span> * \note Since this works with any audio system that libportaudio supports,</span><br><span style="color: hsl(0, 100%, 40%);">- * including ALSA and OSS, this may someday deprecate chan_alsa and chan_oss.</span><br><span style="color: hsl(0, 100%, 40%);">- * However, before that can be done, it needs to *at least* have all of the</span><br><span style="color: hsl(0, 100%, 40%);">- * features that these other channel drivers have. The features implemented</span><br><span style="color: hsl(0, 100%, 40%);">- * in at least one of the other console channel drivers that are not yet</span><br><span style="color: hsl(0, 100%, 40%);">- * implemented here are:</span><br><span style="color: hsl(120, 100%, 40%);">+ * including ALSA and OSS, it has come to replace the deprecated chan_alsa and</span><br><span style="color: hsl(120, 100%, 40%);">+ * chan_oss. However, the following features *at least* need to be implemented</span><br><span style="color: hsl(120, 100%, 40%);">+ * here for this to be a full replacement:</span><br><span> *</span><br><span> * - Set Auto-answer from the dialplan</span><br><span> * - transfer CLI command</span><br><span>diff --git a/configs/samples/alsa.conf.sample b/configs/samples/alsa.conf.sample</span><br><span>deleted file mode 100644</span><br><span>index 3e61710..0000000</span><br><span>--- a/configs/samples/alsa.conf.sample</span><br><span>+++ /dev/null</span><br><span>@@ -1,77 +0,0 @@</span><br><span style="color: hsl(0, 100%, 40%);">-;</span><br><span style="color: hsl(0, 100%, 40%);">-; Open Sound System Console Driver Configuration File</span><br><span style="color: hsl(0, 100%, 40%);">-;</span><br><span style="color: hsl(0, 100%, 40%);">-[general]</span><br><span style="color: hsl(0, 100%, 40%);">-;</span><br><span style="color: hsl(0, 100%, 40%);">-; Automatically answer incoming calls on the console? Choose yes if</span><br><span style="color: hsl(0, 100%, 40%);">-; for example you want to use this as an intercom.</span><br><span style="color: hsl(0, 100%, 40%);">-;</span><br><span style="color: hsl(0, 100%, 40%);">-autoanswer=yes</span><br><span style="color: hsl(0, 100%, 40%);">-;</span><br><span style="color: hsl(0, 100%, 40%);">-; Default context (is overridden with @context syntax)</span><br><span style="color: hsl(0, 100%, 40%);">-;</span><br><span style="color: hsl(0, 100%, 40%);">-context=local</span><br><span style="color: hsl(0, 100%, 40%);">-;</span><br><span style="color: hsl(0, 100%, 40%);">-; Default extension to call</span><br><span style="color: hsl(0, 100%, 40%);">-;</span><br><span style="color: hsl(0, 100%, 40%);">-extension=s</span><br><span style="color: hsl(0, 100%, 40%);">-;</span><br><span style="color: hsl(0, 100%, 40%);">-; Default language</span><br><span style="color: hsl(0, 100%, 40%);">-;</span><br><span style="color: hsl(0, 100%, 40%);">-;language=en</span><br><span style="color: hsl(0, 100%, 40%);">-;</span><br><span style="color: hsl(0, 100%, 40%);">-; Default Music on Hold class to use when this channel is placed on hold in</span><br><span style="color: hsl(0, 100%, 40%);">-; the case that the music class is not set on the channel with</span><br><span style="color: hsl(0, 100%, 40%);">-; Set(CHANNEL(musicclass)=whatever) in the dialplan and the peer channel</span><br><span style="color: hsl(0, 100%, 40%);">-; putting this one on hold did not suggest a class to use.</span><br><span style="color: hsl(0, 100%, 40%);">-;</span><br><span style="color: hsl(0, 100%, 40%);">-;mohinterpret=default</span><br><span style="color: hsl(0, 100%, 40%);">-;</span><br><span style="color: hsl(0, 100%, 40%);">-; Silence suppression can be enabled when sound is over a certain threshold.</span><br><span style="color: hsl(0, 100%, 40%);">-; The value for the threshold should probably be between 500 and 2000 or so,</span><br><span style="color: hsl(0, 100%, 40%);">-; but your mileage may vary. Use the echo test to evaluate the best setting.</span><br><span style="color: hsl(0, 100%, 40%);">-;silencesuppression = yes</span><br><span style="color: hsl(0, 100%, 40%);">-;silencethreshold = 1000</span><br><span style="color: hsl(0, 100%, 40%);">-;</span><br><span style="color: hsl(0, 100%, 40%);">-; To set which ALSA device to use, change this parameter</span><br><span style="color: hsl(0, 100%, 40%);">-;input_device=hw:0,0</span><br><span style="color: hsl(0, 100%, 40%);">-;output_device=hw:0,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%);">-; Default mute state (can also be toggled via CLI)</span><br><span style="color: hsl(0, 100%, 40%);">-;mute=true</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 enabled, no audio capture device will be opened. This is useful on</span><br><span style="color: hsl(0, 100%, 40%);">-; systems where there will be no return audio path, such as overhead pagers.</span><br><span style="color: hsl(0, 100%, 40%);">-;noaudiocapture=true</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-; ----------------------------- JITTER BUFFER CONFIGURATION --------------------------</span><br><span style="color: hsl(0, 100%, 40%);">-; jbenable = yes ; Enables the use of a jitterbuffer on the receiving side of an</span><br><span style="color: hsl(0, 100%, 40%);">- ; ALSA channel. Defaults to "no". An enabled jitterbuffer will</span><br><span style="color: hsl(0, 100%, 40%);">- ; be used only if the sending side can create and the receiving</span><br><span style="color: hsl(0, 100%, 40%);">- ; side can not accept jitter. The ALSA channel can't accept jitter,</span><br><span style="color: hsl(0, 100%, 40%);">- ; thus an enabled jitterbuffer on the receive ALSA side will always</span><br><span style="color: hsl(0, 100%, 40%);">- ; be used if the sending side can create jitter.</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-; jbmaxsize = 200 ; Max length of the jitterbuffer in milliseconds.</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-; jbresyncthreshold = 1000 ; Jump in the frame timestamps over which the jitterbuffer is</span><br><span style="color: hsl(0, 100%, 40%);">- ; resynchronized. Useful to improve the quality of the voice, with</span><br><span style="color: hsl(0, 100%, 40%);">- ; big jumps in/broken timestamps, usually sent from exotic devices</span><br><span style="color: hsl(0, 100%, 40%);">- ; and programs. Defaults to 1000.</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-; jbimpl = fixed ; Jitterbuffer implementation, used on the receiving side of a SIP</span><br><span style="color: hsl(0, 100%, 40%);">- ; channel. Two implementations are currently available - "fixed"</span><br><span style="color: hsl(0, 100%, 40%);">- ; (with size always equals to jbmax-size) and "adaptive" (with</span><br><span style="color: hsl(0, 100%, 40%);">- ; variable size, actually the new jb of IAX2). Defaults to fixed.</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-; jbtargetextra = 40 ; This option only affects the jb when 'jbimpl = adaptive' is set.</span><br><span style="color: hsl(0, 100%, 40%);">- ; The option represents the number of milliseconds by which the new</span><br><span style="color: hsl(0, 100%, 40%);">- ; jitter buffer will pad its size. the default is 40, so without</span><br><span style="color: hsl(0, 100%, 40%);">- ; modification, the new jitter buffer will set its size to the jitter</span><br><span style="color: hsl(0, 100%, 40%);">- ; value plus 40 milliseconds. increasing this value may help if your</span><br><span style="color: hsl(0, 100%, 40%);">- ; network normally has low jitter, but occasionally has spikes.</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-; jblog = no ; Enables jitterbuffer frame logging. Defaults to "no".</span><br><span style="color: hsl(0, 100%, 40%);">-; ----------------------------------------------------------------------------------</span><br><span>diff --git a/configs/samples/modules.conf.sample b/configs/samples/modules.conf.sample</span><br><span>index 2ab16d1..41cf905 100644</span><br><span>--- a/configs/samples/modules.conf.sample</span><br><span>+++ b/configs/samples/modules.conf.sample</span><br><span>@@ -31,10 +31,9 @@</span><br><span> ;</span><br><span> ;load = res_musiconhold.so</span><br><span> ;</span><br><span style="color: hsl(0, 100%, 40%);">-; Load one of: alsa, or console (portaudio).</span><br><span style="color: hsl(120, 100%, 40%);">+; Load one of: console (portaudio).</span><br><span> ; By default, load chan_console only (automatically).</span><br><span> ;</span><br><span style="color: hsl(0, 100%, 40%);">-noload = chan_alsa.so</span><br><span> ;noload = chan_console.so</span><br><span> ;</span><br><span> ; Do not load res_hep and kin unless you are using HEP monitoring</span><br><span>diff --git a/configure b/configure</span><br><span>index 38bfc20..09abe0c 100755</span><br><span>--- a/configure</span><br><span>+++ b/configure</span><br><span>@@ -1179,10 +1179,6 @@</span><br><span> BFD_DIR</span><br><span> BFD_INCLUDE</span><br><span> BFD_LIB</span><br><span style="color: hsl(0, 100%, 40%);">-PBX_ALSA</span><br><span style="color: hsl(0, 100%, 40%);">-ALSA_DIR</span><br><span style="color: hsl(0, 100%, 40%);">-ALSA_INCLUDE</span><br><span style="color: hsl(0, 100%, 40%);">-ALSA_LIB</span><br><span> PJPROJECT_INCLUDE</span><br><span> PJPROJECT_LIB</span><br><span> PBX_PJPROJECT</span><br><span>@@ -11116,32 +11112,6 @@</span><br><span> # to make things easier for the users.</span><br><span> </span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- ALSA_DESCRIP="Advanced Linux Sound Architecture"</span><br><span style="color: hsl(0, 100%, 40%);">- ALSA_OPTION="asound"</span><br><span style="color: hsl(0, 100%, 40%);">- PBX_ALSA=0</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-# Check whether --with-asound was given.</span><br><span style="color: hsl(0, 100%, 40%);">-if test ${with_asound+y}</span><br><span style="color: hsl(0, 100%, 40%);">-then :</span><br><span style="color: hsl(0, 100%, 40%);">- withval=$with_asound;</span><br><span style="color: hsl(0, 100%, 40%);">- case ${withval} in</span><br><span style="color: hsl(0, 100%, 40%);">- n|no)</span><br><span style="color: hsl(0, 100%, 40%);">- USE_ALSA=no</span><br><span style="color: hsl(0, 100%, 40%);">- # -1 is a magic value used by menuselect to know that the package</span><br><span style="color: hsl(0, 100%, 40%);">- # was disabled, other than 'not found'</span><br><span style="color: hsl(0, 100%, 40%);">- PBX_ALSA=-1</span><br><span style="color: hsl(0, 100%, 40%);">- ;;</span><br><span style="color: hsl(0, 100%, 40%);">- y|ye|yes)</span><br><span style="color: hsl(0, 100%, 40%);">- ac_mandatory_list="${ac_mandatory_list} ALSA"</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%);">- ALSA_DIR="${withval}"</span><br><span style="color: hsl(0, 100%, 40%);">- ac_mandatory_list="${ac_mandatory_list} ALSA"</span><br><span style="color: hsl(0, 100%, 40%);">- ;;</span><br><span style="color: hsl(0, 100%, 40%);">- esac</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-fi</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> </span><br><span> </span><br><span> </span><br><span>@@ -21874,102 +21844,6 @@</span><br><span> # do the package library checks now</span><br><span> </span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-if test "x${PBX_ALSA}" != "x1" -a "${USE_ALSA}" != "no"; then</span><br><span style="color: hsl(0, 100%, 40%);">- pbxlibdir=""</span><br><span style="color: hsl(0, 100%, 40%);">- # if --with-ALSA=DIR has been specified, use it.</span><br><span style="color: hsl(0, 100%, 40%);">- if test "x${ALSA_DIR}" != "x"; then</span><br><span style="color: hsl(0, 100%, 40%);">- if test -d ${ALSA_DIR}/lib; then</span><br><span style="color: hsl(0, 100%, 40%);">- pbxlibdir="-L${ALSA_DIR}/lib"</span><br><span style="color: hsl(0, 100%, 40%);">- else</span><br><span style="color: hsl(0, 100%, 40%);">- pbxlibdir="-L${ALSA_DIR}"</span><br><span style="color: hsl(0, 100%, 40%);">- fi</span><br><span style="color: hsl(0, 100%, 40%);">- fi</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- ast_ext_lib_check_save_CFLAGS="${CFLAGS}"</span><br><span style="color: hsl(0, 100%, 40%);">- CFLAGS="${CFLAGS} "</span><br><span style="color: hsl(0, 100%, 40%);">- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for snd_pcm_open in -lasound" >&5</span><br><span style="color: hsl(0, 100%, 40%);">-printf %s "checking for snd_pcm_open in -lasound... " >&6; }</span><br><span style="color: hsl(0, 100%, 40%);">-if test ${ac_cv_lib_asound_snd_pcm_open+y}</span><br><span style="color: hsl(0, 100%, 40%);">-then :</span><br><span style="color: hsl(0, 100%, 40%);">- printf %s "(cached) " >&6</span><br><span style="color: hsl(0, 100%, 40%);">-else $as_nop</span><br><span style="color: hsl(0, 100%, 40%);">- ac_check_lib_save_LIBS=$LIBS</span><br><span style="color: hsl(0, 100%, 40%);">-LIBS="-lasound ${pbxlibdir} $LIBS"</span><br><span style="color: hsl(0, 100%, 40%);">-cat confdefs.h - <<_ACEOF >conftest.$ac_ext</span><br><span style="color: hsl(0, 100%, 40%);">-/* end confdefs.h. */</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-/* Override any GCC internal prototype to avoid an error.</span><br><span style="color: hsl(0, 100%, 40%);">- Use char because int might match the return type of a GCC</span><br><span style="color: hsl(0, 100%, 40%);">- builtin and then its argument prototype would still apply. */</span><br><span style="color: hsl(0, 100%, 40%);">-char snd_pcm_open ();</span><br><span style="color: hsl(0, 100%, 40%);">-int</span><br><span style="color: hsl(0, 100%, 40%);">-main (void)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">-return snd_pcm_open ();</span><br><span style="color: hsl(0, 100%, 40%);">- ;</span><br><span style="color: hsl(0, 100%, 40%);">- return 0;</span><br><span style="color: hsl(0, 100%, 40%);">-}</span><br><span style="color: hsl(0, 100%, 40%);">-_ACEOF</span><br><span style="color: hsl(0, 100%, 40%);">-if ac_fn_c_try_link "$LINENO"</span><br><span style="color: hsl(0, 100%, 40%);">-then :</span><br><span style="color: hsl(0, 100%, 40%);">- ac_cv_lib_asound_snd_pcm_open=yes</span><br><span style="color: hsl(0, 100%, 40%);">-else $as_nop</span><br><span style="color: hsl(0, 100%, 40%);">- ac_cv_lib_asound_snd_pcm_open=no</span><br><span style="color: hsl(0, 100%, 40%);">-fi</span><br><span style="color: hsl(0, 100%, 40%);">-rm -f core conftest.err conftest.$ac_objext conftest.beam \</span><br><span style="color: hsl(0, 100%, 40%);">- conftest$ac_exeext conftest.$ac_ext</span><br><span style="color: hsl(0, 100%, 40%);">-LIBS=$ac_check_lib_save_LIBS</span><br><span style="color: hsl(0, 100%, 40%);">-fi</span><br><span style="color: hsl(0, 100%, 40%);">-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_asound_snd_pcm_open" >&5</span><br><span style="color: hsl(0, 100%, 40%);">-printf "%s\n" "$ac_cv_lib_asound_snd_pcm_open" >&6; }</span><br><span style="color: hsl(0, 100%, 40%);">-if test "x$ac_cv_lib_asound_snd_pcm_open" = xyes</span><br><span style="color: hsl(0, 100%, 40%);">-then :</span><br><span style="color: hsl(0, 100%, 40%);">- AST_ALSA_FOUND=yes</span><br><span style="color: hsl(0, 100%, 40%);">-else $as_nop</span><br><span style="color: hsl(0, 100%, 40%);">- AST_ALSA_FOUND=no</span><br><span style="color: hsl(0, 100%, 40%);">-fi</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- CFLAGS="${ast_ext_lib_check_save_CFLAGS}"</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%);">- # now check for the header.</span><br><span style="color: hsl(0, 100%, 40%);">- if test "${AST_ALSA_FOUND}" = "yes"; then</span><br><span style="color: hsl(0, 100%, 40%);">- ALSA_LIB="${pbxlibdir} -lasound "</span><br><span style="color: hsl(0, 100%, 40%);">- # if --with-ALSA=DIR has been specified, use it.</span><br><span style="color: hsl(0, 100%, 40%);">- if test "x${ALSA_DIR}" != "x"; then</span><br><span style="color: hsl(0, 100%, 40%);">- ALSA_INCLUDE="-I${ALSA_DIR}/include"</span><br><span style="color: hsl(0, 100%, 40%);">- fi</span><br><span style="color: hsl(0, 100%, 40%);">- ALSA_INCLUDE="${ALSA_INCLUDE} "</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- # check for the header</span><br><span style="color: hsl(0, 100%, 40%);">- ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"</span><br><span style="color: hsl(0, 100%, 40%);">- CPPFLAGS="${CPPFLAGS} ${ALSA_INCLUDE}"</span><br><span style="color: hsl(0, 100%, 40%);">- ac_fn_c_check_header_compile "$LINENO" "alsa/asoundlib.h" "ac_cv_header_alsa_asoundlib_h" "$ac_includes_default"</span><br><span style="color: hsl(0, 100%, 40%);">-if test "x$ac_cv_header_alsa_asoundlib_h" = xyes</span><br><span style="color: hsl(0, 100%, 40%);">-then :</span><br><span style="color: hsl(0, 100%, 40%);">- ALSA_HEADER_FOUND=1</span><br><span style="color: hsl(0, 100%, 40%);">-else $as_nop</span><br><span style="color: hsl(0, 100%, 40%);">- ALSA_HEADER_FOUND=0</span><br><span style="color: hsl(0, 100%, 40%);">-fi</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if test "x${ALSA_HEADER_FOUND}" = "x0" ; then</span><br><span style="color: hsl(0, 100%, 40%);">- ALSA_LIB=""</span><br><span style="color: hsl(0, 100%, 40%);">- ALSA_INCLUDE=""</span><br><span style="color: hsl(0, 100%, 40%);">- else</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- PBX_ALSA=1</span><br><span style="color: hsl(0, 100%, 40%);">- cat >>confdefs.h <<_ACEOF</span><br><span style="color: hsl(0, 100%, 40%);">-#define HAVE_ALSA 1</span><br><span style="color: hsl(0, 100%, 40%);">-_ACEOF</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- fi</span><br><span style="color: hsl(0, 100%, 40%);">- fi</span><br><span style="color: hsl(0, 100%, 40%);">-fi</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> </span><br><span> if test "x${PBX_BFD}" != "x1" -a "${USE_BFD}" != "no"; then</span><br><span> pbxlibdir=""</span><br><span>diff --git a/configure.ac b/configure.ac</span><br><span>index af4e316..846d311 100644</span><br><span>--- a/configure.ac</span><br><span>+++ b/configure.ac</span><br><span>@@ -521,7 +521,6 @@</span><br><span> # by the --with option name (the third field),</span><br><span> # to make things easier for the users.</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-AST_EXT_LIB_SETUP([ALSA], [Advanced Linux Sound Architecture], [asound])</span><br><span> AST_EXT_LIB_SETUP([BFD], [Debug symbol decoding], [bfd])</span><br><span> </span><br><span> # BKTR is used for backtrace support on platforms that do not</span><br><span>@@ -1610,8 +1609,6 @@</span><br><span> </span><br><span> # do the package library checks now</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-AST_EXT_LIB_CHECK([ALSA], [asound], [snd_pcm_open], [alsa/asoundlib.h])</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> AST_EXT_LIB_CHECK([BFD], [bfd], [bfd_openr], [bfd.h])</span><br><span> # Fedora/RedHat/CentOS require extra libraries</span><br><span> AST_EXT_LIB_CHECK([BFD], [bfd], [bfd_openr], [bfd.h], [-ldl -liberty])</span><br><span>diff --git a/contrib/scripts/install_prereq b/contrib/scripts/install_prereq</span><br><span>index 590ada5..5843853 100755</span><br><span>--- a/contrib/scripts/install_prereq</span><br><span>+++ b/contrib/scripts/install_prereq</span><br><span>@@ -39,7 +39,7 @@</span><br><span> # Asterisk: basic requirements:</span><br><span> PACKAGES_RH="$PACKAGES_RH libedit-devel jansson-devel libuuid-devel sqlite-devel libxml2-devel"</span><br><span> # Asterisk: for addons:</span><br><span style="color: hsl(0, 100%, 40%);">-PACKAGES_RH="$PACKAGES_RH speex-devel speexdsp-devel libogg-devel libvorbis-devel alsa-lib-devel portaudio-devel libcurl-devel xmlstarlet bison flex"</span><br><span style="color: hsl(120, 100%, 40%);">+PACKAGES_RH="$PACKAGES_RH speex-devel speexdsp-devel libogg-devel libvorbis-devel portaudio-devel libcurl-devel xmlstarlet bison flex"</span><br><span> PACKAGES_RH="$PACKAGES_RH postgresql-devel unixODBC-devel neon-devel gmime-devel lua-devel uriparser-devel libxslt-devel openssl-devel"</span><br><span> PACKAGES_RH="$PACKAGES_RH mysql-devel bluez-libs-devel radcli-devel freetds-devel jack-audio-connection-kit-devel bash libcap-devel"</span><br><span> PACKAGES_RH="$PACKAGES_RH net-snmp-devel iksemel-devel corosynclib-devel newt-devel popt-devel libical-devel spandsp-devel"</span><br><span>@@ -55,7 +55,7 @@</span><br><span> # Asterisk: basic requirements:</span><br><span> PACKAGES_SUSE="$PACKAGES_SUSE libedit-devel libjansson-devel libuuid-devel sqlite3-devel libxml2-devel"</span><br><span> # Asterisk: for addons:</span><br><span style="color: hsl(0, 100%, 40%);">-PACKAGES_SUSE="$PACKAGES_SUSE speex-devel speexdsp-devel libogg-devel libvorbis-devel alsa-devel portaudio-devel libcurl-devel xmlstarlet bison flex"</span><br><span style="color: hsl(120, 100%, 40%);">+PACKAGES_SUSE="$PACKAGES_SUSE speex-devel speexdsp-devel libogg-devel libvorbis-devel portaudio-devel libcurl-devel xmlstarlet bison flex"</span><br><span> PACKAGES_SUSE="$PACKAGES_SUSE postgresql-devel unixODBC-devel libneon-devel gmime-devel lua-devel liburiparser-devel libxslt-devel libopenssl-devel"</span><br><span> PACKAGES_SUSE="$PACKAGES_SUSE libmysqlclient-devel bluez-devel freeradius-client-devel freetds-devel bash libcap-devel"</span><br><span> PACKAGES_SUSE="$PACKAGES_SUSE net-snmp-devel iksemel-devel libcorosync-devel newt-devel popt-devel libical-devel spandsp-devel"</span><br><span>@@ -71,7 +71,7 @@</span><br><span> # Asterisk: basic requirements:</span><br><span> PACKAGES_ARCH="$PACKAGES_ARCH libedit jansson libutil-linux libxml2 sqlite"</span><br><span> # Asterisk: for addons:</span><br><span style="color: hsl(0, 100%, 40%);">-PACKAGES_ARCH="$PACKAGES_ARCH speex speexdsp libogg libvorbis alsa-lib portaudio curl xmlstarlet bison flex"</span><br><span style="color: hsl(120, 100%, 40%);">+PACKAGES_ARCH="$PACKAGES_ARCH speex speexdsp libogg libvorbis portaudio curl xmlstarlet bison flex"</span><br><span> PACKAGES_ARCH="$PACKAGES_ARCH postgresql-libs unixodbc neon gmime lua uriparser libxslt openssl"</span><br><span> PACKAGES_ARCH="$PACKAGES_ARCH libmariadbclient bluez-libs radcli freetds bash libcap"</span><br><span> PACKAGES_ARCH="$PACKAGES_ARCH net-snmp libnewt popt libical spandsp"</span><br><span>@@ -87,7 +87,7 @@</span><br><span> # Asterisk: basic requirements:</span><br><span> PACKAGES_GENTOO="$PACKAGES_GENTOO dev-libs/libedit dev-libs/jansson sys-libs/e2fsprogs-libs dev-libs/libxml2 dev-db/sqlite"</span><br><span> # Asterisk: for addons:</span><br><span style="color: hsl(0, 100%, 40%);">-PACKAGES_GENTOO="$PACKAGES_GENTOO media-libs/speex media-libs/speexdsp media-libs/libogg media-libs/libvorbis media-libs/alsa-lib media-libs/portaudio net-misc/curl app-text/xmlstarlet sys-devel/bison sys-devel/flex"</span><br><span style="color: hsl(120, 100%, 40%);">+PACKAGES_GENTOO="$PACKAGES_GENTOO media-libs/speex media-libs/speexdsp media-libs/libogg media-libs/libvorbis media-libs/portaudio net-misc/curl app-text/xmlstarlet sys-devel/bison sys-devel/flex"</span><br><span> PACKAGES_GENTOO="$PACKAGES_GENTOO dev-db/postgresql dev-db/unixODBC net-libs/neon dev-libs/gmime dev-lang/lua dev-libs/uriparser dev-libs/libxslt dev-libs/openssl"</span><br><span> PACKAGES_GENTOO="$PACKAGES_GENTOO virtual/libmysqlclient net-wireless/bluez net-dialup/radiusclient-ng dev-db/freetds app-shells/bash sys-libs/libcap"</span><br><span> PACKAGES_GENTOO="$PACKAGES_GENTOO net-analyzer/net-snmp dev-libs/iksemel sys-cluster/corosync dev-libs/newt dev-libs/popt dev-libs/libical media-libs/spandsp"</span><br><span>@@ -103,7 +103,7 @@</span><br><span> # Asterisk: basic requirements:</span><br><span> PACKAGES_NBSD="$PACKAGES_NBSD editline jansson sqlite3 libuuid libxml2"</span><br><span> # Asterisk: for addons:</span><br><span style="color: hsl(0, 100%, 40%);">-PACKAGES_NBSD="$PACKAGES_NBSD speex speexdsp libogg libvorbis alsa-lib portaudio-devel curl bison flex"</span><br><span style="color: hsl(120, 100%, 40%);">+PACKAGES_NBSD="$PACKAGES_NBSD speex speexdsp libogg libvorbis portaudio-devel curl bison flex"</span><br><span> PACKAGES_NBSD="$PACKAGES_NBSD postgresql10-client unixodbc neon gmime lua52 uriparser libxslt openssl"</span><br><span> PACKAGES_NBSD="$PACKAGES_NBSD mysql-client radiusclient-ng freetds bash"</span><br><span> PACKAGES_NBSD="$PACKAGES_NBSD net-snmp iksemel popt libical spandsp"</span><br><span>@@ -135,7 +135,7 @@</span><br><span> # Asterisk: basic requirements:</span><br><span> PACKAGES_FBSD="$PACKAGES_FBSD libedit jansson e2fsprogs-libuuid sqlite3 libxml2"</span><br><span> # Asterisk: for addons:</span><br><span style="color: hsl(0, 100%, 40%);">-PACKAGES_FBSD="$PACKAGES_FBSD speex speexdsp libogg libvorbis alsa-lib portaudio curl xmlstarlet bison flex"</span><br><span style="color: hsl(120, 100%, 40%);">+PACKAGES_FBSD="$PACKAGES_FBSD speex speexdsp libogg libvorbis portaudio curl xmlstarlet bison flex"</span><br><span> PACKAGES_FBSD="$PACKAGES_FBSD postgresql10-client unixODBC neon gmime26 lua52 uriparser libxslt openssl"</span><br><span> PACKAGES_FBSD="$PACKAGES_FBSD mysql57-client radcli freetds"</span><br><span> PACKAGES_FBSD="$PACKAGES_FBSD net-snmp iksemel corosync newt popt libical spandsp"</span><br><span>@@ -151,7 +151,7 @@</span><br><span> # Asterisk: basic requirements:</span><br><span> PACKAGES_DBSD="$PACKAGES_DBSD libedit jansson e2fsprogs-libuuid sqlite3 libxml2"</span><br><span> # Asterisk: for addons:</span><br><span style="color: hsl(0, 100%, 40%);">-PACKAGES_DBSD="$PACKAGES_DBSD speex speexdsp libogg libvorbis alsa-lib portaudio curl xmlstarlet bison flex"</span><br><span style="color: hsl(120, 100%, 40%);">+PACKAGES_DBSD="$PACKAGES_DBSD speex speexdsp libogg libvorbis portaudio curl xmlstarlet bison flex"</span><br><span> PACKAGES_DBSD="$PACKAGES_DBSD postgresql10-client unixODBC neon gmime26 lua52 uriparser libxslt libressl"</span><br><span> PACKAGES_DBSD="$PACKAGES_DBSD mariadb101-client radcli freetds"</span><br><span> PACKAGES_DBSD="$PACKAGES_DBSD net-snmp iksemel corosync newt popt libical spandsp"</span><br><span>diff --git a/doc/UPGRADE-staging/chan_alsa_removal.txt b/doc/UPGRADE-staging/chan_alsa_removal.txt</span><br><span>new file mode 100644</span><br><span>index 0000000..baf91af</span><br><span>--- /dev/null</span><br><span>+++ b/doc/UPGRADE-staging/chan_alsa_removal.txt</span><br><span>@@ -0,0 +1,6 @@</span><br><span style="color: hsl(120, 100%, 40%);">+Subject: chan_alsa</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 19</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>diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in</span><br><span>index a86d168..f336b22 100644</span><br><span>--- a/include/asterisk/autoconfig.h.in</span><br><span>+++ b/include/asterisk/autoconfig.h.in</span><br><span>@@ -44,9 +44,6 @@</span><br><span> /* Define to 1 if <alloca.h> works. */</span><br><span> #undef HAVE_ALLOCA_H</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-/* Define to 1 if you have the Advanced Linux Sound Architecture library. */</span><br><span style="color: hsl(0, 100%, 40%);">-#undef HAVE_ALSA</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> /* Define to 1 if you have the <arpa/inet.h> header file. */</span><br><span> #undef HAVE_ARPA_INET_H</span><br><span> </span><br><span>diff --git a/include/asterisk/doxygen/licensing.h b/include/asterisk/doxygen/licensing.h</span><br><span>index fa9e73e..99d70e0 100644</span><br><span>--- a/include/asterisk/doxygen/licensing.h</span><br><span>+++ b/include/asterisk/doxygen/licensing.h</span><br><span>@@ -29,12 +29,6 @@</span><br><span> * This section contains a (not yet complete) list of libraries that are used</span><br><span> * by various parts of Asterisk, including related licensing information.</span><br><span> *</span><br><span style="color: hsl(0, 100%, 40%);">- * \subsection alsa_lib ALSA Library</span><br><span style="color: hsl(0, 100%, 40%);">- * \arg <b>Library</b>: libasound</span><br><span style="color: hsl(0, 100%, 40%);">- * \arg <b>Website</b>: http://www.alsa-project.org</span><br><span style="color: hsl(0, 100%, 40%);">- * \arg <b>Used by</b>: chan_alsa</span><br><span style="color: hsl(0, 100%, 40%);">- * \arg <b>License</b>: LGPL</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span> * \subsection openssl_lib OpenSSL</span><br><span> * \arg <b>Library</b>: libcrypto, libssl</span><br><span> * \arg <b>Website</b>: http://www.openssl.org</span><br><span>@@ -57,8 +51,7 @@</span><br><span> * \arg <b>Note</b>: Even though PortAudio is licensed under a BSD style</span><br><span> * license, PortAudio will make use of some audio interface,</span><br><span> * depending on how it was built. That audio interface may</span><br><span style="color: hsl(0, 100%, 40%);">- * introduce additional licensing restrictions. On Linux,</span><br><span style="color: hsl(0, 100%, 40%);">- * this would most commonly be ALSA: \ref alsa_lib.</span><br><span style="color: hsl(120, 100%, 40%);">+ * introduce additional licensing restrictions.</span><br><span> *</span><br><span> * \subsection rawlist Raw list of libraries that used by any part of Asterisk</span><br><span> * \li c-client.a (app_voicemail with IMAP support)</span><br><span>diff --git a/makeopts.in b/makeopts.in</span><br><span>index 0f6cb91..50fc8eb 100644</span><br><span>--- a/makeopts.in</span><br><span>+++ b/makeopts.in</span><br><span>@@ -130,9 +130,6 @@</span><br><span> AST_RPATH=@AST_RPATH@</span><br><span> AST_FORTIFY_SOURCE=@AST_FORTIFY_SOURCE@</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-ALSA_INCLUDE=@ALSA_INCLUDE@</span><br><span style="color: hsl(0, 100%, 40%);">-ALSA_LIB=@ALSA_LIB@</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> BFD_INCLUDE=@BFD_INCLUDE@</span><br><span> BFD_LIB=@BFD_LIB@</span><br><span> </span><br><span>diff --git a/menuselect/example_menuselect-tree b/menuselect/example_menuselect-tree</span><br><span>index 624a658..81c436a 100644</span><br><span>--- a/menuselect/example_menuselect-tree</span><br><span>+++ b/menuselect/example_menuselect-tree</span><br><span>@@ -183,9 +183,6 @@</span><br><span> <category name="MENUSELECT_CHANNELS" displayname="Channel Drivers"></span><br><span> <member name="chan_agent" displayname="Agent Proxy Channel" remove_on_change="channels/chan_agent.o channels/chan_agent.so"></span><br><span> </member></span><br><span style="color: hsl(0, 100%, 40%);">- <member name="chan_alsa" displayname="ALSA Console Channel Driver" remove_on_change="channels/chan_alsa.o channels/chan_alsa.so"></span><br><span style="color: hsl(0, 100%, 40%);">- <depend>asound</depend></span><br><span style="color: hsl(0, 100%, 40%);">- </member></span><br><span> <member name="chan_features" displayname="Feature Proxy Channel" remove_on_change="channels/chan_features.o channels/chan_features.so"></span><br><span> </member></span><br><span> <member name="chan_h323" displayname="The NuFone Network's Open H.323 Channel Driver" remove_on_change="channels/chan_h323.o channels/chan_h323.so"></span><br><span>diff --git a/menuselect/test/menuselect-tree b/menuselect/test/menuselect-tree</span><br><span>index 73c78bc..6bad4ca 100644</span><br><span>--- a/menuselect/test/menuselect-tree</span><br><span>+++ b/menuselect/test/menuselect-tree</span><br><span>@@ -193,9 +193,6 @@</span><br><span> <member name="chan_agent" displayname="Agent Proxy Channel" remove_on_change="channels/chan_agent.o channels/chan_agent.so"></span><br><span> <depend>chan_local</depend></span><br><span> </member></span><br><span style="color: hsl(0, 100%, 40%);">-<member name="chan_alsa" displayname="ALSA Console Channel Driver" remove_on_change="channels/chan_alsa.o channels/chan_alsa.so"></span><br><span style="color: hsl(0, 100%, 40%);">- <depend>asound</depend></span><br><span style="color: hsl(0, 100%, 40%);">-</member></span><br><span> <member name="chan_console" displayname="Console Channel Driver" remove_on_change="channels/chan_console.o channels/chan_console.so"></span><br><span> <depend>portaudio</depend></span><br><span> </member></span><br><span>diff --git a/tests/CI/buildAsterisk.sh b/tests/CI/buildAsterisk.sh</span><br><span>index 75beb4b..9e3cb66 100755</span><br><span>--- a/tests/CI/buildAsterisk.sh</span><br><span>+++ b/tests/CI/buildAsterisk.sh</span><br><span>@@ -156,7 +156,7 @@</span><br><span> mod_disables+=" cdr_adaptive_odbc cdr_custom cdr_manager cdr_odbc cdr_pgsql cdr_radius"</span><br><span> mod_disables+=" cdr_tds"</span><br><span> mod_disables+=" cel_odbc cel_pgsql cel_radius cel_sqlite3_custom cel_tds"</span><br><span style="color: hsl(0, 100%, 40%);">- mod_disables+=" chan_alsa chan_console chan_motif chan_rtp chan_unistim"</span><br><span style="color: hsl(120, 100%, 40%);">+ mod_disables+=" chan_console chan_motif chan_rtp chan_unistim"</span><br><span> mod_disables+=" func_frame_trace func_pitchshift func_speex func_volume func_dialgroup"</span><br><span> mod_disables+=" func_periodic_hook func_sprintf func_enum func_extstate func_sysinfo func_iconv"</span><br><span> mod_disables+=" func_callcompletion func_version func_rand func_sha1 func_module func_md5"</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/19564">change 19564</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/+/19564"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I5c8afb781528afdf55d237e3bffa5e4a862ae8c7 </div>
<div style="display:none"> Gerrit-Change-Number: 19564 </div>
<div style="display:none"> Gerrit-PatchSet: 5 </div>
<div style="display:none"> Gerrit-Owner: Michael Bradeen <mbradeen@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: N A <asterisk@phreaknet.org> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>