[svn-commits] rmudgett: branch rmudgett/bridge_phase r388102 - in /team/rmudgett/bridge_pha...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Wed May 8 18:17:24 CDT 2013
Author: rmudgett
Date: Wed May 8 18:17:23 2013
New Revision: 388102
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=388102
Log:
Address mmichelson's review feedback.
* Added features parameter to ast_local_setup_bridge().
* Remove ast_ prefix from struct local_pvt.
Modified:
team/rmudgett/bridge_phase/include/asterisk/core_local.h
team/rmudgett/bridge_phase/main/core_local.c
Modified: team/rmudgett/bridge_phase/include/asterisk/core_local.h
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bridge_phase/include/asterisk/core_local.h?view=diff&rev=388102&r1=388101&r2=388102
==============================================================================
--- team/rmudgett/bridge_phase/include/asterisk/core_local.h (original)
+++ team/rmudgett/bridge_phase/include/asterisk/core_local.h Wed May 8 18:17:23 2013
@@ -99,7 +99,7 @@
* \brief struct ast_unreal_pvt destructor.
* \since 12.0.0
*
- * \param vdoomed Void ast_unreal_pvt to destroy.
+ * \param vdoomed Object to destroy.
*
* \return Nothing
*/
@@ -175,11 +175,16 @@
* \param ast Either channel of a local channel pair.
* \param bridge Bridge to join.
* \param swap Channel to swap with when joining.
+ * \param features Bridge features structure.
+ *
+ * \note The features parameter must be NULL or obtained by
+ * ast_bridge_features_new(). You must not dereference features
+ * after calling even if the call fails.
*
* \retval 0 on success.
* \retval -1 on error.
*/
-int ast_local_setup_bridge(struct ast_channel *ast, struct ast_bridge *bridge, struct ast_channel *swap);
+int ast_local_setup_bridge(struct ast_channel *ast, struct ast_bridge *bridge, struct ast_channel *swap, struct ast_bridge_features *features);
/*!
* \brief Setup the outgoing local channel to masquerade into a channel on ast_call().
Modified: team/rmudgett/bridge_phase/main/core_local.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bridge_phase/main/core_local.c?view=diff&rev=388102&r1=388101&r2=388102
==============================================================================
--- team/rmudgett/bridge_phase/main/core_local.c (original)
+++ team/rmudgett/bridge_phase/main/core_local.c Wed May 8 18:17:23 2013
@@ -126,6 +126,8 @@
struct ast_bridge *join;
/*! Channel to swap with when joining bridge. */
struct ast_channel *swap;
+ /*! Features that are specific to this channel when pushed into the bridge. */
+ struct ast_bridge_features *features;
};
/*!
@@ -133,9 +135,9 @@
*
* The local channel pvt has two ast_chan objects - the "owner" and the "next channel", the outbound channel
*
- * ast_chan owner -> ast_local_pvt -> ast_chan chan
+ * ast_chan owner -> local_pvt -> ast_chan chan
*/
-struct ast_local_pvt {
+struct local_pvt {
/*! Unreal channel driver base class values. */
struct ast_unreal_pvt base;
/*! Additional action arguments */
@@ -204,8 +206,8 @@
struct ast_channel *ast_local_get_peer(struct ast_channel *ast)
{
- struct ast_local_pvt *p = ast_channel_tech_pvt(ast);
- struct ast_local_pvt *found;
+ struct local_pvt *p = ast_channel_tech_pvt(ast);
+ struct local_pvt *found;
struct ast_channel *peer;
if (!p) {
@@ -300,7 +302,7 @@
char *exten = ast_strdupa(data);
char *context;
char *opts;
- struct ast_local_pvt *lp;
+ struct local_pvt *lp;
struct ao2_iterator it;
/* Strip options if they exist */
@@ -865,11 +867,11 @@
* \brief Post the LocalBridge AMI event.
* \since 12.0.0
*
- * \param p ast_local_pvt to rais the bridge event.
+ * \param p local_pvt to raise the bridge event.
*
* \return Nothing
*/
-static void local_bridge_event(struct ast_local_pvt *p)
+static void local_bridge_event(struct local_pvt *p)
{
ao2_lock(p);
/*** DOCUMENTATION
@@ -912,14 +914,15 @@
ao2_unlock(p);
}
-int ast_local_setup_bridge(struct ast_channel *ast, struct ast_bridge *bridge, struct ast_channel *swap)
-{
- struct ast_local_pvt *p;
- struct ast_local_pvt *found;
+int ast_local_setup_bridge(struct ast_channel *ast, struct ast_bridge *bridge, struct ast_channel *swap, struct ast_bridge_features *features)
+{
+ struct local_pvt *p;
+ struct local_pvt *found;
int res = -1;
/* Sanity checks. */
if (!ast || !bridge) {
+ ast_bridge_features_destroy(features);
return -1;
}
@@ -941,7 +944,10 @@
found->type = LOCAL_CALL_ACTION_BRIDGE;
found->action.bridge.join = bridge;
found->action.bridge.swap = swap;
+ found->action.bridge.features = features;
res = 0;
+ } else {
+ ast_bridge_features_destroy(features);
}
ao2_unlock(found);
ao2_ref(found, -1);
@@ -952,8 +958,8 @@
int ast_local_setup_masquerade(struct ast_channel *ast, struct ast_channel *masq)
{
- struct ast_local_pvt *p;
- struct ast_local_pvt *found;
+ struct local_pvt *p;
+ struct local_pvt *found;
int res = -1;
/* Sanity checks. */
@@ -988,7 +994,7 @@
* dest is the dial string */
static int local_call(struct ast_channel *ast, const char *dest, int timeout)
{
- struct ast_local_pvt *p = ast_channel_tech_pvt(ast);
+ struct local_pvt *p = ast_channel_tech_pvt(ast);
int pvt_locked = 0;
struct ast_channel *owner = NULL;
@@ -1061,11 +1067,12 @@
local_bridge_event(p);
ast_answer(chan);
res = ast_bridge_impart(p->action.bridge.join, chan, p->action.bridge.swap,
- NULL, 1);
+ p->action.bridge.features, 1);
ao2_ref(p->action.bridge.join, -1);
p->action.bridge.join = NULL;
ao2_cleanup(p->action.bridge.swap);
p->action.bridge.swap = NULL;
+ p->action.bridge.features = NULL;
break;
case LOCAL_CALL_ACTION_MASQUERADE:
local_bridge_event(p);
@@ -1201,7 +1208,7 @@
/*! \brief Hangup a call through the local proxy channel */
static int local_hangup(struct ast_channel *ast)
{
- struct ast_local_pvt *p = ast_channel_tech_pvt(ast);
+ struct local_pvt *p = ast_channel_tech_pvt(ast);
int res;
if (!p) {
@@ -1262,7 +1269,7 @@
/*!
* \internal
- * \brief struct ast_local_pvt destructor.
+ * \brief struct local_pvt destructor.
*
* \param vdoomed Object to destroy.
*
@@ -1270,7 +1277,7 @@
*/
static void local_pvt_destructor(void *vdoomed)
{
- struct ast_local_pvt *doomed = vdoomed;
+ struct local_pvt *doomed = vdoomed;
switch (doomed->type) {
case LOCAL_CALL_ACTION_DIALPLAN:
@@ -1278,6 +1285,7 @@
case LOCAL_CALL_ACTION_BRIDGE:
ao2_cleanup(doomed->action.bridge.join);
ao2_cleanup(doomed->action.bridge.swap);
+ ast_bridge_features_destroy(doomed->action.bridge.features);
break;
case LOCAL_CALL_ACTION_MASQUERADE:
ao2_cleanup(doomed->action.masq);
@@ -1287,14 +1295,14 @@
}
/*! \brief Create a call structure */
-static struct ast_local_pvt *local_alloc(const char *data, struct ast_format_cap *cap)
-{
- struct ast_local_pvt *pvt;
+static struct local_pvt *local_alloc(const char *data, struct ast_format_cap *cap)
+{
+ struct local_pvt *pvt;
char *parse;
char *context;
char *opts;
- pvt = (struct ast_local_pvt *) ast_unreal_alloc(sizeof(*pvt), local_pvt_destructor, cap);
+ pvt = (struct local_pvt *) ast_unreal_alloc(sizeof(*pvt), local_pvt_destructor, cap);
if (!pvt) {
return NULL;
}
@@ -1418,7 +1426,7 @@
/*! \brief Part of PBX interface */
static struct ast_channel *local_request(const char *type, struct ast_format_cap *cap, const struct ast_channel *requestor, const char *data, int *cause)
{
- struct ast_local_pvt *p;
+ struct local_pvt *p;
struct ast_channel *chan;
struct ast_callid *callid;
@@ -1444,7 +1452,7 @@
/*! \brief CLI command "local show channels" */
static char *locals_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
- struct ast_local_pvt *p;
+ struct local_pvt *p;
struct ao2_iterator it;
switch (cmd) {
@@ -1488,8 +1496,8 @@
static int manager_optimize_away(struct mansession *s, const struct message *m)
{
const char *channel;
- struct ast_local_pvt *p;
- struct ast_local_pvt *found;
+ struct local_pvt *p;
+ struct local_pvt *found;
struct ast_channel *chan;
channel = astman_get_header(m, "Channel");
@@ -1536,7 +1544,7 @@
*/
static void unreal_shutdown(void)
{
- struct ast_local_pvt *p;
+ struct local_pvt *p;
struct ao2_iterator it;
/* First, take us out of the channel loop */
More information about the svn-commits
mailing list