Codename Pineapple

Home page | Mailing list | Docs

Last updated: Sat Feb 3 05:01:11 2007

Asterisk developer's documentation :: Codename Pineapple


chan_oss.c File Reference


Detailed Description

Channel driver for OSS sound cards.

Author:
Mark Spencer <markster@digium.com>

Luigi Rizzo

See also

Definition in file chan_oss.c.

#include "asterisk.h"
#include <stdio.h>
#include <ctype.h>
#include <math.h>
#include <string.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <sys/time.h>
#include <stdlib.h>
#include <errno.h>
#include <soundcard.h>
#include "asterisk/lock.h"
#include "asterisk/frame.h"
#include "asterisk/logger.h"
#include "asterisk/callerid.h"
#include "asterisk/channel.h"
#include "asterisk/module.h"
#include "asterisk/options.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/app.h"
#include "busy.h"
#include "ringtone.h"
#include "ring10.h"
#include "answer.h"

Include dependency graph for chan_oss.c:

Go to the source code of this file.

Data Structures

struct  chan_oss_pvt
 descriptor for one of our channels. More...
struct  sound

Defines

#define BOOST_MAX   40
#define BOOST_SCALE   (1<<9)
#define DEV_DSP   "/dev/dsp"
#define FRAGS   ( ( (6 * 5) << 16 ) | 0x6 )
#define FRAME_SIZE   160
#define M_BOOL(tag, dst)   M_F(tag, (dst) = ast_true(__val) )
#define M_END(x)   x;
#define M_F(tag, f)   if (!strcasecmp((__s), tag)) { f; } else
#define M_START(var, val)   char *__s = var; char *__val = val;
#define M_STR(tag, dst)   M_F(tag, ast_copy_string(dst, __val, sizeof(dst)))
#define M_UINT(tag, dst)   M_F(tag, (dst) = strtoul(__val, NULL, 0) )
#define MAX(a, b)   ((a) > (b) ? (a) : (b))
#define MIN(a, b)   ((a) < (b) ? (a) : (b))
#define O_CLOSE   0x444
#define QUEUE_SIZE   10
#define TEXT_SIZE   256
#define WARN_frag   4
#define WARN_speed   2
#define WARN_used_blocks   1

Functions

static char * ast_ext_ctx (const char *src, char **ext, char **ctx)
 AST_MODULE_INFO_STANDARD (ASTERISK_GPL_KEY,"OSS Console Channel Driver")
