Fri Aug 17 00:17:21 2018

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

 AST_MODULE_INFO_STANDARD (ASTERISK_GPL_KEY,"Redirects a given channel to a dialplan target")
static int asyncgoto_exec (struct ast_channel *chan, const char *data)
static int load_module (void)
static int unload_module (void)

Variables

static const char app [] = "ChannelRedirect"

Detailed Description

ChannelRedirect application.

Author:
Sergey Basmanov <sergey_basmanov@mail.ru>

Definition in file app_channelredirect.c.


Function Documentation

AST_MODULE_INFO_STANDARD ( ASTERISK_GPL_KEY  ,
"Redirects a given channel to a dialplan target"   
)
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_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().

00070 {
00071    int res = -1;
00072    char *info;
00073    struct ast_channel *chan2 = NULL;
00074 
00075    AST_DECLARE_APP_ARGS(args,
00076       AST_APP_ARG(channel);
00077       AST_APP_ARG(label);
00078    );
00079 
00080    if (ast_strlen_zero(data)) {
00081       ast_log(LOG_WARNING, "%s requires an argument (channel,[[context,]exten,]priority)\n", app);
00082       return -1;
00083    }
00084 
00085    info = ast_strdupa(data);
00086    AST_STANDARD_APP_ARGS(args, info);
00087 
00088    if (ast_strlen_zero(args.channel) || ast_strlen_zero(args.label)) {
00089       ast_log(LOG_WARNING, "%s requires an argument (channel,[[context,]exten,]priority)\n", app);
00090       return -1;
00091    }
00092 
00093    if (!(chan2 = ast_channel_get_by_name(args.channel))) {
00094       ast_log(LOG_WARNING, "No such channel: %s\n", args.channel);
00095       pbx_builtin_setvar_helper(chan, "CHANNELREDIRECT_STATUS", "NOCHANNEL");
00096       return 0;
00097    }
00098 
00099    if (chan2->pbx) {
00100       ast_set_flag(chan2, AST_FLAG_BRIDGE_HANGUP_DONT); /* don't let the after-bridge code run the h-exten */
00101    }
00102 
00103    res = ast_async_parseable_goto(chan2, args.label);
00104 
00105    chan2 = ast_channel_unref(chan2);
00106 
00107    pbx_builtin_setvar_helper(chan, "CHANNELREDIRECT_STATUS", "SUCCESS");
00108 
00109    return res;
00110 }

static int load_module ( void   )  [static]
static int unload_module ( void   )  [static]

Definition at line 112 of file app_channelredirect.c.

References ast_unregister_application().

00113 {
00114    return ast_unregister_application(app);
00115 }


Variable Documentation

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

Definition at line 67 of file app_channelredirect.c.


Generated on 17 Aug 2018 for Asterisk - The Open Source Telephony Project by  doxygen 1.6.1