Fri Jul 24 00:41:20 2009

Asterisk developer's documentation


chan_alsa.c File Reference

ALSA sound card channel driver. More...

#include "asterisk.h"
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <alsa/asoundlib.h>
#include "asterisk/frame.h"
#include "asterisk/channel.h"
#include "asterisk/module.h"
#include "asterisk/pbx.h"
#include "asterisk/config.h"
#include "asterisk/cli.h"
#include "asterisk/utils.h"
#include "asterisk/causes.h"
#include "asterisk/endian.h"
#include "asterisk/stringfields.h"
#include "asterisk/abstract_jb.h"
#include "asterisk/musiconhold.h"
#include "asterisk/poll-compat.h"

Go to the source code of this file.

Data Structures

struct  chan_alsa_pvt

Defines

#define ALSA_INDEV   "default"
#define ALSA_OUTDEV   "default"
#define ALSA_PCM_NEW_HW_PARAMS_API
#define ALSA_PCM_NEW_SW_PARAMS_API
#define BUFFER_FMT   ((buffersize * 10) << 16) | (0x0006);
#define DEBUG   0
#define DESIRED_RATE   8000
#define FRAME_SIZE   160
#define MAX_BUFFER_SIZE   100
#define MIN(a, b)   ((a) < (b) ? (a) : (b))
#define MIN_SWITCH_TIME   600
#define PERIOD_FRAMES   80

Functions

