58 e->
command =
"dialplan exec application";
60 "Usage: dialplan exec application <appname> [<args>]\n"
61 " Execute a single dialplan application call for\n"
62 " testing. A mock channel is used to execute\n"
63 " the application, so it may not make\n"
64 " sense to use all applications, and only\n"
65 " global variables should be used.\n"
66 " The ulaw, alaw, and h264 codecs are available.\n";
72 if (
a->argc != e->
args + 1 &&
a->argc != e->
args + 2) {
77 app_args =
a->argc == e->
args + 2 ? (
char *)
a->argv[4] :
NULL;
90 ast_log(
LOG_WARNING,
"Failed to append a ulaw format to capabilities for channel nativeformats\n");
95 ast_log(
LOG_WARNING,
"Failed to append an alaw format to capabilities for channel nativeformats\n");
100 ast_log(
LOG_WARNING,
"Failed to append an h264 format to capabilities for channel nativeformats\n");
104 c =
ast_channel_alloc(0,
AST_STATE_DOWN,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL, 0,
"CLIExec/%d", ++
cli_chan);
106 ast_cli(
a->fd,
"Unable to allocate mock channel for application execution.\n");
125 if (substituted_args) {
139 ast_cli(
a->fd,
"Return Value: %s (%d)\n", ret ?
"Failure" :
"Success", ret);
Asterisk main include file. File version handling, generic pbx functions.
General Asterisk PBX channel definitions.
void ast_hangup(struct ast_channel *chan)
Hang up a channel.
#define ast_channel_alloc(needqueue, state, cid_num, cid_name, acctcode, exten, context, assignedids, requestor, amaflag,...)
Create a channel structure.
void ast_channel_nativeformats_set(struct ast_channel *chan, struct ast_format_cap *value)
void ast_channel_set_rawreadformat(struct ast_channel *chan, struct ast_format *format)
void ast_channel_set_rawwriteformat(struct ast_channel *chan, struct ast_format *format)
void ast_channel_set_readformat(struct ast_channel *chan, struct ast_format *format)
void ast_channel_tech_set(struct ast_channel *chan, const struct ast_channel_tech *value)
#define ast_channel_unlock(chan)
void ast_channel_set_writeformat(struct ast_channel *chan, struct ast_format *format)
Standard Command Line Interface.
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
#define AST_CLI_DEFINE(fn, txt,...)
void ast_cli(int fd, const char *fmt,...)
#define ast_cli_register_multiple(e, len)
Register multiple commands.
Asterisk internal frame definitions.
Asterisk module definitions.
#define ASTERISK_GPL_KEY
The text the key() function should return.
@ AST_MODULE_LOAD_SUCCESS
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
Core PBX routines and definitions.
void ast_str_substitute_variables(struct ast_str **buf, ssize_t maxlen, struct ast_channel *chan, const char *templ)
int pbx_exec(struct ast_channel *c, struct ast_app *app, const char *data)
Execute an application.
struct ast_app * pbx_findapp(const char *app)
Look up an application.
const char * app_name(struct ast_app *app)
static char * handle_exec(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
CLI support for executing application.
AST_MODULE_INFO_STANDARD_EXTENDED(ASTERISK_GPL_KEY, "Simple dialplan execution from the CLI")
static struct ast_cli_entry cli_cliorig[]
static const struct ast_channel_tech mock_channel_tech
static int load_module(void)
static int unload_module(void)
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
#define ast_str_create(init_len)
Create a malloc'ed dynamic length string.
ast_app: A registered application
Structure to describe a channel "technology", ie a channel driver See for examples:
Main Channel structure associated with a channel.
descriptor for a cli entry.
int args
This gets set in ast_cli_register()
Support for dynamic strings.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.