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

Blind transfer by caller channel. More...

#include "asterisk.h"
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "asterisk/app.h"
#include "asterisk/channel.h"
#include "asterisk/bridge.h"
Include dependency graph for app_blind_transfer.c:

Go to the source code of this file.

Functions

 AST_MODULE_INFO_STANDARD_EXTENDED (ASTERISK_GPL_KEY, "Blind transfer channel to the given destination")
 
static int blind_transfer_exec (struct ast_channel *chan, const char *data)
 
static int load_module (void)
 
static int unload_module (void)
 

Variables

static const char *const app = "BlindTransfer"
 

Detailed Description

Blind transfer by caller channel.

Author
Alexei Gradinari alex2.nosp@m.grad.nosp@m.@gmai.nosp@m.l.co.nosp@m.m

Definition in file app_blind_transfer.c.

Function Documentation

◆ AST_MODULE_INFO_STANDARD_EXTENDED()

AST_MODULE_INFO_STANDARD_EXTENDED ( ASTERISK_GPL_KEY  ,
"Blind transfer channel to the given destination"   
)

◆ blind_transfer_exec()

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

Definition at line 85 of file app_blind_transfer.c.

86{
87 char *exten = NULL;
88 char *context = NULL;
89 char *parse;
91 AST_APP_ARG(exten);
93 );
94
95 if (ast_strlen_zero((char *)data)) {
96 ast_log(LOG_WARNING, "%s requires an argument (exten)\n", app);
97 pbx_builtin_setvar_helper(chan, "BLINDTRANSFERSTATUS", "FAILURE");
98 return 0;
99 }
100
101 parse = ast_strdupa(data);
103
104 exten = args.exten;
105 if (ast_strlen_zero(args.context)) {
106 context = (char *)ast_channel_context(chan);
107 } else {
108 context = args.context;
109 }
110
111 switch (ast_bridge_transfer_blind(1, chan, exten, context, NULL, NULL)) {
113 pbx_builtin_setvar_helper(chan, "BLINDTRANSFERSTATUS", "NOTPERMITTED");
114 break;
116 pbx_builtin_setvar_helper(chan, "BLINDTRANSFERSTATUS", "INVALID");
117 break;
119 pbx_builtin_setvar_helper(chan, "BLINDTRANSFERSTATUS", "FAILURE");
120 break;
122 pbx_builtin_setvar_helper(chan, "BLINDTRANSFERSTATUS", "SUCCESS");
123 break;
124 default:
125 pbx_builtin_setvar_helper(chan, "BLINDTRANSFERSTATUS", "FAILURE");
126 }
127
128 return 0;
129}
static const char *const app
#define ast_strdupa(s)
duplicate a string in memory from the stack
Definition: astmm.h:298
#define ast_log
Definition: astobj2.c:42
enum ast_transfer_result ast_bridge_transfer_blind(int is_external, struct ast_channel *transferer, const char *exten, const char *context, transfer_channel_cb new_channel_cb, void *user_data)
Blind transfer target to the extension and context provided.
Definition: bridge.c:4494
@ AST_BRIDGE_TRANSFER_NOT_PERMITTED
Definition: bridge.h:1106
@ AST_BRIDGE_TRANSFER_SUCCESS
Definition: bridge.h:1104
@ AST_BRIDGE_TRANSFER_INVALID
Definition: bridge.h:1108
@ AST_BRIDGE_TRANSFER_FAIL
Definition: bridge.h:1110
const char * ast_channel_context(const struct ast_channel *chan)
#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.
#define NULL
Definition: resample.c:96
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Definition: strings.h:65
const char * args

References app, args, AST_APP_ARG, ast_bridge_transfer_blind(), AST_BRIDGE_TRANSFER_FAIL, AST_BRIDGE_TRANSFER_INVALID, AST_BRIDGE_TRANSFER_NOT_PERMITTED, AST_BRIDGE_TRANSFER_SUCCESS, ast_channel_context(), AST_DECLARE_APP_ARGS, ast_log, AST_STANDARD_APP_ARGS, ast_strdupa, ast_strlen_zero(), voicemailpwcheck::context, LOG_WARNING, NULL, and pbx_builtin_setvar_helper().

Referenced by load_module().

◆ load_module()

static int load_module ( void  )
static

Definition at line 136 of file app_blind_transfer.c.

137{
139}
static int blind_transfer_exec(struct ast_channel *chan, const char *data)
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
Definition: module.h:640

References app, ast_register_application_xml, and blind_transfer_exec().

◆ unload_module()

static int unload_module ( void  )
static

Definition at line 131 of file app_blind_transfer.c.

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

References app, and ast_unregister_application().

Variable Documentation

◆ app

const char* const app = "BlindTransfer"
static

Definition at line 83 of file app_blind_transfer.c.

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