static void __reg_module (void)
static void __unreg_module (void)
static int alsa_answer (struct ast_channel *c)
static int alsa_call (struct ast_channel *c, char *dest, int timeout)
static snd_pcm_t * alsa_card_init (char *dev, snd_pcm_stream_t stream)
static int alsa_digit (struct ast_channel *c, char digit, unsigned int duration)
static int alsa_fixup (struct ast_channel *oldchan, struct ast_channel *newchan)
static int alsa_hangup (struct ast_channel *c)
static int alsa_indicate (struct ast_channel *chan, int cond, const void *data, size_t datalen)
static struct ast_channelalsa_new (struct chan_alsa_pvt *p, int state)
static struct ast_framealsa_read (struct ast_channel *chan)
static struct ast_channelalsa_request (const char *type, int format, void *data, int *cause)
static int alsa_text (struct ast_channel *c, const char *text)
static int alsa_write (struct ast_channel *chan, struct ast_frame *f)
static char * autoanswer_complete (const char *line, const char *word, int pos, int state)
static char * console_answer (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static char * console_autoanswer (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static char * console_dial (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static char * console_hangup (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static char * console_sendtext (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static void grab_owner (void)
static int load_module (void)
static int soundcard_init (void)
static int unload_module (void)

Variables

static struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "ALSA Console Channel Driver" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "a9c98e5d177805051735cb5b0b16b0a0" , .load = load_module, .unload = unload_module, }
static struct chan_alsa_pvt alsa
static struct ast_channel_tech alsa_tech
static ast_mutex_t alsalock = ((ast_mutex_t) PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP )
static struct ast_module_infoast_module_info = &__mod_info
static int autoanswer = 1
static struct ast_cli_entry cli_alsa []
static const char config [] = "alsa.conf"
static char context [AST_MAX_CONTEXT] = "default"
static struct ast_jb_conf default_jbconf
static char exten [AST_MAX_EXTENSION] = "s"
static snd_pcm_format_t format = SND_PCM_FORMAT_S16_BE
static struct ast_jb_conf global_jbconf
static int hookstate = 0
static char indevname [50] = ALSA_INDEV
static char language [MAX_LANGUAGE] = ""
static char mohinterpret [MAX_MUSICCLASS]
static char outdevname [50] = ALSA_OUTDEV
static int readdev = -1
static int silencesuppression = 0
static int silencethreshold = 1000
static const char tdesc [] = "ALSA Console Channel Driver"
static int writedev = -1


Detailed Description

ALSA sound card channel driver.

Author:
Matthew Fredrickson <creslin@digium.com>
See also

Definition in file chan_alsa.c.


Define Documentation

#define ALSA_INDEV   "default"

Definition at line 71 of file chan_alsa.c.

#define ALSA_OUTDEV   "default"

Definition at line 72 of file chan_alsa.c.

#define ALSA_PCM_NEW_HW_PARAMS_API

Definition at line 42 of file chan_alsa.c.

#define ALSA_PCM_NEW_SW_PARAMS_API

Definition at line 43 of file chan_alsa.c.

#define BUFFER_FMT   ((buffersize * 10) << 16) | (0x0006);

Definition at line 82 of file chan_alsa.c.

#define DEBUG   0

Definition at line 69 of file chan_alsa.c.

#define DESIRED_RATE   8000

Definition at line 73 of file chan_alsa.c.

Referenced by alsa_card_init().

#define FRAME_SIZE   160

Definition at line 76 of file chan_alsa.c.

Referenced by alsa_read(), oss_read(), and soundcard_writeframe().

#define MAX_BUFFER_SIZE   100

Definition at line 125 of file chan_alsa.c.

#define MIN ( a,
 )     ((a) < (b) ? (a) : (b))

Referenced by autoanswer_complete(), h263p_encap(), h264_encap(), and mpeg4_encap().

#define MIN_SWITCH_TIME   600

Definition at line 85 of file chan_alsa.c.

#define PERIOD_FRAMES   80

Definition at line 77 of file chan_alsa.c.

Referenced by alsa_card_init().


Function Documentation

static void __reg_module ( void   )  [static]

Definition at line 928 of file chan_alsa.c.

static void __unreg_module ( void   )  [static]

Definition at line 928 of file chan_alsa.c.

static int alsa_answer ( struct ast_channel c  )  [static]

Definition at line 336 of file chan_alsa.c.

References alsa, alsalock, ast_mutex_lock(), ast_mutex_unlock(), ast_setstate(), AST_STATE_UP, ast_verbose, and chan_alsa_pvt::icard.

00337 {
00338    ast_mutex_lock(&alsalock);
00339    ast_verbose(" << Console call has been answered >> \n");
00340    ast_setstate(c, AST_STATE_UP);
00341    snd_pcm_prepare(alsa.icard);
00342    snd_pcm_start(alsa.icard);
00343    ast_mutex_unlock(&alsalock);
00344 
00345    return 0;
00346 }

static int alsa_call ( struct ast_channel c,
char *  dest,
int  timeout 
) [static]

Definition at line 305 of file chan_alsa.c.

References alsa, alsalock, ast_channel_unlock, AST_CONTROL_ANSWER, AST_CONTROL_RINGING, AST_FRAME_CONTROL, ast_indicate(), ast_mutex_lock(), ast_mutex_unlock(), ast_queue_frame(), ast_verbose, f, grab_owner(), chan_alsa_pvt::icard, and chan_alsa_pvt::owner.

00306 {
00307    struct ast_frame f = { AST_FRAME_CONTROL };
00308 
00309    ast_mutex_lock(&alsalock);
00310    ast_verbose(" << Call placed to '%s' on console >> \n", dest);
00311    if (autoanswer) {
00312       ast_verbose(" << Auto-answered >> \n");
00313       grab_owner();
00314       if (alsa.owner) {
00315          f.subclass = AST_CONTROL_ANSWER;
00316          ast_queue_frame(alsa.owner, &f);
00317          ast_channel_unlock(alsa.owner);
00318       }
00319    } else {
00320       ast_verbose(" << Type 'answer' to answer, or use 'autoanswer' for future calls >> \n");
00321       grab_owner();
00322       if (alsa.owner) {
00323          f.subclass = AST_CONTROL_RINGING;
00324          ast_queue_frame(alsa.owner, &f);
00325          ast_channel_unlock(alsa.owner);
00326          ast_indicate(alsa.owner, AST_CONTROL_RINGING);
00327       }
00328    }
00329    snd_pcm_prepare(alsa.icard);
00330    snd_pcm_start(alsa.icard);
00331    ast_mutex_unlock(&alsalock);
00332 
00333    return 0;
00334 }

static snd_pcm_t* alsa_card_init ( char *  dev,
snd_pcm_stream_t  stream 
) [static]

Definition at line 160 of file chan_alsa.c.

References ast_debug, ast_log(), DESIRED_RATE, LOG_ERROR, LOG_WARNING, and PERIOD_FRAMES.

Referenced by soundcard_init().

00161 {
00162    int err;
00163    int direction;
00164    snd_pcm_t *handle = NULL;
00165    snd_pcm_hw_params_t *hwparams = NULL;
00166    snd_pcm_sw_params_t *swparams = NULL;
00167    struct pollfd pfd;
00168    snd_pcm_uframes_t period_size = PERIOD_FRAMES * 4;
00169    snd_pcm_uframes_t buffer_size = 0;
00170    unsigned int rate = DESIRED_RATE;
00171    snd_pcm_uframes_t start_threshold, stop_threshold;
00172 
00173    err = snd_pcm_open(&handle, dev, stream, SND_PCM_NONBLOCK);
00174    if (err < 0) {
00175       ast_log(LOG_ERROR, "snd_pcm_open failed: %s\n", snd_strerror(err));
00176       return NULL;
00177    } else {
00178       ast_debug(1, "Opening device %s in %s mode\n", dev, (stream == SND_PCM_STREAM_CAPTURE) ? "read" : "write");
00179    }
00180 
00181    hwparams = alloca(snd_pcm_hw_params_sizeof());
00182    memset(hwparams, 0, snd_pcm_hw_params_sizeof());
00183    snd_pcm_hw_params_any(handle, hwparams);
00184 
00185    err = snd_pcm_hw_params_set_access(handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED);
00186    if (err < 0)
00187       ast_log(LOG_ERROR, "set_access failed: %s\n", snd_strerror(err));
00188 
00189    err = snd_pcm_hw_params_set_format(handle, hwparams, format);
00190    if (err < 0)
00191       ast_log(LOG_ERROR, "set_format failed: %s\n", snd_strerror(err));
00192 
00193    err = snd_pcm_hw_params_set_channels(handle, hwparams, 1);
00194    if (err < 0)
00195       ast_log(LOG_ERROR, "set_channels failed: %s\n", snd_strerror(err));
00196 
00197    direction = 0;
00198    err = snd_pcm_hw_params_set_rate_near(handle, hwparams, &rate, &direction);
00199    if (rate != DESIRED_RATE)
00200       ast_log(LOG_WARNING, "Rate not correct, requested %d, got %d\n", DESIRED_RATE, rate);
00201 
00202    direction = 0;
00203    err = snd_pcm_hw_params_set_period_size_near(handle, hwparams, &period_size, &direction);
00204    if (err < 0)
00205       ast_log(LOG_ERROR, "period_size(%ld frames) is bad: %s\n", period_size, snd_strerror(err));
00206    else {
00207       ast_debug(1, "Period size is %d\n", err);
00208    }
00209 
00210    buffer_size = 4096 * 2;    /* period_size * 16; */
00211    err = snd_pcm_hw_params_set_buffer_size_near(handle, hwparams, &buffer_size);
00212    if (err < 0)
00213       ast_log(LOG_WARNING, "Problem setting buffer size of %ld: %s\n", buffer_size, snd_strerror(err));
00214    else {
00215       ast_debug(1, "Buffer size is set to %d frames\n", err);
00216    }
00217 
00218    err = snd_pcm_hw_params(handle, hwparams);
00219    if (err < 0)
00220       ast_log(LOG_ERROR, "Couldn't set the new hw params: %s\n", snd_strerror(err));
00221 
00222    swparams = alloca(snd_pcm_sw_params_sizeof());
00223    memset(swparams, 0, snd_pcm_sw_params_sizeof());
00224    snd_pcm_sw_params_current(handle, swparams);
00225 
00226    if (stream == SND_PCM_STREAM_PLAYBACK)
00227       start_threshold = period_size;
00228    else
00229       start_threshold = 1;
00230 
00231    err = snd_pcm_sw_params_set_start_threshold(handle, swparams, start_threshold);
00232    if (err < 0)
00233       ast_log(LOG_ERROR, "start threshold: %s\n", snd_strerror(err));
00234 
00235    if (stream == SND_PCM_STREAM_PLAYBACK)
00236       stop_threshold = buffer_size;
00237    else
00238       stop_threshold = buffer_size;
00239 
00240    err = snd_pcm_sw_params_set_stop_threshold(handle, swparams, stop_threshold);
00241    if (err < 0)
00242       ast_log(LOG_ERROR, "stop threshold: %s\n", snd_strerror(err));
00243 
00244    err = snd_pcm_sw_params(handle, swparams);
00245    if (err < 0)
00246       ast_log(LOG_ERROR, "sw_params: %s\n", snd_strerror(err));
00247 
00248    err = snd_pcm_poll_descriptors_count(handle);
00249    if (err <= 0)
00250       ast_log(LOG_ERROR, "Unable to get a poll descriptors count, error is %s\n", snd_strerror(err));
00251    if (err != 1) {
00252       ast_debug(1, "Can't handle more than one device\n");
00253    }
00254 
00255    snd_pcm_poll_descriptors(handle, &pfd, err);
00256    ast_debug(1, "Acquired fd %d from the poll descriptor\n", pfd.fd);
00257 
00258    if (stream == SND_PCM_STREAM_CAPTURE)
00259       readdev = pfd.fd;
00260    else
00261       writedev = pfd.fd;
00262 
00263    return handle;
00264 }

static int alsa_digit ( struct ast_channel c,
char  digit,
unsigned int  duration 
) [static]

Definition at line 279 of file chan_alsa.c.

References alsalock, ast_mutex_lock(), ast_mutex_unlock(), and ast_verbose.

00280 {
00281    ast_mutex_lock(&alsalock);
00282    ast_verbose(" << Console Received digit %c of duration %u ms >> \n", 
00283       digit, duration);
00284    ast_mutex_unlock(&alsalock);
00285 
00286    return 0;
00287 }

static int alsa_fixup ( struct ast_channel oldchan,
struct ast_channel newchan 
) [static]

Definition at line 488 of file chan_alsa.c.

References alsalock, ast_mutex_lock(), ast_mutex_unlock(), chan_alsa_pvt::owner, and ast_channel::tech_pvt.

00489 {
00490    struct chan_alsa_pvt *p = newchan->tech_pvt;
00491 
00492    ast_mutex_lock(&alsalock);
00493    p->owner = newchan;
00494    ast_mutex_unlock(&alsalock);
00495 
00496    return 0;
00497 }

static int alsa_hangup ( struct ast_channel c  )  [static]

Definition at line 348 of file chan_alsa.c.

References alsa, alsalock, ast_module_unref(), ast_mutex_lock(), ast_mutex_unlock(), ast_verbose, chan_alsa_pvt::icard, chan_alsa_pvt::owner, and ast_channel::tech_pvt.

00349 {
00350    ast_mutex_lock(&alsalock);
00351    c->tech_pvt = NULL;
00352    alsa.owner = NULL;
00353    ast_verbose(" << Hangup on console >> \n");
00354    ast_module_unref(ast_module_info->self);
00355    hookstate = 0;
00356    snd_pcm_drop(alsa.icard);
00357    ast_mutex_unlock(&alsalock);
00358 
00359    return 0;
00360 }

static int alsa_indicate ( struct ast_channel chan,
int  cond,
const void *  data,
size_t  datalen 
) [static]

Definition at line 499 of file chan_alsa.c.

References alsalock, AST_CONTROL_BUSY, AST_CONTROL_CONGESTION, AST_CONTROL_HOLD, AST_CONTROL_PROCEEDING, AST_CONTROL_PROGRESS, AST_CONTROL_RINGING, AST_CONTROL_SRCUPDATE, AST_CONTROL_UNHOLD, AST_CONTROL_VIDUPDATE, ast_log(), ast_moh_start(), ast_moh_stop(), ast_mutex_lock(), ast_mutex_unlock(), ast_verbose, chan, LOG_WARNING, and ast_channel::name.

00500 {
00501    int res = 0;
00502 
00503    ast_mutex_lock(&alsalock);
00504 
00505    switch (cond) {
00506    case AST_CONTROL_BUSY:
00507    case AST_CONTROL_CONGESTION:
00508    case AST_CONTROL_RINGING:
00509    case -1:
00510       res = -1;  /* Ask for inband indications */
00511       break;
00512    case AST_CONTROL_PROGRESS:
00513    case AST_CONTROL_PROCEEDING:
00514    case AST_CONTROL_VIDUPDATE:
00515    case AST_CONTROL_SRCUPDATE:
00516       break;
00517    case AST_CONTROL_HOLD:
00518       ast_verbose(" << Console Has Been Placed on Hold >> \n");
00519       ast_moh_start(chan, data, mohinterpret);
00520       break;
00521    case AST_CONTROL_UNHOLD:
00522       ast_verbose(" << Console Has Been Retrieved from Hold >> \n");
00523       ast_moh_stop(chan);
00524       break;
00525    default:
00526       ast_log(LOG_WARNING, "Don't know how to display condition %d on %s\n", cond, chan->name);
00527       res = -1;
00528    }
00529 
00530    ast_mutex_unlock(&alsalock);
00531 
00532    return res;
00533 }

static struct ast_channel* alsa_new ( struct chan_alsa_pvt p,
int  state 
) [static]

Definition at line 535 of file chan_alsa.c.

References alsa_tech, ast_channel_alloc(), ast_channel_set_fd(), ast_copy_string(), AST_FORMAT_SLINEAR, ast_hangup(), ast_jb_configure(), ast_log(), ast_module_ref(), ast_pbx_start(), AST_STATE_DOWN, ast_string_field_set, ast_strlen_zero(), ast_channel::context, chan_alsa_pvt::context, ast_channel::exten, chan_alsa_pvt::exten, global_jbconf, LOG_WARNING, ast_channel::nativeformats, chan_alsa_pvt::owner, ast_channel::readformat, ast_channel::tech, ast_channel::tech_pvt, and ast_channel::writeformat.

Referenced by alsa_request(), and console_dial().

00536 {
00537    struct ast_channel *tmp = NULL;
00538 
00539    if (!(tmp = ast_channel_alloc(1, state, 0, 0, "", p->exten, p->context, 0, "ALSA/%s", indevname)))
00540       return NULL;
00541 
00542    tmp->tech = &alsa_tech;
00543    ast_channel_set_fd(tmp, 0, readdev);
00544    tmp->nativeformats = AST_FORMAT_SLINEAR;
00545    tmp->readformat = AST_FORMAT_SLINEAR;
00546    tmp->writeformat = AST_FORMAT_SLINEAR;
00547    tmp->tech_pvt = p;
00548    if (!ast_strlen_zero(p->context))
00549       ast_copy_string(tmp->context, p->context, sizeof(tmp->context));
00550    if (!ast_strlen_zero(p->exten))
00551       ast_copy_string(tmp->exten, p->exten, sizeof(tmp->exten));
00552    if (!ast_strlen_zero(language))
00553       ast_string_field_set(tmp, language, language);
00554    p->owner = tmp;
00555    ast_module_ref(ast_module_info->self);
00556    ast_jb_configure(tmp, &global_jbconf);
00557    if (state != AST_STATE_DOWN) {
00558       if (ast_pbx_start(tmp)) {
00559          ast_log(LOG_WARNING, "Unable to start PBX on %s\n", tmp->name);
00560          ast_hangup(tmp);
00561          tmp = NULL;
00562       }
00563    }
00564 
00565    return tmp;
00566 }

static struct ast_frame * alsa_read ( struct ast_channel chan  )  [static]

Definition at line 416 of file chan_alsa.c.

References ast_channel::_state, alsa, alsalock, AST_FORMAT_SLINEAR, AST_FRAME_NULL, AST_FRAME_VOICE, AST_FRIENDLY_OFFSET, ast_log(), ast_mutex_lock(), ast_mutex_unlock(), AST_STATE_UP, buf, chan, f, FRAME_SIZE, chan_alsa_pvt::icard, and LOG_ERROR.

00417 {
00418    static struct ast_frame f;
00419    static short __buf[FRAME_SIZE + AST_FRIENDLY_OFFSET / 2];
00420    short *buf;
00421    static int readpos = 0;
00422    static int left = FRAME_SIZE;
00423    snd_pcm_state_t state;
00424    int r = 0;
00425    int off = 0;
00426 
00427    ast_mutex_lock(&alsalock);
00428    f.frametype = AST_FRAME_NULL;
00429    f.subclass = 0;
00430    f.samples = 0;
00431    f.datalen = 0;
00432    f.data.ptr = NULL;
00433    f.offset = 0;
00434    f.src = "Console";
00435    f.mallocd = 0;
00436    f.delivery.tv_sec = 0;
00437    f.delivery.tv_usec = 0;
00438 
00439    state = snd_pcm_state(alsa.icard);
00440    if ((state != SND_PCM_STATE_PREPARED) && (state != SND_PCM_STATE_RUNNING)) {
00441       snd_pcm_prepare(alsa.icard);
00442    }
00443 
00444    buf = __buf + AST_FRIENDLY_OFFSET / 2;
00445 
00446    r = snd_pcm_readi(alsa.icard, buf + readpos, left);
00447    if (r == -EPIPE) {
00448 #if DEBUG
00449       ast_log(LOG_ERROR, "XRUN read\n");
00450 #endif
00451       snd_pcm_prepare(alsa.icard);
00452    } else if (r == -ESTRPIPE) {
00453       ast_log(LOG_ERROR, "-ESTRPIPE\n");
00454       snd_pcm_prepare(alsa.icard);
00455    } else if (r < 0) {
00456       ast_log(LOG_ERROR, "Read error: %s\n", snd_strerror(r));
00457    } else if (r >= 0) {
00458       off -= r;
00459    }
00460    /* Update positions */
00461    readpos += r;
00462    left -= r;
00463 
00464    if (readpos >= FRAME_SIZE) {
00465       /* A real frame */
00466       readpos = 0;
00467       left = FRAME_SIZE;
00468       if (chan->_state != AST_STATE_UP) {
00469          /* Don't transmit unless it's up */
00470          ast_mutex_unlock(&alsalock);
00471          return &f;
00472       }
00473       f.frametype = AST_FRAME_VOICE;
00474       f.subclass = AST_FORMAT_SLINEAR;
00475       f.samples = FRAME_SIZE;
00476       f.datalen = FRAME_SIZE * 2;
00477       f.data.ptr = buf;
00478       f.offset = AST_FRIENDLY_OFFSET;
00479       f.src = "Console";
00480       f.mallocd = 0;
00481 
00482    }
00483    ast_mutex_unlock(&alsalock);
00484 
00485    return &f;
00486 }

static struct ast_channel * alsa_request ( const char *  type,
int  format,
void *  data,
int *  cause 
) [static]

Definition at line 568 of file chan_alsa.c.

References alsa, alsa_new(), alsalock, AST_CAUSE_BUSY, AST_FORMAT_SLINEAR, ast_log(), ast_mutex_lock(), ast_mutex_unlock(), AST_STATE_DOWN, LOG_NOTICE, LOG_WARNING, and chan_alsa_pvt::owner.

00569 {
00570    int oldformat = fmt;
00571    struct ast_channel *tmp = NULL;
00572 
00573    if (!(fmt &= AST_FORMAT_SLINEAR)) {
00574       ast_log(LOG_NOTICE, "Asked to get a channel of format '%d'\n", oldformat);
00575       return NULL;
00576    }
00577 
00578    ast_mutex_lock(&alsalock);
00579 
00580    if (alsa.owner) {
00581       ast_log(LOG_NOTICE, "Already have a call on the ALSA channel\n");
00582       *cause = AST_CAUSE_BUSY;
00583    } else if (!(tmp = alsa_new(&alsa, AST_STATE_DOWN))) {
00584       ast_log(LOG_WARNING, "Unable to create new ALSA channel\n");
00585    }
00586 
00587    ast_mutex_unlock(&alsalock);
00588 
00589    return tmp;
00590 }

static int alsa_text ( struct ast_channel c,
const char *  text 
) [static]

Definition at line 289 of file chan_alsa.c.

References alsalock, ast_mutex_lock(), ast_mutex_unlock(), and ast_verbose.

00290 {
00291    ast_mutex_lock(&alsalock);
00292    ast_verbose(" << Console Received text %s >> \n", text);
00293    ast_mutex_unlock(&alsalock);
00294 
00295    return 0;
00296 }

static int alsa_write ( struct ast_channel chan,
struct ast_frame f 
) [static]

Definition at line 362 of file chan_alsa.c.

References alsa, alsalock, ast_debug, ast_log(), ast_mutex_lock(), ast_mutex_unlock(), f, len(), LOG_ERROR, LOG_NOTICE, LOG_WARNING, and chan_alsa_pvt::ocard.

00363 {
00364    static char sizbuf[8000];
00365    static int sizpos = 0;
00366    int len = sizpos;
00367    int pos;
00368    int res = 0;
00369    /* size_t frames = 0; */
00370    snd_pcm_state_t state;
00371 
00372    ast_mutex_lock(&alsalock);
00373 
00374    /* We have to digest the frame in 160-byte portions */
00375    if (f->datalen > sizeof(sizbuf) - sizpos) {
00376       ast_log(LOG_WARNING, "Frame too large\n");
00377       res = -1;
00378    } else {
00379       memcpy(sizbuf + sizpos, f->data.ptr, f->datalen);
00380       len += f->datalen;
00381       pos = 0;
00382       state = snd_pcm_state(alsa.ocard);
00383       if (state == SND_PCM_STATE_XRUN)
00384          snd_pcm_prepare(alsa.ocard);
00385       while ((res = snd_pcm_writei(alsa.ocard, sizbuf, len / 2)) == -EAGAIN) {
00386          usleep(1);
00387       }
00388       if (res == -EPIPE) {
00389 #if DEBUG
00390          ast_debug(1, "XRUN write\n");
00391 #endif
00392          snd_pcm_prepare(alsa.ocard);
00393          while ((res = snd_pcm_writei(alsa.ocard, sizbuf, len / 2)) == -EAGAIN) {
00394             usleep(1);
00395          }
00396          if (res != len / 2) {
00397             ast_log(LOG_ERROR, "Write error: %s\n", snd_strerror(res));
00398             res = -1;
00399          } else if (res < 0) {
00400             ast_log(LOG_ERROR, "Write error %s\n", snd_strerror(res));
00401             res = -1;
00402          }
00403       } else {
00404          if (res == -ESTRPIPE)
00405             ast_log(LOG_ERROR, "You've got some big problems\n");
00406          else if (res < 0)
00407             ast_log(LOG_NOTICE, "Error %d on write\n", res);
00408       }
00409    }
00410    ast_mutex_unlock(&alsalock);
00411 
00412    return res >= 0 ? 0 : res;
00413 }

static char* autoanswer_complete ( const char *  line,
const char *  word,
int  pos,
int  state 
) [static]

Definition at line 592 of file chan_alsa.c.

References ast_strdup, ast_strlen_zero(), and MIN.

Referenced by console_autoanswer().

00593 {
00594 #ifndef MIN
00595 #define MIN(a,b) ((a) < (b) ? (a) : (b))
00596 #endif
00597    switch (state) {
00598       case 0:
00599          if (!ast_strlen_zero(word) && !strncasecmp(word, "on", MIN(strlen(word), 2)))
00600             return ast_strdup("on");
00601       case 1:
00602          if (!ast_strlen_zero(word) && !strncasecmp(word, "off", MIN(strlen(word), 3)))
00603             return ast_strdup("off");
00604       default:
00605          return NULL;
00606    }
00607 
00608    return NULL;
00609 }

static char* console_answer ( struct ast_cli_entry e,
int  cmd,
struct ast_cli_args a 
) [static]

Definition at line 647 of file chan_alsa.c.

References alsa, alsalock, ast_cli_args::argc, ast_channel_unlock, ast_cli(), AST_CONTROL_ANSWER, AST_FRAME_CONTROL, ast_mutex_lock(), ast_mutex_unlock(), ast_queue_frame(), CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, f, ast_cli_args::fd, grab_owner(), chan_alsa_pvt::icard, chan_alsa_pvt::owner, and ast_cli_entry::usage.

00648 {
00649    char *res = CLI_SUCCESS;
00650 
00651    switch (cmd) {
00652    case CLI_INIT:
00653       e->command = "console answer";
00654       e->usage =
00655          "Usage: console answer\n"
00656          "       Answers an incoming call on the console (ALSA) channel.\n";
00657 
00658       return NULL;
00659    case CLI_GENERATE:
00660       return NULL; 
00661    }
00662 
00663    if (a->argc != 2)
00664       return CLI_SHOWUSAGE;
00665 
00666    ast_mutex_lock(&alsalock);
00667 
00668    if (!alsa.owner) {
00669       ast_cli(a->fd, "No one is calling us\n");
00670       res = CLI_FAILURE;
00671    } else {
00672       hookstate = 1;
00673       grab_owner();
00674       if (alsa.owner) {
00675          struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_ANSWER };
00676 
00677          ast_queue_frame(alsa.owner, &f);
00678          ast_channel_unlock(alsa.owner);
00679       }
00680    }
00681 
00682    snd_pcm_prepare(alsa.icard);
00683    snd_pcm_start(alsa.icard);
00684 
00685    ast_mutex_unlock(&alsalock);
00686 
00687    return res;
00688 }

static char* console_autoanswer ( struct ast_cli_entry e,
int  cmd,
struct ast_cli_args a 
) [static]

Definition at line 611 of file chan_alsa.c.

References alsalock, ast_cli_args::argc, ast_cli_args::argv, ast_cli(), ast_mutex_lock(), ast_mutex_unlock(), autoanswer_complete(), CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, ast_cli_args::line, ast_cli_args::n, ast_cli_args::pos, ast_cli_entry::usage, and ast_cli_args::word.

00612 {
00613    char *res = CLI_SUCCESS;
00614 
00615    switch (cmd) {
00616    case CLI_INIT:
00617       e->command = "console autoanswer";
00618       e->usage =
00619          "Usage: console autoanswer [on|off]\n"
00620          "       Enables or disables autoanswer feature.  If used without\n"
00621          "       argument, displays the current on/off status of autoanswer.\n"
00622          "       The default value of autoanswer is in 'alsa.conf'.\n";
00623       return NULL;
00624    case CLI_GENERATE:
00625       return autoanswer_complete(a->line, a->word, a->pos, a->n);
00626    }
00627 
00628    if ((a->argc != 2) && (a->argc != 3))
00629       return CLI_SHOWUSAGE;
00630 
00631    ast_mutex_lock(&alsalock);
00632    if (a->argc == 2) {
00633       ast_cli(a->fd, "Auto answer is %s.\n", autoanswer ? "on" : "off");
00634    } else {
00635       if (!strcasecmp(a->argv[2], "on"))
00636          autoanswer = -1;
00637       else if (!strcasecmp(a->argv[2], "off"))
00638          autoanswer = 0;
00639       else
00640          res = CLI_SHOWUSAGE;
00641    }
00642    ast_mutex_unlock(&alsalock);
00643 
00644    return res;
00645 }

static char* console_dial ( struct ast_cli_entry e,
int  cmd,
struct ast_cli_args a 
) [static]

Definition at line 781 of file chan_alsa.c.

References alsa, alsa_new(), alsalock, ast_cli_args::argc, ast_cli_args::argv, ast_cli(), ast_copy_string(), ast_exists_extension(), AST_FRAME_DTMF, ast_mutex_lock(), ast_mutex_unlock(), ast_queue_frame(), AST_STATE_RINGING, ast_strlen_zero(), CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, chan_alsa_pvt::context, chan_alsa_pvt::exten, f, ast_cli_args::fd, chan_alsa_pvt::owner, strsep(), and ast_cli_entry::usage.

00782 {
00783    char tmp[256], *tmp2;
00784    char *mye, *myc;
00785    char *d;
00786    char *res = CLI_SUCCESS;
00787 
00788    switch (cmd) {
00789    case CLI_INIT:
00790       e->command = "console dial";
00791       e->usage =
00792          "Usage: console dial [extension[@context]]\n"
00793          "       Dials a given extension (and context if specified)\n";
00794       return NULL;
00795    case CLI_GENERATE:
00796       return NULL;
00797    }
00798 
00799    if ((a->argc != 2) && (a->argc != 3))
00800       return CLI_SHOWUSAGE;
00801 
00802    ast_mutex_lock(&alsalock);
00803 
00804    if (alsa.owner) {
00805       if (a->argc == 3) {
00806          if (alsa.owner) {
00807             for (d = a->argv[2]; *d; d++) {
00808                struct ast_frame f = { .frametype = AST_FRAME_DTMF, .subclass = *d };
00809 
00810                ast_queue_frame(alsa.owner, &f);
00811             }
00812          }
00813       } else {
00814          ast_cli(a->fd, "You're already in a call.  You can use this only to dial digits until you hangup\n");
00815          res = CLI_FAILURE;
00816       }
00817    } else {
00818       mye = exten;
00819       myc = context;
00820       if (a->argc == 3) {
00821          char *stringp = NULL;
00822 
00823          ast_copy_string(tmp, a->argv[2], sizeof(tmp));
00824          stringp = tmp;
00825          strsep(&stringp, "@");
00826          tmp2 = strsep(&stringp, "@");
00827          if (!ast_strlen_zero(tmp))
00828             mye = tmp;
00829          if (!ast_strlen_zero(tmp2))
00830             myc = tmp2;
00831       }
00832       if (ast_exists_extension(NULL, myc, mye, 1, NULL)) {
00833          ast_copy_string(alsa.exten, mye, sizeof(alsa.exten));
00834          ast_copy_string(alsa.context, myc, sizeof(alsa.context));
00835          hookstate = 1;
00836          alsa_new(&alsa, AST_STATE_RINGING);
00837       } else
00838          ast_cli(a->fd, "No such extension '%s' in context '%s'\n", mye, myc);
00839    }
00840 
00841    ast_mutex_unlock(&alsalock);
00842 
00843    return res;
00844 }

static char* console_hangup ( struct ast_cli_entry e,
int  cmd,
struct ast_cli_args a 
) [static]

Definition at line 743 of file chan_alsa.c.

References alsa, alsalock, ast_cli_args::argc, AST_CAUSE_NORMAL_CLEARING, ast_channel_unlock, ast_cli(), ast_mutex_lock(), ast_mutex_unlock(), ast_queue_hangup_with_cause(), CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, grab_owner(), chan_alsa_pvt::owner, and ast_cli_entry::usage.

00744 {
00745    char *res = CLI_SUCCESS;
00746 
00747    switch (cmd) {
00748    case CLI_INIT:
00749       e->command = "console hangup";
00750       e->usage =
00751          "Usage: console hangup\n"
00752          "       Hangs up any call currently placed on the console.\n";
00753       return NULL;
00754    case CLI_GENERATE:
00755       return NULL; 
00756    }
00757  
00758 
00759    if (a->argc != 2)
00760       return CLI_SHOWUSAGE;
00761 
00762    ast_mutex_lock(&alsalock);
00763 
00764    if (!alsa.owner && !hookstate) {
00765       ast_cli(a->fd, "No call to hangup\n");
00766       res = CLI_FAILURE;
00767    } else {
00768       hookstate = 0;
00769       grab_owner();
00770       if (alsa.owner) {
00771          ast_queue_hangup_with_cause(alsa.owner, AST_CAUSE_NORMAL_CLEARING);
00772          ast_channel_unlock(alsa.owner);
00773       }
00774    }
00775 
00776    ast_mutex_unlock(&alsalock);
00777 
00778    return res;
00779 }

static char* console_sendtext ( struct ast_cli_entry e,
int  cmd,
struct ast_cli_args a 
) [static]

Definition at line 690 of file chan_alsa.c.

References alsa, alsalock, ast_cli_args::argc, ast_cli_args::argv, ast_channel_unlock, ast_cli(), AST_CONTROL_ANSWER, AST_FRAME_CONTROL, AST_FRAME_TEXT, ast_mutex_lock(), ast_mutex_unlock(), ast_queue_frame(), CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, f, ast_cli_args::fd, grab_owner(), chan_alsa_pvt::owner, and ast_cli_entry::usage.

00691 {
00692    int tmparg = 3;
00693    char *res = CLI_SUCCESS;
00694 
00695    switch (cmd) {
00696    case CLI_INIT:
00697       e->command = "console send text";
00698       e->usage =
00699          "Usage: console send text <message>\n"
00700          "       Sends a text message for display on the remote terminal.\n";
00701       return NULL;
00702    case CLI_GENERATE:
00703       return NULL; 
00704    }
00705 
00706    if (a->argc < 3)
00707       return CLI_SHOWUSAGE;
00708 
00709    ast_mutex_lock(&alsalock);
00710 
00711    if (!alsa.owner) {
00712       ast_cli(a->fd, "No channel active\n");
00713       res = CLI_FAILURE;
00714    } else {
00715       struct ast_frame f = { AST_FRAME_TEXT, 0 };
00716       char text2send[256] = "";
00717 
00718       while (tmparg < a->argc) {
00719          strncat(text2send, a->argv[tmparg++], sizeof(text2send) - strlen(text2send) - 1);
00720          strncat(text2send, " ", sizeof(text2send) - strlen(text2send) - 1);
00721       }
00722 
00723       text2send[strlen(text2send) - 1] = '\n';
00724       f.data.ptr = text2send;
00725       f.datalen = strlen(text2send) + 1;
00726       grab_owner();
00727       if (alsa.owner) {
00728          ast_queue_frame(alsa.owner, &f);
00729          f.frametype = AST_FRAME_CONTROL;
00730          f.subclass = AST_CONTROL_ANSWER;
00731          f.data.ptr = NULL;
00732          f.datalen = 0;
00733          ast_queue_frame(alsa.owner, &f);
00734          ast_channel_unlock(alsa.owner);
00735       }
00736    }
00737 
00738    ast_mutex_unlock(&alsalock);
00739 
00740    return res;
00741 }

static void grab_owner ( void   )  [static]

Definition at line 298 of file chan_alsa.c.

References alsa, alsalock, ast_channel_trylock, DEADLOCK_AVOIDANCE, and chan_alsa_pvt::owner.

Referenced by alsa_call(), console_answer(), console_hangup(), and console_sendtext().

00299 {
00300    while (alsa.owner && ast_channel_trylock(alsa.owner)) {
00301       DEADLOCK_AVOIDANCE(&alsalock);
00302    }
00303 }

static int load_module ( void   )  [static]

Definition at line 854 of file chan_alsa.c.

References alsa_tech, ast_channel_register(), ast_cli_register_multiple(), ast_config_destroy(), ast_config_load, ast_copy_string(), ast_jb_read_conf(), ast_log(), AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_FAILURE, AST_MODULE_LOAD_SUCCESS, ast_true(), ast_variable_browse(), ast_verb, cli_alsa, config_flags, default_jbconf, global_jbconf, LOG_ERROR, ast_variable::name, ast_variable::next, soundcard_init(), and ast_variable::value.

00855 {
00856    struct ast_config *cfg;
00857    struct ast_variable *v;
00858    struct ast_flags config_flags = { 0 };
00859 
00860    /* Copy the default jb config over global_jbconf */
00861    memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf));
00862 
00863    strcpy(mohinterpret, "default");
00864 
00865    if (!(cfg = ast_config_load(config, config_flags)))
00866       return AST_MODULE_LOAD_DECLINE;
00867 
00868    v = ast_variable_browse(cfg, "general");
00869    for (; v; v = v->next) {
00870       /* handle jb conf */
00871       if (!ast_jb_read_conf(&global_jbconf, v->name, v->value))
00872             continue;
00873       
00874       if (!strcasecmp(v->name, "autoanswer"))
00875          autoanswer = ast_true(v->value);
00876       else if (!strcasecmp(v->name, "silencesuppression"))
00877          silencesuppression = ast_true(v->value);
00878       else if (!strcasecmp(v->name, "silencethreshold"))
00879          silencethreshold = atoi(v->value);
00880       else if (!strcasecmp(v->name, "context"))
00881          ast_copy_string(context, v->value, sizeof(context));
00882       else if (!strcasecmp(v->name, "language"))
00883          ast_copy_string(language, v->value, sizeof(language));
00884       else if (!strcasecmp(v->name, "extension"))
00885          ast_copy_string(exten, v->value, sizeof(exten));
00886       else if (!strcasecmp(v->name, "input_device"))
00887          ast_copy_string(indevname, v->value, sizeof(indevname));
00888       else if (!strcasecmp(v->name, "output_device"))
00889          ast_copy_string(outdevname, v->value, sizeof(outdevname));
00890       else if (!strcasecmp(v->name, "mohinterpret"))
00891          ast_copy_string(mohinterpret, v->value, sizeof(mohinterpret));
00892    }
00893    ast_config_destroy(cfg);
00894 
00895    if (soundcard_init() < 0) {
00896       ast_verb(2, "No sound card detected -- console channel will be unavailable\n");
00897       ast_verb(2, "Turn off ALSA support by adding 'noload=chan_alsa.so' in /etc/asterisk/modules.conf\n");
00898       return AST_MODULE_LOAD_DECLINE;
00899    }
00900 
00901    if (ast_channel_register(&alsa_tech)) {
00902       ast_log(LOG_ERROR, "Unable to register channel class 'Console'\n");
00903       return AST_MODULE_LOAD_FAILURE;
00904    }
00905 
00906    ast_cli_register_multiple(cli_alsa, sizeof(cli_alsa) / sizeof(struct ast_cli_entry));
00907 
00908    return AST_MODULE_LOAD_SUCCESS;
00909 }

