<p>Joshua Colp has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/16311">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">chan_oss: Remove deprecated module.<br><br>ASTERISK-29593<br><br>Change-Id: Ib53a42ad974c63871344b95078c61c188e43da99<br>---<br>M build_tools/menuselect-deps.in<br>D channels/chan_oss.c<br>M configure<br>M configure.ac<br>A doc/UPGRADE-staging/chan_oss_removal.txt<br>M include/asterisk/autoconfig.h.in<br>M menuselect/configure<br>7 files changed, 41 insertions(+), 1,795 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/11/16311/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/build_tools/menuselect-deps.in b/build_tools/menuselect-deps.in</span><br><span>index 161c67b..586985f 100644</span><br><span>--- a/build_tools/menuselect-deps.in</span><br><span>+++ b/build_tools/menuselect-deps.in</span><br><span>@@ -46,7 +46,6 @@</span><br><span> OPUS=@PBX_OPUS@</span><br><span> OPUSFILE=@PBX_OPUSFILE@</span><br><span> OSPTK=@PBX_OSPTK@</span><br><span style="color: hsl(0, 100%, 40%);">-OSS=@PBX_OSS@</span><br><span> PGSQL=@PBX_PGSQL@</span><br><span> PJPROJECT=@PBX_PJPROJECT@</span><br><span> POPT=@PBX_POPT@</span><br><span>diff --git a/channels/chan_oss.c b/channels/chan_oss.c</span><br><span>deleted file mode 100644</span><br><span>index 69dd71f..0000000</span><br><span>--- a/channels/chan_oss.c</span><br><span>+++ /dev/null</span><br><span>@@ -1,1529 +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 - 2007, Digium, Inc.</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * Mark Spencer <markster@digium.com></span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * FreeBSD changes and multiple device support by Luigi Rizzo, 2005.05.25</span><br><span style="color: hsl(0, 100%, 40%);">- * note-this code best seen with ts=8 (8-spaces tabs) in the editor</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%);">-// #define HAVE_VIDEO_CONSOLE // uncomment to enable video</span><br><span style="color: hsl(0, 100%, 40%);">-/*! \file</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * \brief Channel driver for OSS sound cards</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * \author Mark Spencer <markster@digium.com></span><br><span style="color: hsl(0, 100%, 40%);">- * \author Luigi Rizzo</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_oss.c uses the configuration file \ref oss.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 oss.conf oss.conf</span><br><span style="color: hsl(0, 100%, 40%);">- * \verbinclude oss.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>oss</depend></span><br><span style="color: hsl(0, 100%, 40%);">- <support_level>deprecated</support_level></span><br><span style="color: hsl(0, 100%, 40%);">- <deprecated_in>16</deprecated_in></span><br><span style="color: hsl(0, 100%, 40%);">- <removed_in>19</removed_in></span><br><span style="color: hsl(0, 100%, 40%);">- ***/</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-#include "asterisk.h"</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-#include <ctype.h> /* isalnum() used here */</span><br><span style="color: hsl(0, 100%, 40%);">-#include <math.h></span><br><span style="color: hsl(0, 100%, 40%);">-#include <sys/ioctl.h></span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-#ifdef __linux</span><br><span style="color: hsl(0, 100%, 40%);">-#include <linux/soundcard.h></span><br><span style="color: hsl(0, 100%, 40%);">-#elif defined(__FreeBSD__) || defined(__DragonFly__) || defined(__CYGWIN__) || defined(__GLIBC__) || defined(__sun)</span><br><span style="color: hsl(0, 100%, 40%);">-#include <sys/soundcard.h></span><br><span style="color: hsl(0, 100%, 40%);">-#else</span><br><span style="color: hsl(0, 100%, 40%);">-#include <soundcard.h></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%);">-#include "asterisk/channel.h"</span><br><span style="color: hsl(0, 100%, 40%);">-#include "asterisk/file.h"</span><br><span style="color: hsl(0, 100%, 40%);">-#include "asterisk/callerid.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/cli.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/musiconhold.h"</span><br><span style="color: hsl(0, 100%, 40%);">-#include "asterisk/app.h"</span><br><span style="color: hsl(0, 100%, 40%);">-#include "asterisk/bridge.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%);">-#include "console_video.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 oss.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%);">-{</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%);">-/*</span><br><span style="color: hsl(0, 100%, 40%);">- * Basic mode of operation:</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * we have one keyboard (which receives commands from the keyboard)</span><br><span style="color: hsl(0, 100%, 40%);">- * and multiple headset's connected to audio cards.</span><br><span style="color: hsl(0, 100%, 40%);">- * Cards/Headsets are named as the sections of oss.conf.</span><br><span style="color: hsl(0, 100%, 40%);">- * The section called [general] contains the default parameters.</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * At any time, the keyboard is attached to one card, and you</span><br><span style="color: hsl(0, 100%, 40%);">- * can switch among them using the command 'console foo'</span><br><span style="color: hsl(0, 100%, 40%);">- * where 'foo' is the name of the card you want.</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * oss.conf parameters are</span><br><span style="color: hsl(0, 100%, 40%);">-START_CONFIG</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%);">- ; General config options, with default values shown.</span><br><span style="color: hsl(0, 100%, 40%);">- ; You should use one section per device, with [general] being used</span><br><span style="color: hsl(0, 100%, 40%);">- ; for the first device and also as a template for other devices.</span><br><span style="color: hsl(0, 100%, 40%);">- ;</span><br><span style="color: hsl(0, 100%, 40%);">- ; All but 'debug' can go also in the device-specific sections.</span><br><span style="color: hsl(0, 100%, 40%);">- ;</span><br><span style="color: hsl(0, 100%, 40%);">- ; debug = 0x0 ; misc debug flags, default is 0</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- ; Set the device to use for I/O</span><br><span style="color: hsl(0, 100%, 40%);">- ; device = /dev/dsp</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- ; Optional mixer command to run upon startup (e.g. to set</span><br><span style="color: hsl(0, 100%, 40%);">- ; volume levels, mutes, etc.</span><br><span style="color: hsl(0, 100%, 40%);">- ; mixer =</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- ; Software mic volume booster (or attenuator), useful for sound</span><br><span style="color: hsl(0, 100%, 40%);">- ; cards or microphones with poor sensitivity. The volume level</span><br><span style="color: hsl(0, 100%, 40%);">- ; is in dB, ranging from -20.0 to +20.0</span><br><span style="color: hsl(0, 100%, 40%);">- ; boost = n ; mic volume boost in dB</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- ; Set the callerid for outgoing calls</span><br><span style="color: hsl(0, 100%, 40%);">- ; callerid = John Doe <555-1234></span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- ; autoanswer = no ; no autoanswer on call</span><br><span style="color: hsl(0, 100%, 40%);">- ; autohangup = yes ; hangup when other party closes</span><br><span style="color: hsl(0, 100%, 40%);">- ; extension = s ; default extension to call</span><br><span style="color: hsl(0, 100%, 40%);">- ; context = default ; default context for outgoing calls</span><br><span style="color: hsl(0, 100%, 40%);">- ; language = "" ; default language</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%);">- ; If you set overridecontext to 'yes', then the whole dial string</span><br><span style="color: hsl(0, 100%, 40%);">- ; will be interpreted as an extension, which is extremely useful</span><br><span style="color: hsl(0, 100%, 40%);">- ; to dial SIP, IAX and other extensions which use the '@' character.</span><br><span style="color: hsl(0, 100%, 40%);">- ; The default is 'no' just for backward compatibility, but the</span><br><span style="color: hsl(0, 100%, 40%);">- ; suggestion is to change it.</span><br><span style="color: hsl(0, 100%, 40%);">- ; overridecontext = no ; if 'no', the last @ will start the context</span><br><span style="color: hsl(0, 100%, 40%);">- ; if 'yes' the whole string is an extension.</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- ; low level device parameters in case you have problems with the</span><br><span style="color: hsl(0, 100%, 40%);">- ; device driver on your operating system. You should not touch these</span><br><span style="color: hsl(0, 100%, 40%);">- ; unless you know what you are doing.</span><br><span style="color: hsl(0, 100%, 40%);">- ; queuesize = 10 ; frames in device driver</span><br><span style="color: hsl(0, 100%, 40%);">- ; frags = 8 ; argument to SETFRAGMENT</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%);">- ; OSS 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 OSS channel can't accept jitter,</span><br><span style="color: hsl(0, 100%, 40%);">- ; thus an enabled jitterbuffer on the receive OSS 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, usualy 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 an OSS</span><br><span style="color: hsl(0, 100%, 40%);">- ; channel. Two implementations are currenlty 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%);">- ; jblog = no ; Enables jitterbuffer frame logging. Defaults to "no".</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%);">-[card1]</span><br><span style="color: hsl(0, 100%, 40%);">- ; device = /dev/dsp1 ; alternate device</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-END_CONFIG</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-.. and so on for the other cards.</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-/*</span><br><span style="color: hsl(0, 100%, 40%);">- * The following parameters are used in the driver:</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * FRAME_SIZE the size of an audio frame, in samples.</span><br><span style="color: hsl(0, 100%, 40%);">- * 160 is used almost universally, so you should not change it.</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * FRAGS the argument for the SETFRAGMENT ioctl.</span><br><span style="color: hsl(0, 100%, 40%);">- * Overridden by the 'frags' parameter in oss.conf</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * Bits 0-7 are the base-2 log of the device's block size,</span><br><span style="color: hsl(0, 100%, 40%);">- * bits 16-31 are the number of blocks in the driver's queue.</span><br><span style="color: hsl(0, 100%, 40%);">- * There are a lot of differences in the way this parameter</span><br><span style="color: hsl(0, 100%, 40%);">- * is supported by different drivers, so you may need to</span><br><span style="color: hsl(0, 100%, 40%);">- * experiment a bit with the value.</span><br><span style="color: hsl(0, 100%, 40%);">- * A good default for linux is 30 blocks of 64 bytes, which</span><br><span style="color: hsl(0, 100%, 40%);">- * results in 6 frames of 320 bytes (160 samples).</span><br><span style="color: hsl(0, 100%, 40%);">- * FreeBSD works decently with blocks of 256 or 512 bytes,</span><br><span style="color: hsl(0, 100%, 40%);">- * leaving the number unspecified.</span><br><span style="color: hsl(0, 100%, 40%);">- * Note that this only refers to the device buffer size,</span><br><span style="color: hsl(0, 100%, 40%);">- * this module will then try to keep the lenght of audio</span><br><span style="color: hsl(0, 100%, 40%);">- * buffered within small constraints.</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * QUEUE_SIZE The max number of blocks actually allowed in the device</span><br><span style="color: hsl(0, 100%, 40%);">- * driver's buffer, irrespective of the available number.</span><br><span style="color: hsl(0, 100%, 40%);">- * Overridden by the 'queuesize' parameter in oss.conf</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * Should be >=2, and at most as large as the hw queue above</span><br><span style="color: hsl(0, 100%, 40%);">- * (otherwise it will never be full).</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-#define FRAME_SIZE 160</span><br><span style="color: hsl(0, 100%, 40%);">-#define QUEUE_SIZE 10</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-#if defined(__FreeBSD__)</span><br><span style="color: hsl(0, 100%, 40%);">-#define FRAGS 0x8</span><br><span style="color: hsl(0, 100%, 40%);">-#else</span><br><span style="color: hsl(0, 100%, 40%);">-#define FRAGS ( ( (6 * 5) << 16 ) | 0x6 )</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%);">-/*</span><br><span style="color: hsl(0, 100%, 40%);">- * XXX text message sizes are probably 256 chars, but i am</span><br><span style="color: hsl(0, 100%, 40%);">- * not sure if there is a suitable definition anywhere.</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">-#define TEXT_SIZE 256</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-#if 0</span><br><span style="color: hsl(0, 100%, 40%);">-#define TRYOPEN 1 /* try to open on startup */</span><br><span style="color: hsl(0, 100%, 40%);">-#endif</span><br><span style="color: hsl(0, 100%, 40%);">-#define O_CLOSE 0x444 /* special 'close' mode for device */</span><br><span style="color: hsl(0, 100%, 40%);">-/* Which device to use */</span><br><span style="color: hsl(0, 100%, 40%);">-#if defined( __OpenBSD__ ) || defined( __NetBSD__ )</span><br><span style="color: hsl(0, 100%, 40%);">-#define DEV_DSP "/dev/audio"</span><br><span style="color: hsl(0, 100%, 40%);">-#else</span><br><span style="color: hsl(0, 100%, 40%);">-#define DEV_DSP "/dev/dsp"</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 *config = "oss.conf"; /* default config file */</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-static int oss_debug;</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 descriptor for one of our channels.</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * There is one used for 'default' values (from the [general] entry in</span><br><span style="color: hsl(0, 100%, 40%);">- * the configuration file), and then one instance for each device</span><br><span style="color: hsl(0, 100%, 40%);">- * (the default is cloned from [general], others are only created</span><br><span style="color: hsl(0, 100%, 40%);">- * if the relevant section exists).</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">-struct chan_oss_pvt {</span><br><span style="color: hsl(0, 100%, 40%);">- struct chan_oss_pvt *next;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- char *name;</span><br><span style="color: hsl(0, 100%, 40%);">- int total_blocks; /*!< total blocks in the output device */</span><br><span style="color: hsl(0, 100%, 40%);">- int sounddev;</span><br><span style="color: hsl(0, 100%, 40%);">- enum {</span><br><span style="color: hsl(0, 100%, 40%);">- CHAN_OSS_DUPLEX_UNSET,</span><br><span style="color: hsl(0, 100%, 40%);">- CHAN_OSS_DUPLEX_FULL,</span><br><span style="color: hsl(0, 100%, 40%);">- CHAN_OSS_DUPLEX_READ,</span><br><span style="color: hsl(0, 100%, 40%);">- CHAN_OSS_DUPLEX_WRITE</span><br><span style="color: hsl(0, 100%, 40%);">- } duplex;</span><br><span style="color: hsl(0, 100%, 40%);">- int autoanswer; /*!< Boolean: whether to answer the immediately upon calling */</span><br><span style="color: hsl(0, 100%, 40%);">- int autohangup; /*!< Boolean: whether to hangup the call when the remote end hangs up */</span><br><span style="color: hsl(0, 100%, 40%);">- int hookstate; /*!< Boolean: 1 if offhook; 0 if onhook */</span><br><span style="color: hsl(0, 100%, 40%);">- char *mixer_cmd; /*!< initial command to issue to the mixer */</span><br><span style="color: hsl(0, 100%, 40%);">- unsigned int queuesize; /*!< max fragments in queue */</span><br><span style="color: hsl(0, 100%, 40%);">- unsigned int frags; /*!< parameter for SETFRAGMENT */</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- int warned; /*!< various flags used for warnings */</span><br><span style="color: hsl(0, 100%, 40%);">-#define WARN_used_blocks 1</span><br><span style="color: hsl(0, 100%, 40%);">-#define WARN_speed 2</span><br><span style="color: hsl(0, 100%, 40%);">-#define WARN_frag 4</span><br><span style="color: hsl(0, 100%, 40%);">- int w_errors; /*!< overfull in the write path */</span><br><span style="color: hsl(0, 100%, 40%);">- struct timeval lastopen;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- int overridecontext;</span><br><span style="color: hsl(0, 100%, 40%);">- int mute;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- /*! boost support. BOOST_SCALE * 10 ^(BOOST_MAX/20) must</span><br><span style="color: hsl(0, 100%, 40%);">- * be representable in 16 bits to avoid overflows.</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">-#define BOOST_SCALE (1<<9)</span><br><span style="color: hsl(0, 100%, 40%);">-#define BOOST_MAX 40 /*!< slightly less than 7 bits */</span><br><span style="color: hsl(0, 100%, 40%);">- int boost; /*!< input boost, scaled by BOOST_SCALE */</span><br><span style="color: hsl(0, 100%, 40%);">- char device[64]; /*!< device to open */</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- pthread_t sthread;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_channel *owner;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- struct video_desc *env; /*!< parameters for video support */</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- char ext[AST_MAX_EXTENSION];</span><br><span style="color: hsl(0, 100%, 40%);">- char ctx[AST_MAX_CONTEXT];</span><br><span style="color: hsl(0, 100%, 40%);">- char language[MAX_LANGUAGE];</span><br><span style="color: hsl(0, 100%, 40%);">- char cid_name[256]; /*!< Initial CallerID name */</span><br><span style="color: hsl(0, 100%, 40%);">- char cid_num[256]; /*!< Initial CallerID number */</span><br><span style="color: hsl(0, 100%, 40%);">- char mohinterpret[MAX_MUSICCLASS];</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- /*! buffers used in oss_write */</span><br><span style="color: hsl(0, 100%, 40%);">- char oss_write_buf[FRAME_SIZE * 2];</span><br><span style="color: hsl(0, 100%, 40%);">- int oss_write_dst;</span><br><span style="color: hsl(0, 100%, 40%);">- /*! buffers used in oss_read - AST_FRIENDLY_OFFSET space for headers</span><br><span style="color: hsl(0, 100%, 40%);">- * plus enough room for a full frame</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">- char oss_read_buf[FRAME_SIZE * 2 + AST_FRIENDLY_OFFSET];</span><br><span style="color: hsl(0, 100%, 40%);">- int readpos; /*!< read position above */</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_frame read_f; /*!< returned by oss_read */</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%);">-/*! forward declaration */</span><br><span style="color: hsl(0, 100%, 40%);">-static struct chan_oss_pvt *find_desc(const char *dev);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-static char *oss_active; /*!< the active device */</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-/*! \brief return the pointer to the video descriptor */</span><br><span style="color: hsl(0, 100%, 40%);">-struct video_desc *get_video_desc(struct ast_channel *c)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- struct chan_oss_pvt *o = c ? ast_channel_tech_pvt(c) : find_desc(oss_active);</span><br><span style="color: hsl(0, 100%, 40%);">- return o ? o->env : NULL;</span><br><span style="color: hsl(0, 100%, 40%);">-}</span><br><span style="color: hsl(0, 100%, 40%);">-static struct chan_oss_pvt oss_default = {</span><br><span style="color: hsl(0, 100%, 40%);">- .sounddev = -1,</span><br><span style="color: hsl(0, 100%, 40%);">- .duplex = CHAN_OSS_DUPLEX_UNSET, /* XXX check this */</span><br><span style="color: hsl(0, 100%, 40%);">- .autoanswer = 1,</span><br><span style="color: hsl(0, 100%, 40%);">- .autohangup = 1,</span><br><span style="color: hsl(0, 100%, 40%);">- .queuesize = QUEUE_SIZE,</span><br><span style="color: hsl(0, 100%, 40%);">- .frags = FRAGS,</span><br><span style="color: hsl(0, 100%, 40%);">- .ext = "s",</span><br><span style="color: hsl(0, 100%, 40%);">- .ctx = "default",</span><br><span style="color: hsl(0, 100%, 40%);">- .readpos = AST_FRIENDLY_OFFSET, /* start here on reads */</span><br><span style="color: hsl(0, 100%, 40%);">- .lastopen = { 0, 0 },</span><br><span style="color: hsl(0, 100%, 40%);">- .boost = BOOST_SCALE,</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 setformat(struct chan_oss_pvt *o, int mode);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-static struct ast_channel *oss_request(const char *type, struct ast_format_cap *cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor,</span><br><span style="color: hsl(0, 100%, 40%);">- const char *data, int *cause);</span><br><span style="color: hsl(0, 100%, 40%);">-static int oss_digit_begin(struct ast_channel *c, char digit);</span><br><span style="color: hsl(0, 100%, 40%);">-static int oss_digit_end(struct ast_channel *c, char digit, unsigned int duration);</span><br><span style="color: hsl(0, 100%, 40%);">-static int oss_text(struct ast_channel *c, const char *text);</span><br><span style="color: hsl(0, 100%, 40%);">-static int oss_hangup(struct ast_channel *c);</span><br><span style="color: hsl(0, 100%, 40%);">-static int oss_answer(struct ast_channel *c);</span><br><span style="color: hsl(0, 100%, 40%);">-static struct ast_frame *oss_read(struct ast_channel *chan);</span><br><span style="color: hsl(0, 100%, 40%);">-static int oss_call(struct ast_channel *c, const char *dest, int timeout);</span><br><span style="color: hsl(0, 100%, 40%);">-static int oss_write(struct ast_channel *chan, struct ast_frame *f);</span><br><span style="color: hsl(0, 100%, 40%);">-static int oss_indicate(struct ast_channel *chan, int cond, const void *data, size_t datalen);</span><br><span style="color: hsl(0, 100%, 40%);">-static int oss_fixup(struct ast_channel *oldchan, struct ast_channel *newchan);</span><br><span style="color: hsl(0, 100%, 40%);">-static char tdesc[] = "OSS Console Channel Driver";</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-/* cannot do const because need to update some fields at runtime */</span><br><span style="color: hsl(0, 100%, 40%);">-static struct ast_channel_tech oss_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 = oss_request,</span><br><span style="color: hsl(0, 100%, 40%);">- .send_digit_begin = oss_digit_begin,</span><br><span style="color: hsl(0, 100%, 40%);">- .send_digit_end = oss_digit_end,</span><br><span style="color: hsl(0, 100%, 40%);">- .send_text = oss_text,</span><br><span style="color: hsl(0, 100%, 40%);">- .hangup = oss_hangup,</span><br><span style="color: hsl(0, 100%, 40%);">- .answer = oss_answer,</span><br><span style="color: hsl(0, 100%, 40%);">- .read = oss_read,</span><br><span style="color: hsl(0, 100%, 40%);">- .call = oss_call,</span><br><span style="color: hsl(0, 100%, 40%);">- .write = oss_write,</span><br><span style="color: hsl(0, 100%, 40%);">- .write_video = console_write_video,</span><br><span style="color: hsl(0, 100%, 40%);">- .indicate = oss_indicate,</span><br><span style="color: hsl(0, 100%, 40%);">- .fixup = oss_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%);">-/*!</span><br><span style="color: hsl(0, 100%, 40%);">- * \brief returns a pointer to the descriptor with the given name</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">-static struct chan_oss_pvt *find_desc(const char *dev)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- struct chan_oss_pvt *o = NULL;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (!dev)</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING, "null dev\n");</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- for (o = oss_default.next; o && o->name && dev && strcmp(o->name, dev) != 0; o = o->next);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (!o)</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING, "could not find <%s>\n", dev ? dev : "--no-device--");</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- return o;</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 split a string in extension-context, returns pointers to malloc'ed</span><br><span style="color: hsl(0, 100%, 40%);">- * strings.</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * If we do not have 'overridecontext' then the last @ is considered as</span><br><span style="color: hsl(0, 100%, 40%);">- * a context separator, and the context is overridden.</span><br><span style="color: hsl(0, 100%, 40%);">- * This is usually not very necessary as you can play with the dialplan,</span><br><span style="color: hsl(0, 100%, 40%);">- * and it is nice not to need it because you have '@' in SIP addresses.</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * \return the buffer address.</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">-static char *ast_ext_ctx(const char *src, char **ext, char **ctx)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- struct chan_oss_pvt *o = find_desc(oss_active);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (ext == NULL || ctx == NULL)</span><br><span style="color: hsl(0, 100%, 40%);">- return NULL; /* error */</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- *ext = *ctx = NULL;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (src && *src != '\0')</span><br><span style="color: hsl(0, 100%, 40%);">- *ext = ast_strdup(src);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (*ext == NULL)</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%);">- if (!o->overridecontext) {</span><br><span style="color: hsl(0, 100%, 40%);">- /* parse from the right */</span><br><span style="color: hsl(0, 100%, 40%);">- *ctx = strrchr(*ext, '@');</span><br><span style="color: hsl(0, 100%, 40%);">- if (*ctx)</span><br><span style="color: hsl(0, 100%, 40%);">- *(*ctx)++ = '\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%);">- return *ext;</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 Returns the number of blocks used in the audio output channel</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">-static int used_blocks(struct chan_oss_pvt *o)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- struct audio_buf_info info;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (ioctl(o->sounddev, SNDCTL_DSP_GETOSPACE, &info)) {</span><br><span style="color: hsl(0, 100%, 40%);">- if (!(o->warned & WARN_used_blocks)) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING, "Error reading output space\n");</span><br><span style="color: hsl(0, 100%, 40%);">- o->warned |= WARN_used_blocks;</span><br><span style="color: hsl(0, 100%, 40%);">- }</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%);">- if (o->total_blocks == 0) {</span><br><span style="color: hsl(0, 100%, 40%);">- if (0) /* debugging */</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING, "fragtotal %d size %d avail %d\n", info.fragstotal, info.fragsize, info.fragments);</span><br><span style="color: hsl(0, 100%, 40%);">- o->total_blocks = info.fragments;</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 o->total_blocks - info.fragments;</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%);">-/*! Write an exactly FRAME_SIZE sized frame */</span><br><span style="color: hsl(0, 100%, 40%);">-static int soundcard_writeframe(struct chan_oss_pvt *o, short *data)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- int res;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (o->sounddev < 0)</span><br><span style="color: hsl(0, 100%, 40%);">- setformat(o, O_RDWR);</span><br><span style="color: hsl(0, 100%, 40%);">- if (o->sounddev < 0)</span><br><span style="color: hsl(0, 100%, 40%);">- return 0; /* not fatal */</span><br><span style="color: hsl(0, 100%, 40%);">- /*</span><br><span style="color: hsl(0, 100%, 40%);">- * Nothing complex to manage the audio device queue.</span><br><span style="color: hsl(0, 100%, 40%);">- * If the buffer is full just drop the extra, otherwise write.</span><br><span style="color: hsl(0, 100%, 40%);">- * XXX in some cases it might be useful to write anyways after</span><br><span style="color: hsl(0, 100%, 40%);">- * a number of failures, to restart the output chain.</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">- res = used_blocks(o);</span><br><span style="color: hsl(0, 100%, 40%);">- if (res > o->queuesize) { /* no room to write a block */</span><br><span style="color: hsl(0, 100%, 40%);">- if (o->w_errors++ == 0 && (oss_debug & 0x4))</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING, "write: used %d blocks (%d)\n", res, o->w_errors);</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%);">- o->w_errors = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- return write(o->sounddev, (void *)data, FRAME_SIZE * 2);</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%);">- * reset and close the device if opened,</span><br><span style="color: hsl(0, 100%, 40%);">- * then open and initialize it in the desired mode,</span><br><span style="color: hsl(0, 100%, 40%);">- * trigger reads and writes so we can start using it.</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">-static int setformat(struct chan_oss_pvt *o, int mode)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- int fmt, desired, res, fd;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (o->sounddev >= 0) {</span><br><span style="color: hsl(0, 100%, 40%);">- ioctl(o->sounddev, SNDCTL_DSP_RESET, 0);</span><br><span style="color: hsl(0, 100%, 40%);">- close(o->sounddev);</span><br><span style="color: hsl(0, 100%, 40%);">- o->duplex = CHAN_OSS_DUPLEX_UNSET;</span><br><span style="color: hsl(0, 100%, 40%);">- o->sounddev = -1;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- if (mode == O_CLOSE) /* we are done */</span><br><span style="color: hsl(0, 100%, 40%);">- return 0;</span><br><span style="color: hsl(0, 100%, 40%);">- if (ast_tvdiff_ms(ast_tvnow(), o->lastopen) < 1000)</span><br><span style="color: hsl(0, 100%, 40%);">- return -1; /* don't open too often */</span><br><span style="color: hsl(0, 100%, 40%);">- o->lastopen = ast_tvnow();</span><br><span style="color: hsl(0, 100%, 40%);">- fd = o->sounddev = open(o->device, mode | O_NONBLOCK);</span><br><span style="color: hsl(0, 100%, 40%);">- if (fd < 0) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING, "Unable to re-open DSP device %s: %s\n", o->device, strerror(errno));</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%);">- if (o->owner)</span><br><span style="color: hsl(0, 100%, 40%);">- ast_channel_set_fd(o->owner, 0, fd);</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%);">- fmt = AFMT_S16_LE;</span><br><span style="color: hsl(0, 100%, 40%);">-#else</span><br><span style="color: hsl(0, 100%, 40%);">- fmt = AFMT_S16_BE;</span><br><span style="color: hsl(0, 100%, 40%);">-#endif</span><br><span style="color: hsl(0, 100%, 40%);">- res = ioctl(fd, SNDCTL_DSP_SETFMT, &fmt);</span><br><span style="color: hsl(0, 100%, 40%);">- if (res < 0) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING, "Unable to set format to 16-bit signed\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%);">- switch (mode) {</span><br><span style="color: hsl(0, 100%, 40%);">- case O_RDWR:</span><br><span style="color: hsl(0, 100%, 40%);">- res = ioctl(fd, SNDCTL_DSP_SETDUPLEX, 0);</span><br><span style="color: hsl(0, 100%, 40%);">- /* Check to see if duplex set (FreeBSD Bug) */</span><br><span style="color: hsl(0, 100%, 40%);">- res = ioctl(fd, SNDCTL_DSP_GETCAPS, &fmt);</span><br><span style="color: hsl(0, 100%, 40%);">- if (res == 0 && (fmt & DSP_CAP_DUPLEX)) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_verb(2, "Console is full duplex\n");</span><br><span style="color: hsl(0, 100%, 40%);">- o->duplex = CHAN_OSS_DUPLEX_FULL;</span><br><span style="color: hsl(0, 100%, 40%);">- };</span><br><span style="color: hsl(0, 100%, 40%);">- break;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- case O_WRONLY:</span><br><span style="color: hsl(0, 100%, 40%);">- o->duplex = CHAN_OSS_DUPLEX_WRITE;</span><br><span style="color: hsl(0, 100%, 40%);">- break;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- case O_RDONLY:</span><br><span style="color: hsl(0, 100%, 40%);">- o->duplex = CHAN_OSS_DUPLEX_READ;</span><br><span style="color: hsl(0, 100%, 40%);">- break;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- fmt = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- res = ioctl(fd, SNDCTL_DSP_STEREO, &fmt);</span><br><span style="color: hsl(0, 100%, 40%);">- if (res < 0) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING, "Failed to set audio device to mono\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%);">- fmt = desired = DEFAULT_SAMPLE_RATE; /* 8000 Hz desired */</span><br><span style="color: hsl(0, 100%, 40%);">- res = ioctl(fd, SNDCTL_DSP_SPEED, &fmt);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (res < 0) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING, "Failed to set sample rate to %d\n", desired);</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%);">- if (fmt != desired) {</span><br><span style="color: hsl(0, 100%, 40%);">- if (!(o->warned & WARN_speed)) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING,</span><br><span style="color: hsl(0, 100%, 40%);">- "Requested %d Hz, got %d Hz -- sound may be choppy\n",</span><br><span style="color: hsl(0, 100%, 40%);">- desired, fmt);</span><br><span style="color: hsl(0, 100%, 40%);">- o->warned |= WARN_speed;</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%);">- * on Freebsd, SETFRAGMENT does not work very well on some cards.</span><br><span style="color: hsl(0, 100%, 40%);">- * Default to use 256 bytes, let the user override</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">- if (o->frags) {</span><br><span style="color: hsl(0, 100%, 40%);">- fmt = o->frags;</span><br><span style="color: hsl(0, 100%, 40%);">- res = ioctl(fd, SNDCTL_DSP_SETFRAGMENT, &fmt);</span><br><span style="color: hsl(0, 100%, 40%);">- if (res < 0) {</span><br><span style="color: hsl(0, 100%, 40%);">- if (!(o->warned & WARN_frag)) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING,</span><br><span style="color: hsl(0, 100%, 40%);">- "Unable to set fragment size -- sound may be choppy\n");</span><br><span style="color: hsl(0, 100%, 40%);">- o->warned |= WARN_frag;</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%);">- /* on some cards, we need SNDCTL_DSP_SETTRIGGER to start outputting */</span><br><span style="color: hsl(0, 100%, 40%);">- res = PCM_ENABLE_INPUT | PCM_ENABLE_OUTPUT;</span><br><span style="color: hsl(0, 100%, 40%);">- res = ioctl(fd, SNDCTL_DSP_SETTRIGGER, &res);</span><br><span style="color: hsl(0, 100%, 40%);">- /* it may fail if we are in half duplex, never mind */</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%);">- * some of the standard methods supported by channels.</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">-static int oss_digit_begin(struct ast_channel *c, char digit)</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 oss_digit_end(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%);">- /* no better use for received digits than print them */</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%);">- 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 oss_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%);">- /* print received messages */</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%);">- 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 handler for incoming calls. Either autoanswer, or start ringing</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">-static int oss_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 chan_oss_pvt *o = ast_channel_tech_pvt(c);</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%);">- AST_DECLARE_APP_ARGS(args,</span><br><span style="color: hsl(0, 100%, 40%);">- AST_APP_ARG(name);</span><br><span style="color: hsl(0, 100%, 40%);">- AST_APP_ARG(flags);</span><br><span style="color: hsl(0, 100%, 40%);">- );</span><br><span style="color: hsl(0, 100%, 40%);">- char *parse = ast_strdupa(dest);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- AST_NONSTANDARD_APP_ARGS(args, parse, '/');</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- ast_verbose(" << Call to device '%s' dnid '%s' rdnis '%s' on console from '%s' <%s> >>\n",</span><br><span style="color: hsl(0, 100%, 40%);">- dest,</span><br><span style="color: hsl(0, 100%, 40%);">- S_OR(ast_channel_dialed(c)->number.str, ""),</span><br><span style="color: hsl(0, 100%, 40%);">- S_COR(ast_channel_redirecting(c)->from.number.valid, ast_channel_redirecting(c)->from.number.str, ""),</span><br><span style="color: hsl(0, 100%, 40%);">- S_COR(ast_channel_caller(c)->id.name.valid, ast_channel_caller(c)->id.name.str, ""),</span><br><span style="color: hsl(0, 100%, 40%);">- S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, ""));</span><br><span style="color: hsl(0, 100%, 40%);">- if (!ast_strlen_zero(args.flags) && strcasecmp(args.flags, "answer") == 0) {</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(c, &f);</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (!ast_strlen_zero(args.flags) && strcasecmp(args.flags, "noanswer") == 0) {</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(c, &f);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_indicate(c, AST_CONTROL_RINGING);</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (o->autoanswer) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_verbose(" << Auto-answered >> \n");</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(c, &f);</span><br><span style="color: hsl(0, 100%, 40%);">- o->hookstate = 1;</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%);">- f.subclass.integer = AST_CONTROL_RINGING;</span><br><span style="color: hsl(0, 100%, 40%);">- ast_queue_frame(c, &f);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_indicate(c, AST_CONTROL_RINGING);</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 remote side answered the phone</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">-static int oss_answer(struct ast_channel *c)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- struct chan_oss_pvt *o = ast_channel_tech_pvt(c);</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%);">- o->hookstate = 1;</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 oss_hangup(struct ast_channel *c)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- struct chan_oss_pvt *o = ast_channel_tech_pvt(c);</span><br><span style="color: hsl(0, 100%, 40%);">-</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%);">- o->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%);">- console_video_uninit(o->env);</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%);">- if (o->hookstate) {</span><br><span style="color: hsl(0, 100%, 40%);">- if (o->autoanswer || o->autohangup) {</span><br><span style="color: hsl(0, 100%, 40%);">- /* Assume auto-hangup too */</span><br><span style="color: hsl(0, 100%, 40%);">- o->hookstate = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- setformat(o, O_CLOSE);</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 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%);">-/*! \brief used for data coming from the network */</span><br><span style="color: hsl(0, 100%, 40%);">-static int oss_write(struct ast_channel *c, struct ast_frame *f)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- int src;</span><br><span style="color: hsl(0, 100%, 40%);">- struct chan_oss_pvt *o = ast_channel_tech_pvt(c);</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%);">- * we could receive a block which is not a multiple of our</span><br><span style="color: hsl(0, 100%, 40%);">- * FRAME_SIZE, so buffer it locally and write to the device</span><br><span style="color: hsl(0, 100%, 40%);">- * in FRAME_SIZE chunks.</span><br><span style="color: hsl(0, 100%, 40%);">- * Keep the residue stored for future use.</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">- src = 0; /* read position into f->data */</span><br><span style="color: hsl(0, 100%, 40%);">- while (src < f->datalen) {</span><br><span style="color: hsl(0, 100%, 40%);">- /* Compute spare room in the buffer */</span><br><span style="color: hsl(0, 100%, 40%);">- int l = sizeof(o->oss_write_buf) - o->oss_write_dst;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (f->datalen - src >= l) { /* enough to fill a frame */</span><br><span style="color: hsl(0, 100%, 40%);">- memcpy(o->oss_write_buf + o->oss_write_dst, f->data.ptr + src, l);</span><br><span style="color: hsl(0, 100%, 40%);">- soundcard_writeframe(o, (short *) o->oss_write_buf);</span><br><span style="color: hsl(0, 100%, 40%);">- src += l;</span><br><span style="color: hsl(0, 100%, 40%);">- o->oss_write_dst = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- } else { /* copy residue */</span><br><span style="color: hsl(0, 100%, 40%);">- l = f->datalen - src;</span><br><span style="color: hsl(0, 100%, 40%);">- memcpy(o->oss_write_buf + o->oss_write_dst, f->data.ptr + src, l);</span><br><span style="color: hsl(0, 100%, 40%);">- src += l; /* but really, we are done */</span><br><span style="color: hsl(0, 100%, 40%);">- o->oss_write_dst += l;</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 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 struct ast_frame *oss_read(struct ast_channel *c)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- int res;</span><br><span style="color: hsl(0, 100%, 40%);">- struct chan_oss_pvt *o = ast_channel_tech_pvt(c);</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_frame *f = &o->read_f;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- /* XXX can be simplified returning &ast_null_frame */</span><br><span style="color: hsl(0, 100%, 40%);">- /* prepare a NULL frame in case we don't have enough data to return */</span><br><span style="color: hsl(0, 100%, 40%);">- memset(f, '\0', sizeof(struct ast_frame));</span><br><span style="color: hsl(0, 100%, 40%);">- f->frametype = AST_FRAME_NULL;</span><br><span style="color: hsl(0, 100%, 40%);">- f->src = oss_tech.type;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- res = read(o->sounddev, o->oss_read_buf + o->readpos, sizeof(o->oss_read_buf) - o->readpos);</span><br><span style="color: hsl(0, 100%, 40%);">- if (res < 0) /* audio data not ready, return a NULL frame */</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%);">- o->readpos += res;</span><br><span style="color: hsl(0, 100%, 40%);">- if (o->readpos < sizeof(o->oss_read_buf)) /* not enough samples */</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 (o->mute)</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%);">- o->readpos = AST_FRIENDLY_OFFSET; /* reset read pointer for next frame */</span><br><span style="color: hsl(0, 100%, 40%);">- if (ast_channel_state(c) != AST_STATE_UP) /* drop data if frame is not up */</span><br><span style="color: hsl(0, 100%, 40%);">- return f;</span><br><span style="color: hsl(0, 100%, 40%);">- /* ok we can build and deliver the frame to the caller */</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 = o->oss_read_buf + AST_FRIENDLY_OFFSET;</span><br><span style="color: hsl(0, 100%, 40%);">- if (o->boost != BOOST_SCALE) { /* scale and clip values */</span><br><span style="color: hsl(0, 100%, 40%);">- int i, x;</span><br><span style="color: hsl(0, 100%, 40%);">- int16_t *p = (int16_t *) f->data.ptr;</span><br><span style="color: hsl(0, 100%, 40%);">- for (i = 0; i < f->samples; i++) {</span><br><span style="color: hsl(0, 100%, 40%);">- x = (p[i] * o->boost) / BOOST_SCALE;</span><br><span style="color: hsl(0, 100%, 40%);">- if (x > 32767)</span><br><span style="color: hsl(0, 100%, 40%);">- x = 32767;</span><br><span style="color: hsl(0, 100%, 40%);">- else if (x < -32768)</span><br><span style="color: hsl(0, 100%, 40%);">- x = -32768;</span><br><span style="color: hsl(0, 100%, 40%);">- p[i] = x;</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%);">- f->offset = AST_FRIENDLY_OFFSET;</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 oss_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_oss_pvt *o = ast_channel_tech_pvt(newchan);</span><br><span style="color: hsl(0, 100%, 40%);">- o->owner = newchan;</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 oss_indicate(struct ast_channel *c, 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%);">- struct chan_oss_pvt *o = ast_channel_tech_pvt(c);</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%);">- switch (cond) {</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_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_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;</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(c, data, o->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(c);</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(c));</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 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%);">- * \brief allocate a new channel.</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">-static struct ast_channel *oss_new(struct chan_oss_pvt *o, char *ext, char *ctx, 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 *c;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- c = ast_channel_alloc(1, state, o->cid_num, o->cid_name, "", ext, ctx, assignedids, requestor, 0, "Console/%s", o->device + 5);</span><br><span style="color: hsl(0, 100%, 40%);">- if (c == NULL)</span><br><span style="color: hsl(0, 100%, 40%);">- return NULL;</span><br><span style="color: hsl(0, 100%, 40%);">- ast_channel_tech_set(c, &oss_tech);</span><br><span style="color: hsl(0, 100%, 40%);">- if (o->sounddev < 0)</span><br><span style="color: hsl(0, 100%, 40%);">- setformat(o, O_RDWR);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_channel_set_fd(c, 0, o->sounddev); /* -1 if device closed, override later */</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- ast_channel_set_readformat(c, ast_format_slin);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_channel_set_writeformat(c, ast_format_slin);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_channel_nativeformats_set(c, oss_tech.capabilities);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- /* if the console makes the call, add video to the offer */</span><br><span style="color: hsl(0, 100%, 40%);">- /* if (state == AST_STATE_RINGING) TODO XXX CONSOLE VIDEO IS DISABLED UNTIL IT GETS A MAINTAINER</span><br><span style="color: hsl(0, 100%, 40%);">- c->nativeformats |= console_video_formats; */</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- ast_channel_tech_pvt_set(c, o);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (!ast_strlen_zero(o->language))</span><br><span style="color: hsl(0, 100%, 40%);">- ast_channel_language_set(c, o->language);</span><br><span style="color: hsl(0, 100%, 40%);">- /* Don't use ast_set_callerid() here because it will</span><br><span style="color: hsl(0, 100%, 40%);">- * generate a needless NewCallerID event */</span><br><span style="color: hsl(0, 100%, 40%);">- if (!ast_strlen_zero(o->cid_num)) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_channel_caller(c)->ani.number.valid = 1;</span><br><span style="color: hsl(0, 100%, 40%);">- ast_channel_caller(c)->ani.number.str = ast_strdup(o->cid_num);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- if (!ast_strlen_zero(ext)) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_channel_dialed(c)->number.str = ast_strdup(ext);</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%);">- o->owner = c;</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(c, &global_jbconf);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_channel_unlock(c);</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(c)) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING, "Unable to start PBX on %s\n", ast_channel_name(c));</span><br><span style="color: hsl(0, 100%, 40%);">- ast_hangup(c);</span><br><span style="color: hsl(0, 100%, 40%);">- o->owner = c = 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%);">- console_video_start(get_video_desc(c), c); /* XXX cleanup */</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- return c;</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 *oss_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 *c;</span><br><span style="color: hsl(0, 100%, 40%);">- struct chan_oss_pvt *o;</span><br><span style="color: hsl(0, 100%, 40%);">- AST_DECLARE_APP_ARGS(args,</span><br><span style="color: hsl(0, 100%, 40%);">- AST_APP_ARG(name);</span><br><span style="color: hsl(0, 100%, 40%);">- AST_APP_ARG(flags);</span><br><span style="color: hsl(0, 100%, 40%);">- );</span><br><span style="color: hsl(0, 100%, 40%);">- char *parse = ast_strdupa(data);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- AST_NONSTANDARD_APP_ARGS(args, parse, '/');</span><br><span style="color: hsl(0, 100%, 40%);">- o = find_desc(args.name);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING, "oss_request ty <%s> data 0x%p <%s>\n", type, data, data);</span><br><span style="color: hsl(0, 100%, 40%);">- if (o == NULL) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_NOTICE, "Device %s not found\n", args.name);</span><br><span style="color: hsl(0, 100%, 40%);">- /* XXX we could default to 'dsp' perhaps ? */</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%);">- 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, "Format %s unsupported\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%);">- if (o->owner) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_NOTICE, "Already have a call (chan %p) on the OSS channel\n", o->owner);</span><br><span style="color: hsl(0, 100%, 40%);">- *cause = AST_CAUSE_BUSY;</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%);">- c = oss_new(o, NULL, NULL, AST_STATE_DOWN, assignedids, requestor);</span><br><span style="color: hsl(0, 100%, 40%);">- if (c == NULL) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING, "Unable to create new OSS channel\n");</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%);">- return c;</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 store_config_core(struct chan_oss_pvt *o, const char *var, const char *value);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-/*! Generic console command handler. Basically a wrapper for a subset</span><br><span style="color: hsl(0, 100%, 40%);">- * of config file options which are also available from the CLI</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">-static char *console_cmd(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%);">- struct chan_oss_pvt *o = find_desc(oss_active);</span><br><span style="color: hsl(0, 100%, 40%);">- const char *var, *value;</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_VIDEO_CMDS;</span><br><span style="color: hsl(0, 100%, 40%);">- e->usage =</span><br><span style="color: hsl(0, 100%, 40%);">- "Usage: " CONSOLE_VIDEO_CMDS "...\n"</span><br><span style="color: hsl(0, 100%, 40%);">- " Generic handler for console commands.\n";</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%);">- 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 < e->args)</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_SHOWUSAGE;</span><br><span style="color: hsl(0, 100%, 40%);">- if (o == NULL) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING, "Cannot find device %s (should not happen!)\n",</span><br><span style="color: hsl(0, 100%, 40%);">- oss_active);</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_FAILURE;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- var = a->argv[e->args-1];</span><br><span style="color: hsl(0, 100%, 40%);">- value = a->argc > e->args ? a->argv[e->args] : NULL;</span><br><span style="color: hsl(0, 100%, 40%);">- if (value) /* handle setting */</span><br><span style="color: hsl(0, 100%, 40%);">- store_config_core(o, var, value);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!console_video_cli(o->env, var, a->fd)) /* print video-related values */</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_SUCCESS;</span><br><span style="color: hsl(0, 100%, 40%);">- /* handle other values */</span><br><span style="color: hsl(0, 100%, 40%);">- if (!strcasecmp(var, "device")) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_cli(a->fd, "device is [%s]\n", o->device);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_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%);">-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%);">- struct chan_oss_pvt *o = find_desc(oss_active);</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 {set|show} 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 {set|show} 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 'oss.conf'.\n";</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%);">- 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 == e->args - 1) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_cli(a->fd, "Auto answer is %s.\n", o->autoanswer ? "on" : "off");</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_SUCCESS;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- if (a->argc != e->args)</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_SHOWUSAGE;</span><br><span style="color: hsl(0, 100%, 40%);">- if (o == NULL) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING, "Cannot find device %s (should not happen!)\n",</span><br><span style="color: hsl(0, 100%, 40%);">- oss_active);</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_FAILURE;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- if (!strcasecmp(a->argv[e->args-1], "on"))</span><br><span style="color: hsl(0, 100%, 40%);">- o->autoanswer = 1;</span><br><span style="color: hsl(0, 100%, 40%);">- else if (!strcasecmp(a->argv[e->args - 1], "off"))</span><br><span style="color: hsl(0, 100%, 40%);">- o->autoanswer = 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%);">- return CLI_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%);">-/*! \brief helper function for the answer key/cli command */</span><br><span style="color: hsl(0, 100%, 40%);">-static char *console_do_answer(int fd)</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, { AST_CONTROL_ANSWER } };</span><br><span style="color: hsl(0, 100%, 40%);">- struct chan_oss_pvt *o = find_desc(oss_active);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!o->owner) {</span><br><span style="color: hsl(0, 100%, 40%);">- if (fd > -1)</span><br><span style="color: hsl(0, 100%, 40%);">- ast_cli(fd, "No one is calling us\n");</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_FAILURE;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- o->hookstate = 1;</span><br><span style="color: hsl(0, 100%, 40%);">- ast_queue_frame(o->owner, &f);</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_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%);">-/*!</span><br><span style="color: hsl(0, 100%, 40%);">- * \brief answer command from the console</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%);">- 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 (OSS) channel.\n";</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%);">- case CLI_GENERATE:</span><br><span style="color: hsl(0, 100%, 40%);">- return NULL; /* no completion */</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- if (a->argc != e->args)</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_SHOWUSAGE;</span><br><span style="color: hsl(0, 100%, 40%);">- return console_do_answer(a->fd);</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 Console send text CLI command</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * \note concatenate all arguments into a single string. argv is NULL-terminated</span><br><span style="color: hsl(0, 100%, 40%);">- * so we can use it right away</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%);">- struct chan_oss_pvt *o = find_desc(oss_active);</span><br><span style="color: hsl(0, 100%, 40%);">- char buf[TEXT_SIZE];</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (cmd == 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%);">- } else if (cmd == 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%);">- if (a->argc < e->args + 1)</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_SHOWUSAGE;</span><br><span style="color: hsl(0, 100%, 40%);">- if (!o->owner) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_cli(a->fd, "Not in a call\n");</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_FAILURE;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- ast_join(buf, sizeof(buf) - 1, a->argv + e->args);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!ast_strlen_zero(buf)) {</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_frame f = { 0, };</span><br><span style="color: hsl(0, 100%, 40%);">- int i = strlen(buf);</span><br><span style="color: hsl(0, 100%, 40%);">- buf[i] = '\n';</span><br><span style="color: hsl(0, 100%, 40%);">- f.frametype = AST_FRAME_TEXT;</span><br><span style="color: hsl(0, 100%, 40%);">- f.subclass.integer = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- f.data.ptr = buf;</span><br><span style="color: hsl(0, 100%, 40%);">- f.datalen = i + 1;</span><br><span style="color: hsl(0, 100%, 40%);">- ast_queue_frame(o->owner, &f);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_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%);">-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%);">- struct chan_oss_pvt *o = find_desc(oss_active);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (cmd == 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%);">- } else if (cmd == 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%);">- if (a->argc != e->args)</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_SHOWUSAGE;</span><br><span style="color: hsl(0, 100%, 40%);">- if (!o->owner && !o->hookstate) { /* XXX maybe only one ? */</span><br><span style="color: hsl(0, 100%, 40%);">- ast_cli(a->fd, "No call to hang up\n");</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_FAILURE;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- o->hookstate = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- if (o->owner)</span><br><span style="color: hsl(0, 100%, 40%);">- ast_queue_hangup_with_cause(o->owner, AST_CAUSE_NORMAL_CLEARING);</span><br><span style="color: hsl(0, 100%, 40%);">- setformat(o, O_CLOSE);</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_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%);">-static char *console_flash(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%);">- struct ast_frame f = { AST_FRAME_CONTROL, { AST_CONTROL_FLASH } };</span><br><span style="color: hsl(0, 100%, 40%);">- struct chan_oss_pvt *o = find_desc(oss_active);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (cmd == CLI_INIT) {</span><br><span style="color: hsl(0, 100%, 40%);">- e->command = "console flash";</span><br><span style="color: hsl(0, 100%, 40%);">- e->usage =</span><br><span style="color: hsl(0, 100%, 40%);">- "Usage: console flash\n"</span><br><span style="color: hsl(0, 100%, 40%);">- " Flashes the 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%);">- } else if (cmd == 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%);">- if (a->argc != e->args)</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_SHOWUSAGE;</span><br><span style="color: hsl(0, 100%, 40%);">- if (!o->owner) { /* XXX maybe !o->hookstate too ? */</span><br><span style="color: hsl(0, 100%, 40%);">- ast_cli(a->fd, "No call to flash\n");</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_FAILURE;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- o->hookstate = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- if (o->owner)</span><br><span style="color: hsl(0, 100%, 40%);">- ast_queue_frame(o->owner, &f);</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_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%);">-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 *s = NULL;</span><br><span style="color: hsl(0, 100%, 40%);">- char *mye = NULL, *myc = NULL;</span><br><span style="color: hsl(0, 100%, 40%);">- struct chan_oss_pvt *o = find_desc(oss_active);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (cmd == 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%);">- } else if (cmd == 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%);">- if (a->argc > e->args + 1)</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_SHOWUSAGE;</span><br><span style="color: hsl(0, 100%, 40%);">- if (o->owner) { /* already in a call */</span><br><span style="color: hsl(0, 100%, 40%);">- int i;</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_frame f = { AST_FRAME_DTMF, { 0 } };</span><br><span style="color: hsl(0, 100%, 40%);">- const char *digits;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (a->argc == e->args) { /* argument is mandatory here */</span><br><span style="color: hsl(0, 100%, 40%);">- ast_cli(a->fd, "Already in a call. You can only dial digits until you hangup.\n");</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_FAILURE;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- digits = a->argv[e->args];</span><br><span style="color: hsl(0, 100%, 40%);">- /* send the string one char at a time */</span><br><span style="color: hsl(0, 100%, 40%);">- for (i = 0; i < strlen(digits); i++) {</span><br><span style="color: hsl(0, 100%, 40%);">- f.subclass.integer = digits[i];</span><br><span style="color: hsl(0, 100%, 40%);">- ast_queue_frame(o->owner, &f);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_SUCCESS;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- /* if we have an argument split it into extension and context */</span><br><span style="color: hsl(0, 100%, 40%);">- if (a->argc == e->args + 1)</span><br><span style="color: hsl(0, 100%, 40%);">- s = ast_ext_ctx(a->argv[e->args], &mye, &myc);</span><br><span style="color: hsl(0, 100%, 40%);">- /* supply default values if needed */</span><br><span style="color: hsl(0, 100%, 40%);">- if (mye == NULL)</span><br><span style="color: hsl(0, 100%, 40%);">- mye = o->ext;</span><br><span style="color: hsl(0, 100%, 40%);">- if (myc == NULL)</span><br><span style="color: hsl(0, 100%, 40%);">- myc = o->ctx;</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%);">- o->hookstate = 1;</span><br><span style="color: hsl(0, 100%, 40%);">- oss_new(o, mye, myc, 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%);">- if (s)</span><br><span style="color: hsl(0, 100%, 40%);">- ast_free(s);</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_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%);">-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%);">- struct chan_oss_pvt *o = find_desc(oss_active);</span><br><span style="color: hsl(0, 100%, 40%);">- const char *s;</span><br><span style="color: hsl(0, 100%, 40%);">- int toggle = 0;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (cmd == 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%);">- } else if (cmd == 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%);">- if (a->argc > e->args)</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_SHOWUSAGE;</span><br><span style="color: hsl(0, 100%, 40%);">- if (a->argc == e->args) {</span><br><span style="color: hsl(0, 100%, 40%);">- if (strcasecmp(a->argv[e->args-1], "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%);">- s = a->argv[e->args-2];</span><br><span style="color: hsl(0, 100%, 40%);">- if (!strcasecmp(s, "mute"))</span><br><span style="color: hsl(0, 100%, 40%);">- o->mute = toggle ? !o->mute : 1;</span><br><span style="color: hsl(0, 100%, 40%);">- else if (!strcasecmp(s, "unmute"))</span><br><span style="color: hsl(0, 100%, 40%);">- o->mute = toggle ? !o->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%);">- ast_cli(a->fd, "Console mic is %s\n", o->mute ? "off" : "on");</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_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%);">-static char *console_transfer(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%);">- struct chan_oss_pvt *o = find_desc(oss_active);</span><br><span style="color: hsl(0, 100%, 40%);">- char *tmp, *ext, *ctx;</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 transfer";</span><br><span style="color: hsl(0, 100%, 40%);">- e->usage =</span><br><span style="color: hsl(0, 100%, 40%);">- "Usage: console transfer <extension>[@context]\n"</span><br><span style="color: hsl(0, 100%, 40%);">- " Transfers the currently connected call to the given extension (and\n"</span><br><span style="color: hsl(0, 100%, 40%);">- " 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 != 3)</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_SHOWUSAGE;</span><br><span style="color: hsl(0, 100%, 40%);">- if (o == NULL)</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_FAILURE;</span><br><span style="color: hsl(0, 100%, 40%);">- if (o->owner == NULL || !ast_channel_is_bridged(o->owner)) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_cli(a->fd, "There is no call to transfer\n");</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_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%);">- tmp = ast_ext_ctx(a->argv[2], &ext, &ctx);</span><br><span style="color: hsl(0, 100%, 40%);">- if (ctx == NULL) { /* supply default context if needed */</span><br><span style="color: hsl(0, 100%, 40%);">- ctx = ast_strdupa(ast_channel_context(o->owner));</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- if (ast_bridge_transfer_blind(1, o->owner, ext, ctx, NULL, NULL) != AST_BRIDGE_TRANSFER_SUCCESS) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING, "Unable to transfer call from channel %s\n", ast_channel_name(o->owner));</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- ast_free(tmp);</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_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%);">-static char *console_active(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%);">- 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 {set|show} active [<device>]";</span><br><span style="color: hsl(0, 100%, 40%);">- e->usage =</span><br><span style="color: hsl(0, 100%, 40%);">- "Usage: console active [device]\n"</span><br><span style="color: hsl(0, 100%, 40%);">- " If used without a parameter, displays which device is the current\n"</span><br><span style="color: hsl(0, 100%, 40%);">- " console. If a device is specified, the console sound device is changed to\n"</span><br><span style="color: hsl(0, 100%, 40%);">- " the device 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 == 3)</span><br><span style="color: hsl(0, 100%, 40%);">- ast_cli(a->fd, "active console is [%s]\n", oss_active);</span><br><span style="color: hsl(0, 100%, 40%);">- else if (a->argc != 4)</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_SHOWUSAGE;</span><br><span style="color: hsl(0, 100%, 40%);">- else {</span><br><span style="color: hsl(0, 100%, 40%);">- struct chan_oss_pvt *o;</span><br><span style="color: hsl(0, 100%, 40%);">- if (strcmp(a->argv[3], "show") == 0) {</span><br><span style="color: hsl(0, 100%, 40%);">- for (o = oss_default.next; o; o = o->next)</span><br><span style="color: hsl(0, 100%, 40%);">- ast_cli(a->fd, "device [%s] exists\n", o->name);</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_SUCCESS;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- o = find_desc(a->argv[3]);</span><br><span style="color: hsl(0, 100%, 40%);">- if (o == NULL)</span><br><span style="color: hsl(0, 100%, 40%);">- ast_cli(a->fd, "No device [%s] exists\n", a->argv[3]);</span><br><span style="color: hsl(0, 100%, 40%);">- else</span><br><span style="color: hsl(0, 100%, 40%);">- oss_active = o->name;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_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%);">-/*!</span><br><span style="color: hsl(0, 100%, 40%);">- * \brief store the boost factor</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">-static void store_boost(struct chan_oss_pvt *o, const char *s)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- double boost = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- if (sscanf(s, "%30lf", &boost) != 1) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING, "invalid boost <%s>\n", s);</span><br><span style="color: hsl(0, 100%, 40%);">- return;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- if (boost < -BOOST_MAX) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING, "boost %s too small, using %d\n", s, -BOOST_MAX);</span><br><span style="color: hsl(0, 100%, 40%);">- boost = -BOOST_MAX;</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (boost > BOOST_MAX) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING, "boost %s too large, using %d\n", s, BOOST_MAX);</span><br><span style="color: hsl(0, 100%, 40%);">- boost = BOOST_MAX;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- boost = exp(log(10) * boost / 20) * BOOST_SCALE;</span><br><span style="color: hsl(0, 100%, 40%);">- o->boost = boost;</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING, "setting boost %s to %d\n", s, o->boost);</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_boost(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%);">- struct chan_oss_pvt *o = find_desc(oss_active);</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 boost";</span><br><span style="color: hsl(0, 100%, 40%);">- e->usage =</span><br><span style="color: hsl(0, 100%, 40%);">- "Usage: console boost [boost in dB]\n"</span><br><span style="color: hsl(0, 100%, 40%);">- " Sets or display mic boost in dB\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)</span><br><span style="color: hsl(0, 100%, 40%);">- ast_cli(a->fd, "boost currently %5.1f\n", 20 * log10(((double) o->boost / (double) BOOST_SCALE)));</span><br><span style="color: hsl(0, 100%, 40%);">- else if (a->argc == 3)</span><br><span style="color: hsl(0, 100%, 40%);">- store_boost(o, a->argv[2]);</span><br><span style="color: hsl(0, 100%, 40%);">- return CLI_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%);">-static struct ast_cli_entry cli_oss[] = {</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_flash, "Flash 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_mute, "Disable/Enable mic input"),</span><br><span style="color: hsl(0, 100%, 40%);">- AST_CLI_DEFINE(console_transfer, "Transfer a call to a different extension"),</span><br><span style="color: hsl(0, 100%, 40%);">- AST_CLI_DEFINE(console_cmd, "Generic console command"),</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_boost, "Sets/displays mic boost in dB"),</span><br><span style="color: hsl(0, 100%, 40%);">- AST_CLI_DEFINE(console_active, "Sets/displays active console"),</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%);">- * store the mixer argument from the config file, filtering possibly</span><br><span style="color: hsl(0, 100%, 40%);">- * invalid or dangerous values (the string is used as argument for</span><br><span style="color: hsl(0, 100%, 40%);">- * system("mixer %s")</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">-static void store_mixer(struct chan_oss_pvt *o, const char *s)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- int i;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- for (i = 0; i < strlen(s); i++) {</span><br><span style="color: hsl(0, 100%, 40%);">- if (!isalnum(s[i]) && strchr(" \t-/", s[i]) == NULL) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING, "Suspect char %c in mixer cmd, ignoring:\n\t%s\n", s[i], s);</span><br><span style="color: hsl(0, 100%, 40%);">- return;</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 (o->mixer_cmd)</span><br><span style="color: hsl(0, 100%, 40%);">- ast_free(o->mixer_cmd);</span><br><span style="color: hsl(0, 100%, 40%);">- o->mixer_cmd = ast_strdup(s);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING, "setting mixer %s\n", s);</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%);">- * store the callerid components</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">-static void store_callerid(struct chan_oss_pvt *o, const char *s)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- ast_callerid_split(s, o->cid_name, sizeof(o->cid_name), o->cid_num, sizeof(o->cid_num));</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 store_config_core(struct chan_oss_pvt *o, const char *var, const char *value)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- CV_START(var, value);</span><br><span style="color: hsl(0, 100%, 40%);">-</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, var, value))</span><br><span style="color: hsl(0, 100%, 40%);">- return;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (!console_video_config(&o->env, var, value))</span><br><span style="color: hsl(0, 100%, 40%);">- return; /* matched there */</span><br><span style="color: hsl(0, 100%, 40%);">- CV_BOOL("autoanswer", o->autoanswer);</span><br><span style="color: hsl(0, 100%, 40%);">- CV_BOOL("autohangup", o->autohangup);</span><br><span style="color: hsl(0, 100%, 40%);">- CV_BOOL("overridecontext", o->overridecontext);</span><br><span style="color: hsl(0, 100%, 40%);">- CV_STR("device", o->device);</span><br><span style="color: hsl(0, 100%, 40%);">- CV_UINT("frags", o->frags);</span><br><span style="color: hsl(0, 100%, 40%);">- CV_UINT("debug", oss_debug);</span><br><span style="color: hsl(0, 100%, 40%);">- CV_UINT("queuesize", o->queuesize);</span><br><span style="color: hsl(0, 100%, 40%);">- CV_STR("context", o->ctx);</span><br><span style="color: hsl(0, 100%, 40%);">- CV_STR("language", o->language);</span><br><span style="color: hsl(0, 100%, 40%);">- CV_STR("mohinterpret", o->mohinterpret);</span><br><span style="color: hsl(0, 100%, 40%);">- CV_STR("extension", o->ext);</span><br><span style="color: hsl(0, 100%, 40%);">- CV_F("mixer", store_mixer(o, value));</span><br><span style="color: hsl(0, 100%, 40%);">- CV_F("callerid", store_callerid(o, value)) ;</span><br><span style="color: hsl(0, 100%, 40%);">- CV_F("boost", store_boost(o, value));</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- CV_END;</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%);">- * grab fields from the config file, init the descriptor and open the device.</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">-static struct chan_oss_pvt *store_config(struct ast_config *cfg, char *ctg)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_variable *v;</span><br><span style="color: hsl(0, 100%, 40%);">- struct chan_oss_pvt *o;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (ctg == NULL) {</span><br><span style="color: hsl(0, 100%, 40%);">- o = &oss_default;</span><br><span style="color: hsl(0, 100%, 40%);">- ctg = "general";</span><br><span style="color: hsl(0, 100%, 40%);">- } else {</span><br><span style="color: hsl(0, 100%, 40%);">- if (!(o = ast_calloc(1, sizeof(*o))))</span><br><span style="color: hsl(0, 100%, 40%);">- return NULL;</span><br><span style="color: hsl(0, 100%, 40%);">- *o = oss_default;</span><br><span style="color: hsl(0, 100%, 40%);">- /* "general" is also the default thing */</span><br><span style="color: hsl(0, 100%, 40%);">- if (strcmp(ctg, "general") == 0) {</span><br><span style="color: hsl(0, 100%, 40%);">- o->name = ast_strdup("dsp");</span><br><span style="color: hsl(0, 100%, 40%);">- oss_active = o->name;</span><br><span style="color: hsl(0, 100%, 40%);">- goto openit;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- o->name = ast_strdup(ctg);</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%);">- strcpy(o->mohinterpret, "default");</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- o->lastopen = ast_tvnow(); /* don't leave it 0 or tvdiff may wrap */</span><br><span style="color: hsl(0, 100%, 40%);">- /* fill other fields from configuration */</span><br><span style="color: hsl(0, 100%, 40%);">- for (v = ast_variable_browse(cfg, ctg); v; v = v->next) {</span><br><span style="color: hsl(0, 100%, 40%);">- store_config_core(o, v->name, v->value);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- if (ast_strlen_zero(o->device))</span><br><span style="color: hsl(0, 100%, 40%);">- ast_copy_string(o->device, DEV_DSP, sizeof(o->device));</span><br><span style="color: hsl(0, 100%, 40%);">- if (o->mixer_cmd) {</span><br><span style="color: hsl(0, 100%, 40%);">- char *cmd;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (ast_asprintf(&cmd, "mixer %s", o->mixer_cmd) >= 0) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING, "running [%s]\n", cmd);</span><br><span style="color: hsl(0, 100%, 40%);">- if (system(cmd) < 0) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING, "system() failed: %s\n", strerror(errno));</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- ast_free(cmd);</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 the config file requested to start the GUI, do it */</span><br><span style="color: hsl(0, 100%, 40%);">- if (get_gui_startup(o->env))</span><br><span style="color: hsl(0, 100%, 40%);">- console_video_start(o->env, NULL);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (o == &oss_default) /* we are done with the default */</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%);">-openit:</span><br><span style="color: hsl(0, 100%, 40%);">-#ifdef TRYOPEN</span><br><span style="color: hsl(0, 100%, 40%);">- if (setformat(o, O_RDWR) < 0) { /* open device */</span><br><span style="color: hsl(0, 100%, 40%);">- ast_verb(1, "Device %s not detected\n", ctg);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_verb(1, "Turn off OSS support by adding " "'noload=chan_oss.so' in /etc/asterisk/modules.conf\n");</span><br><span style="color: hsl(0, 100%, 40%);">- goto error;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- if (o->duplex != CHAN_OSS_DUPLEX_FULL)</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING, "XXX I don't work right with non " "full-duplex sound cards XXX\n");</span><br><span style="color: hsl(0, 100%, 40%);">-#endif /* TRYOPEN */</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- /* link into list of devices */</span><br><span style="color: hsl(0, 100%, 40%);">- if (o != &oss_default) {</span><br><span style="color: hsl(0, 100%, 40%);">- o->next = oss_default.next;</span><br><span style="color: hsl(0, 100%, 40%);">- oss_default.next = o;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- return o;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-#ifdef TRYOPEN</span><br><span style="color: hsl(0, 100%, 40%);">-error:</span><br><span style="color: hsl(0, 100%, 40%);">- if (o != &oss_default)</span><br><span style="color: hsl(0, 100%, 40%);">- ast_free(o);</span><br><span style="color: hsl(0, 100%, 40%);">- return NULL;</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%);">-</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%);">- struct chan_oss_pvt *o, *next;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- ast_channel_unregister(&oss_tech);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_cli_unregister_multiple(cli_oss, ARRAY_LEN(cli_oss));</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- o = oss_default.next;</span><br><span style="color: hsl(0, 100%, 40%);">- while (o) {</span><br><span style="color: hsl(0, 100%, 40%);">- close(o->sounddev);</span><br><span style="color: hsl(0, 100%, 40%);">- if (o->owner)</span><br><span style="color: hsl(0, 100%, 40%);">- ast_softhangup(o->owner, AST_SOFTHANGUP_APPUNLOAD);</span><br><span style="color: hsl(0, 100%, 40%);">- if (o->owner)</span><br><span style="color: hsl(0, 100%, 40%);">- return -1;</span><br><span style="color: hsl(0, 100%, 40%);">- next = o->next;</span><br><span style="color: hsl(0, 100%, 40%);">- ast_free(o->name);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_free(o);</span><br><span style="color: hsl(0, 100%, 40%);">- o = next;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- ao2_cleanup(oss_tech.capabilities);</span><br><span style="color: hsl(0, 100%, 40%);">- oss_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 = NULL;</span><br><span style="color: hsl(0, 100%, 40%);">- char *ctg = NULL;</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%);">- /* 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%);">- /* load config file */</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_NOTICE, "Unable to load config %s\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, "Config file %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%);">- do {</span><br><span style="color: hsl(0, 100%, 40%);">- store_config(cfg, ctg);</span><br><span style="color: hsl(0, 100%, 40%);">- } while ( (ctg = ast_category_browse(cfg, ctg)) != NULL);</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 (find_desc(oss_active) == NULL) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_NOTICE, "Device %s not found\n", oss_active);</span><br><span style="color: hsl(0, 100%, 40%);">- /* XXX we could default to 'dsp' perhaps ? */</span><br><span style="color: hsl(0, 100%, 40%);">- unload_module();</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 (!(oss_tech.capabilities = ast_format_cap_alloc(0))) {</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(oss_tech.capabilities, ast_format_slin, 0);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- /* TODO XXX CONSOLE VIDEO IS DISABLE UNTIL IT HAS A MAINTAINER</span><br><span style="color: hsl(0, 100%, 40%);">- * add console_video_formats to oss_tech.capabilities once this occurs. */</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (ast_channel_register(&oss_tech)) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_ERROR, "Unable to register channel type 'OSS'\n");</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_oss, ARRAY_LEN(cli_oss));</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_STANDARD_DEPRECATED(ASTERISK_GPL_KEY, "OSS Console Channel Driver");</span><br><span>diff --git a/configure b/configure</span><br><span>index 735a8e9..4d1da0d 100755</span><br><span>--- a/configure</span><br><span>+++ b/configure</span><br><span>@@ -999,10 +999,6 @@</span><br><span> PGSQL_DIR</span><br><span> PGSQL_INCLUDE</span><br><span> PGSQL_LIB</span><br><span style="color: hsl(0, 100%, 40%);">-PBX_OSS</span><br><span style="color: hsl(0, 100%, 40%);">-OSS_DIR</span><br><span style="color: hsl(0, 100%, 40%);">-OSS_INCLUDE</span><br><span style="color: hsl(0, 100%, 40%);">-OSS_LIB</span><br><span> PBX_OSPTK</span><br><span> OSPTK_DIR</span><br><span> OSPTK_INCLUDE</span><br><span>@@ -1296,7 +1292,6 @@</span><br><span> BUILD_VENDOR</span><br><span> BUILD_CPU</span><br><span> BUILD_PLATFORM</span><br><span style="color: hsl(0, 100%, 40%);">-astcachedir</span><br><span> astvarrundir</span><br><span> astlogdir</span><br><span> astspooldir</span><br><span>@@ -1309,6 +1304,7 @@</span><br><span> astlibdir</span><br><span> astheaderdir</span><br><span> astetcdir</span><br><span style="color: hsl(120, 100%, 40%);">+astcachedir</span><br><span> astsbindir</span><br><span> EGREP</span><br><span> GREP</span><br><span>@@ -1349,6 +1345,7 @@</span><br><span> docdir</span><br><span> oldincludedir</span><br><span> includedir</span><br><span style="color: hsl(120, 100%, 40%);">+runstatedir</span><br><span> localstatedir</span><br><span> sharedstatedir</span><br><span> sysconfdir</span><br><span>@@ -1425,7 +1422,6 @@</span><br><span> with_opus</span><br><span> with_opusfile</span><br><span> with_osptk</span><br><span style="color: hsl(0, 100%, 40%);">-with_oss</span><br><span> with_postgres</span><br><span> with_beanstalk</span><br><span> with_pjproject</span><br><span>@@ -1538,6 +1534,7 @@</span><br><span> sysconfdir='${prefix}/etc'</span><br><span> sharedstatedir='${prefix}/com'</span><br><span> localstatedir='${prefix}/var'</span><br><span style="color: hsl(120, 100%, 40%);">+runstatedir='${localstatedir}/run'</span><br><span> includedir='${prefix}/include'</span><br><span> oldincludedir='/usr/include'</span><br><span> docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'</span><br><span>@@ -1790,6 +1787,15 @@</span><br><span> | -silent | --silent | --silen | --sile | --sil)</span><br><span> silent=yes ;;</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ -runstatedir | --runstatedir | --runstatedi | --runstated \</span><br><span style="color: hsl(120, 100%, 40%);">+ | --runstate | --runstat | --runsta | --runst | --runs \</span><br><span style="color: hsl(120, 100%, 40%);">+ | --run | --ru | --r)</span><br><span style="color: hsl(120, 100%, 40%);">+ ac_prev=runstatedir ;;</span><br><span style="color: hsl(120, 100%, 40%);">+ -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \</span><br><span style="color: hsl(120, 100%, 40%);">+ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \</span><br><span style="color: hsl(120, 100%, 40%);">+ | --run=* | --ru=* | --r=*)</span><br><span style="color: hsl(120, 100%, 40%);">+ runstatedir=$ac_optarg ;;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)</span><br><span> ac_prev=sbindir ;;</span><br><span> -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \</span><br><span>@@ -1927,7 +1933,7 @@</span><br><span> for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \</span><br><span> datadir sysconfdir sharedstatedir localstatedir includedir \</span><br><span> oldincludedir docdir infodir htmldir dvidir pdfdir psdir \</span><br><span style="color: hsl(0, 100%, 40%);">- libdir localedir mandir</span><br><span style="color: hsl(120, 100%, 40%);">+ libdir localedir mandir runstatedir</span><br><span> do</span><br><span> eval ac_val=\$$ac_var</span><br><span> # Remove trailing slashes.</span><br><span>@@ -2080,6 +2086,7 @@</span><br><span> --sysconfdir=DIR read-only single-machine data [PREFIX/etc]</span><br><span> --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]</span><br><span> --localstatedir=DIR modifiable single-machine data [PREFIX/var]</span><br><span style="color: hsl(120, 100%, 40%);">+ --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]</span><br><span> --libdir=DIR object code libraries [EPREFIX/lib]</span><br><span> --includedir=DIR C header files [PREFIX/include]</span><br><span> --oldincludedir=DIR C header files for non-gcc [/usr/include]</span><br><span>@@ -2188,7 +2195,6 @@</span><br><span> --with-opus=PATH use Opus files in PATH</span><br><span> --with-opusfile=PATH use Opusfile files in PATH</span><br><span> --with-osptk=PATH use OSP Toolkit files in PATH</span><br><span style="color: hsl(0, 100%, 40%);">- --with-oss=PATH use Open Sound System files in PATH</span><br><span> --with-postgres=PATH use PostgreSQL files in PATH</span><br><span> --with-beanstalk=PATH use Beanstalk Job Queue files in PATH</span><br><span> --with-pjproject=PATH use PJPROJECT files in PATH</span><br><span>@@ -10848,6 +10854,7 @@</span><br><span> </span><br><span> </span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> MISDN_DESCRIP="mISDN user"</span><br><span> MISDN_OPTION="misdn"</span><br><span> PBX_MISDN=0</span><br><span>@@ -11232,38 +11239,6 @@</span><br><span> </span><br><span> </span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- OSS_DESCRIP="Open Sound System"</span><br><span style="color: hsl(0, 100%, 40%);">- OSS_OPTION="oss"</span><br><span style="color: hsl(0, 100%, 40%);">- PBX_OSS=0</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-# Check whether --with-oss was given.</span><br><span style="color: hsl(0, 100%, 40%);">-if test "${with_oss+set}" = set; then :</span><br><span style="color: hsl(0, 100%, 40%);">- withval=$with_oss;</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_OSS=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_OSS=-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} OSS"</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%);">- OSS_DIR="${withval}"</span><br><span style="color: hsl(0, 100%, 40%);">- ac_mandatory_list="${ac_mandatory_list} OSS"</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 style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> PGSQL_DESCRIP="PostgreSQL"</span><br><span> PGSQL_OPTION="postgres"</span><br><span> PBX_PGSQL=0</span><br><span>@@ -14688,7 +14663,7 @@</span><br><span> We can't simply define LARGE_OFF_T to be 9223372036854775807,</span><br><span> since some C++ compilers masquerading as C compilers</span><br><span> incorrectly reject 9223372036854775807. */</span><br><span style="color: hsl(0, 100%, 40%);">-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))</span><br><span style="color: hsl(120, 100%, 40%);">+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))</span><br><span> int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721</span><br><span> && LARGE_OFF_T % 2147483647 == 1)</span><br><span> ? 1 : -1];</span><br><span>@@ -14734,7 +14709,7 @@</span><br><span> We can't simply define LARGE_OFF_T to be 9223372036854775807,</span><br><span> since some C++ compilers masquerading as C compilers</span><br><span> incorrectly reject 9223372036854775807. */</span><br><span style="color: hsl(0, 100%, 40%);">-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))</span><br><span style="color: hsl(120, 100%, 40%);">+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))</span><br><span> int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721</span><br><span> && LARGE_OFF_T % 2147483647 == 1)</span><br><span> ? 1 : -1];</span><br><span>@@ -14758,7 +14733,7 @@</span><br><span> We can't simply define LARGE_OFF_T to be 9223372036854775807,</span><br><span> since some C++ compilers masquerading as C compilers</span><br><span> incorrectly reject 9223372036854775807. */</span><br><span style="color: hsl(0, 100%, 40%);">-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))</span><br><span style="color: hsl(120, 100%, 40%);">+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))</span><br><span> int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721</span><br><span> && LARGE_OFF_T % 2147483647 == 1)</span><br><span> ? 1 : -1];</span><br><span>@@ -14803,7 +14778,7 @@</span><br><span> We can't simply define LARGE_OFF_T to be 9223372036854775807,</span><br><span> since some C++ compilers masquerading as C compilers</span><br><span> incorrectly reject 9223372036854775807. */</span><br><span style="color: hsl(0, 100%, 40%);">-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))</span><br><span style="color: hsl(120, 100%, 40%);">+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))</span><br><span> int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721</span><br><span> && LARGE_OFF_T % 2147483647 == 1)</span><br><span> ? 1 : -1];</span><br><span>@@ -14827,7 +14802,7 @@</span><br><span> We can't simply define LARGE_OFF_T to be 9223372036854775807,</span><br><span> since some C++ compilers masquerading as C compilers</span><br><span> incorrectly reject 9223372036854775807. */</span><br><span style="color: hsl(0, 100%, 40%);">-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))</span><br><span style="color: hsl(120, 100%, 40%);">+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))</span><br><span> int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721</span><br><span> && LARGE_OFF_T % 2147483647 == 1)</span><br><span> ? 1 : -1];</span><br><span>@@ -16127,6 +16102,8 @@</span><br><span> if (*(data + i) != *(data3 + i))</span><br><span> return 14;</span><br><span> close (fd);</span><br><span style="color: hsl(120, 100%, 40%);">+ free (data);</span><br><span style="color: hsl(120, 100%, 40%);">+ free (data3);</span><br><span> return 0;</span><br><span> }</span><br><span> _ACEOF</span><br><span>@@ -24215,216 +24192,6 @@</span><br><span> </span><br><span> </span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-# possible places for oss definitions</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-if test "x${PBX_OSS}" != "x1" -a "${USE_OSS}" != "no"; then</span><br><span style="color: hsl(0, 100%, 40%);">- pbxlibdir=""</span><br><span style="color: hsl(0, 100%, 40%);">- # if --with-OSS=DIR has been specified, use it.</span><br><span style="color: hsl(0, 100%, 40%);">- if test "x${OSS_DIR}" != "x"; then</span><br><span style="color: hsl(0, 100%, 40%);">- if test -d ${OSS_DIR}/lib; then</span><br><span style="color: hsl(0, 100%, 40%);">- pbxlibdir="-L${OSS_DIR}/lib"</span><br><span style="color: hsl(0, 100%, 40%);">- else</span><br><span style="color: hsl(0, 100%, 40%);">- pbxlibdir="-L${OSS_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%);">- # empty lib, assume only headers</span><br><span style="color: hsl(0, 100%, 40%);">- AST_OSS_FOUND=yes</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_OSS_FOUND}" = "yes"; then</span><br><span style="color: hsl(0, 100%, 40%);">- OSS_LIB="${pbxlibdir} -lossaudio "</span><br><span style="color: hsl(0, 100%, 40%);">- # if --with-OSS=DIR has been specified, use it.</span><br><span style="color: hsl(0, 100%, 40%);">- if test "x${OSS_DIR}" != "x"; then</span><br><span style="color: hsl(0, 100%, 40%);">- OSS_INCLUDE="-I${OSS_DIR}/include"</span><br><span style="color: hsl(0, 100%, 40%);">- fi</span><br><span style="color: hsl(0, 100%, 40%);">- OSS_INCLUDE="${OSS_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} ${OSS_INCLUDE}"</span><br><span style="color: hsl(0, 100%, 40%);">- ac_fn_c_check_header_mongrel "$LINENO" "linux/soundcard.h" "ac_cv_header_linux_soundcard_h" "$ac_includes_default"</span><br><span style="color: hsl(0, 100%, 40%);">-if test "x$ac_cv_header_linux_soundcard_h" = xyes; then :</span><br><span style="color: hsl(0, 100%, 40%);">- OSS_HEADER_FOUND=1</span><br><span style="color: hsl(0, 100%, 40%);">-else</span><br><span style="color: hsl(0, 100%, 40%);">- OSS_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%);">-</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${OSS_HEADER_FOUND}" = "x0" ; then</span><br><span style="color: hsl(0, 100%, 40%);">- OSS_LIB=""</span><br><span style="color: hsl(0, 100%, 40%);">- OSS_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%);">- # only checking headers -> no library</span><br><span style="color: hsl(0, 100%, 40%);">- OSS_LIB=""</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- PBX_OSS=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_OSS 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 style="color: hsl(0, 100%, 40%);">-if test "x${PBX_OSS}" != "x1" -a "${USE_OSS}" != "no"; then</span><br><span style="color: hsl(0, 100%, 40%);">- pbxlibdir=""</span><br><span style="color: hsl(0, 100%, 40%);">- # if --with-OSS=DIR has been specified, use it.</span><br><span style="color: hsl(0, 100%, 40%);">- if test "x${OSS_DIR}" != "x"; then</span><br><span style="color: hsl(0, 100%, 40%);">- if test -d ${OSS_DIR}/lib; then</span><br><span style="color: hsl(0, 100%, 40%);">- pbxlibdir="-L${OSS_DIR}/lib"</span><br><span style="color: hsl(0, 100%, 40%);">- else</span><br><span style="color: hsl(0, 100%, 40%);">- pbxlibdir="-L${OSS_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%);">- # empty lib, assume only headers</span><br><span style="color: hsl(0, 100%, 40%);">- AST_OSS_FOUND=yes</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_OSS_FOUND}" = "yes"; then</span><br><span style="color: hsl(0, 100%, 40%);">- OSS_LIB="${pbxlibdir} -lossaudio "</span><br><span style="color: hsl(0, 100%, 40%);">- # if --with-OSS=DIR has been specified, use it.</span><br><span style="color: hsl(0, 100%, 40%);">- if test "x${OSS_DIR}" != "x"; then</span><br><span style="color: hsl(0, 100%, 40%);">- OSS_INCLUDE="-I${OSS_DIR}/include"</span><br><span style="color: hsl(0, 100%, 40%);">- fi</span><br><span style="color: hsl(0, 100%, 40%);">- OSS_INCLUDE="${OSS_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} ${OSS_INCLUDE}"</span><br><span style="color: hsl(0, 100%, 40%);">- ac_fn_c_check_header_mongrel "$LINENO" "sys/soundcard.h" "ac_cv_header_sys_soundcard_h" "$ac_includes_default"</span><br><span style="color: hsl(0, 100%, 40%);">-if test "x$ac_cv_header_sys_soundcard_h" = xyes; then :</span><br><span style="color: hsl(0, 100%, 40%);">- OSS_HEADER_FOUND=1</span><br><span style="color: hsl(0, 100%, 40%);">-else</span><br><span style="color: hsl(0, 100%, 40%);">- OSS_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%);">-</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${OSS_HEADER_FOUND}" = "x0" ; then</span><br><span style="color: hsl(0, 100%, 40%);">- OSS_LIB=""</span><br><span style="color: hsl(0, 100%, 40%);">- OSS_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%);">- # only checking headers -> no library</span><br><span style="color: hsl(0, 100%, 40%);">- OSS_LIB=""</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- PBX_OSS=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_OSS 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 style="color: hsl(0, 100%, 40%);">-if test "x${PBX_OSS}" != "x1" -a "${USE_OSS}" != "no"; then</span><br><span style="color: hsl(0, 100%, 40%);">- pbxlibdir=""</span><br><span style="color: hsl(0, 100%, 40%);">- # if --with-OSS=DIR has been specified, use it.</span><br><span style="color: hsl(0, 100%, 40%);">- if test "x${OSS_DIR}" != "x"; then</span><br><span style="color: hsl(0, 100%, 40%);">- if test -d ${OSS_DIR}/lib; then</span><br><span style="color: hsl(0, 100%, 40%);">- pbxlibdir="-L${OSS_DIR}/lib"</span><br><span style="color: hsl(0, 100%, 40%);">- else</span><br><span style="color: hsl(0, 100%, 40%);">- pbxlibdir="-L${OSS_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%);">- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for oss_ioctl_mixer in -lossaudio" >&5</span><br><span style="color: hsl(0, 100%, 40%);">-$as_echo_n "checking for oss_ioctl_mixer in -lossaudio... " >&6; }</span><br><span style="color: hsl(0, 100%, 40%);">-if ${ac_cv_lib_ossaudio_oss_ioctl_mixer+:} false; then :</span><br><span style="color: hsl(0, 100%, 40%);">- $as_echo_n "(cached) " >&6</span><br><span style="color: hsl(0, 100%, 40%);">-else</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="-lossaudio ${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%);">-#ifdef __cplusplus</span><br><span style="color: hsl(0, 100%, 40%);">-extern "C"</span><br><span style="color: hsl(0, 100%, 40%);">-#endif</span><br><span style="color: hsl(0, 100%, 40%);">-char oss_ioctl_mixer ();</span><br><span style="color: hsl(0, 100%, 40%);">-int</span><br><span style="color: hsl(0, 100%, 40%);">-main ()</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">-return oss_ioctl_mixer ();</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"; then :</span><br><span style="color: hsl(0, 100%, 40%);">- ac_cv_lib_ossaudio_oss_ioctl_mixer=yes</span><br><span style="color: hsl(0, 100%, 40%);">-else</span><br><span style="color: hsl(0, 100%, 40%);">- ac_cv_lib_ossaudio_oss_ioctl_mixer=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 \</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%);">-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ossaudio_oss_ioctl_mixer" >&5</span><br><span style="color: hsl(0, 100%, 40%);">-$as_echo "$ac_cv_lib_ossaudio_oss_ioctl_mixer" >&6; }</span><br><span style="color: hsl(0, 100%, 40%);">-if test "x$ac_cv_lib_ossaudio_oss_ioctl_mixer" = xyes; then :</span><br><span style="color: hsl(0, 100%, 40%);">- AST_OSS_FOUND=yes</span><br><span style="color: hsl(0, 100%, 40%);">-else</span><br><span style="color: hsl(0, 100%, 40%);">- AST_OSS_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_OSS_FOUND}" = "yes"; then</span><br><span style="color: hsl(0, 100%, 40%);">- OSS_LIB="${pbxlibdir} -lossaudio "</span><br><span style="color: hsl(0, 100%, 40%);">- # if --with-OSS=DIR has been specified, use it.</span><br><span style="color: hsl(0, 100%, 40%);">- if test "x${OSS_DIR}" != "x"; then</span><br><span style="color: hsl(0, 100%, 40%);">- OSS_INCLUDE="-I${OSS_DIR}/include"</span><br><span style="color: hsl(0, 100%, 40%);">- fi</span><br><span style="color: hsl(0, 100%, 40%);">- OSS_INCLUDE="${OSS_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} ${OSS_INCLUDE}"</span><br><span style="color: hsl(0, 100%, 40%);">- ac_fn_c_check_header_mongrel "$LINENO" "soundcard.h" "ac_cv_header_soundcard_h" "$ac_includes_default"</span><br><span style="color: hsl(0, 100%, 40%);">-if test "x$ac_cv_header_soundcard_h" = xyes; then :</span><br><span style="color: hsl(0, 100%, 40%);">- OSS_HEADER_FOUND=1</span><br><span style="color: hsl(0, 100%, 40%);">-else</span><br><span style="color: hsl(0, 100%, 40%);">- OSS_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%);">-</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${OSS_HEADER_FOUND}" = "x0" ; then</span><br><span style="color: hsl(0, 100%, 40%);">- OSS_LIB=""</span><br><span style="color: hsl(0, 100%, 40%);">- OSS_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_OSS=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_OSS 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> PG_CONFIG=No</span><br><span> if test "${USE_PGSQL}" != "no"; then</span><br><span> if test "x${PGSQL_DIR}" != "x"; then</span><br><span>diff --git a/configure.ac b/configure.ac</span><br><span>index 2260fe6..02f9f9c 100644</span><br><span>--- a/configure.ac</span><br><span>+++ b/configure.ac</span><br><span>@@ -524,7 +524,6 @@</span><br><span> AST_EXT_LIB_SETUP([OPUS], [Opus], [opus])</span><br><span> AST_EXT_LIB_SETUP([OPUSFILE], [Opusfile], [opusfile])</span><br><span> AST_EXT_LIB_SETUP([OSPTK], [OSP Toolkit], [osptk])</span><br><span style="color: hsl(0, 100%, 40%);">-AST_EXT_LIB_SETUP([OSS], [Open Sound System], [oss])</span><br><span> AST_EXT_LIB_SETUP([PGSQL], [PostgreSQL], [postgres])</span><br><span> AST_EXT_LIB_SETUP([BEANSTALK], [Beanstalk Job Queue], [beanstalk])</span><br><span> </span><br><span>@@ -2344,11 +2343,6 @@</span><br><span> </span><br><span> AST_EXT_LIB_CHECK([BEANSTALK], [beanstalk], [bs_version], [beanstalk.h])</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-# possible places for oss definitions</span><br><span style="color: hsl(0, 100%, 40%);">-AST_EXT_LIB_CHECK([OSS], [ossaudio], [], [linux/soundcard.h])</span><br><span style="color: hsl(0, 100%, 40%);">-AST_EXT_LIB_CHECK([OSS], [ossaudio], [], [sys/soundcard.h])</span><br><span style="color: hsl(0, 100%, 40%);">-AST_EXT_LIB_CHECK([OSS], [ossaudio], [oss_ioctl_mixer], [soundcard.h])</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> PG_CONFIG=No</span><br><span> if test "${USE_PGSQL}" != "no"; then</span><br><span> if test "x${PGSQL_DIR}" != "x"; then</span><br><span>diff --git a/doc/UPGRADE-staging/chan_oss_removal.txt b/doc/UPGRADE-staging/chan_oss_removal.txt</span><br><span>new file mode 100644</span><br><span>index 0000000..062f64b</span><br><span>--- /dev/null</span><br><span>+++ b/doc/UPGRADE-staging/chan_oss_removal.txt</span><br><span>@@ -0,0 +1,6 @@</span><br><span style="color: hsl(120, 100%, 40%);">+Subject: chan_oss</span><br><span style="color: hsl(120, 100%, 40%);">+Master-Only: True</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+This module was deprecated in Asterisk 16</span><br><span style="color: hsl(120, 100%, 40%);">+and is now being removed in accordance with</span><br><span style="color: hsl(120, 100%, 40%);">+the Asterisk Module Deprecation policy.</span><br><span>diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in</span><br><span>index 2c770d1..c8225e2 100644</span><br><span>--- a/include/asterisk/autoconfig.h.in</span><br><span>+++ b/include/asterisk/autoconfig.h.in</span><br><span>@@ -603,9 +603,6 @@</span><br><span> /* Define this to indicate the ${OSPTK_DESCRIP} library */</span><br><span> #undef HAVE_OSPTK</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-/* Define to 1 if you have the Open Sound System library. */</span><br><span style="color: hsl(0, 100%, 40%);">-#undef HAVE_OSS</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> /* Define to 1 if your system defines the file flag O_EVTONLY in fcntl.h */</span><br><span> #undef HAVE_O_EVTONLY</span><br><span> </span><br><span>diff --git a/menuselect/configure b/menuselect/configure</span><br><span>index 1d15c1c..9986b4f 100755</span><br><span>--- a/menuselect/configure</span><br><span>+++ b/menuselect/configure</span><br><span>@@ -696,6 +696,7 @@</span><br><span> docdir</span><br><span> oldincludedir</span><br><span> includedir</span><br><span style="color: hsl(120, 100%, 40%);">+runstatedir</span><br><span> localstatedir</span><br><span> sharedstatedir</span><br><span> sysconfdir</span><br><span>@@ -777,6 +778,7 @@</span><br><span> sysconfdir='${prefix}/etc'</span><br><span> sharedstatedir='${prefix}/com'</span><br><span> localstatedir='${prefix}/var'</span><br><span style="color: hsl(120, 100%, 40%);">+runstatedir='${localstatedir}/run'</span><br><span> includedir='${prefix}/include'</span><br><span> oldincludedir='/usr/include'</span><br><span> docdir='${datarootdir}/doc/${PACKAGE}'</span><br><span>@@ -1029,6 +1031,15 @@</span><br><span> | -silent | --silent | --silen | --sile | --sil)</span><br><span> silent=yes ;;</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ -runstatedir | --runstatedir | --runstatedi | --runstated \</span><br><span style="color: hsl(120, 100%, 40%);">+ | --runstate | --runstat | --runsta | --runst | --runs \</span><br><span style="color: hsl(120, 100%, 40%);">+ | --run | --ru | --r)</span><br><span style="color: hsl(120, 100%, 40%);">+ ac_prev=runstatedir ;;</span><br><span style="color: hsl(120, 100%, 40%);">+ -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \</span><br><span style="color: hsl(120, 100%, 40%);">+ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \</span><br><span style="color: hsl(120, 100%, 40%);">+ | --run=* | --ru=* | --r=*)</span><br><span style="color: hsl(120, 100%, 40%);">+ runstatedir=$ac_optarg ;;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)</span><br><span> ac_prev=sbindir ;;</span><br><span> -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \</span><br><span>@@ -1166,7 +1177,7 @@</span><br><span> for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \</span><br><span> datadir sysconfdir sharedstatedir localstatedir includedir \</span><br><span> oldincludedir docdir infodir htmldir dvidir pdfdir psdir \</span><br><span style="color: hsl(0, 100%, 40%);">- libdir localedir mandir</span><br><span style="color: hsl(120, 100%, 40%);">+ libdir localedir mandir runstatedir</span><br><span> do</span><br><span> eval ac_val=\$$ac_var</span><br><span> # Remove trailing slashes.</span><br><span>@@ -1319,6 +1330,7 @@</span><br><span> --sysconfdir=DIR read-only single-machine data [PREFIX/etc]</span><br><span> --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]</span><br><span> --localstatedir=DIR modifiable single-machine data [PREFIX/var]</span><br><span style="color: hsl(120, 100%, 40%);">+ --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]</span><br><span> --libdir=DIR object code libraries [EPREFIX/lib]</span><br><span> --includedir=DIR C header files [PREFIX/include]</span><br><span> --oldincludedir=DIR C header files for non-gcc [/usr/include]</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/16311">change 16311</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/+/16311"/><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: Ib53a42ad974c63871344b95078c61c188e43da99 </div>
<div style="display:none"> Gerrit-Change-Number: 16311 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>