Asterisk - The Open Source Telephony Project  18.5.0
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"   
)

Referenced by load_module().

◆ 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.

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, context, exten, LOG_WARNING, NULL, parse(), and pbx_builtin_setvar_helper().

Referenced by load_module().

82 {
83  char *exten = NULL;
84  char *context = NULL;
85  char *parse;
87  AST_APP_ARG(exten);
88  AST_APP_ARG(context);
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 char exten[AST_MAX_EXTENSION]
Definition: chan_alsa.c:118
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
#define LOG_WARNING
Definition: logger.h:274
const char * args
#define NULL
Definition: resample.c:96
#define ast_strlen_zero(foo)
Definition: strings.h:52
#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:4477
#define ast_strdupa(s)
duplicate a string in memory from the stack
Definition: astmm.h:300
static const char *const app
static void parse(struct mgcp_request *req)
Definition: chan_mgcp.c:1872
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...
const char * ast_channel_context(const struct ast_channel *chan)
static char context[AST_MAX_CONTEXT]
Definition: chan_alsa.c:116
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
#define AST_APP_ARG(name)
Define an application argument.

◆ load_module()

static int load_module ( void  )
static

Definition at line 132 of file app_blind_transfer.c.

References app, AST_MODULE_INFO_STANDARD_EXTENDED(), ast_register_application_xml, ASTERISK_GPL_KEY, and blind_transfer_exec().

133 {
135 }
static const char *const app
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:626

◆ unload_module()

static int unload_module ( void  )
static

Definition at line 127 of file app_blind_transfer.c.

References app, and ast_unregister_application().

128 {
130 }
int ast_unregister_application(const char *app)
Unregister an application.
Definition: pbx_app.c:392
static const char *const app

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().