static int soundcard_init ( void   )  [static]

Definition at line 266 of file chan_alsa.c.

References alsa, alsa_card_init(), ast_log(), chan_alsa_pvt::icard, LOG_ERROR, and chan_alsa_pvt::ocard.

Referenced by load_module().

00267 {
00268    alsa.icard = alsa_card_init(indevname, SND_PCM_STREAM_CAPTURE);
00269    alsa.ocard = alsa_card_init(outdevname, SND_PCM_STREAM_PLAYBACK);
00270 
00271    if (!alsa.icard || !alsa.ocard) {
00272       ast_log(LOG_ERROR, "Problem opening ALSA I/O devices\n");
00273       return -1;
00274    }
00275 
00276    return readdev;
00277 }

static int unload_module ( void   )  [static]

Definition at line 911 of file chan_alsa.c.

References alsa, alsa_tech, ast_channel_unregister(), ast_cli_unregister_multiple(), ast_softhangup(), AST_SOFTHANGUP_APPUNLOAD, cli_alsa, chan_alsa_pvt::icard, chan_alsa_pvt::ocard, and chan_alsa_pvt::owner.

00912 {
00913    ast_channel_unregister(&alsa_tech);
00914    ast_cli_unregister_multiple(cli_alsa, sizeof(cli_alsa) / sizeof(struct ast_cli_entry));
00915 
00916    if (alsa.icard)
00917       snd_pcm_close(alsa.icard);
00918    if (alsa.ocard)
00919       snd_pcm_close(alsa.ocard);
00920    if (alsa.owner)
00921       ast_softhangup(alsa.owner, AST_SOFTHANGUP_APPUNLOAD);
00922    if (alsa.owner)
00923       return -1;
00924 
00925    return 0;
00926 }


