#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 = "a9c98e5d177805051735cb5b0b16b0a0" , .load = load_module, .unload = unload_module, } |
static const char * | app = "Transfer" |
static 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 121 of file app_transfer.c.
static void __unreg_module | ( | void | ) | [static] |
Definition at line 121 of file app_transfer.c.
static int load_module | ( | void | ) | [static] |
Definition at line 116 of file app_transfer.c.
References ast_register_application, and transfer_exec().
00117 { 00118 return ast_register_application(app, transfer_exec, synopsis, descrip); 00119 }
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 ); 00068 00069 if (ast_strlen_zero((char *)data)) { 00070 ast_log(LOG_WARNING, "Transfer requires an argument ([Tech/]destination)\n"); 00071 pbx_builtin_setvar_helper(chan, "TRANSFERSTATUS", "FAILURE"); 00072 return 0; 00073 } else 00074 parse = ast_strdupa(data); 00075 00076 AST_STANDARD_APP_ARGS(args, parse); 00077 00078 dest = args.dest; 00079 00080 if ((slash = strchr(dest, '/')) && (len = (slash - dest))) { 00081 tech = dest; 00082 dest = slash + 1; 00083 /* Allow execution only if the Tech/destination agrees with the type of the channel */ 00084 if (strncasecmp(chan->tech->type, tech, len)) { 00085 pbx_builtin_setvar_helper(chan, "TRANSFERSTATUS", "FAILURE"); 00086 return 0; 00087 } 00088 } 00089 00090 /* Check if the channel supports transfer before we try it */ 00091 if (!chan->tech->transfer) { 00092 pbx_builtin_setvar_helper(chan, "TRANSFERSTATUS", "UNSUPPORTED"); 00093 return 0; 00094 } 00095 00096 res = ast_transfer(chan, dest); 00097 00098 if (res < 0) { 00099 status = "FAILURE"; 00100 res = 0; 00101 } else { 00102 status = "SUCCESS"; 00103 res = 0; 00104 } 00105 00106 pbx_builtin_setvar_helper(chan, "TRANSFERSTATUS", status); 00107 00108 return res; 00109 }
static int unload_module | ( | void | ) | [static] |
Definition at line 111 of file app_transfer.c.
References ast_unregister_application().
00112 { 00113 return ast_unregister_application(app); 00114 }
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 = "a9c98e5d177805051735cb5b0b16b0a0" , .load = load_module, .unload = unload_module, } [static] |
Definition at line 121 of file app_transfer.c.
const char* app = "Transfer" [static] |
Definition at line 40 of file app_transfer.c.
struct ast_module_info* ast_module_info = &__mod_info [static] |
Definition at line 121 of file app_transfer.c.
const char* descrip [static] |
Definition at line 44 of file app_transfer.c.
Definition at line 42 of file app_transfer.c.