Fri Jul 24 00:41:07 2009

Asterisk developer's documentation


app_channelredirect.c File Reference

ChannelRedirect application. More...

#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, void *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_DEFAULT , .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 = "a9c98e5d177805051735cb5b0b16b0a0" , .load = load_module, .unload = unload_module, }
static char * app = "ChannelRedirect"
static struct ast_module_infoast_module_info = &__mod_info
static char * descrip
static char * synopsis = "Redirects given channel to a dialplan target."


Detailed Description

ChannelRedirect application.

Author:
Sergey Basmanov <sergey_basmanov@mail.ru>

Definition in file app_channelredirect.c.


Function Documentation

static void __reg_module ( void   )  [static]

Definition at line 99 of file app_channelredirect.c.

static void __unreg_module ( void   )  [static]

Definition at line 99 of file app_channelredirect.c.

static int asyncgoto_exec ( struct ast_channel chan,
void *  data 
) [static]

Definition at line 47 of file app_channelredirect.c.

References AST_APP_ARG, ast_async_parseable_goto(), ast_channel_unlock, AST_DECLARE_APP_ARGS, AST_FLAG_BRIDGE_HANGUP_DONT, ast_get_channel_by_name_locked(), ast_log(), ast_set_flag, AST_STANDARD_APP_ARGS, ast_strdupa, ast_strlen_zero(), chan, LOG_WARNING, ast_channel::pbx, and pbx_builtin_setvar_helper().

Referenced by load_module().

00048 {
00049    int res = -1;
00050    char *info;
00051    struct ast_channel *chan2 = NULL;
00052 
00053    AST_DECLARE_APP_ARGS(args,
00054       AST_APP_ARG(channel);
00055       AST_APP_ARG(label);
00056    );
00057 
00058    if (ast_strlen_zero(data)) {
00059       ast_log(LOG_WARNING, "%s requires an argument (channel,[[context,]exten,]priority)\n", app);
00060       return -1;
00061    }
00062 
00063    info = ast_strdupa(data);
00064    AST_STANDARD_APP_ARGS(args, info);
00065 
00066    if (ast_strlen_zero(args.channel) || ast_strlen_zero(args.label)) {
00067       ast_log(LOG_WARNING, "%s requires an argument (channel,[[context,]exten,]priority)\n", app);
00068       return -1;
00069    }
00070 
00071    chan2 = ast_get_channel_by_name_locked(args.channel);
00072    if (!chan2) {
00073       ast_log(LOG_WARNING, "No such channel: %s\n", args.channel);
00074       pbx_builtin_setvar_helper(chan, "CHANNELREDIRECT_STATUS", "NOCHANNEL");
00075       return 0;
00076    }
00077 
00078    if (chan2->pbx) {
00079       ast_set_flag(chan2, AST_FLAG_BRIDGE_HANGUP_DONT); /* don't let the after-bridge code run the h-exten */
00080    }
00081    res = ast_async_parseable_goto(chan2, args.label);
00082    pbx_builtin_setvar_helper(chan, "CHANNELREDIRECT_STATUS", "SUCCESS");
00083    ast_channel_unlock(chan2);
00084 
00085    return res;
00086 }

static int load_module ( void   )  [static]

Definition at line 93 of file app_channelredirect.c.

References AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, ast_register_application, and asyncgoto_exec().

static int unload_module ( void   )  [static]

Definition at line 88 of file app_channelredirect.c.

References ast_unregister_application().

00089 {
00090    return ast_unregister_application(app);
00091 }


Variable Documentation

struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .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 = "a9c98e5d177805051735cb5b0b16b0a0" , .load = load_module, .unload = unload_module, } [static]

Definition at line 99 of file app_channelredirect.c.

char* app = "ChannelRedirect" [static]

Definition at line 38 of file app_channelredirect.c.

struct ast_module_info* ast_module_info = &__mod_info [static]

Definition at line 99 of file app_channelredirect.c.

char* descrip [static]

Definition at line 40 of file app_channelredirect.c.

char* synopsis = "Redirects given channel to a dialplan target." [static]

Definition at line 39 of file app_channelredirect.c.


Generated on Fri Jul 24 00:41:07 2009 for Asterisk - the Open Source PBX by  doxygen 1.4.7