Variable Documentation

struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "ALSA Console Channel Driver" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "a9c98e5d177805051735cb5b0b16b0a0" , .load = load_module, .unload = unload_module, } [static]

Definition at line 928 of file chan_alsa.c.

struct chan_alsa_pvt alsa [static]

Referenced by alsa_answer(), alsa_call(), alsa_hangup(), alsa_read(), alsa_request(), alsa_write(), console_answer(), console_dial(), console_hangup(), console_sendtext(), grab_owner(), soundcard_init(), and unload_module().

struct ast_channel_tech alsa_tech [static]

Definition at line 144 of file chan_alsa.c.

Referenced by alsa_new(), load_module(), and unload_module().

ast_mutex_t alsalock = ((ast_mutex_t) PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP ) [static]

Definition at line 99 of file chan_alsa.c.

Referenced by alsa_answer(), alsa_call(), alsa_digit(), alsa_fixup(), alsa_hangup(), alsa_indicate(), alsa_read(), alsa_request(), alsa_text(), alsa_write(), console_answer(), console_autoanswer(), console_dial(), console_hangup(), console_sendtext(), and grab_owner().

struct ast_module_info* ast_module_info = &__mod_info [static]

Definition at line 928 of file chan_alsa.c.

int autoanswer = 1 [static]