static int console_active (int fd, int argc, char *argv[])
static char * console_answer (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 answer command from the console
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_flash (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_mute (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)
 Console send text CLI command.
static int console_transfer (int fd, int argc, char *argv[])
static int do_boost (int fd, int argc, char *argv[])
static struct chan_oss_pvtfind_desc (char *dev)
 returns a pointer to the descriptor with the given name
static int load_module (void)
static int oss_answer (struct ast_channel *c)
 remote side answered the phone
static int oss_call (struct ast_channel *c, char *dest, int timeout)
 handler for incoming calls. Either autoanswer, or start ringing
static int oss_digit_begin (struct ast_channel *c, char digit)
static int oss_digit_end (struct ast_channel *c, char digit, unsigned int duration)
static int oss_fixup (struct ast_channel *oldchan, struct ast_channel *newchan)
static int oss_hangup (struct ast_channel *c)
static int oss_indicate (struct ast_channel *chan, int cond, const void *data, size_t datalen)
static struct ast_channeloss_new (struct chan_oss_pvt *o, char *ext, char *ctx, int state)
 allocate a new channel.
static struct ast_frameoss_read (struct ast_channel *chan)
static struct ast_channeloss_request (const char *type, int format, void *data, int *cause)
static int oss_text (struct ast_channel *c, const char *text)
static int oss_write (struct ast_channel *c, struct ast_frame *f)
 used for data coming from the network
static void ring (struct chan_oss_pvt *o, int x)
 Play ringtone 'x' on device 'o'.
static void send_sound (struct chan_oss_pvt *o)
 Handler for 'sound writable' events from the sound thread.
static int setformat (struct chan_oss_pvt *o, int mode)
static void * sound_thread (void *arg)
static int soundcard_writeframe (struct chan_oss_pvt *o, short *data)
static void store_boost (struct chan_oss_pvt *o, char *s)
 store the boost factor
static void store_callerid (struct chan_oss_pvt *o, char *s)
static struct chan_oss_pvtstore_config (struct ast_config *cfg, char *ctg)
static void store_mixer (struct chan_oss_pvt *o, char *s)
static int unload_module (void)
static int used_blocks (struct chan_oss_pvt *o)
 Returns the number of blocks used in the audio output channel.

Variables

static const char active_usage []
static struct ast_cli_entry cli_oss []
static char * config = "oss.conf"
static struct ast_jb_conf default_jbconf
static struct ast_jb_conf global_jbconf
static char * oss_active
static int oss_debug
static struct chan_oss_pvt oss_default
static const struct ast_channel_tech oss_tech
static struct sound sounds []
static char tdesc [] = "OSS Console Channel Driver"
static const char transfer_usage []


Define Documentation

#define BOOST_MAX   40
 

slightly less than 7 bits

Definition at line 362 of file chan_oss.c.

Referenced by store_boost().

#define BOOST_SCALE   (1<<9)
 

boost support. BOOST_SCALE * 10 ^(BOOST_MAX/20) must be representable in 16 bits to avoid overflows.

Definition at line 361 of file chan_oss.c.

Referenced by do_boost(), oss_read(), and store_boost().

#define DEV_DSP   "/dev/dsp"
 

Definition at line 275 of file chan_oss.c.

#define FRAGS   ( ( (6 * 5) << 16 ) | 0x6 )
 

Definition at line 258 of file chan_oss.c.

#define FRAME_SIZE   160
 

Definition at line 252 of file chan_oss.c.

#define M_BOOL tag,
dst   )     M_F(tag, (dst) = ast_true(__val) )
 

Definition at line 218 of file chan_oss.c.

Referenced by store_config().

#define M_END  )     x;
 

Definition at line 216 of file chan_oss.c.

Referenced by store_config().

#define M_F tag,
 )     if (!strcasecmp((__s), tag)) { f; } else
 

Definition at line 217 of file chan_oss.c.

Referenced by store_config().

#define M_START var,
val   )     char *__s = var; char *__val = val;
 

Definition at line 214 of file chan_oss.c.

Referenced by store_config().

#define M_STR tag,
dst   )     M_F(tag, ast_copy_string(dst, __val, sizeof(dst)))
 

Definition at line 220 of file chan_oss.c.

Referenced by store_config().

#define M_UINT tag,
dst   )     M_F(tag, (dst) = strtoul(__val, NULL, 0) )
 

Definition at line 219 of file chan_oss.c.

Referenced by store_config().

#define MAX a,
 )     ((a) > (b) ? (a) : (b))
 

Definition at line 282 of file chan_oss.c.

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

Definition at line 279 of file chan_oss.c.

#define O_CLOSE   0x444
 

Definition at line 270 of file chan_oss.c.

Referenced by console_hangup(), oss_hangup(), setformat(), and sound_thread().

#define QUEUE_SIZE   10
 

Definition at line 253 of file chan_oss.c.

#define TEXT_SIZE   256
 

Definition at line 265 of file chan_oss.c.

Referenced by console_sendtext().

#define WARN_frag   4
 

Definition at line 351 of file chan_oss.c.

Referenced by setformat().

#define WARN_speed   2
 

Definition at line 350 of file chan_oss.c.

Referenced by setformat().

#define WARN_used_blocks   1
 

Definition at line 349 of file chan_oss.c.

Referenced by used_blocks().


Function Documentation

static char* ast_ext_ctx const char *  src,
char **  ext,
char **  ctx
[static]
 

Definition at line 466 of file chan_oss.c.

References ast_strdup, find_desc(), and chan_oss_pvt::overridecontext.

Referenced by console_transfer().

