Asterisk - The Open Source Telephony Project GIT-master-f36a736
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 81 of file app_blind_transfer.c.

82{
83 char *exten = NULL;
84 char *context = NULL;
85 char *parse;
87 AST_APP_ARG(exten);
89 );
90
91 if (ast_strlen_zero((char *)data)) {
92 ast_log(LOG_WARNING, "%s requires an argument (exten)\n", app);
93 pbx_builtin_setvar_helper(chan, "BLINDTRANSFERSTATUS", "FAILURE");
94 return 0;
95 }
96
97 parse = ast_strdupa(data);
99
100 exten = args.exten;
101 if (ast_strlen_zero(args.context)) {
102 context = (char *)ast_channel_context(chan);
103 } else {
104 context = args.context;
105 }
106
107 switch (ast_bridge_transfer_blind(1, chan, exten, context, NULL, NULL)) {
109 pbx_builtin_setvar_helper(chan, "BLINDTRANSFERSTATUS", "NOTPERMITTED");
110 break;
112 pbx_builtin_setvar_helper(chan, "BLINDTRANSFERSTATUS", "INVALID");
113 break;
115 pbx_builtin_setvar_helper(chan, "BLINDTRANSFERSTATUS", "FAILURE");
116 break;
118 pbx_builtin_setvar_helper(chan, "BLINDTRANSFERSTATUS", "SUCCESS");
119 break;
120 default:
121 pbx_builtin_setvar_helper(chan, "BLINDTRANSFERSTATUS", "FAILURE");
122 }
123
124 return 0;
125}
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:4425
@ AST_BRIDGE_TRANSFER_NOT_PERMITTED
Definition: bridge.h:1102
@ AST_BRIDGE_TRANSFER_SUCCESS
Definition: bridge.h:1100
@ AST_BRIDGE_TRANSFER_INVALID
Definition: bridge.h:1104
@ AST_BRIDGE_TRANSFER_FAIL
Definition: bridge.h:1106
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 132 of file app_blind_transfer.c.

133{
135}
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 127 of file app_blind_transfer.c.

128{
130}
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 79 of file app_blind_transfer.c.

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