54 static char *
orig_app(
int fd,
const char *chan,
const char *
app,
const char *appdata)
65 chantech =
strsep(&chandata,
"/");
67 ast_cli(fd,
"*** No data provided after channel type! ***\n");
71 ast_pbx_outgoing_app(chantech,
AST_FORMAT_SLINEAR, chandata,
TIMEOUT * 1000, app, appdata, &reason, 0, NULL, NULL, NULL, NULL, NULL);
84 static char *
orig_exten(
int fd,
const char *chan,
const char *data)
94 chantech =
strsep(&chandata,
"/");
96 ast_cli(fd,
"*** No data provided after channel type! ***\n");
102 exten =
strsep(&context,
"@");
110 ast_pbx_outgoing_exten(chantech,
AST_FORMAT_SLINEAR, chandata,
TIMEOUT * 1000, context, exten, 1, &reason, 0, NULL, NULL, NULL, NULL, NULL);
124 static const char *
const choices[] = {
"application",
"extension", NULL };
128 e->
command =
"channel originate";
130 " There are two ways to use this command. A call can be originated between a\n"
131 "channel and a specific application, or between a channel and an extension in\n"
132 "the dialplan. This is similar to call files or the manager originate action.\n"
133 "Calls originated with this command are given a timeout of 30 seconds.\n\n"
135 "Usage1: channel originate <tech/data> application <appname> [appdata]\n"
136 " This will originate a call between the specified channel tech/data and the\n"
137 "given application. Arguments to the application are optional. If the given\n"
138 "arguments to the application include spaces, all of the arguments to the\n"
139 "application need to be placed in quotation marks.\n\n"
141 "Usage2: channel originate <tech/data> extension [exten@][context]\n"
142 " This will originate a call between the specified channel tech/data and the\n"
143 "given extension. If no context is specified, the 'default' context will be\n"
144 "used. If no extension is given, the 's' extension will be used.\n";
151 }
else if (a->
pos == 4) {
152 if (!strcasecmp(
"application", a->
argv[3])) {
166 if (!strcasecmp(
"application", a->
argv[3])) {
168 }
else if (!strcasecmp(
"extension", a->
argv[3])) {
181 const char *
name, *dest;
187 e->
command =
"channel redirect";
189 "Usage: channel redirect <channel> <[[context,]exten,]priority>\n"
190 " Redirect an active channel to a specified extension.\n";
209 ast_cli(a->
fd,
"Channel '%s' not found\n", name);
218 ast_cli(a->
fd,
"Channel '%s' successfully redirected to %s\n", name, dest);
220 ast_cli(a->
fd,
"Channel '%s' failed to be redirected to %s\n", name, dest);
static char exten[AST_MAX_EXTENSION]
Main Channel structure associated with a channel.
#define AST_CLI_DEFINE(fn, txt,...)
#define AST_MODULE_INFO_STANDARD(keystr, desc)
Asterisk main include file. File version handling, generic pbx functions.
void ast_module_unref(struct ast_module *)
char * strsep(char **str, const char *delims)
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
#define ast_channel_unref(c)
Decrease channel reference count.
descriptor for a cli entry.
char * ast_complete_applications(const char *line, const char *word, int state)
Command completion for the list of installed applications.
static int unload_module(void)
static struct ast_cli_entry cli_cliorig[]
static char * orig_app(int fd, const char *chan, const char *app, const char *appdata)
orginate a call from the CLI
void ast_cli(int fd, const char *fmt,...)
int args
This gets set in ast_cli_register()
char * ast_cli_complete(const char *word, const char *const choices[], int pos)
General Asterisk PBX channel definitions.
static char * handle_orig(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
handle for orgination app or exten.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Asterisk internal frame definitions.
static char * orig_exten(int fd, const char *chan, const char *data)
orginate from extension
Core PBX routines and definitions.
#define ast_strdupa(s)
duplicate a string in memory from the stack
int ast_pbx_outgoing_exten(const char *type, format_t format, void *data, int timeout, const char *context, const char *exten, int priority, int *reason, int sync, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **locked_channel)
static int load_module(void)
int ast_async_parseable_goto(struct ast_channel *chan, const char *goto_string)
#define AST_FORMAT_SLINEAR
Standard Command Line Interface.
int ast_cli_register_multiple(struct ast_cli_entry *e, int len)
Register multiple commands.
static char * handle_redirect(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
char * ast_complete_channels(const char *line, const char *word, int pos, int state, int rpos)
Command completion for the list of active channels.
static char context[AST_MAX_CONTEXT]
int ast_pbx_outgoing_app(const char *type, format_t format, void *data, int timeout, const char *app, const char *appdata, int *reason, int sync, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **locked_channel)
#define ASTERISK_GPL_KEY
The text the key() function should return.
struct ast_channel * ast_channel_get_by_name(const char *name)
Find a channel by name.
Asterisk module definitions.
#define ASTERISK_FILE_VERSION(file, version)
Register/unregister a source code file with the core.
struct ast_module * ast_module_ref(struct ast_module *)