Definition at line 131 of file chan_alsa.c.

struct ast_cli_entry cli_alsa[] [static]

Definition at line 846 of file chan_alsa.c.

Referenced by load_module(), and unload_module().

const char config[] = "alsa.conf" [static]

Definition at line 102 of file chan_alsa.c.

char context[AST_MAX_CONTEXT] = "default" [static]

Definition at line 104 of file chan_alsa.c.

Referenced by acf_isexten_exec(), acf_vmcount_exec(), action_atxfer(), action_redirect(), add_peer_mailboxes(), append_mailbox_mapping(), ast_event_hash_mwi(), ast_get_enum(), ast_get_srv(), ast_get_txt(), blr_ebl(), blr_txt(), build_device(), build_gateway(), build_peer(), check_access(), check_peer_ok(), complete_dialplan_add_include(), complete_dialplan_remove_extension(), complete_dialplan_remove_include(), create_addr_from_peer(), disa_exec(), extenspy_exec(), extstate_read(), get_also_info(), get_cid_name(), get_destination(), gtalk_load_config(), handle_cli_dialplan_remove_extension(), handle_request_bye(), handle_request_invite(), handle_request_options(), handle_request_refer(), has_voicemail(), hint_read(), iax2_call(), iax2_transfer(), isexten_function_read(), jingle_load_config(), load_config(), log_exec(), lua_pbx_exec(), lua_register_switches(), lua_sort_extensions(), notify_message(), orig_exten(), pickup_exec(), process_ast_dsp(), process_weights(), readexten_exec(), register_peer_exten(), reload_config(), rpt_exec(), set_pvt_defaults(), SHA1Input(), SHA1PadMessage(), SHA1ProcessMessageBlock(), SHA1Reset(), SHA1Result(), sip_alloc(), socket_process(), store_config_core(), unistim_send_mwi_to_peer(), unreference_cached_app(), and update_registry().

