Asterisk - The Open Source Telephony Project GIT-master-754dea3
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Modules Pages
Functions | Variables
func_export.c File Reference

Set variables and functions on other channels. More...

#include "asterisk.h"
#include "asterisk/module.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/utils.h"
#include "asterisk/app.h"
#include "asterisk/stringfields.h"
Include dependency graph for func_export.c:

Go to the source code of this file.

Functions

 AST_MODULE_INFO_STANDARD_EXTENDED (ASTERISK_GPL_KEY, "Set variables and functions on other channels")
 
static int func_export_write (struct ast_channel *chan, const char *function, char *data, const char *value)
 
static int load_module (void)
 
static int unload_module (void)
 

Variables

static struct ast_custom_function export_function
 

Detailed Description

Set variables and functions on other channels.

Author
Naveen Albert aster.nosp@m.isk@.nosp@m.phrea.nosp@m.knet.nosp@m..org

Definition in file func_export.c.

Function Documentation

◆ AST_MODULE_INFO_STANDARD_EXTENDED()

AST_MODULE_INFO_STANDARD_EXTENDED ( ASTERISK_GPL_KEY  ,
"Set variables and functions on other channels  
)

◆ func_export_write()

static int func_export_write ( struct ast_channel chan,
const char *  function,
char *  data,
const char *  value 
)
static

Definition at line 69 of file func_export.c.

70{
71 struct ast_channel *ochan;
72
74 AST_APP_ARG(channel);
76 );
78
79 if (!args.channel) {
80 ast_log(LOG_WARNING, "No channel was provided to %s function.\n", function);
81 return -1;
82 }
83 if (!args.var) {
84 ast_log(LOG_WARNING, "No variable name was provided to %s function.\n", function);
85 return -1;
86 }
87 ochan = ast_channel_get_by_name(args.channel);
88 if (!ochan) {
89 ast_log(LOG_WARNING, "Channel '%s' not found! '%s' not set.\n", args.channel, args.var);
90 return -1;
91 }
92
94 ast_channel_unref(ochan);
95 return 0;
96}
#define var
Definition: ast_expr2f.c:605
#define ast_log
Definition: astobj2.c:42
#define ast_channel_unref(c)
Decrease channel reference count.
Definition: channel.h:3006
struct ast_channel * ast_channel_get_by_name(const char *name)
Find a channel by name.
Definition: channel.c:1481
#define AST_APP_ARG(name)
Define an application 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 LOG_WARNING
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.
Main Channel structure associated with a channel.
const char * data
int value
Definition: syslog.c:37
const char * args

References args, AST_APP_ARG, ast_channel_get_by_name(), ast_channel_unref, AST_DECLARE_APP_ARGS, ast_log, AST_STANDARD_APP_ARGS, ast_channel::data, LOG_WARNING, pbx_builtin_setvar_helper(), value, and var.

◆ load_module()

static int load_module ( void  )
static

Definition at line 108 of file func_export.c.

109{
111}
static struct ast_custom_function export_function
Definition: func_export.c:98
#define ast_custom_function_register(acf)
Register a custom function.
Definition: pbx.h:1559

References ast_custom_function_register, and export_function.

◆ unload_module()

static int unload_module ( void  )
static

Definition at line 103 of file func_export.c.

104{
106}
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.

References ast_custom_function_unregister(), and export_function.

Variable Documentation

◆ export_function

struct ast_custom_function export_function
static
Initial value:
= {
.name = "EXPORT",
}
static int func_export_write(struct ast_channel *chan, const char *function, char *data, const char *value)
Definition: func_export.c:69

Definition at line 98 of file func_export.c.

Referenced by load_module(), and unload_module().