00467 {
00468    struct chan_oss_pvt *o = find_desc(oss_active);
00469 
00470    if (ext == NULL || ctx == NULL)
00471       return NULL;         /* error */
00472 
00473    *ext = *ctx = NULL;
00474 
00475    if (src && *src != '\0')
00476       *ext = ast_strdup(src);
00477 
00478    if (*ext == NULL)
00479       return NULL;
00480 
00481    if (!o->overridecontext) {
00482       /* parse from the right */
00483       *ctx = strrchr(*ext, '@');
00484       if (*ctx)
00485          *(*ctx)++ = '\0';
00486    }
00487 
00488    return *ext;
00489 }

AST_MODULE_INFO_STANDARD ASTERISK_GPL_KEY  ,
"OSS Console Channel Driver" 
 

static int console_active int  fd,
int  argc,
char *  argv[]
[static]
 

Definition at line 1378 of file chan_oss.c.

References ast_cli(), find_desc(), chan_oss_pvt::name, chan_oss_pvt::next, oss_default, RESULT_SHOWUSAGE, and RESULT_SUCCESS.

01379 {
01380    if (argc == 2)
01381       ast_cli(fd, "active console is [%s]\n", oss_active);
01382    else if (argc != 3)
01383       return RESULT_SHOWUSAGE;
01384    else {
01385       struct chan_oss_pvt *o;
01386       if (strcmp(argv[2], "show") == 0) {
01387          for (o = oss_default.next; o; o = o->next)
01388             ast_cli(fd, "device [%s] exists\n", o->name);
01389          return RESULT_SUCCESS;
01390       }
01391       o = find_desc(argv[2]);
01392       if (o == NULL)
01393          ast_cli(fd, "No device [%s] exists\n", argv[2]);
01394       else
01395          oss_active = o->name;
01396    }
01397    return RESULT_SUCCESS;
01398 }

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

answer command from the console

Definition at line 1142 of file chan_oss.c.

References ast_cli_args::argc, ast_cli_entry::args, ast_cli(), AST_CONTROL_ANSWER, AST_FRAME_CONTROL, ast_queue_frame(), CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, chan_oss_pvt::cursound, ast_cli_args::fd, find_desc(), chan_oss_pvt::hookstate, chan_oss_pvt::nosound, chan_oss_pvt::owner, and ast_cli_entry::usage.

01143 {
01144    struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_ANSWER };
01145    struct chan_oss_pvt *o = find_desc(oss_active);
01146 
01147    switch (cmd) {
01148    case CLI_INIT:
01149       e->command = "console answer";
01150       e->usage =
01151          "Usage: console answer\n"
01152          "       Answers an incoming call on the console (OSS) channel.\n";
01153       return NULL;
01154 
01155    case CLI_GENERATE:
01156       return NULL;   /* no completion */
01157    }
01158    if (a->argc != e->args)
01159       return CLI_SHOWUSAGE;
01160    if (!o->owner) {
01161       ast_cli(a->fd, "No one is calling us\n");
01162       return CLI_FAILURE;
01163    }
01164    o->hookstate = 1;
01165    o->cursound = -1;
01166    o->nosound = 0;
01167    ast_queue_frame(o->owner, &f);
01168    return CLI_SUCCESS;
01169 }

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

Definition at line 1101 of file chan_oss.c.

References ast_cli_args::argc, ast_cli_entry::args, ast_cli_args::argv, ast_cli(), ast_log(), chan_oss_pvt::autoanswer, CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, find_desc(), LOG_WARNING, and ast_cli_entry::usage.

01102 {
01103    struct chan_oss_pvt *o = find_desc(oss_active);
01104 
01105    switch (cmd) {
01106    case CLI_INIT:
01107       e->command = "console autoanswer [on|off]";
01108       e->usage =
01109          "Usage: console autoanswer [on|off]\n"
01110          "       Enables or disables autoanswer feature.  If used without\n"
01111          "       argument, displays the current on/off status of autoanswer.\n"
01112          "       The default value of autoanswer is in 'oss.conf'.\n";
01113       return NULL;
01114 
01115    case CLI_GENERATE:
01116       return NULL;
01117    }
01118 
01119    if (a->argc == e->args - 1) {
01120       ast_cli(a->fd, "Auto answer is %s.\n", o->autoanswer ? "on" : "off");
01121       return CLI_SUCCESS;
01122    }
01123    if (a->argc != e->args)
01124       return CLI_SHOWUSAGE;
01125    if (o == NULL) {
01126       ast_log(LOG_WARNING, "Cannot find device %s (should not happen!)\n",
01127           oss_active);
01128       return CLI_FAILURE;
01129    }
01130    if (!strcasecmp(a->argv[e->args-1], "on"))
01131       o->autoanswer = 1;
01132    else if (!strcasecmp(a->argv[e->args - 1], "off"))
01133       o->autoanswer = 0;
01134    else
01135       return CLI_SHOWUSAGE;
01136    return CLI_SUCCESS;
01137 }

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