struct ast_jb_conf default_jbconf [static]

Global jitterbuffer configuration - by default, jb is disabled

Definition at line 61 of file chan_alsa.c.

Referenced by gtalk_load_config(), jingle_load_config(), load_config(), load_module(), misdn_cfg_init(), reload_config(), and setup_dahdi().

char exten[AST_MAX_EXTENSION] = "s" [static]

Definition at line 106 of file chan_alsa.c.

Referenced by action_atxfer(), action_redirect(), add_user_extension(), ast_context_remove_extension_callerid2(), ast_get_extension_context(), ast_get_extension_label(), ast_get_extension_name(), ast_get_extension_priority(), ast_ivr_menu_run_internal(), ast_walk_context_extensions(), ast_walk_extension_priorities(), build_extension(), check_access(), check_user_full(), complete_dialplan_remove_extension(), complete_dpreply(), copy_plain_file(), delete_extension(), destroy_station(), disa_exec(), extenspy_exec(), extstate_read(), get_cid_name(), get_destination(), get_rdnis(), gtalk_alloc(), handle_cli_dialplan_add_extension(), handle_cli_dialplan_remove_extension(), handle_debug_dialplan(), handle_request_invite(), handle_show_dialplan(), hint_read(), initreqprep(), isexten_function_read(), leave_voicemail(), lua_pbx_exec(), lua_sort_extensions(), manager_show_dialplan(), mgcp_ss(), new_iax(), orig_exten(), osplookup_exec(), pbx_builtin_raise_exception(), pbx_parseable_goto(), pickup_exec(), pp_each_extension_exec(), readexten_exec(), register_verify(), rpt_exec(), set_pvt_defaults(), socket_process(), ss_thread(), store_config_core(), transmit_register(), update_scoreboard(), user_destructor(), and waitstream_core().

