#include "asterisk.h"
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "asterisk/app.h"
#include "asterisk/channel.h"
Go to the source code of this file.
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static int | load_module (void) |
static int | transfer_exec (struct ast_channel *chan, const char *data) |
static int | unload_module (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Transfers a caller to another extension" , .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 = "8586c2a7d357cb591cc3a6607a8f62d1" , .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, } |
static const char *const | app = "Transfer" |
static struct ast_module_info * | ast_module_info = &__mod_info |
Definition in file app_transfer.c.
static void __reg_module | ( | void | ) | [static] |
Definition at line 142 of file app_transfer.c.
static void __unreg_module | ( | void | ) | [static] |
Definition at line 142 of file app_transfer.c.
static int load_module | ( | void | ) | [static] |
Definition at line 137 of file app_transfer.c.
References ast_register_application_xml, and transfer_exec().
00138 { 00139 return ast_register_application_xml(app, transfer_exec); 00140 }
static int transfer_exec | ( | struct ast_channel * | chan, | |
const char * | data | |||
) | [static] |
Definition at line 77 of file app_transfer.c.
References args, AST_APP_ARG, AST_DECLARE_APP_ARGS, ast_log(), AST_STANDARD_APP_ARGS, ast_strdupa, ast_strlen_zero(), ast_transfer(), len(), LOG_WARNING, parse(), pbx_builtin_setvar_helper(), status, ast_channel::tech, ast_channel_tech::transfer, and ast_channel_tech::type.
Referenced by load_module().
00078 { 00079 int res; 00080 int len; 00081 char *slash; 00082 char *tech = NULL; 00083 char *dest = NULL; 00084 char *status; 00085 char *parse; 00086 AST_DECLARE_APP_ARGS(args, 00087 AST_APP_ARG(dest); 00088 ); 00089 00090 if (ast_strlen_zero((char *)data)) { 00091 ast_log(LOG_WARNING, "Transfer requires an argument ([Tech/]destination)\n"); 00092 pbx_builtin_setvar_helper(chan, "TRANSFERSTATUS", "FAILURE"); 00093 return 0; 00094 } else 00095 parse = ast_strdupa(data); 00096 00097 AST_STANDARD_APP_ARGS(args, parse); 00098 00099 dest = args.dest; 00100 00101 if ((slash = strchr(dest, '/')) && (len = (slash - dest))) { 00102 tech = dest; 00103 dest = slash + 1; 00104 /* Allow execution only if the Tech/destination agrees with the type of the channel */ 00105 if (strncasecmp(chan->tech->type, tech, len)) { 00106 pbx_builtin_setvar_helper(chan, "TRANSFERSTATUS", "FAILURE"); 00107 return 0; 00108 } 00109 } 00110 00111 /* Check if the channel supports transfer before we try it */ 00112 if (!chan->tech->transfer) { 00113 pbx_builtin_setvar_helper(chan, "TRANSFERSTATUS", "UNSUPPORTED"); 00114 return 0; 00115 } 00116 00117 res = ast_transfer(chan, dest); 00118 00119 if (res < 0) { 00120 status = "FAILURE"; 00121 res = 0; 00122 } else { 00123 status = "SUCCESS"; 00124 res = 0; 00125 } 00126 00127 pbx_builtin_setvar_helper(chan, "TRANSFERSTATUS", status); 00128 00129 return res; 00130 }
static int unload_module | ( | void | ) | [static] |
Definition at line 132 of file app_transfer.c.
References ast_unregister_application().
00133 { 00134 return ast_unregister_application(app); 00135 }
struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Transfers a caller to another extension" , .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 = "8586c2a7d357cb591cc3a6607a8f62d1" , .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, } [static] |
Definition at line 142 of file app_transfer.c.
const char* const app = "Transfer" [static] |
Definition at line 75 of file app_transfer.c.
struct ast_module_info* ast_module_info = &__mod_info [static] |
Definition at line 142 of file app_transfer.c.