Definition at line 1267 of file chan_oss.c.

References ast_cli_args::argc, ast_cli_entry::args, ast_cli_args::argv, ast_cli(), AST_FRAME_DTMF, ast_queue_frame(), CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, find_desc(), chan_oss_pvt::owner, s, ast_frame::subclass, and ast_cli_entry::usage.

01268 {
01269    char *s = NULL, *mye = NULL, *myc = NULL;
01270    struct chan_oss_pvt *o = find_desc(oss_active);
01271 
01272    if (cmd == CLI_INIT) {
01273       e->command = "console dial";
01274       e->usage =
01275          "Usage: console dial [extension[@context]]\n"
01276          "       Dials a given extension (and context if specified)\n";
01277       return NULL;
01278    } else if (cmd == CLI_GENERATE)
01279       return NULL;
01280 
01281    if (a->argc > e->args + 1)
01282       return CLI_SHOWUSAGE;
01283    if (o->owner) {   /* already in a call */
01284       int i;
01285       struct ast_frame f = { AST_FRAME_DTMF, 0 };
01286 
01287       if (a->argc == e->args) {  /* argument is mandatory here */
01288          ast_cli(a->fd, "Already in a call. You can only dial digits until you hangup.\n");
01289          return CLI_FAILURE;
01290       }
01291       s = a->argv[e->args];
01292       /* send the string one char at a time */
01293       for (i = 0; i < strlen(s); i++) {
01294          f.subclass = s[i];
01295          ast_queue_frame(o->owner, &f);
01296       }
01297       return CLI_SUCCESS;
01298    }
01299    /* if we have an argument split it into extension and context */
01300    if (a->argc == e->args + 1)
01301       s = ast_ext_ctx(a->argv[e->args], &mye, &myc);
01302    /* supply default values if needed */
01303    if (mye == NULL)
01304       mye = o->ext;
01305    if (myc == NULL)
01306       myc = o->ctx;
01307    if (ast_exists_extension(NULL, myc, mye, 1, NULL)) {
01308       o->hookstate = 1;
01309       oss_new(o, mye, myc, AST_STATE_RINGING);
01310    } else
01311       ast_cli(a->fd, "No such extension '%s' in context '%s'\n", mye, myc);
01312    if (s)
01313       free(s);
01314    return CLI_SUCCESS;
01315 }

static char* console_flash struct ast_cli_entry e,
int  cmd,
struct ast_cli_args a
[static]
 

Definition at line 1239 of file chan_oss.c.

References ast_cli_args::argc, ast_cli_entry::args, ast_cli(), AST_CONTROL_FLASH, AST_FRAME_CONTROL, ast_queue_frame(), CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, chan_oss_pvt::cursound, ast_cli_args::fd, find_desc(), chan_oss_pvt::hookstate, chan_oss_pvt::nosound, chan_oss_pvt::owner, and ast_cli_entry::usage.

01240 {
01241    struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_FLASH };
01242    struct chan_oss_pvt *o = find_desc(oss_active);
01243 
01244    if (cmd == CLI_INIT) {
01245       e->command = "console flash";
01246       e->usage =
01247          "Usage: console flash\n"
01248          "       Flashes the call currently placed on the console.\n";
01249       return NULL;
01250    } else if (cmd == CLI_GENERATE)
01251       return NULL;
01252 
01253    if (a->argc != e->args)
01254       return CLI_SHOWUSAGE;
01255    o->cursound = -1;
01256    o->nosound = 0;            /* when cursound is -1 nosound must be 0 */
01257    if (!o->owner) {        /* XXX maybe !o->hookstate too ? */
01258       ast_cli(a->fd, "No call to flash\n");
01259       return CLI_FAILURE;
01260    }
01261    o->hookstate = 0;
01262    if (o->owner)           /* XXX must be true, right ? */
01263       ast_queue_frame(o->owner, &f);
01264    return CLI_SUCCESS;
01265 }

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

