#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, void *data) |
static int | unload_module (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .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 = "068e67f60f50dd9ee86464c05884a49d" , .load = load_module, .unload = unload_module, } |
static const char * | app = "Transfer" |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static const char * | descrip |
static const char * | synopsis = "Transfer caller to remote extension" |
Definition in file app_transfer.c.
static void __reg_module | ( | void | ) | [static] |
Definition at line 125 of file app_transfer.c.
static void __unreg_module | ( | void | ) | [static] |
Definition at line 125 of file app_transfer.c.
static int load_module | ( | void | ) | [static] |
Definition at line 120 of file app_transfer.c.
References ast_register_application, and transfer_exec().
00121 { 00122 return ast_register_application(app, transfer_exec, synopsis, descrip); 00123 }
static int transfer_exec | ( | struct ast_channel * | chan, | |
void * | data | |||
) | [static] |
Definition at line 56 of file app_transfer.c.
References AST_APP_ARG, AST_DECLARE_APP_ARGS, ast_log(), AST_STANDARD_APP_ARGS, ast_strdupa, ast_strlen_zero(), ast_transfer(), chan, 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().
00057 { 00058 int res; 00059 int len; 00060 char *slash; 00061 char *tech = NULL; 00062 char *dest = NULL; 00063 char *status; 00064 char *parse; 00065 AST_DECLARE_APP_ARGS(args, 00066 AST_APP_ARG(dest); 00067 AST_APP_ARG(options); 00068 ); 00069 00070 if (ast_strlen_zero((char *)data)) { 00071 ast_log(LOG_WARNING, "Transfer requires an argument ([Tech/]destination[,options])\n"); 00072 pbx_builtin_setvar_helper(chan, "TRANSFERSTATUS", "FAILURE"); 00073 return 0; 00074 } else 00075 parse = ast_strdupa(data); 00076 00077 AST_STANDARD_APP_ARGS(args, parse); 00078 00079 if (args.options) { 00080 } 00081 00082 dest = args.dest; 00083 00084 if ((slash = strchr(dest, '/')) && (len = (slash - dest))) { 00085 tech = dest; 00086 dest = slash + 1; 00087 /* Allow execution only if the Tech/destination agrees with the type of the channel */ 00088 if (strncasecmp(chan->tech->type, tech, len)) { 00089 pbx_builtin_setvar_helper(chan, "TRANSFERSTATUS", "FAILURE"); 00090 return 0; 00091 } 00092 } 00093 00094 /* Check if the channel supports transfer before we try it */ 00095 if (!chan->tech->transfer) { 00096 pbx_builtin_setvar_helper(chan, "TRANSFERSTATUS", "UNSUPPORTED"); 00097 return 0; 00098 } 00099 00100 res = ast_transfer(chan, dest); 00101 00102 if (res < 0) { 00103 status = "FAILURE"; 00104 res = 0; 00105 } else { 00106 status = "SUCCESS"; 00107 res = 0; 00108 } 00109 00110 pbx_builtin_setvar_helper(chan, "TRANSFERSTATUS", status); 00111 00112 return res; 00113 }
static int unload_module | ( | void | ) | [static] |
Definition at line 115 of file app_transfer.c.
References ast_unregister_application().
00116 { 00117 return ast_unregister_application(app); 00118 }
struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .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 = "068e67f60f50dd9ee86464c05884a49d" , .load = load_module, .unload = unload_module, } [static] |
Definition at line 125 of file app_transfer.c.
const char* app = "Transfer" [static] |
Definition at line 40 of file app_transfer.c.
const struct ast_module_info* ast_module_info = &__mod_info [static] |
Definition at line 125 of file app_transfer.c.
const char* descrip [static] |
Definition at line 44 of file app_transfer.c.
const char* synopsis = "Transfer caller to remote extension" [static] |
Definition at line 42 of file app_transfer.c.