#include "asterisk.h"
#include "asterisk/file.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "asterisk/lock.h"
#include "asterisk/app.h"
#include "asterisk/features.h"
Go to the source code of this file.
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static int | asyncgoto_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 = "Redirects a given channel to a dialplan target" , .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 | app [] = "ChannelRedirect" |
static struct ast_module_info * | ast_module_info = &__mod_info |
Definition in file app_channelredirect.c.
static void __reg_module | ( | void | ) | [static] |
Definition at line 119 of file app_channelredirect.c.
static void __unreg_module | ( | void | ) | [static] |
Definition at line 119 of file app_channelredirect.c.
static int asyncgoto_exec | ( | struct ast_channel * | chan, | |
const char * | data | |||
) | [static] |
Definition at line 65 of file app_channelredirect.c.
References args, AST_APP_ARG, ast_async_parseable_goto(), ast_channel_get_by_name(), ast_channel_unref, AST_DECLARE_APP_ARGS, AST_FLAG_BRIDGE_HANGUP_DONT, ast_log(), ast_set_flag, AST_STANDARD_APP_ARGS, ast_strdupa, ast_strlen_zero(), LOG_WARNING, ast_channel::pbx, and pbx_builtin_setvar_helper().
Referenced by load_module().
00066 { 00067 int res = -1; 00068 char *info; 00069 struct ast_channel *chan2 = NULL; 00070 00071 AST_DECLARE_APP_ARGS(args, 00072 AST_APP_ARG(channel); 00073 AST_APP_ARG(label); 00074 ); 00075 00076 if (ast_strlen_zero(data)) { 00077 ast_log(LOG_WARNING, "%s requires an argument (channel,[[context,]exten,]priority)\n", app); 00078 return -1; 00079 } 00080 00081 info = ast_strdupa(data); 00082 AST_STANDARD_APP_ARGS(args, info); 00083 00084 if (ast_strlen_zero(args.channel) || ast_strlen_zero(args.label)) { 00085 ast_log(LOG_WARNING, "%s requires an argument (channel,[[context,]exten,]priority)\n", app); 00086 return -1; 00087 } 00088 00089 if (!(chan2 = ast_channel_get_by_name(args.channel))) { 00090 ast_log(LOG_WARNING, "No such channel: %s\n", args.channel); 00091 pbx_builtin_setvar_helper(chan, "CHANNELREDIRECT_STATUS", "NOCHANNEL"); 00092 return 0; 00093 } 00094 00095 if (chan2->pbx) { 00096 ast_set_flag(chan2, AST_FLAG_BRIDGE_HANGUP_DONT); /* don't let the after-bridge code run the h-exten */ 00097 } 00098 00099 res = ast_async_parseable_goto(chan2, args.label); 00100 00101 chan2 = ast_channel_unref(chan2); 00102 00103 pbx_builtin_setvar_helper(chan, "CHANNELREDIRECT_STATUS", "SUCCESS"); 00104 00105 return res; 00106 }
static int load_module | ( | void | ) | [static] |
Definition at line 113 of file app_channelredirect.c.
References AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, ast_register_application_xml, and asyncgoto_exec().
00114 { 00115 return ast_register_application_xml(app, asyncgoto_exec) ? 00116 AST_MODULE_LOAD_DECLINE : AST_MODULE_LOAD_SUCCESS; 00117 }
static int unload_module | ( | void | ) | [static] |
Definition at line 108 of file app_channelredirect.c.
References ast_unregister_application().
00109 { 00110 return ast_unregister_application(app); 00111 }
struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Redirects a given channel to a dialplan target" , .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 119 of file app_channelredirect.c.
const char app[] = "ChannelRedirect" [static] |
Definition at line 63 of file app_channelredirect.c.
struct ast_module_info* ast_module_info = &__mod_info [static] |
Definition at line 119 of file app_channelredirect.c.