#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_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_channel * | alsa_new (struct chan_alsa_pvt *p, int state) |
static struct ast_frame * | alsa_read (struct ast_channel *chan) |
static struct ast_channel * | alsa_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_info * | ast_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 |
Definition in file chan_alsa.c.
#define ALSA_INDEV "default" |
Definition at line 72 of file chan_alsa.c.
#define ALSA_OUTDEV "default" |
Definition at line 73 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 83 of file chan_alsa.c.
#define DEBUG 0 |
Definition at line 70 of file chan_alsa.c.
#define DESIRED_RATE 8000 |
#define FRAME_SIZE 160 |
Definition at line 77 of file chan_alsa.c.
Referenced by alsa_read(), oss_read(), and soundcard_writeframe().
#define MAX_BUFFER_SIZE 100 |
Definition at line 126 of file chan_alsa.c.
#define MIN_SWITCH_TIME 600 |
Definition at line 86 of file chan_alsa.c.
#define PERIOD_FRAMES 80 |
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 337 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.
00338 { 00339 ast_mutex_lock(&alsalock); 00340 ast_verbose(" << Console call has been answered >> \n"); 00341 ast_setstate(c, AST_STATE_UP); 00342 snd_pcm_prepare(alsa.icard); 00343 snd_pcm_start(alsa.icard); 00344 ast_mutex_unlock(&alsalock); 00345 00346 return 0; 00347 }
static int alsa_call | ( | struct ast_channel * | c, | |
char * | dest, | |||
int | timeout | |||
) | [static] |
Definition at line 306 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.
00307 { 00308 struct ast_frame f = { AST_FRAME_CONTROL }; 00309 00310 ast_mutex_lock(&alsalock); 00311 ast_verbose(" << Call placed to '%s' on console >> \n", dest); 00312 if (autoanswer) { 00313 ast_verbose(" << Auto-answered >> \n"); 00314 grab_owner(); 00315 if (alsa.owner) { 00316 f.subclass = AST_CONTROL_ANSWER; 00317 ast_queue_frame(alsa.owner, &f); 00318 ast_channel_unlock(alsa.owner); 00319 } 00320 } else { 00321 ast_verbose(" << Type 'answer' to answer, or use 'autoanswer' for future calls >> \n"); 00322 grab_owner(); 00323 if (alsa.owner) { 00324 f.subclass = AST_CONTROL_RINGING; 00325 ast_queue_frame(alsa.owner, &f); 00326 ast_channel_unlock(alsa.owner); 00327 ast_indicate(alsa.owner, AST_CONTROL_RINGING); 00328 } 00329 } 00330 snd_pcm_prepare(alsa.icard); 00331 snd_pcm_start(alsa.icard); 00332 ast_mutex_unlock(&alsalock); 00333 00334 return 0; 00335 }
static snd_pcm_t* alsa_card_init | ( | char * | dev, | |
snd_pcm_stream_t | stream | |||
) | [static] |
Definition at line 161 of file chan_alsa.c.
References ast_debug, ast_log(), DESIRED_RATE, LOG_ERROR, LOG_WARNING, and PERIOD_FRAMES.
Referenced by soundcard_init().
00162 { 00163 int err; 00164 int direction; 00165 snd_pcm_t *handle = NULL; 00166 snd_pcm_hw_params_t *hwparams = NULL; 00167 snd_pcm_sw_params_t *swparams = NULL; 00168 struct pollfd pfd; 00169 snd_pcm_uframes_t period_size = PERIOD_FRAMES * 4; 00170 snd_pcm_uframes_t buffer_size = 0; 00171 unsigned int rate = DESIRED_RATE; 00172 snd_pcm_uframes_t start_threshold, stop_threshold; 00173 00174 err = snd_pcm_open(&handle, dev, stream, SND_PCM_NONBLOCK); 00175 if (err < 0) { 00176 ast_log(LOG_ERROR, "snd_pcm_open failed: %s\n", snd_strerror(err)); 00177 return NULL; 00178 } else { 00179 ast_debug(1, "Opening device %s in %s mode\n", dev, (stream == SND_PCM_STREAM_CAPTURE) ? "read" : "write"); 00180 } 00181 00182 hwparams = alloca(snd_pcm_hw_params_sizeof()); 00183 memset(hwparams, 0, snd_pcm_hw_params_sizeof()); 00184 snd_pcm_hw_params_any(handle, hwparams); 00185 00186 err = snd_pcm_hw_params_set_access(handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED); 00187 if (err < 0) 00188 ast_log(LOG_ERROR, "set_access failed: %s\n", snd_strerror(err)); 00189 00190 err = snd_pcm_hw_params_set_format(handle, hwparams, format); 00191 if (err < 0) 00192 ast_log(LOG_ERROR, "set_format failed: %s\n", snd_strerror(err)); 00193 00194 err = snd_pcm_hw_params_set_channels(handle, hwparams, 1); 00195 if (err < 0) 00196 ast_log(LOG_ERROR, "set_channels failed: %s\n", snd_strerror(err)); 00197 00198 direction = 0; 00199 err = snd_pcm_hw_params_set_rate_near(handle, hwparams, &rate, &direction); 00200 if (rate != DESIRED_RATE) 00201 ast_log(LOG_WARNING, "Rate not correct, requested %d, got %d\n", DESIRED_RATE, rate); 00202 00203 direction = 0; 00204 err = snd_pcm_hw_params_set_period_size_near(handle, hwparams, &period_size, &direction); 00205 if (err < 0) 00206 ast_log(LOG_ERROR, "period_size(%ld frames) is bad: %s\n", period_size, snd_strerror(err)); 00207 else { 00208 ast_debug(1, "Period size is %d\n", err); 00209 } 00210 00211 buffer_size = 4096 * 2; /* period_size * 16; */ 00212 err = snd_pcm_hw_params_set_buffer_size_near(handle, hwparams, &buffer_size); 00213 if (err < 0) 00214 ast_log(LOG_WARNING, "Problem setting buffer size of %ld: %s\n", buffer_size, snd_strerror(err)); 00215 else { 00216 ast_debug(1, "Buffer size is set to %d frames\n", err); 00217 } 00218 00219 err = snd_pcm_hw_params(handle, hwparams); 00220 if (err < 0) 00221 ast_log(LOG_ERROR, "Couldn't set the new hw params: %s\n", snd_strerror(err)); 00222 00223 swparams = alloca(snd_pcm_sw_params_sizeof()); 00224 memset(swparams, 0, snd_pcm_sw_params_sizeof()); 00225 snd_pcm_sw_params_current(handle, swparams); 00226 00227 if (stream == SND_PCM_STREAM_PLAYBACK) 00228 start_threshold = period_size; 00229 else 00230 start_threshold = 1; 00231 00232 err = snd_pcm_sw_params_set_start_threshold(handle, swparams, start_threshold); 00233 if (err < 0) 00234 ast_log(LOG_ERROR, "start threshold: %s\n", snd_strerror(err)); 00235 00236 if (stream == SND_PCM_STREAM_PLAYBACK) 00237 stop_threshold = buffer_size; 00238 else 00239 stop_threshold = buffer_size; 00240 00241 err = snd_pcm_sw_params_set_stop_threshold(handle, swparams, stop_threshold); 00242 if (err < 0) 00243 ast_log(LOG_ERROR, "stop threshold: %s\n", snd_strerror(err)); 00244 00245 err = snd_pcm_sw_params(handle, swparams); 00246 if (err < 0) 00247 ast_log(LOG_ERROR, "sw_params: %s\n", snd_strerror(err)); 00248 00249 err = snd_pcm_poll_descriptors_count(handle); 00250 if (err <= 0) 00251 ast_log(LOG_ERROR, "Unable to get a poll descriptors count, error is %s\n", snd_strerror(err)); 00252 if (err != 1) { 00253 ast_debug(1, "Can't handle more than one device\n"); 00254 } 00255 00256 snd_pcm_poll_descriptors(handle, &pfd, err); 00257 ast_debug(1, "Acquired fd %d from the poll descriptor\n", pfd.fd); 00258 00259 if (stream == SND_PCM_STREAM_CAPTURE) 00260 readdev = pfd.fd; 00261 else 00262 writedev = pfd.fd; 00263 00264 return handle; 00265 }
static int alsa_digit | ( | struct ast_channel * | c, | |
char | digit, | |||
unsigned int | duration | |||
) | [static] |
Definition at line 280 of file chan_alsa.c.
References alsalock, ast_mutex_lock(), ast_mutex_unlock(), and ast_verbose.
00281 { 00282 ast_mutex_lock(&alsalock); 00283 ast_verbose(" << Console Received digit %c of duration %u ms >> \n", 00284 digit, duration); 00285 ast_mutex_unlock(&alsalock); 00286 00287 return 0; 00288 }
static int alsa_fixup | ( | struct ast_channel * | oldchan, | |
struct ast_channel * | newchan | |||
) | [static] |
Definition at line 489 of file chan_alsa.c.
References alsalock, ast_mutex_lock(), ast_mutex_unlock(), chan_alsa_pvt::owner, and ast_channel::tech_pvt.
00490 { 00491 struct chan_alsa_pvt *p = newchan->tech_pvt; 00492 00493 ast_mutex_lock(&alsalock); 00494 p->owner = newchan; 00495 ast_mutex_unlock(&alsalock); 00496 00497 return 0; 00498 }
static int alsa_hangup | ( | struct ast_channel * | c | ) | [static] |
Definition at line 349 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.
00350 { 00351 ast_mutex_lock(&alsalock); 00352 c->tech_pvt = NULL; 00353 alsa.owner = NULL; 00354 ast_verbose(" << Hangup on console >> \n"); 00355 ast_module_unref(ast_module_info->self); 00356 hookstate = 0; 00357 snd_pcm_drop(alsa.icard); 00358 ast_mutex_unlock(&alsalock); 00359 00360 return 0; 00361 }
static int alsa_indicate | ( | struct ast_channel * | chan, | |
int | cond, | |||
const void * | data, | |||
size_t | datalen | |||
) | [static] |
Definition at line 500 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.
00501 { 00502 int res = 0; 00503 00504 ast_mutex_lock(&alsalock); 00505 00506 switch (cond) { 00507 case AST_CONTROL_BUSY: 00508 case AST_CONTROL_CONGESTION: 00509 case AST_CONTROL_RINGING: 00510 case -1: 00511 res = -1; /* Ask for inband indications */ 00512 break; 00513 case AST_CONTROL_PROGRESS: 00514 case AST_CONTROL_PROCEEDING: 00515 case AST_CONTROL_VIDUPDATE: 00516 case AST_CONTROL_SRCUPDATE: 00517 break; 00518 case AST_CONTROL_HOLD: 00519 ast_verbose(" << Console Has Been Placed on Hold >> \n"); 00520 ast_moh_start(chan, data, mohinterpret); 00521 break; 00522 case AST_CONTROL_UNHOLD: 00523 ast_verbose(" << Console Has Been Retrieved from Hold >> \n"); 00524 ast_moh_stop(chan); 00525 break; 00526 default: 00527 ast_log(LOG_WARNING, "Don't know how to display condition %d on %s\n", cond, chan->name); 00528 res = -1; 00529 } 00530 00531 ast_mutex_unlock(&alsalock); 00532 00533 return res; 00534 }
static struct ast_channel* alsa_new | ( | struct chan_alsa_pvt * | p, | |
int | state | |||
) | [static] |
Definition at line 536 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().
00537 { 00538 struct ast_channel *tmp = NULL; 00539 00540 if (!(tmp = ast_channel_alloc(1, state, 0, 0, "", p->exten, p->context, 0, "ALSA/%s", indevname))) 00541 return NULL; 00542 00543 tmp->tech = &alsa_tech; 00544 ast_channel_set_fd(tmp, 0, readdev); 00545 tmp->nativeformats = AST_FORMAT_SLINEAR; 00546 tmp->readformat = AST_FORMAT_SLINEAR; 00547 tmp->writeformat = AST_FORMAT_SLINEAR; 00548 tmp->tech_pvt = p; 00549 if (!ast_strlen_zero(p->context)) 00550 ast_copy_string(tmp->context, p->context, sizeof(tmp->context)); 00551 if (!ast_strlen_zero(p->exten)) 00552 ast_copy_string(tmp->exten, p->exten, sizeof(tmp->exten)); 00553 if (!ast_strlen_zero(language)) 00554 ast_string_field_set(tmp, language, language); 00555 p->owner = tmp; 00556 ast_module_ref(ast_module_info->self); 00557 ast_jb_configure(tmp, &global_jbconf); 00558 if (state != AST_STATE_DOWN) { 00559 if (ast_pbx_start(tmp)) { 00560 ast_log(LOG_WARNING, "Unable to start PBX on %s\n", tmp->name); 00561 ast_hangup(tmp); 00562 tmp = NULL; 00563 } 00564 } 00565 00566 return tmp; 00567 }
static struct ast_frame * alsa_read | ( | struct ast_channel * | chan | ) | [static] |
Definition at line 417 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.
00418 { 00419 static struct ast_frame f; 00420 static short __buf[FRAME_SIZE + AST_FRIENDLY_OFFSET / 2]; 00421 short *buf; 00422 static int readpos = 0; 00423 static int left = FRAME_SIZE; 00424 snd_pcm_state_t state; 00425 int r = 0; 00426 int off = 0; 00427 00428 ast_mutex_lock(&alsalock); 00429 f.frametype = AST_FRAME_NULL; 00430 f.subclass = 0; 00431 f.samples = 0; 00432 f.datalen = 0; 00433 f.data.ptr = NULL; 00434 f.offset = 0; 00435 f.src = "Console"; 00436 f.mallocd = 0; 00437 f.delivery.tv_sec = 0; 00438 f.delivery.tv_usec = 0; 00439 00440 state = snd_pcm_state(alsa.icard); 00441 if ((state != SND_PCM_STATE_PREPARED) && (state != SND_PCM_STATE_RUNNING)) { 00442 snd_pcm_prepare(alsa.icard); 00443 } 00444 00445 buf = __buf + AST_FRIENDLY_OFFSET / 2; 00446 00447 r = snd_pcm_readi(alsa.icard, buf + readpos, left); 00448 if (r == -EPIPE) { 00449 #if DEBUG 00450 ast_log(LOG_ERROR, "XRUN read\n"); 00451 #endif 00452 snd_pcm_prepare(alsa.icard); 00453 } else if (r == -ESTRPIPE) { 00454 ast_log(LOG_ERROR, "-ESTRPIPE\n"); 00455 snd_pcm_prepare(alsa.icard); 00456 } else if (r < 0) { 00457 ast_log(LOG_ERROR, "Read error: %s\n", snd_strerror(r)); 00458 } else if (r >= 0) { 00459 off -= r; 00460 } 00461 /* Update positions */ 00462 readpos += r; 00463 left -= r; 00464 00465 if (readpos >= FRAME_SIZE) { 00466 /* A real frame */ 00467 readpos = 0; 00468 left = FRAME_SIZE; 00469 if (chan->_state != AST_STATE_UP) { 00470 /* Don't transmit unless it's up */ 00471 ast_mutex_unlock(&alsalock); 00472 return &f; 00473 } 00474 f.frametype = AST_FRAME_VOICE; 00475 f.subclass = AST_FORMAT_SLINEAR; 00476 f.samples = FRAME_SIZE; 00477 f.datalen = FRAME_SIZE * 2; 00478 f.data.ptr = buf; 00479 f.offset = AST_FRIENDLY_OFFSET; 00480 f.src = "Console"; 00481 f.mallocd = 0; 00482 00483 } 00484 ast_mutex_unlock(&alsalock); 00485 00486 return &f; 00487 }
static struct ast_channel * alsa_request | ( | const char * | type, | |
int | format, | |||
void * | data, | |||
int * | cause | |||
) | [static] |
Definition at line 569 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.
00570 { 00571 int oldformat = fmt; 00572 struct ast_channel *tmp = NULL; 00573 00574 if (!(fmt &= AST_FORMAT_SLINEAR)) { 00575 ast_log(LOG_NOTICE, "Asked to get a channel of format '%d'\n", oldformat); 00576 return NULL; 00577 } 00578 00579 ast_mutex_lock(&alsalock); 00580 00581 if (alsa.owner) { 00582 ast_log(LOG_NOTICE, "Already have a call on the ALSA channel\n"); 00583 *cause = AST_CAUSE_BUSY; 00584 } else if (!(tmp = alsa_new(&alsa, AST_STATE_DOWN))) { 00585 ast_log(LOG_WARNING, "Unable to create new ALSA channel\n"); 00586 } 00587 00588 ast_mutex_unlock(&alsalock); 00589 00590 return tmp; 00591 }
static int alsa_text | ( | struct ast_channel * | c, | |
const char * | text | |||
) | [static] |
Definition at line 290 of file chan_alsa.c.
References alsalock, ast_mutex_lock(), ast_mutex_unlock(), and ast_verbose.
00291 { 00292 ast_mutex_lock(&alsalock); 00293 ast_verbose(" << Console Received text %s >> \n", text); 00294 ast_mutex_unlock(&alsalock); 00295 00296 return 0; 00297 }
static int alsa_write | ( | struct ast_channel * | chan, | |
struct ast_frame * | f | |||
) | [static] |
Definition at line 363 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.
00364 { 00365 static char sizbuf[8000]; 00366 static int sizpos = 0; 00367 int len = sizpos; 00368 int pos; 00369 int res = 0; 00370 /* size_t frames = 0; */ 00371 snd_pcm_state_t state; 00372 00373 ast_mutex_lock(&alsalock); 00374 00375 /* We have to digest the frame in 160-byte portions */ 00376 if (f->datalen > sizeof(sizbuf) - sizpos) { 00377 ast_log(LOG_WARNING, "Frame too large\n"); 00378 res = -1; 00379 } else { 00380 memcpy(sizbuf + sizpos, f->data.ptr, f->datalen); 00381 len += f->datalen; 00382 pos = 0; 00383 state = snd_pcm_state(alsa.ocard); 00384 if (state == SND_PCM_STATE_XRUN) 00385 snd_pcm_prepare(alsa.ocard); 00386 while ((res = snd_pcm_writei(alsa.ocard, sizbuf, len / 2)) == -EAGAIN) { 00387 usleep(1); 00388 } 00389 if (res == -EPIPE) { 00390 #if DEBUG 00391 ast_debug(1, "XRUN write\n"); 00392 #endif 00393 snd_pcm_prepare(alsa.ocard); 00394 while ((res = snd_pcm_writei(alsa.ocard, sizbuf, len / 2)) == -EAGAIN) { 00395 usleep(1); 00396 } 00397 if (res != len / 2) { 00398 ast_log(LOG_ERROR, "Write error: %s\n", snd_strerror(res)); 00399 res = -1; 00400 } else if (res < 0) { 00401 ast_log(LOG_ERROR, "Write error %s\n", snd_strerror(res)); 00402 res = -1; 00403 } 00404 } else { 00405 if (res == -ESTRPIPE) 00406 ast_log(LOG_ERROR, "You've got some big problems\n"); 00407 else if (res < 0) 00408 ast_log(LOG_NOTICE, "Error %d on write\n", res); 00409 } 00410 } 00411 ast_mutex_unlock(&alsalock); 00412 00413 return res >= 0 ? 0 : res; 00414 }
static char* autoanswer_complete | ( | const char * | line, | |
const char * | word, | |||
int | pos, | |||
int | state | |||
) | [static] |
Definition at line 593 of file chan_alsa.c.
References ast_strdup, ast_strlen_zero(), and MIN.
Referenced by console_autoanswer().
00594 { 00595 switch (state) { 00596 case 0: 00597 if (!ast_strlen_zero(word) && !strncasecmp(word, "on", MIN(strlen(word), 2))) 00598 return ast_strdup("on"); 00599 case 1: 00600 if (!ast_strlen_zero(word) && !strncasecmp(word, "off", MIN(strlen(word), 3))) 00601 return ast_strdup("off"); 00602 default: 00603 return NULL; 00604 } 00605 00606 return NULL; 00607 }
static char* console_answer | ( | struct ast_cli_entry * | e, | |
int | cmd, | |||
struct ast_cli_args * | a | |||
) | [static] |
Definition at line 645 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.
00646 { 00647 char *res = CLI_SUCCESS; 00648 00649 switch (cmd) { 00650 case CLI_INIT: 00651 e->command = "console answer"; 00652 e->usage = 00653 "Usage: console answer\n" 00654 " Answers an incoming call on the console (ALSA) channel.\n"; 00655 00656 return NULL; 00657 case CLI_GENERATE: 00658 return NULL; 00659 } 00660 00661 if (a->argc != 2) 00662 return CLI_SHOWUSAGE; 00663 00664 ast_mutex_lock(&alsalock); 00665 00666 if (!alsa.owner) { 00667 ast_cli(a->fd, "No one is calling us\n"); 00668 res = CLI_FAILURE; 00669 } else { 00670 hookstate = 1; 00671 grab_owner(); 00672 if (alsa.owner) { 00673 struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_ANSWER }; 00674 00675 ast_queue_frame(alsa.owner, &f); 00676 ast_channel_unlock(alsa.owner); 00677 } 00678 } 00679 00680 snd_pcm_prepare(alsa.icard); 00681 snd_pcm_start(alsa.icard); 00682 00683 ast_mutex_unlock(&alsalock); 00684 00685 return res; 00686 }
static char* console_autoanswer | ( | struct ast_cli_entry * | e, | |
int | cmd, | |||
struct ast_cli_args * | a | |||
) | [static] |
Definition at line 609 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.
00610 { 00611 char *res = CLI_SUCCESS; 00612 00613 switch (cmd) { 00614 case CLI_INIT: 00615 e->command = "console autoanswer"; 00616 e->usage = 00617 "Usage: console autoanswer [on|off]\n" 00618 " Enables or disables autoanswer feature. If used without\n" 00619 " argument, displays the current on/off status of autoanswer.\n" 00620 " The default value of autoanswer is in 'alsa.conf'.\n"; 00621 return NULL; 00622 case CLI_GENERATE: 00623 return autoanswer_complete(a->line, a->word, a->pos, a->n); 00624 } 00625 00626 if ((a->argc != 2) && (a->argc != 3)) 00627 return CLI_SHOWUSAGE; 00628 00629 ast_mutex_lock(&alsalock); 00630 if (a->argc == 2) { 00631 ast_cli(a->fd, "Auto answer is %s.\n", autoanswer ? "on" : "off"); 00632 } else { 00633 if (!strcasecmp(a->argv[2], "on")) 00634 autoanswer = -1; 00635 else if (!strcasecmp(a->argv[2], "off")) 00636 autoanswer = 0; 00637 else 00638 res = CLI_SHOWUSAGE; 00639 } 00640 ast_mutex_unlock(&alsalock); 00641 00642 return res; 00643 }
static char* console_dial | ( | struct ast_cli_entry * | e, | |
int | cmd, | |||
struct ast_cli_args * | a | |||
) | [static] |
Definition at line 779 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.
00780 { 00781 char tmp[256], *tmp2; 00782 char *mye, *myc; 00783 char *d; 00784 char *res = CLI_SUCCESS; 00785 00786 switch (cmd) { 00787 case CLI_INIT: 00788 e->command = "console dial"; 00789 e->usage = 00790 "Usage: console dial [extension[@context]]\n" 00791 " Dials a given extension (and context if specified)\n"; 00792 return NULL; 00793 case CLI_GENERATE: 00794 return NULL; 00795 } 00796 00797 if ((a->argc != 2) && (a->argc != 3)) 00798 return CLI_SHOWUSAGE; 00799 00800 ast_mutex_lock(&alsalock); 00801 00802 if (alsa.owner) { 00803 if (a->argc == 3) { 00804 if (alsa.owner) { 00805 for (d = a->argv[2]; *d; d++) { 00806 struct ast_frame f = { .frametype = AST_FRAME_DTMF, .subclass = *d }; 00807 00808 ast_queue_frame(alsa.owner, &f); 00809 } 00810 } 00811 } else { 00812 ast_cli(a->fd, "You're already in a call. You can use this only to dial digits until you hangup\n"); 00813 res = CLI_FAILURE; 00814 } 00815 } else { 00816 mye = exten; 00817 myc = context; 00818 if (a->argc == 3) { 00819 char *stringp = NULL; 00820 00821 ast_copy_string(tmp, a->argv[2], sizeof(tmp)); 00822 stringp = tmp; 00823 strsep(&stringp, "@"); 00824 tmp2 = strsep(&stringp, "@"); 00825 if (!ast_strlen_zero(tmp)) 00826 mye = tmp; 00827 if (!ast_strlen_zero(tmp2)) 00828 myc = tmp2; 00829 } 00830 if (ast_exists_extension(NULL, myc, mye, 1, NULL)) { 00831 ast_copy_string(alsa.exten, mye, sizeof(alsa.exten)); 00832 ast_copy_string(alsa.context, myc, sizeof(alsa.context)); 00833 hookstate = 1; 00834 alsa_new(&alsa, AST_STATE_RINGING); 00835 } else 00836 ast_cli(a->fd, "No such extension '%s' in context '%s'\n", mye, myc); 00837 } 00838 00839 ast_mutex_unlock(&alsalock); 00840 00841 return res; 00842 }
static char* console_hangup | ( | struct ast_cli_entry * | e, | |
int | cmd, | |||
struct ast_cli_args * | a | |||
) | [static] |
Definition at line 741 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.
00742 { 00743 char *res = CLI_SUCCESS; 00744 00745 switch (cmd) { 00746 case CLI_INIT: 00747 e->command = "console hangup"; 00748 e->usage = 00749 "Usage: console hangup\n" 00750 " Hangs up any call currently placed on the console.\n"; 00751 return NULL; 00752 case CLI_GENERATE: 00753 return NULL; 00754 } 00755 00756 00757 if (a->argc != 2) 00758 return CLI_SHOWUSAGE; 00759 00760 ast_mutex_lock(&alsalock); 00761 00762 if (!alsa.owner && !hookstate) { 00763 ast_cli(a->fd, "No call to hangup\n"); 00764 res = CLI_FAILURE; 00765 } else { 00766 hookstate = 0; 00767 grab_owner(); 00768 if (alsa.owner) { 00769 ast_queue_hangup_with_cause(alsa.owner, AST_CAUSE_NORMAL_CLEARING); 00770 ast_channel_unlock(alsa.owner); 00771 } 00772 } 00773 00774 ast_mutex_unlock(&alsalock); 00775 00776 return res; 00777 }
static char* console_sendtext | ( | struct ast_cli_entry * | e, | |
int | cmd, | |||
struct ast_cli_args * | a | |||
) | [static] |
Definition at line 688 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.
00689 { 00690 int tmparg = 3; 00691 char *res = CLI_SUCCESS; 00692 00693 switch (cmd) { 00694 case CLI_INIT: 00695 e->command = "console send text"; 00696 e->usage = 00697 "Usage: console send text <message>\n" 00698 " Sends a text message for display on the remote terminal.\n"; 00699 return NULL; 00700 case CLI_GENERATE: 00701 return NULL; 00702 } 00703 00704 if (a->argc < 3) 00705 return CLI_SHOWUSAGE; 00706 00707 ast_mutex_lock(&alsalock); 00708 00709 if (!alsa.owner) { 00710 ast_cli(a->fd, "No channel active\n"); 00711 res = CLI_FAILURE; 00712 } else { 00713 struct ast_frame f = { AST_FRAME_TEXT, 0 }; 00714 char text2send[256] = ""; 00715 00716 while (tmparg < a->argc) { 00717 strncat(text2send, a->argv[tmparg++], sizeof(text2send) - strlen(text2send) - 1); 00718 strncat(text2send, " ", sizeof(text2send) - strlen(text2send) - 1); 00719 } 00720 00721 text2send[strlen(text2send) - 1] = '\n'; 00722 f.data.ptr = text2send; 00723 f.datalen = strlen(text2send) + 1; 00724 grab_owner(); 00725 if (alsa.owner) { 00726 ast_queue_frame(alsa.owner, &f); 00727 f.frametype = AST_FRAME_CONTROL; 00728 f.subclass = AST_CONTROL_ANSWER; 00729 f.data.ptr = NULL; 00730 f.datalen = 0; 00731 ast_queue_frame(alsa.owner, &f); 00732 ast_channel_unlock(alsa.owner); 00733 } 00734 } 00735 00736 ast_mutex_unlock(&alsalock); 00737 00738 return res; 00739 }
static void grab_owner | ( | void | ) | [static] |
Definition at line 299 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().
00300 { 00301 while (alsa.owner && ast_channel_trylock(alsa.owner)) { 00302 DEADLOCK_AVOIDANCE(&alsalock); 00303 } 00304 }
static int load_module | ( | void | ) | [static] |
Definition at line 852 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.
00853 { 00854 struct ast_config *cfg; 00855 struct ast_variable *v; 00856 struct ast_flags config_flags = { 0 }; 00857 00858 /* Copy the default jb config over global_jbconf */ 00859 memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf)); 00860 00861 strcpy(mohinterpret, "default"); 00862 00863 if (!(cfg = ast_config_load(config, config_flags))) { 00864 ast_log(LOG_ERROR, "Unable to read ALSA configuration file %s. Aborting.\n", config); 00865 return AST_MODULE_LOAD_DECLINE; 00866 } 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 267 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().
00268 { 00269 alsa.icard = alsa_card_init(indevname, SND_PCM_STREAM_CAPTURE); 00270 alsa.ocard = alsa_card_init(outdevname, SND_PCM_STREAM_PLAYBACK); 00271 00272 if (!alsa.icard || !alsa.ocard) { 00273 ast_log(LOG_ERROR, "Problem opening ALSA I/O devices\n"); 00274 return -1; 00275 } 00276 00277 return readdev; 00278 }
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 }
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] |
struct ast_channel_tech alsa_tech [static] |
Definition at line 145 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 100 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 132 of file chan_alsa.c.
struct ast_cli_entry cli_alsa[] [static] |
const char config[] = "alsa.conf" [static] |
Definition at line 103 of file chan_alsa.c.
char context[AST_MAX_CONTEXT] = "default" [static] |
Definition at line 105 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 107 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(), pickup_exec(), pp_each_extension_exec(), readexten_exec(), register_verify(), rpt_exec(), set_pvt_defaults(), socket_process(), ss_thread(), store_config_core(), transmit_notify_with_mwi(), transmit_register(), update_scoreboard(), user_destructor(), and waitstream_core().
snd_pcm_format_t format = SND_PCM_FORMAT_S16_BE [static] |
Definition at line 91 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_a_audio(), 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 68 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 110 of file chan_alsa.c.
char indevname[50] = ALSA_INDEV [static] |
Definition at line 94 of file chan_alsa.c.
char language[MAX_LANGUAGE] = "" [static] |
Definition at line 106 of file chan_alsa.c.
Referenced by __ast_channel_alloc_ap(), agent_new(), ast_do_masquerade(), begin_dial_channel(), build_gateway(), check_peer_ok(), console_new(), create_addr_from_peer(), dahdi_new(), findmeexec(), 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 108 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 95 of file chan_alsa.c.
int readdev = -1 [static] |
Definition at line 129 of file chan_alsa.c.
int silencesuppression = 0 [static] |
Definition at line 97 of file chan_alsa.c.
int silencethreshold = 1000 [static] |
Definition at line 98 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 102 of file chan_alsa.c.
int writedev = -1 [static] |
Definition at line 130 of file chan_alsa.c.