chan_bridge_media.c File Reference

Bridge Media Channels driver. More...

#include "asterisk.h"
#include "asterisk/channel.h"
#include "asterisk/bridge.h"
#include "asterisk/core_unreal.h"
#include "asterisk/module.h"

Include dependency graph for chan_bridge_media.c:

Go to the source code of this file.

Functions

static void __reg_module (void)
static void __unreg_module (void)
static struct ast_channelannounce_request (const char *type, struct ast_format_cap *cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *data, int *cause)
static void cleanup_capabilities (void)
static int load_module (void)
static int media_call (struct ast_channel *chan, const char *addr, int timeout)
static int media_hangup (struct ast_channel *ast)
static struct ast_channelmedia_request_helper (struct ast_format_cap *cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *data, struct ast_channel_tech *tech, const char *role)
static struct ast_channelrecord_request (const char *type, struct ast_format_cap *cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *data, int *cause)
static int unload_module (void)

Variables

static struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "Bridge Media Channel Driver" , .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, .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, }
static struct ast_channel_tech announce_tech
static struct ast_module_infoast_module_info = &__mod_info
static struct ast_channel_tech record_tech


Detailed Description

Bridge Media Channels driver.

Author:
Jonathan Rose <jrose@digium.com>

Richard Mudgett <rmudgett@digium.com>

Bridge Media Channels

Definition in file chan_bridge_media.c.


Function Documentation

static void __reg_module ( void   )  [static]

Definition at line 221 of file chan_bridge_media.c.

static void __unreg_module ( void   )  [static]

Definition at line 221 of file chan_bridge_media.c.

static struct ast_channel * announce_request ( const char *  type,
struct ast_format_cap cap,
const struct ast_assigned_ids assignedids,
const struct ast_channel requestor,
const char *  data,
int *  cause 
) [static, read]

Definition at line 152 of file chan_bridge_media.c.

References media_request_helper().

00154 {
00155    return media_request_helper(cap, assignedids, requestor, data, &announce_tech, "announcer");
00156 }

static void cleanup_capabilities ( void   )  [static]

Definition at line 164 of file chan_bridge_media.c.

References ao2_ref, ast_channel_tech::capabilities, and NULL.

Referenced by load_module(), and unload_module().

00165 {
00166    if (announce_tech.capabilities) {
00167       ao2_ref(announce_tech.capabilities, -1);
00168       announce_tech.capabilities = NULL;
00169    }
00170 
00171    if (record_tech.capabilities) {
00172       ao2_ref(record_tech.capabilities, -1);
00173       record_tech.capabilities = NULL;
00174    }
00175 }

static int load_module ( void   )  [static]

static int media_call ( struct ast_channel chan,
const char *  addr,
int  timeout 
) [static]

Definition at line 44 of file chan_bridge_media.c.

00045 {
00046    /* ast_call() will fail unconditionally against channels provided by this driver */
00047    return -1;
00048 }

static int media_hangup ( struct ast_channel ast  )  [static]

Definition at line 50 of file chan_bridge_media.c.

References ao2_ref, ast_channel_tech_pvt(), and ast_unreal_hangup().

00051 {
00052    struct ast_unreal_pvt *p = ast_channel_tech_pvt(ast);
00053    int res;
00054 
00055    if (!p) {
00056       return -1;
00057    }
00058 
00059    /* Give the pvt a ref to fulfill calling requirements. */
00060    ao2_ref(p, +1);
00061    res = ast_unreal_hangup(p, ast);
00062    ao2_ref(p, -1);
00063 
00064    return res;
00065 }

static struct ast_channel* media_request_helper ( struct ast_format_cap cap,
const struct ast_assigned_ids assignedids,
const struct ast_channel requestor,
const char *  data,
struct ast_channel_tech tech,
const char *  role 
) [static, read]

Definition at line 117 of file chan_bridge_media.c.

References ao2_cleanup, ast_answer(), ast_channel_add_bridge_role(), ast_copy_string(), ast_hangup(), ast_read_threadstorage_callid(), ast_set_flag, AST_STATE_UP, ast_unreal_alloc(), ast_unreal_destructor(), ast_unreal_new_channels(), AST_UNREAL_NO_OPTIMIZATION, ast_channel::callid, NULL, and RAII_VAR.

Referenced by announce_request(), and record_request().

00119 {
00120    struct ast_channel *chan;
00121    ast_callid callid;
00122 
00123    RAII_VAR(struct ast_unreal_pvt *, pvt, NULL, ao2_cleanup);
00124 
00125    if (!(pvt = ast_unreal_alloc(sizeof(*pvt), ast_unreal_destructor, cap))) {
00126       return NULL;
00127    }
00128 
00129    ast_copy_string(pvt->name, data, sizeof(pvt->name));
00130 
00131    ast_set_flag(pvt, AST_UNREAL_NO_OPTIMIZATION);
00132 
00133    callid = ast_read_threadstorage_callid();
00134 
00135    chan = ast_unreal_new_channels(pvt, tech,
00136       AST_STATE_UP, AST_STATE_UP, NULL, NULL, assignedids, requestor, callid);
00137    if (!chan) {
00138       return NULL;
00139    }
00140 
00141    ast_answer(pvt->owner);
00142    ast_answer(pvt->chan);
00143 
00144    if (ast_channel_add_bridge_role(pvt->chan, role)) {
00145       ast_hangup(chan);
00146       return NULL;
00147    }
00148 
00149    return chan;
00150 }

static struct ast_channel * record_request ( const char *  type,
struct ast_format_cap cap,
const struct ast_assigned_ids assignedids,
const struct ast_channel requestor,
const char *  data,
int *  cause 
) [static, read]

Definition at line 158 of file chan_bridge_media.c.

References media_request_helper().

00160 {
00161    return media_request_helper(cap, assignedids, requestor, data, &record_tech, "recorder");
00162 }

static int unload_module ( void   )  [static]

Definition at line 177 of file chan_bridge_media.c.

References ast_channel_unregister(), and cleanup_capabilities().

00178 {
00179    ast_channel_unregister(&announce_tech);
00180    ast_channel_unregister(&record_tech);
00181    cleanup_capabilities();
00182    return 0;
00183 }


Variable Documentation

struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "Bridge Media Channel Driver" , .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, .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, } [static]

Definition at line 221 of file chan_bridge_media.c.

Definition at line 73 of file chan_bridge_media.c.

Definition at line 221 of file chan_bridge_media.c.

struct ast_channel_tech record_tech [static]

Definition at line 95 of file chan_bridge_media.c.


Generated on Thu Apr 16 06:29:31 2015 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6