Asterisk - The Open Source Telephony Project  GIT-master-9ed6387
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"

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 blind_transfer_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 = "Blind transfer channel to the given destination" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .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 *const app = "BlindTransfer"
 
static const struct ast_module_infoast_module_info = &__mod_info
 

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

◆ __reg_module()

static void __reg_module ( void  )
static

Definition at line 137 of file app_blind_transfer.c.

◆ __unreg_module()

static void __unreg_module ( void  )
static

Definition at line 137 of file app_blind_transfer.c.

◆ AST_MODULE_SELF_SYM()

struct ast_module* AST_MODULE_SELF_SYM ( void  )

Definition at line 137 of file app_blind_transfer.c.

◆ 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_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:4457
#define ast_strdupa(s)
duplicate a string in memory from the stack
Definition: astmm.h:300
static const char *const app
#define ast_strlen_zero(a)
Definition: muted.c:73
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_register_application_xml, 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

◆ __mod_info

struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Blind transfer channel to the given destination" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .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 137 of file app_blind_transfer.c.

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

◆ ast_module_info

const struct ast_module_info* ast_module_info = &__mod_info
static

Definition at line 137 of file app_blind_transfer.c.