186 char *predial_callee =
NULL;
187 char *parse, *cnum =
NULL, *cname =
NULL;
190 char *chantech, *chandata;
192 int continue_in_dialplan = 0;
193 int outgoing_status = 0;
194 unsigned int timeout = 30;
195 static const char default_exten[] =
"s";
221 if(sscanf(
args.timeout,
"%u", &timeout) != 1) {
228 chantech =
strsep(&chandata,
"/");
254 if (strcasecmp(
args.type,
"exten") && strcasecmp(
args.type,
"app")) {
290 char *varname, *varvalue;
291 if (!(varname =
ast_strsep(&vartext,
'=', 0))) {
295 if (!(varvalue =
ast_strsep(&vartext,
'=', 0))) {
303 ast_debug(1,
"Appending variable '%s' with value '%s'", varname, varvalue);
308 if (!strcasecmp(
args.type,
"exten")) {
309 const char *cid_num = cnum;
310 const char *cid_name = cname;
312 const char *exten =
args.arg2;
314 if (
args.argc == 5) {
320 }
else if (
args.argc == 3) {
322 exten = default_exten;
325 ast_debug(1,
"Originating call to '%s/%s' and connecting them to extension %s,%s,%d\n",
329 timeout * 1000,
args.arg1, exten,
priority, &outgoing_status,
334 const char *cid_num = cnum;
335 const char *cid_name = cname;
336 ast_debug(1,
"Originating call to '%s/%s' and connecting them to %s(%s)\n",
340 timeout * 1000,
args.arg1,
args.arg2, &outgoing_status,
352 if (res && outgoing_status) {
357 continue_in_dialplan = 1;
363 switch (outgoing_status) {
393 return continue_in_dialplan ? 0 : -1;
static const char app_originate[]
static int originate_exec(struct ast_channel *chan, const char *data)
static const struct ast_app_option originate_exec_options[128]
static int load_module(void)
static int unload_module(void)
Asterisk main include file. File version handling, generic pbx functions.
#define ast_strdupa(s)
duplicate a string in memory from the stack
General Asterisk PBX channel definitions.
int ast_autoservice_stop(struct ast_channel *chan)
Stop servicing a channel for us...
int ast_autoservice_start(struct ast_channel *chan)
Automatically service a channel for us...
struct ast_party_caller * ast_channel_caller(struct ast_channel *chan)
Generic File Format Support. Should be included by clients of the file handling routines....
Application convenience functions, designed to give consistent look and feel to Asterisk apps.
#define AST_APP_ARG(name)
Define an application argument.
#define AST_APP_OPTIONS(holder, options...)
Declares an array of options for an application.
#define AST_APP_OPTION_ARG(option, flagno, argno)
Declares an application option that accepts an argument.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
#define AST_APP_OPTION(option, flagno)
Declares an application option that does not accept an argument.
int ast_app_exec_sub(struct ast_channel *autoservice_chan, struct ast_channel *sub_chan, const char *sub_args, int ignore_hangup)
Run a subroutine on a channel, placing an optional second channel into autoservice.
int ast_app_parse_options64(const struct ast_app_option *options, struct ast_flags64 *flags, char **args, char *optstr)
Parses a string containing application options and sets flags/arguments.
char * strsep(char **str, const char *delims)
#define ast_variable_new(name, value, filename)
#define ast_variable_list_append(head, new_var)
void ast_variables_destroy(struct ast_variable *var)
Free variable list.
#define ast_debug(level,...)
Log a DEBUG message.
Asterisk module definitions.
#define AST_MODULE_INFO_STANDARD(keystr, desc)
#define ASTERISK_GPL_KEY
The text the key() function should return.
int ast_unregister_application(const char *app)
Unregister an application.
@ AST_MODULE_LOAD_SUCCESS
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
Core PBX routines and definitions.
int ast_pbx_outgoing_exten_predial(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, const char *predial_callee)
int ast_pbx_outgoing_app_predial(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, const char *predial_callee)
int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value)
Add a variable to the channel variable stack, removing the most recently set value for the same name.
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
char * ast_strsep(char **s, const char sep, uint32_t flags)
Act like strsep but ignore separators inside quotes.
Main Channel structure associated with a channel.
Structure used to handle a large number of boolean flags == used only in app_dial?
struct ast_party_id id
Caller party ID.
struct ast_party_name name
Subscriber name.
struct ast_party_number number
Subscriber phone number.
char * str
Subscriber name (Malloced)
char * str
Subscriber phone number (Malloced)
Structure for variables, used for configurations and for channel variables.
#define ast_test_flag64(p, flag)
void ast_replace_subargument_delimiter(char *s)
Replace '^' in a string with ','.