Asterisk - The Open Source Telephony Project  21.4.1
Data Structures | Functions | Variables
app_playback.c File Reference

Trivial application to playback a sound file. More...

#include "asterisk.h"
#include "asterisk/file.h"
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "asterisk/app.h"
#include "asterisk/say.h"
#include "asterisk/cli.h"

Go to the source code of this file.

Data Structures

struct  say_args_t
 Typical 'say' arguments in addition to the date or number or string to say. We do not include 'options' because they may be different in recursive calls, and so they are better left as an external parameter. More...
 

Functions

static void __reg_module (void)
 
static char * __say_cli_init (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 
static void __unreg_module (void)
 
struct ast_moduleAST_MODULE_SELF_SYM (void)
 
static int do_say (say_args_t *a, const char *s, const char *options, int depth)
 the string is 'prefix:data' or prefix:fmt:data' with ':' being invalid in strings.
 
static int load_module (void)
 
static int playback_exec (struct ast_channel *chan, const char *data)
 
static int reload (void)
 
static void restore_say_mode (void *arg)
 
static int s_streamwait3 (const say_args_t *a, const char *fn)
 
static void save_say_mode (const void *arg)
 
static int say_date (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 
static int say_date_generic (struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *timezonename, const char *prefix)
 
static int say_date_with_format (struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *timezonename)
 
static int say_datetime (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 
static int say_enumeration_full (struct ast_channel *chan, int num, const char *ints, const char *lang, const char *options, int audiofd, int ctrlfd)
 
static int say_full (struct ast_channel *chan, const char *string, const char *ints, const char *lang, const char *options, int audiofd, int ctrlfd)
 
static int say_init_mode (const char *mode)
 remap the 'say' functions to use those in this file
 
static int say_number_full (struct ast_channel *chan, int num, const char *ints, const char *lang, const char *options, int audiofd, int ctrlfd)
 
static int say_time (struct ast_channel *chan, time_t t, const char *ints, const char *lang)
 
static int unload_module (void)
 

Variables

static struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "Sound File Playback Application" , .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 = "da6642af068ee5e6490c5b1d2cc1d238" , .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .reload = reload, }
 
static char * app = "Playback"
 
static const struct ast_module_infoast_module_info = &__mod_info
 
static struct ast_cli_entry cli_playback []
 
static const void * say_api_buf [40]
 save the say' api calls. The first entry is NULL if we have the standard source, otherwise we are sourcing from here. 'say load [new|old]' will enable the new or old method, or report status
 
static struct ast_configsay_cfg = NULL
 
static const char *const say_new = "new"
 
static const char *const say_old = "old"
 

Detailed Description

Trivial application to playback a sound file.

Author
Mark Spencer marks.nosp@m.ter@.nosp@m.digiu.nosp@m.m.co.nosp@m.m

Definition in file app_playback.c.

Function Documentation

static int reload ( void  )
static
Todo:
XXX here we should sort rules according to the same order we have in pbx.c so we have the same matching behaviour.

Definition at line 531 of file app_playback.c.

References ast_config_destroy(), ast_config_load, ast_extension_match(), CONFIG_FLAG_FILEUNCHANGED, ast_variable::name, ast_variable::next, say_init_mode(), and ast_variable::value.

532 {
533  struct ast_variable *v;
534  struct ast_flags config_flags = { CONFIG_FLAG_FILEUNCHANGED };
535  struct ast_config *newcfg;
536 
537  if ((newcfg = ast_config_load("say.conf", config_flags)) == CONFIG_STATUS_FILEUNCHANGED) {
538  return 0;
539  } else if (newcfg == CONFIG_STATUS_FILEINVALID) {
540  ast_log(LOG_ERROR, "Config file say.conf is in an invalid format. Aborting.\n");
541  return 0;
542  }
543 
544  if (say_cfg) {
545  ast_config_destroy(say_cfg);
546  ast_log(LOG_NOTICE, "Reloading say.conf\n");
547  }
548  say_cfg = newcfg;
549 
550  if (say_cfg) {
551  for (v = ast_variable_browse(say_cfg, "general"); v ; v = v->next) {
552  if (ast_extension_match(v->name, "mode")) {
553  say_init_mode(v->value);
554  break;
555  }
556  }
557  }
558 
559  /*! \todo
560  * XXX here we should sort rules according to the same order
561  * we have in pbx.c so we have the same matching behaviour.
562  */
563  return 0;
564 }
struct ast_variable * next
Structure for variables, used for configurations and for channel variables.
#define ast_config_load(filename, flags)
Load a config file.
int ast_extension_match(const char *pattern, const char *extension)
Determine if a given extension matches a given pattern (in NXX format)
Definition: extconf.c:4295
Structure used to handle boolean flags.
Definition: utils.h:199
void ast_config_destroy(struct ast_config *cfg)
Destroys a config.
Definition: extconf.c:1289
static int say_init_mode(const char *mode)
remap the 'say' functions to use those in this file
Definition: app_playback.c:382

Variable Documentation

char* app = "Playback"
static

< provides config-file based 'say' functions

Definition at line 107 of file app_playback.c.

struct ast_cli_entry cli_playback[]
static
Initial value:
= {
{ .handler = __say_cli_init , .summary = "Set or show the say mode" ,},
}

Definition at line 451 of file app_playback.c.