Sat Apr 26 2014 22:01:45

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"
Include dependency graph for app_channelredirect.c:

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 = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, }
static const char app [] = "ChannelRedirect"
static struct ast_module_infoast_module_info = &__mod_info

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 123 of file app_channelredirect.c.

static void __unreg_module ( void  ) [static]

Definition at line 123 of file app_channelredirect.c.

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

Definition at line 69 of file app_channelredirect.c.

References args, AST_APP_ARG, ast_async_parseable_goto(), ast_channel_flags(), ast_channel_get_by_name(), ast_channel_pbx(), ast_channel_unref, AST_DECLARE_APP_ARGS, AST_FLAG_BRIDGE_HANGUP_DONT, ast_log(), ast_set_flag, AST_STANDARD_APP_ARGS, ast_strlen_zero(), LOG_WARNING, and pbx_builtin_setvar_helper().

Referenced by load_module().

{
   int res = -1;
   char *info;
   struct ast_channel *chan2 = NULL;

   AST_DECLARE_APP_ARGS(args,
      AST_APP_ARG(channel);
      AST_APP_ARG(label);
   );

   if (ast_strlen_zero(data)) {
      ast_log(LOG_WARNING, "%s requires an argument (channel,[[context,]exten,]priority)\n", app);
      return -1;
   }

   info = ast_strdupa(data);
   AST_STANDARD_APP_ARGS(args, info);

   if (ast_strlen_zero(args.channel) || ast_strlen_zero(args.label)) {
      ast_log(LOG_WARNING, "%s requires an argument (channel,[[context,]exten,]priority)\n", app);
      return -1;
   }

   if (!(chan2 = ast_channel_get_by_name(args.channel))) {
      ast_log(LOG_WARNING, "No such channel: %s\n", args.channel);
      pbx_builtin_setvar_helper(chan, "CHANNELREDIRECT_STATUS", "NOCHANNEL");
      return 0;
   }

   if (ast_channel_pbx(chan2)) {
      ast_set_flag(ast_channel_flags(chan2), AST_FLAG_BRIDGE_HANGUP_DONT); /* don't let the after-bridge code run the h-exten */
   }

   res = ast_async_parseable_goto(chan2, args.label);

   chan2 = ast_channel_unref(chan2);

   pbx_builtin_setvar_helper(chan, "CHANNELREDIRECT_STATUS", "SUCCESS");

   return res;
}
static int unload_module ( void  ) [static]

Definition at line 112 of file app_channelredirect.c.

References ast_unregister_application().


Variable Documentation

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 = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, } [static]

Definition at line 123 of file app_channelredirect.c.

const char app[] = "ChannelRedirect" [static]

Definition at line 67 of file app_channelredirect.c.

Definition at line 123 of file app_channelredirect.c.