Asterisk - The Open Source Telephony Project GIT-master-27fb039
Loading...
Searching...
No Matches
Functions | Variables
app_channelredirect.c File Reference

ChannelRedirect application. More...

#include "asterisk.h"
#include "asterisk/file.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "asterisk/lock.h"
#include "asterisk/app.h"
#include "asterisk/features.h"
Include dependency graph for app_channelredirect.c:

Go to the source code of this file.

Functions

static void __reg_module (void)
 
static void __unreg_module (void)
 
struct ast_moduleAST_MODULE_SELF_SYM (void)
 
static int asyncgoto_exec (struct ast_channel *chan, const char *data)
 
static int load_module (void)
 
static int unload_module (void)
 

Variables

static struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Redirects a given channel to a dialplan target" , .key = ASTERISK_GPL_KEY , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, .support_level = AST_MODULE_SUPPORT_CORE, }
 
static const char app [] = "ChannelRedirect"
 
static const struct ast_module_infoast_module_info = &__mod_info
 

Detailed Description

ChannelRedirect application.

Author
Sergey Basmanov serge.nosp@m.y_ba.nosp@m.smano.nosp@m.v@ma.nosp@m.il.ru

Definition in file app_channelredirect.c.

Function Documentation

◆ __reg_module()

static void __reg_module ( void  )
static

Definition at line 120 of file app_channelredirect.c.

◆ __unreg_module()

static void __unreg_module ( void  )
static

Definition at line 120 of file app_channelredirect.c.

◆ AST_MODULE_SELF_SYM()

struct ast_module * AST_MODULE_SELF_SYM ( void  )

Definition at line 120 of file app_channelredirect.c.

◆ asyncgoto_exec()

static int asyncgoto_exec ( struct ast_channel chan,
const char *  data 
)
static

Definition at line 70 of file app_channelredirect.c.

71{
72 int res = -1;
73 char *info;
74 struct ast_channel *chan2 = NULL;
75
77 AST_APP_ARG(channel);
78 AST_APP_ARG(label);
79 );
80
81 if (ast_strlen_zero(data)) {
82 ast_log(LOG_WARNING, "%s requires an argument (channel,[[context,]exten,]priority)\n", app);
83 return -1;
84 }
85
88
89 if (ast_strlen_zero(args.channel) || ast_strlen_zero(args.label)) {
90 ast_log(LOG_WARNING, "%s requires an argument (channel,[[context,]exten,]priority)\n", app);
91 return -1;
92 }
93
94 if (!(chan2 = ast_channel_get_by_name(args.channel))) {
95 ast_log(LOG_WARNING, "No such channel: %s\n", args.channel);
96 pbx_builtin_setvar_helper(chan, "CHANNELREDIRECT_STATUS", "NOCHANNEL");
97 return 0;
98 }
99
100 res = ast_async_parseable_goto(chan2, args.label);
101
102 chan2 = ast_channel_unref(chan2);
103
104 pbx_builtin_setvar_helper(chan, "CHANNELREDIRECT_STATUS", "SUCCESS");
105
106 return res;
107}
static const char app[]
#define ast_strdupa(s)
duplicate a string in memory from the stack
Definition astmm.h:298
#define ast_log
Definition astobj2.c:42
struct ast_channel * ast_channel_get_by_name(const char *search)
Find a channel by name or uniqueid.
Definition channel.c:1416
#define ast_channel_unref(c)
Decrease channel reference count.
Definition channel.h:3018
#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.
int ast_async_parseable_goto(struct ast_channel *chan, const char *goto_string)
Definition pbx.c:8896
static struct @519 args
#define NULL
Definition resample.c:96
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Definition strings.h:65
Main Channel structure associated with a channel.
const char * data

References app, args, AST_APP_ARG, ast_async_parseable_goto(), ast_channel_get_by_name(), ast_channel_unref, AST_DECLARE_APP_ARGS, ast_log, AST_STANDARD_APP_ARGS, ast_strdupa, ast_strlen_zero(), ast_channel::data, LOG_WARNING, NULL, and pbx_builtin_setvar_helper().

Referenced by load_module().

◆ load_module()

static int load_module ( void  )
static

Definition at line 114 of file app_channelredirect.c.

115{
118}
static int asyncgoto_exec(struct ast_channel *chan, const char *data)
@ AST_MODULE_LOAD_SUCCESS
Definition module.h:70
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
Definition module.h:78
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
Definition module.h:640

References app, AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, ast_register_application_xml, and asyncgoto_exec().

◆ unload_module()

static int unload_module ( void  )
static

Definition at line 109 of file app_channelredirect.c.

110{
112}
int ast_unregister_application(const char *app)
Unregister an application.
Definition pbx_app.c:392

References app, and ast_unregister_application().

Variable Documentation

◆ __mod_info

struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Redirects a given channel to a dialplan target" , .key = ASTERISK_GPL_KEY , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, .support_level = AST_MODULE_SUPPORT_CORE, }
static

Definition at line 120 of file app_channelredirect.c.

◆ app

const char app[] = "ChannelRedirect"
static

Definition at line 68 of file app_channelredirect.c.

Referenced by asyncgoto_exec(), load_module(), and unload_module().

◆ ast_module_info

const struct ast_module_info* ast_module_info = &__mod_info
static

Definition at line 120 of file app_channelredirect.c.