snd_pcm_format_t format = SND_PCM_FORMAT_S16_BE [static]

Definition at line 90 of file chan_alsa.c.

Referenced by acf_sprintf(), acf_strftime(), acf_strptime(), action_originate(), add_codec_to_answer(), ast_codec_pref_getsize(), ast_getformatbyname(), ast_monitor_stop(), ast_openvstream(), ast_parse_allow_disallow(), ast_rtp_lookup_mime_multiple(), ast_speech_new(), ast_strftime(), build_peer(), build_user(), check_header(), echo_exec(), handle_saydatetime(), map_video_codec(), minivm_notify_exec(), process_sdp(), reload_config(), sayunixtime_exec(), set_config(), socket_process(), start_monitor_action(), and start_monitor_exec().

struct ast_jb_conf global_jbconf [static]

Definition at line 67 of file chan_alsa.c.

Referenced by __oh323_rtp_create(), __oh323_update_info(), _build_general_config(), alsa_new(), console_new(), dahdi_new(), gtalk_load_config(), gtalk_new(), handle_skinny_show_settings(), jingle_load_config(), jingle_new(), load_config(), load_module(), mgcp_new(), misdn_cfg_init(), misdn_get_global_jbconf(), oss_new(), process_dahdi(), reload_config(), setup_dahdi(), sip_get_rtp_peer(), sip_new(), sip_show_settings(), skinny_new(), store_config(), store_config_core(), unistim_new(), and usbradio_new().

