func_jitterbuffer.c File Reference

Put a jitterbuffer on the read side of a channel. More...

#include "asterisk.h"
#include "asterisk/module.h"
#include "asterisk/channel.h"
#include "asterisk/framehook.h"
#include "asterisk/frame.h"
#include "asterisk/pbx.h"
#include "asterisk/abstract_jb.h"
#include "asterisk/timing.h"
#include "asterisk/app.h"

Include dependency graph for func_jitterbuffer.c:

Go to the source code of this file.

Functions

static void __reg_module (void)
static void __unreg_module (void)
static int jb_helper (struct ast_channel *chan, const char *cmd, char *data, const char *value)
static int load_module (void)
static int unload_module (void)

Variables

static struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Jitter buffer for read side of channel." , .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 = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, .support_level = AST_MODULE_SUPPORT_CORE, }
static struct ast_module_infoast_module_info = &__mod_info
static struct ast_custom_function jb_function


Detailed Description

Put a jitterbuffer on the read side of a channel.

Author:
David Vossel <dvossel@digium.com>

Definition in file func_jitterbuffer.c.


Function Documentation

static void __reg_module ( void   )  [static]

Definition at line 183 of file func_jitterbuffer.c.

static void __unreg_module ( void   )  [static]

Definition at line 183 of file func_jitterbuffer.c.

static int jb_helper ( struct ast_channel chan,
const char *  cmd,
char *  data,
const char *  value 
) [static]

Definition at line 108 of file func_jitterbuffer.c.

References args, AST_APP_ARG, ast_copy_string(), AST_DECLARE_APP_ARGS, ast_jb_conf_default(), ast_jb_create_framehook(), ast_jb_read_conf(), ast_log, AST_STANDARD_APP_ARGS, ast_strdupa, ast_strlen_zero, ast_jb_conf::impl, LOG_WARNING, ast_jb_conf::max_size, parse(), ast_jb_conf::resync_threshold, and ast_jb_conf::target_extra.

00109 {
00110    struct ast_jb_conf jb_conf;
00111 
00112    if (!chan) {
00113       ast_log(LOG_WARNING, "No channel was provided to %s function.\n", cmd);
00114       return -1;
00115    }
00116 
00117    /* Initialize and set jb_conf */
00118    ast_jb_conf_default(&jb_conf);
00119 
00120    /* Now check user options to see if any of the defaults need to change. */
00121    if (!ast_strlen_zero(data)) {
00122       if (strcasecmp(data, "fixed") &&
00123             strcasecmp(data, "adaptive") &&
00124             strcasecmp(data, "disabled")) {
00125          ast_log(LOG_WARNING, "Unknown Jitterbuffer type %s. Failed to create jitterbuffer.\n", data);
00126          return -1;
00127       }
00128       ast_copy_string(jb_conf.impl, data, sizeof(jb_conf.impl));
00129    }
00130 
00131    if (!ast_strlen_zero(value) && strcasecmp(value, "default")) {
00132       char *parse = ast_strdupa(value);
00133       int res = 0;
00134       AST_DECLARE_APP_ARGS(args,
00135          AST_APP_ARG(max_size);
00136          AST_APP_ARG(resync_threshold);
00137          AST_APP_ARG(target_extra);
00138       );
00139 
00140       AST_STANDARD_APP_ARGS(args, parse);
00141       if (!ast_strlen_zero(args.max_size)) {
00142          res |= ast_jb_read_conf(&jb_conf,
00143             "jbmaxsize",
00144             args.max_size);
00145       }
00146       if (!ast_strlen_zero(args.resync_threshold)) {
00147          res |= ast_jb_read_conf(&jb_conf,
00148             "jbresyncthreshold",
00149             args.resync_threshold);
00150       }
00151       if (!ast_strlen_zero(args.target_extra)) {
00152          res |= ast_jb_read_conf(&jb_conf,
00153             "jbtargetextra",
00154             args.target_extra);
00155       }
00156       if (res) {
00157          ast_log(LOG_WARNING, "Invalid jitterbuffer parameters %s\n", value);
00158       }
00159    }
00160 
00161    ast_jb_create_framehook(chan, &jb_conf, 0);
00162 
00163    return 0;
00164 }

static int load_module ( void   )  [static]

static int unload_module ( void   )  [static]

Definition at line 172 of file func_jitterbuffer.c.

References ast_custom_function_unregister().

00173 {
00174    return ast_custom_function_unregister(&jb_function);
00175 }


Variable Documentation

struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Jitter buffer for read side of channel." , .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 = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, .support_level = AST_MODULE_SUPPORT_CORE, } [static]

Definition at line 183 of file func_jitterbuffer.c.

Definition at line 183 of file func_jitterbuffer.c.

Initial value:

 {
   .name = "JITTERBUFFER",
   .write = jb_helper,
}

Definition at line 167 of file func_jitterbuffer.c.


Generated on Thu Apr 16 06:31:19 2015 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6