Definition at line 1211 of file chan_oss.c.

References ast_cli_args::argc, ast_cli_entry::args, ast_cli(), ast_queue_hangup(), CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, chan_oss_pvt::cursound, ast_cli_args::fd, find_desc(), chan_oss_pvt::hookstate, chan_oss_pvt::nosound, O_CLOSE, chan_oss_pvt::owner, setformat(), and ast_cli_entry::usage.

01212 {
01213    struct chan_oss_pvt *o = find_desc(oss_active);
01214 
01215    if (cmd == CLI_INIT) {
01216       e->command = "console hangup";
01217       e->usage =
01218          "Usage: console hangup\n"
01219          "       Hangs up any call currently placed on the console.\n";
01220       return NULL;
01221    } else if (cmd == CLI_GENERATE)
01222       return NULL;
01223 
01224    if (a->argc != e->args)
01225       return CLI_SHOWUSAGE;
01226    o->cursound = -1;
01227    o->nosound = 0;
01228    if (!o->owner && !o->hookstate) { /* XXX maybe only one ? */
01229       ast_cli(a->fd, "No call to hang up\n");
01230       return CLI_FAILURE;
01231    }
01232    o->hookstate = 0;
01233    if (o->owner)
01234       ast_queue_hangup(o->owner);
01235    setformat(o, O_CLOSE);
01236    return CLI_SUCCESS;
01237 }

static char* console_mute struct ast_cli_entry e,
int  cmd,
struct ast_cli_args a
[static]
 

Definition at line 1317 of file chan_oss.c.

References ast_cli_args::argc, ast_cli_entry::args, ast_cli_args::argv, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, find_desc(), chan_oss_pvt::mute, s, and ast_cli_entry::usage.

01318 {
01319    struct chan_oss_pvt *o = find_desc(oss_active);
01320    char *s;
01321    
01322    if (cmd == CLI_INIT) {
01323       e->command = "console {mute|unmute}";
01324       e->usage =
01325          "Usage: console {mute|unmute}\n"
01326          "       Mute/unmute the microphone.\n";
01327       return NULL;
01328    } else if (cmd == CLI_GENERATE)
01329       return NULL;
01330 
01331    if (a->argc != e->args)
01332       return CLI_SHOWUSAGE;
01333    s = a->argv[e->args-1];
01334    if (!strcasecmp(s, "mute"))
01335       o->mute = 1;
01336    else if (!strcasecmp(s, "unmute"))
01337       o->mute = 0;
01338    else
01339       return CLI_SHOWUSAGE;
01340    return CLI_SUCCESS;
01341 }

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

Console send text CLI command.

Note:
concatenate all arguments into a single string. argv is NULL-terminated so we can use it right away

Definition at line 1177 of file chan_oss.c.

References ast_cli_args::argc, ast_cli_entry::args, ast_cli_args::argv, ast_cli(), AST_FRAME_TEXT, ast_join(), ast_queue_frame(), ast_strlen_zero(), CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, ast_frame::data, ast_frame::datalen, ast_cli_args::fd, find_desc(), ast_frame::frametype, chan_oss_pvt::owner, ast_frame::subclass, TEXT_SIZE, and ast_cli_entry::usage.

01178 {
01179    struct chan_oss_pvt *o = find_desc(oss_active);
01180    char buf[TEXT_SIZE];
01181 
01182    if (cmd == CLI_INIT) {
01183       e->command = "console send text";
01184       e->usage =
01185          "Usage: console send text <message>\n"
01186          "       Sends a text message for display on the remote terminal.\n";
01187       return NULL;
01188    } else if (cmd == CLI_GENERATE)
01189       return NULL;
01190 
01191    if (a->argc < e->args + 1)
01192       return CLI_SHOWUSAGE;
01193    if (!o->owner) {
01194       ast_cli(a->fd, "Not in a call\n");
01195       return CLI_FAILURE;
01196    }
01197    ast_join(buf, sizeof(buf) - 1, a->argv + e->args);
01198    if (!ast_strlen_zero(buf)) {
01199       struct ast_frame f = { 0, };
01200       int i = strlen(buf);
01201       buf[i] = '\n';
01202       f.frametype = AST_FRAME_TEXT;
01203       f.subclass = 0;
01204       f.data = buf;
01205       f.datalen = i + 1;
01206       ast_queue_frame(o->owner, &f);
01207    }
01208    return CLI_SUCCESS;
01209 }