int hookstate = 0 [static]

Definition at line 109 of file chan_alsa.c.

char indevname[50] = ALSA_INDEV [static]

Definition at line 93 of file chan_alsa.c.

char language[MAX_LANGUAGE] = "" [static]

Definition at line 105 of file chan_alsa.c.

Referenced by agent_new(), ast_channel_alloc(), ast_do_masquerade(), begin_dial_channel(), build_gateway(), check_peer_ok(), console_new(), create_addr_from_peer(), dahdi_new(), func_channel_write(), gtalk_new(), jingle_new(), local_call(), mgcp_new(), nbs_new(), oss_new(), read_config(), set_pvt_defaults(), sip_new(), store_config_core(), tds_load_module(), unistim_new(), usbradio_new(), and vm_execmain().

char mohinterpret[MAX_MUSICCLASS] [static]

Definition at line 107 of file chan_alsa.c.

Referenced by check_peer_ok(), create_addr_from_peer(), set_pvt_defaults(), sip_alloc(), and store_config_core().

char outdevname[50] = ALSA_OUTDEV [static]

Definition at line 94 of file chan_alsa.c.

int readdev = -1 [static]

Definition at line 128 of file chan_alsa.c.

int silencesuppression = 0 [static]

Definition at line 96 of file chan_alsa.c.

int silencethreshold = 1000 [static]

Definition at line 97 of file chan_alsa.c.

Referenced by ast_record_review(), and setup_privacy_args().

const char tdesc[] = "ALSA Console Channel Driver" [static]

Definition at line 101 of file chan_alsa.c.

int writedev = -1 [static]

Definition at line 129 of file chan_alsa.c.


Generated on Fri Jul 24 00:41:20 2009 for Asterisk - the Open Source PBX by  doxygen 1.4.7