53static 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");
91static char *
orig_exten(
int fd,
const char *chan,
const char *data)
102 chantech =
strsep(&chandata,
"/");
104 ast_cli(fd,
"*** No data provided after channel type! ***\n");
138 static const char *
const choices[] = {
"application",
"extension",
NULL };
142 e->
command =
"channel originate";
144 " There are two ways to use this command. A call can be originated between a\n"
145 "channel and a specific application, or between a channel and an extension in\n"
146 "the dialplan. This is similar to call files or the manager originate action.\n"
147 "Calls originated with this command are given a timeout of 30 seconds.\n\n"
149 "Usage1: channel originate <tech/data> application <appname> [appdata]\n"
150 " This will originate a call between the specified channel tech/data and the\n"
151 "given application. Arguments to the application are optional. If the given\n"
152 "arguments to the application include spaces, all of the arguments to the\n"
153 "application need to be placed in quotation marks.\n\n"
155 "Usage2: channel originate <tech/data> extension [exten@][context]\n"
156 " This will originate a call between the specified channel tech/data and the\n"
157 "given extension. If no context is specified, the 'default' context will be\n"
158 "used. If no extension is given, the 's' extension will be used.\n";
163 }
else if (
a->pos == 4) {
164 if (!strcasecmp(
"application",
a->argv[3])) {
174 if (!strcasecmp(
"application",
a->argv[3])) {
175 res =
orig_app(
a->fd,
a->argv[2],
a->argv[4],
a->argv[5]);
176 }
else if (!strcasecmp(
"extension",
a->argv[3])) {
187 const char *
name, *dest;
193 e->
command =
"channel redirect";
195 "Usage: channel redirect <channel> <[[context,]exten,]priority>\n"
196 " Redirect an active channel to a specified extension.\n";
207 if (
a->argc != e->
args + 2) {
224 ast_cli(
a->fd,
"Channel '%s' successfully redirected to %s\n",
name, dest);
226 ast_cli(
a->fd,
"Channel '%s' failed to be redirected to %s\n",
name, dest);
Asterisk main include file. File version handling, generic pbx functions.
#define ast_strdupa(s)
duplicate a string in memory from the stack
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
General Asterisk PBX channel definitions.
#define ast_channel_unref(c)
Decrease channel reference count.
struct ast_channel * ast_channel_get_by_name(const char *name)
Find a channel by name.
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,...)
char * ast_cli_complete(const char *word, const char *const choices[], int pos)
char * ast_complete_channels(const char *line, const char *word, int pos, int state, int rpos)
Command completion for the list of active channels.
#define ast_cli_register_multiple(e, len)
Register multiple commands.
char * strsep(char **str, const char *delims)
Asterisk internal frame definitions.
Asterisk module definitions.
#define AST_MODULE_INFO_STANDARD(keystr, desc)
#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.
int ast_pbx_outgoing_app(const char *type, struct ast_format_cap *cap, const char *addr, int timeout, const char *app, const char *appdata, int *reason, int synchronous, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **locked_channel, const struct ast_assigned_ids *assignedids)
Synchronously or asynchronously make an outbound call and execute an application on the channel.
int ast_pbx_outgoing_exten(const char *type, struct ast_format_cap *cap, const char *addr, int timeout, const char *context, const char *exten, int priority, int *reason, int synchronous, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **locked_channel, int early_media, const struct ast_assigned_ids *assignedids)
Synchronously or asynchronously make an outbound call and send it to a particular extension.
char * ast_complete_applications(const char *line, const char *word, int state)
Command completion for the list of installed applications.
int ast_async_parseable_goto(struct ast_channel *chan, const char *goto_string)
static char * orig_exten(int fd, const char *chan, const char *data)
orginate from extension
static struct ast_cli_entry cli_cliorig[]
static char * handle_redirect(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static char * orig_app(int fd, const char *chan, const char *app, const char *appdata)
orginate a call from the CLI
static int load_module(void)
static int unload_module(void)
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)
Main Channel structure associated with a channel.
descriptor for a cli entry.
int args
This gets set in ast_cli_register()