static int console_transfer int  fd,
int  argc,
char *  argv[]
[static]
 

Definition at line 1343 of file chan_oss.c.

References ast_async_goto(), ast_bridged_channel(), ast_cli(), ast_exists_extension(), ast_ext_ctx(), ast_channel::cid, ast_callerid::cid_num, ast_channel::context, ext, find_desc(), free, chan_oss_pvt::owner, RESULT_FAILURE, RESULT_SHOWUSAGE, and RESULT_SUCCESS.

01344 {
01345    struct chan_oss_pvt *o = find_desc(oss_active);
01346    struct ast_channel *b = NULL;
01347    char *tmp, *ext, *ctx;
01348 
01349    if (argc != 3)
01350       return RESULT_SHOWUSAGE;
01351    if (o == NULL)
01352       return RESULT_FAILURE;
01353    if (o->owner == NULL || (b = ast_bridged_channel(o->owner)) == NULL) {
01354       ast_cli(fd, "There is no call to transfer\n");
01355       return RESULT_SUCCESS;
01356    }
01357 
01358    tmp = ast_ext_ctx(argv[2], &ext, &ctx);
01359    if (ctx == NULL)        /* supply default context if needed */
01360       ctx = o->owner->context;
01361    if (!ast_exists_extension(b, ctx, ext, 1, b->cid.cid_num))
01362       ast_cli(fd, "No such extension exists\n");
01363    else {
01364       ast_cli(fd, "Whee, transferring %s to %s@%s.\n", b->name, ext, ctx);
01365       if (ast_async_goto(b, ctx, ext, 1))
01366          ast_cli(fd, "Failed to transfer :(\n");
01367    }
01368    if (tmp)
01369       free(tmp);
01370    return RESULT_SUCCESS;
01371 }

static int do_boost int  fd,
int  argc,
char *  argv[]
[static]
 

Definition at line 1428 of file chan_oss.c.

References ast_cli(), chan_oss_pvt::boost, BOOST_SCALE, find_desc(), RESULT_SUCCESS, and store_boost().

01429 {
01430    struct chan_oss_pvt *o = find_desc(oss_active);
01431 
01432    if (argc == 2)
01433       ast_cli(fd, "boost currently %5.1f\n", 20 * log10(((double) o->boost / (double) BOOST_SCALE)));
01434    else if (argc == 3)
01435       store_boost(o, argv[2]);
01436    return RESULT_SUCCESS;
01437 }

static struct chan_oss_pvt* find_desc char *  dev  )  [static]
 

returns a pointer to the descriptor with the given name

Definition at line 440 of file chan_oss.c.

References ast_log(), LOG_WARNING, chan_oss_pvt::name, chan_oss_pvt::next, and oss_default.

Referenced by ast_ext_ctx(), console_active(), console_answer(), console_autoanswer(), console_dial(), console_flash(), console_hangup(), console_mute(), console_sendtext(), console_transfer(), do_boost(), load_module(), and oss_request().

00441 {
00442    struct chan_oss_pvt *o = NULL;
00443 
00444    if (!dev)
00445       ast_log(LOG_WARNING, "null dev\n");
00446 
00447    for (o = oss_default.next; o && o->name && dev && strcmp(o->name, dev) != 0; o = o->next);
00448 
00449    if (!o)
00450       ast_log(LOG_WARNING, "could not find <%s>\n", dev ? dev : "--no-device--");
00451 
00452    return o;
00453 }

static int load_module void   )  [static]
 

Definition at line 1585 of file chan_oss.c.

References ast_category_browse(), ast_channel_register(), ast_cli_register_multiple(),