[svn-commits] mjordan: trunk r395367 - in /trunk: apps/ bridges/ funcs/ include/asterisk/ m...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Wed Jul 24 21:20:25 CDT 2013
Author: mjordan
Date: Wed Jul 24 21:20:23 2013
New Revision: 395367
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=395367
Log:
Move after bridge callbacks into their own file
One more major refactoring to go.
Added:
trunk/include/asterisk/bridging_after.h (with props)
trunk/main/bridging_after.c (with props)
Modified:
trunk/apps/app_agent_pool.c
trunk/apps/app_dial.c
trunk/apps/app_queue.c
trunk/bridges/bridge_builtin_features.c
trunk/bridges/bridge_builtin_interval_features.c
trunk/bridges/bridge_softmix.c
trunk/funcs/func_channel.c
trunk/include/asterisk/bridging.h
trunk/include/asterisk/bridging_channel.h
trunk/include/asterisk/bridging_channel_internal.h
trunk/include/asterisk/bridging_features.h
trunk/include/asterisk/bridging_internal.h
trunk/include/asterisk/bridging_technology.h
trunk/main/bridging.c
trunk/main/bridging_basic.c
trunk/main/bridging_channel.c
trunk/main/features.c
trunk/res/parking/parking_bridge_features.c
Modified: trunk/apps/app_agent_pool.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_agent_pool.c?view=diff&rev=395367&r1=395366&r2=395367
==============================================================================
--- trunk/apps/app_agent_pool.c (original)
+++ trunk/apps/app_agent_pool.c Wed Jul 24 21:20:23 2013
@@ -43,6 +43,7 @@
#include "asterisk/bridging.h"
#include "asterisk/bridging_internal.h"
#include "asterisk/bridging_basic.h"
+#include "asterisk/bridging_after.h"
#include "asterisk/config_options.h"
#include "asterisk/features_config.h"
#include "asterisk/astobj2.h"
@@ -1055,7 +1056,7 @@
if (!caller_bridge) {
/* Reset agent. */
- ast_bridge_channel_leave_bridge(bridge_channel, AST_BRIDGE_CHANNEL_STATE_END);
+ ast_bridge_channel_leave_bridge(bridge_channel, BRIDGE_CHANNEL_STATE_END);
return;
}
res = ast_bridge_move(caller_bridge, bridge_channel->bridge, bridge_channel->chan,
@@ -1063,7 +1064,7 @@
if (res) {
/* Reset agent. */
ast_bridge_destroy(caller_bridge);
- ast_bridge_channel_leave_bridge(bridge_channel, AST_BRIDGE_CHANNEL_STATE_END);
+ ast_bridge_channel_leave_bridge(bridge_channel, BRIDGE_CHANNEL_STATE_END);
return;
}
ast_bridge_channel_write_control_data(bridge_channel, AST_CONTROL_ANSWER, NULL, 0);
@@ -1159,13 +1160,13 @@
if (deferred_logoff) {
ast_debug(1, "Agent %s: Deferred logoff.\n", agent->username);
- ast_bridge_channel_leave_bridge(bridge_channel, AST_BRIDGE_CHANNEL_STATE_END);
+ ast_bridge_channel_leave_bridge(bridge_channel, BRIDGE_CHANNEL_STATE_END);
} else if (probation_timedout) {
ast_debug(1, "Agent %s: Login complete.\n", agent->username);
agent_devstate_changed(agent->username);
} else if (ack_timedout) {
ast_debug(1, "Agent %s: Ack call timeout.\n", agent->username);
- ast_bridge_channel_leave_bridge(bridge_channel, AST_BRIDGE_CHANNEL_STATE_END);
+ ast_bridge_channel_leave_bridge(bridge_channel, BRIDGE_CHANNEL_STATE_END);
} else if (wrapup_timedout) {
ast_debug(1, "Agent %s: Wrapup timeout. Ready for new call.\n", agent->username);
agent_devstate_changed(agent->username);
@@ -1175,7 +1176,7 @@
}
static void agent_after_bridge_cb(struct ast_channel *chan, void *data);
-static void agent_after_bridge_cb_failed(enum ast_after_bridge_cb_reason reason, void *data);
+static void agent_after_bridge_cb_failed(enum ast_bridge_after_cb_reason reason, void *data);
/*!
* \internal
@@ -1252,7 +1253,7 @@
}
if (swap) {
- res = ast_after_bridge_callback_set(chan, agent_after_bridge_cb,
+ res = ast_bridge_set_after_callback(chan, agent_after_bridge_cb,
agent_after_bridge_cb_failed, chan);
if (res) {
ast_channel_remove_bridge_role(chan, "holding_participant");
@@ -1270,7 +1271,7 @@
* agent will have some slightly different behavior in corner
* cases.
*/
- ast_bridge_channel_leave_bridge(bridge_channel, AST_BRIDGE_CHANNEL_STATE_END);
+ ast_bridge_channel_leave_bridge(bridge_channel, BRIDGE_CHANNEL_STATE_END);
return 0;
}
@@ -1620,7 +1621,7 @@
ao2_ref(agent, -1);
}
-static void agent_after_bridge_cb_failed(enum ast_after_bridge_cb_reason reason, void *data)
+static void agent_after_bridge_cb_failed(enum ast_bridge_after_cb_reason reason, void *data)
{
struct ast_channel *chan = data;
struct agent_pvt *agent;
@@ -1631,7 +1632,7 @@
}
ast_log(LOG_WARNING, "Agent %s: Forced logout. Lost control of %s because: %s\n",
agent->username, ast_channel_name(chan),
- ast_after_bridge_cb_reason_string(reason));
+ ast_bridge_after_cb_reason_string(reason));
agent_lock(agent);
agent_logout(agent);
ao2_ref(agent, -1);
@@ -1704,7 +1705,7 @@
}
/* Kick the agent out of the holding bridge to reset it. */
- ast_bridge_channel_leave_bridge_nolock(logged, AST_BRIDGE_CHANNEL_STATE_END);
+ ast_bridge_channel_leave_bridge_nolock(logged, BRIDGE_CHANNEL_STATE_END);
ast_bridge_channel_unlock(logged);
}
@@ -1714,7 +1715,7 @@
if (agent->state == AGENT_STATE_CALL_PRESENT) {
ast_verb(3, "Agent '%s' did not respond. Safety timeout.\n", agent->username);
- ast_bridge_channel_leave_bridge(bridge_channel, AST_BRIDGE_CHANNEL_STATE_END);
+ ast_bridge_channel_leave_bridge(bridge_channel, BRIDGE_CHANNEL_STATE_END);
caller_abort_agent(agent);
}
Modified: trunk/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_dial.c?view=diff&rev=395367&r1=395366&r2=395367
==============================================================================
--- trunk/apps/app_dial.c (original)
+++ trunk/apps/app_dial.c Wed Jul 24 21:20:23 2013
@@ -67,6 +67,7 @@
#include "asterisk/dial.h"
#include "asterisk/stasis_channels.h"
#include "asterisk/bridging.h"
+#include "asterisk/bridging_after.h"
#include "asterisk/features_config.h"
/*** DOCUMENTATION
@@ -201,7 +202,7 @@
<argument name="exten" required="false" />
<argument name="priority" required="true" />
<para>If the call is answered, transfer the calling party to
- the specified <replaceable>priority</replaceable> and the called party to the specified
+ the specified <replaceable>priority</replaceable> and the called party to the specified
<replaceable>priority</replaceable> plus one.</para>
<note>
<para>You cannot use any additional action post answer options in conjunction with this option.</para>
@@ -290,7 +291,7 @@
<argument name="arg" multiple="true">
<para>Macro arguments</para>
</argument>
- <para>Execute the specified <replaceable>macro</replaceable> for the <emphasis>called</emphasis> channel
+ <para>Execute the specified <replaceable>macro</replaceable> for the <emphasis>called</emphasis> channel
before connecting to the calling channel. Arguments can be specified to the Macro
using <literal>^</literal> as a delimiter. The macro can set the variable
<variable>MACRO_RESULT</variable> to specify the following actions after the macro is
@@ -332,7 +333,7 @@
<para>With <replaceable>delete</replaceable> set to <literal>1</literal>, the introduction will
always be deleted.</para>
</argument>
- <para>This option is a modifier for the call screening/privacy mode. (See the
+ <para>This option is a modifier for the call screening/privacy mode. (See the
<literal>p</literal> and <literal>P</literal> options.) It specifies
that no introductions are to be saved in the <directory>priv-callerintros</directory>
directory.</para>
@@ -353,7 +354,7 @@
<argument name="mode">
<para>With <replaceable>mode</replaceable> either not specified or set to <literal>1</literal>,
the originator hanging up will cause the phone to ring back immediately.</para>
- <para>With <replaceable>mode</replaceable> set to <literal>2</literal>, when the operator
+ <para>With <replaceable>mode</replaceable> set to <literal>2</literal>, when the operator
flashes the trunk, it will ring their phone back.</para>
</argument>
<para>Enables <emphasis>operator services</emphasis> mode. This option only
@@ -1071,7 +1072,7 @@
/* If we are calling a single channel, and not providing ringback or music, */
/* then, make them compatible for in-band tone purpose */
if (ast_channel_make_compatible(outgoing->chan, in) < 0) {
- /* If these channels can not be made compatible,
+ /* If these channels can not be made compatible,
* there is no point in continuing. The bridge
* will just fail if it gets that far.
*/
@@ -1765,7 +1766,7 @@
/*! \page DialPrivacy Dial Privacy scripts
* \par priv-callee-options script:
- * \li Dial 1 if you wish this caller to reach you directly in the future,
+ * \li Dial 1 if you wish this caller to reach you directly in the future,
* and immediately connect to their incoming call.
* \li Dial 2 if you wish to send this caller to voicemail now and forevermore.
* \li Dial 3 to send this caller to the torture menus, now and forevermore.
@@ -1891,7 +1892,7 @@
} else if (ast_test_flag64(opts, OPT_SCREEN_NOCALLERID) && strncmp(pa->privcid, "NOCALLERID", 10) == 0) {
ast_verb(3, "CallerID blank; N option set; Screening should happen; dbval is %d\n", pa->privdb_val);
}
-
+
if (pa->privdb_val == AST_PRIVACY_DENY) {
ast_verb(3, "Privacy DB reports PRIVACY_DENY for this callerid. Dial reports unavailable\n");
ast_copy_string(pa->status, "NOANSWER", sizeof(pa->status));
@@ -2021,14 +2022,14 @@
ast_channel_lock(chan);
context = ast_strdupa(ast_channel_context(chan));
ast_channel_unlock(chan);
- ast_after_bridge_set_h(peer, context);
+ ast_bridge_set_after_h(peer, context);
} else if (ast_test_flag64(opts, OPT_CALLEE_GO_ON)) {
ast_channel_lock(chan);
context = ast_strdupa(ast_channel_context(chan));
extension = ast_strdupa(ast_channel_exten(chan));
priority = ast_channel_priority(chan);
ast_channel_unlock(chan);
- ast_after_bridge_set_go_on(peer, context, extension, priority,
+ ast_bridge_set_after_go_on(peer, context, extension, priority,
opt_args[OPT_ARG_CALLEE_GO_ON]);
}
}
@@ -2444,7 +2445,7 @@
/* We are on the only destination. */
ast_rtp_instance_early_bridge_make_compatible(tc, chan);
}
-
+
/* Inherit specially named variables from parent channel */
ast_channel_inherit_variables(chan, tc);
ast_channel_datastore_inherit(chan, tc);
@@ -2698,7 +2699,7 @@
/* If appropriate, log that we have a destination channel and set the answer time */
if (ast_channel_name(peer))
pbx_builtin_setvar_helper(chan, "DIALEDPEERNAME", ast_channel_name(peer));
-
+
ast_channel_lock(peer);
number = pbx_builtin_getvar_helper(peer, "DIALEDPEERNUMBER");
if (ast_strlen_zero(number)) {
@@ -2967,7 +2968,7 @@
ast_channel_hangupcause_set(chan, ast_channel_hangupcause(peer));
}
setup_peer_after_bridge_goto(chan, peer, &opts, opt_args);
- if (ast_after_bridge_goto_setup(peer)
+ if (ast_bridge_setup_after_goto(peer)
|| ast_pbx_start(peer)) {
ast_autoservice_chan_hangup_peer(chan, peer);
}
@@ -2997,7 +2998,7 @@
config.end_bridge_callback = end_bridge_callback;
config.end_bridge_callback_data = chan;
config.end_bridge_callback_data_fixup = end_bridge_callback_data_fixup;
-
+
if (moh) {
moh = 0;
ast_moh_stop(chan);
Modified: trunk/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_queue.c?view=diff&rev=395367&r1=395366&r2=395367
==============================================================================
--- trunk/apps/app_queue.c (original)
+++ trunk/apps/app_queue.c Wed Jul 24 21:20:23 2013
@@ -109,6 +109,7 @@
#include "asterisk/stasis_channels.h"
#include "asterisk/stasis_message_router.h"
#include "asterisk/bridging.h"
+#include "asterisk/bridging_after.h"
/* Define, to debug reference counts on queues, without debugging reference counts on queue members */
/* #define REF_DEBUG_ONLY_QUEUES */
@@ -5293,7 +5294,7 @@
extension = ast_strdupa(ast_channel_exten(chan));
priority = ast_channel_priority(chan);
ast_channel_unlock(chan);
- ast_after_bridge_set_go_on(peer, context, extension, priority,
+ ast_bridge_set_after_go_on(peer, context, extension, priority,
opt_args[OPT_ARG_CALLEE_GO_ON]);
}
}
Modified: trunk/bridges/bridge_builtin_features.c
URL: http://svnview.digium.com/svn/asterisk/trunk/bridges/bridge_builtin_features.c?view=diff&rev=395367&r1=395366&r2=395367
==============================================================================
--- trunk/bridges/bridge_builtin_features.c (original)
+++ trunk/bridges/bridge_builtin_features.c Wed Jul 24 21:20:23 2013
@@ -483,7 +483,7 @@
* bridge_channel to force the channel out of the bridge and the
* core takes care of the rest.
*/
- ast_bridge_channel_leave_bridge(bridge_channel, AST_BRIDGE_CHANNEL_STATE_END);
+ ast_bridge_channel_leave_bridge(bridge_channel, BRIDGE_CHANNEL_STATE_END);
return 0;
}
Modified: trunk/bridges/bridge_builtin_interval_features.c
URL: http://svnview.digium.com/svn/asterisk/trunk/bridges/bridge_builtin_interval_features.c?view=diff&rev=395367&r1=395366&r2=395367
==============================================================================
--- trunk/bridges/bridge_builtin_interval_features.c (original)
+++ trunk/bridges/bridge_builtin_interval_features.c Wed Jul 24 21:20:23 2013
@@ -58,7 +58,7 @@
ast_stream_and_wait(bridge_channel->chan, limits->duration_sound, AST_DIGIT_NONE);
}
- ast_bridge_channel_leave_bridge(bridge_channel, AST_BRIDGE_CHANNEL_STATE_END);
+ ast_bridge_channel_leave_bridge(bridge_channel, BRIDGE_CHANNEL_STATE_END);
ast_test_suite_event_notify("BRIDGE_TIMELIMIT", "Channel1: %s", ast_channel_name(bridge_channel->chan));
return -1;
@@ -114,7 +114,7 @@
{
struct ast_bridge_features_limits *limits = hook_pvt;
- if (bridge_channel->state != AST_BRIDGE_CHANNEL_STATE_WAIT) {
+ if (bridge_channel->state != BRIDGE_CHANNEL_STATE_WAIT) {
return -1;
}
@@ -126,7 +126,7 @@
{
struct ast_bridge_features_limits *limits = hook_pvt;
- if (bridge_channel->state == AST_BRIDGE_CHANNEL_STATE_WAIT) {
+ if (bridge_channel->state == BRIDGE_CHANNEL_STATE_WAIT) {
/* If we aren't in the wait state, something more important than this warning is happening and we should skip it. */
limits_interval_playback(bridge, bridge_channel, limits, limits->warning_sound);
}
Modified: trunk/bridges/bridge_softmix.c
URL: http://svnview.digium.com/svn/asterisk/trunk/bridges/bridge_softmix.c?view=diff&rev=395367&r1=395366&r2=395367
==============================================================================
--- trunk/bridges/bridge_softmix.c (original)
+++ trunk/bridges/bridge_softmix.c Wed Jul 24 21:20:23 2013
@@ -576,7 +576,7 @@
ast_mutex_unlock(&sc->lock);
if (update_talking != -1) {
- ast_bridge_notify_talking(bridge_channel, update_talking);
+ ast_bridge_channel_notify_talking(bridge_channel, update_talking);
}
}
Modified: trunk/funcs/func_channel.c
URL: http://svnview.digium.com/svn/asterisk/trunk/funcs/func_channel.c?view=diff&rev=395367&r1=395366&r2=395367
==============================================================================
--- trunk/funcs/func_channel.c (original)
+++ trunk/funcs/func_channel.c Wed Jul 24 21:20:23 2013
@@ -45,6 +45,7 @@
#include "asterisk/stringfields.h"
#include "asterisk/global_datastores.h"
#include "asterisk/bridging_basic.h"
+#include "asterisk/bridging_after.h"
/*** DOCUMENTATION
<function name="CHANNELS" language="en_US">
@@ -531,7 +532,7 @@
locked_copy_string(chan, buf, ast_print_namedgroups(&tmp_str, ast_channel_named_pickupgroups(chan)), len);
} else if (!strcasecmp(data, "after_bridge_goto")) {
- ast_after_bridge_goto_read(chan, buf, len);
+ ast_bridge_read_after_goto(chan, buf, len);
} else if (!strcasecmp(data, "amaflags")) {
ast_channel_lock(chan);
snprintf(buf, len, "%d", ast_channel_amaflags(chan));
@@ -575,9 +576,9 @@
locked_string_field_set(chan, userfield, value);
else if (!strcasecmp(data, "after_bridge_goto")) {
if (ast_strlen_zero(value)) {
- ast_after_bridge_goto_discard(chan);
+ ast_bridge_discard_after_goto(chan);
} else {
- ast_after_bridge_set_go_on(chan, ast_channel_context(chan), ast_channel_exten(chan), ast_channel_priority(chan), value);
+ ast_bridge_set_after_go_on(chan, ast_channel_context(chan), ast_channel_exten(chan), ast_channel_priority(chan), value);
}
} else if (!strcasecmp(data, "amaflags")) {
ast_channel_lock(chan);
Modified: trunk/include/asterisk/bridging.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/bridging.h?view=diff&rev=395367&r1=395366&r2=395367
==============================================================================
--- trunk/include/asterisk/bridging.h (original)
+++ trunk/include/asterisk/bridging.h Wed Jul 24 21:20:23 2013
@@ -447,7 +447,7 @@
* If channel specific features are enabled a pointer to the features structure
* can be specified in the features parameter.
*/
-enum ast_bridge_channel_state ast_bridge_join(struct ast_bridge *bridge,
+enum bridge_channel_state ast_bridge_join(struct ast_bridge *bridge,
struct ast_channel *chan,
struct ast_channel *swap,
struct ast_bridge_features *features,
@@ -884,202 +884,6 @@
*/
enum ast_transfer_result ast_bridge_transfer_attended(struct ast_channel *to_transferee,
struct ast_channel *to_transfer_target);
-/*!
- * \brief Set channel to goto specific location after the bridge.
- * \since 12.0.0
- *
- * \param chan Channel to setup after bridge goto location.
- * \param context Context to goto after bridge.
- * \param exten Exten to goto after bridge.
- * \param priority Priority to goto after bridge.
- *
- * \note chan is locked by this function.
- *
- * \details Add a channel datastore to setup the goto location
- * when the channel leaves the bridge and run a PBX from there.
- *
- * \return Nothing
- */
-void ast_after_bridge_set_goto(struct ast_channel *chan, const char *context, const char *exten, int priority);
-
-/*!
- * \brief Set channel to run the h exten after the bridge.
- * \since 12.0.0
- *
- * \param chan Channel to setup after bridge goto location.
- * \param context Context to goto after bridge.
- *
- * \note chan is locked by this function.
- *
- * \details Add a channel datastore to setup the goto location
- * when the channel leaves the bridge and run a PBX from there.
- *
- * \return Nothing
- */
-void ast_after_bridge_set_h(struct ast_channel *chan, const char *context);
-
-/*!
- * \brief Set channel to go on in the dialplan after the bridge.
- * \since 12.0.0
- *
- * \param chan Channel to setup after bridge goto location.
- * \param context Current context of the caller channel.
- * \param exten Current exten of the caller channel.
- * \param priority Current priority of the caller channel
- * \param parseable_goto User specified goto string from dialplan.
- *
- * \note chan is locked by this function.
- *
- * \details Add a channel datastore to setup the goto location
- * when the channel leaves the bridge and run a PBX from there.
- *
- * If parseable_goto then use the given context/exten/priority
- * as the relative position for the parseable_goto.
- * Else goto the given context/exten/priority+1.
- *
- * \return Nothing
- */
-void ast_after_bridge_set_go_on(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *parseable_goto);
-
-/*!
- * \brief Setup any after bridge goto location to begin execution.
- * \since 12.0.0
- *
- * \param chan Channel to setup after bridge goto location.
- *
- * \note chan is locked by this function.
- *
- * \details Pull off any after bridge goto location datastore and
- * setup for dialplan execution there.
- *
- * \retval 0 on success. The goto location is set for a PBX to run it.
- * \retval non-zero on error or no goto location.
- *
- * \note If the after bridge goto is set to run an h exten it is
- * run here immediately.
- */
-int ast_after_bridge_goto_setup(struct ast_channel *chan);
-
-/*!
- * \brief Run a PBX on any after bridge goto location.
- * \since 12.0.0
- *
- * \param chan Channel to execute after bridge goto location.
- *
- * \note chan is locked by this function.
- *
- * \details Pull off any after bridge goto location datastore
- * and run a PBX at that location.
- *
- * \note On return, the chan pointer is no longer valid because
- * the channel has hung up.
- *
- * \return Nothing
- */
-void ast_after_bridge_goto_run(struct ast_channel *chan);
-
-/*!
- * \brief Discard channel after bridge goto location.
- * \since 12.0.0
- *
- * \param chan Channel to discard after bridge goto location.
- *
- * \note chan is locked by this function.
- *
- * \return Nothing
- */
-void ast_after_bridge_goto_discard(struct ast_channel *chan);
-
-/*!
- * \brief Read after bridge goto if it exists
- * \since 12.0.0
- *
- * \param chan Channel to read the after bridge goto parseable goto string from
- * \param buffer Buffer to write the after bridge goto data to
- * \param buf_size size of the buffer being written to
- */
-void ast_after_bridge_goto_read(struct ast_channel *chan, char *buffer, size_t buf_size);
-
-/*! Reason the the after bridge callback will not be called. */
-enum ast_after_bridge_cb_reason {
- /*! The datastore is being destroyed. Likely due to hangup. (Enum value must be zero.) */
- AST_AFTER_BRIDGE_CB_REASON_DESTROY,
- /*! Something else replaced the callback with another. */
- AST_AFTER_BRIDGE_CB_REASON_REPLACED,
- /*! The callback was removed because of a masquerade. (fixup) */
- AST_AFTER_BRIDGE_CB_REASON_MASQUERADE,
- /*! The channel was departed from the bridge. */
- AST_AFTER_BRIDGE_CB_REASON_DEPART,
- /*! Was explicitly removed by external code. */
- AST_AFTER_BRIDGE_CB_REASON_REMOVED,
-};
-
-/*!
- * \brief After bridge callback failed.
- * \since 12.0.0
- *
- * \param reason Reason callback is failing.
- * \param data Extra data what setup the callback wanted to pass.
- *
- * \note Called when the channel leaves the bridging system or
- * is destroyed.
- *
- * \return Nothing
- */
-typedef void (*ast_after_bridge_cb_failed)(enum ast_after_bridge_cb_reason reason, void *data);
-
-/*!
- * \brief After bridge callback function.
- * \since 12.0.0
- *
- * \param chan Channel just leaving bridging system.
- * \param data Extra data what setup the callback wanted to pass.
- *
- * \return Nothing
- */
-typedef void (*ast_after_bridge_cb)(struct ast_channel *chan, void *data);
-
-/*!
- * \brief Discard channel after bridge callback.
- * \since 12.0.0
- *
- * \param chan Channel to discard after bridge callback.
- * \param reason Why are we doing this.
- *
- * \note chan is locked by this function.
- *
- * \return Nothing
- */
-void ast_after_bridge_callback_discard(struct ast_channel *chan, enum ast_after_bridge_cb_reason reason);
-
-/*!
- * \brief Setup an after bridge callback for when the channel leaves the bridging system.
- * \since 12.0.0
- *
- * \param chan Channel to setup an after bridge callback on.
- * \param callback Function to call when the channel leaves the bridging system.
- * \param failed Function to call when it will not be calling the callback.
- * \param data Extra data to pass with the callback.
- *
- * \note chan is locked by this function.
- *
- * \note failed is called when the channel leaves the bridging
- * system or is destroyed.
- *
- * \retval 0 on success.
- * \retval -1 on error.
- */
-int ast_after_bridge_callback_set(struct ast_channel *chan, ast_after_bridge_cb callback, ast_after_bridge_cb_failed failed, void *data);
-
-/*!
- * \brief Get a string representation of an after bridge callback reason
- * \since 12.0.0
- *
- * \param reason The reason to interpret to a string
- * \retval NULL Unrecognized reason
- * \retval non-NULL String representation of reason
- */
-const char *ast_after_bridge_cb_reason_string(enum ast_after_bridge_cb_reason reason);
/*!
* \brief Get a container of all channels in the bridge
Added: trunk/include/asterisk/bridging_after.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/bridging_after.h?view=auto&rev=395367
==============================================================================
--- trunk/include/asterisk/bridging_after.h (added)
+++ trunk/include/asterisk/bridging_after.h Wed Jul 24 21:20:23 2013
@@ -1,0 +1,244 @@
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) 2013 Digium, Inc.
+ *
+ * Richard Mudgett <rmudgett at digium.com>
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+/*!
+ * \file
+ * \brief After Bridge Execution API
+ *
+ * \author Richard Mudgett <rmudgett at digium.com>
+ *
+ * See Also:
+ * \arg \ref AstCREDITS
+ */
+
+#ifndef _ASTERISK_BRIDGING_AFTER_H
+#define _ASTERISK_BRIDGING_AFTER_H
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+/*! Reason the the after bridge callback will not be called. */
+enum ast_bridge_after_cb_reason {
+ /*! The datastore is being destroyed. Likely due to hangup. (Enum value must be zero.) */
+ AST_BRIDGE_AFTER_CB_REASON_DESTROY,
+ /*! Something else replaced the callback with another. */
+ AST_BRIDGE_AFTER_CB_REASON_REPLACED,
+ /*! The callback was removed because of a masquerade. (fixup) */
+ AST_BRIDGE_AFTER_CB_REASON_MASQUERADE,
+ /*! The channel was departed from the bridge. */
+ AST_BRIDGE_AFTER_CB_REASON_DEPART,
+ /*! Was explicitly removed by external code. */
+ AST_BRIDGE_AFTER_CB_REASON_REMOVED,
+};
+
+/*!
+ * \brief Set channel to goto specific location after the bridge.
+ * \since 12.0.0
+ *
+ * \param chan Channel to setup after bridge goto location.
+ * \param context Context to goto after bridge.
+ * \param exten Exten to goto after bridge.
+ * \param priority Priority to goto after bridge.
+ *
+ * \note chan is locked by this function.
+ *
+ * \details Add a channel datastore to setup the goto location
+ * when the channel leaves the bridge and run a PBX from there.
+ *
+ * \return Nothing
+ */
+void ast_bridge_set_after_goto(struct ast_channel *chan, const char *context, const char *exten, int priority);
+
+/*!
+ * \brief Set channel to run the h exten after the bridge.
+ * \since 12.0.0
+ *
+ * \param chan Channel to setup after bridge goto location.
+ * \param context Context to goto after bridge.
+ *
+ * \note chan is locked by this function.
+ *
+ * \details Add a channel datastore to setup the goto location
+ * when the channel leaves the bridge and run a PBX from there.
+ *
+ * \return Nothing
+ */
+void ast_bridge_set_after_h(struct ast_channel *chan, const char *context);
+
+/*!
+ * \brief Set channel to go on in the dialplan after the bridge.
+ * \since 12.0.0
+ *
+ * \param chan Channel to setup after bridge goto location.
+ * \param context Current context of the caller channel.
+ * \param exten Current exten of the caller channel.
+ * \param priority Current priority of the caller channel
+ * \param parseable_goto User specified goto string from dialplan.
+ *
+ * \note chan is locked by this function.
+ *
+ * \details Add a channel datastore to setup the goto location
+ * when the channel leaves the bridge and run a PBX from there.
+ *
+ * If parseable_goto then use the given context/exten/priority
+ * as the relative position for the parseable_goto.
+ * Else goto the given context/exten/priority+1.
+ *
+ * \return Nothing
+ */
+void ast_bridge_set_after_go_on(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *parseable_goto);
+
+/*!
+ * \brief Setup any after bridge goto location to begin execution.
+ * \since 12.0.0
+ *
+ * \param chan Channel to setup after bridge goto location.
+ *
+ * \note chan is locked by this function.
+ *
+ * \details Pull off any after bridge goto location datastore and
+ * setup for dialplan execution there.
+ *
+ * \retval 0 on success. The goto location is set for a PBX to run it.
+ * \retval non-zero on error or no goto location.
+ *
+ * \note If the after bridge goto is set to run an h exten it is
+ * run here immediately.
+ */
+int ast_bridge_setup_after_goto(struct ast_channel *chan);
+
+/*!
+ * \brief Run any after bridge callback.
+ * \since 12.0.0
+ *
+ * \param chan Channel to run after bridge callback.
+ *
+ * \return Nothing
+ */
+void ast_bridge_run_after_callback(struct ast_channel *chan);
+
+/*!
+ * \brief Run discarding any after bridge callbacks.
+ * \since 12.0.0
+ *
+ * \param chan Channel to run after bridge callback.
+ *
+ * \return Nothing
+ */
+void ast_bridge_discard_after_callback(struct ast_channel *chan, enum ast_bridge_after_cb_reason reason);
+
+/*!
+ * \brief Run a PBX on any after bridge goto location.
+ * \since 12.0.0
+ *
+ * \param chan Channel to execute after bridge goto location.
+ *
+ * \note chan is locked by this function.
+ *
+ * \details Pull off any after bridge goto location datastore
+ * and run a PBX at that location.
+ *
+ * \note On return, the chan pointer is no longer valid because
+ * the channel has hung up.
+ *
+ * \return Nothing
+ */
+void ast_bridge_run_after_goto(struct ast_channel *chan);
+
+/*!
+ * \brief Discard channel after bridge goto location.
+ * \since 12.0.0
+ *
+ * \param chan Channel to discard after bridge goto location.
+ *
+ * \note chan is locked by this function.
+ *
+ * \return Nothing
+ */
+void ast_bridge_discard_after_goto(struct ast_channel *chan);
+
+/*!
+ * \brief Read after bridge goto if it exists
+ * \since 12.0.0
+ *
+ * \param chan Channel to read the after bridge goto parseable goto string from
+ * \param buffer Buffer to write the after bridge goto data to
+ * \param buf_size size of the buffer being written to
+ */
+void ast_bridge_read_after_goto(struct ast_channel *chan, char *buffer, size_t buf_size);
+
+/*!
+ * \brief After bridge callback failed.
+ * \since 12.0.0
+ *
+ * \param reason Reason callback is failing.
+ * \param data Extra data what setup the callback wanted to pass.
+ *
+ * \note Called when the channel leaves the bridging system or
+ * is destroyed.
+ *
+ * \return Nothing
+ */
+typedef void (*ast_bridge_after_cb_failed)(enum ast_bridge_after_cb_reason reason, void *data);
+
+/*!
+ * \brief After bridge callback function.
+ * \since 12.0.0
+ *
+ * \param chan Channel just leaving bridging system.
+ * \param data Extra data what setup the callback wanted to pass.
+ *
+ * \return Nothing
+ */
+typedef void (*ast_bridge_after_cb)(struct ast_channel *chan, void *data);
+
+/*!
+ * \brief Setup an after bridge callback for when the channel leaves the bridging system.
+ * \since 12.0.0
+ *
+ * \param chan Channel to setup an after bridge callback on.
+ * \param callback Function to call when the channel leaves the bridging system.
+ * \param failed Function to call when it will not be calling the callback.
+ * \param data Extra data to pass with the callback.
+ *
+ * \note chan is locked by this function.
+ *
+ * \note failed is called when the channel leaves the bridging
+ * system or is destroyed.
+ *
+ * \retval 0 on success.
+ * \retval -1 on error.
+ */
+int ast_bridge_set_after_callback(struct ast_channel *chan, ast_bridge_after_cb callback, ast_bridge_after_cb_failed failed, void *data);
+
+/*!
+ * \brief Get a string representation of an after bridge callback reason
+ * \since 12.0.0
+ *
+ * \param reason The reason to interpret to a string
+ * \retval NULL Unrecognized reason
+ * \retval non-NULL String representation of reason
+ */
+const char *ast_bridge_after_cb_reason_string(enum ast_bridge_after_cb_reason reason);
+
+#if defined(__cplusplus) || defined(c_plusplus)
+}
+#endif
+
+#endif /* _ASTERISK_BRIDGING_H */
Propchange: trunk/include/asterisk/bridging_after.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: trunk/include/asterisk/bridging_after.h
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: trunk/include/asterisk/bridging_after.h
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: trunk/include/asterisk/bridging_channel.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/bridging_channel.h?view=diff&rev=395367&r1=395366&r2=395367
==============================================================================
--- trunk/include/asterisk/bridging_channel.h (original)
+++ trunk/include/asterisk/bridging_channel.h Wed Jul 24 21:20:23 2013
@@ -20,29 +20,29 @@
/*!
* \file
- * \brief Bridging Channel API
+ * \page AstBridgeChannel Bridging Channel API
*
* An API that act on a channel in a bridge. Note that while the
* \ref ast_bridge_channel is owned by a channel, it should only be used
* by members of the bridging system. The only places where this API should
* be used is:
- * - The \ref AstBridging API itself
- * - Bridge mixing technologies
- * - Bridge sub-classes
+ * \arg \ref AstBridging API itself
+ * \arg Bridge mixing technologies
+ * \arg Bridge sub-classes
*
* In general, anywhere else it is unsafe to use this API. Care should be
* taken when using this API to ensure that the locking order remains
* correct. The locking order must be:
- * - The \ref ast_bridge
- * - The \ref ast_bridge_channel
- * - The \ref ast_channel
+ * \arg The \ref \c ast_bridge
+ * \arg The \ref \c ast_bridge_channel
+ * \arg The \ref \c ast_channel
*
* \author Joshua Colp <jcolp at digium.com>
* \author Richard Mudgett <rmudgett at digium.com>
* \author Matt Jordan <mjordan at digium.com>
*
* See Also:
- * \ref bridging.h
+ * \arg \ref AstBridging
* \arg \ref AstCREDITS
*/
@@ -56,22 +56,22 @@
#include "asterisk/bridging_technology.h"
/*! \brief State information about a bridged channel */
-enum ast_bridge_channel_state {
+enum bridge_channel_state {
/*! Waiting for a signal (Channel in the bridge) */
- AST_BRIDGE_CHANNEL_STATE_WAIT = 0,
+ BRIDGE_CHANNEL_STATE_WAIT = 0,
/*! Bridged channel was forced out and should be hung up (Bridge may dissolve.) */
- AST_BRIDGE_CHANNEL_STATE_END,
+ BRIDGE_CHANNEL_STATE_END,
/*! Bridged channel was forced out. Don't dissolve the bridge regardless */
- AST_BRIDGE_CHANNEL_STATE_END_NO_DISSOLVE,
+ BRIDGE_CHANNEL_STATE_END_NO_DISSOLVE,
};
-enum ast_bridge_channel_thread_state {
+enum bridge_channel_thread_state {
/*! Bridge channel thread is idle/waiting. */
- AST_BRIDGE_CHANNEL_THREAD_IDLE,
+ BRIDGE_CHANNEL_THREAD_IDLE,
/*! Bridge channel thread is writing a normal/simple frame. */
- AST_BRIDGE_CHANNEL_THREAD_SIMPLE,
+ BRIDGE_CHANNEL_THREAD_SIMPLE,
/*! Bridge channel thread is processing a frame. */
- AST_BRIDGE_CHANNEL_THREAD_FRAME,
+ BRIDGE_CHANNEL_THREAD_FRAME,
};
struct ast_bridge;
@@ -85,7 +85,7 @@
/*! Condition, used if we want to wake up a thread waiting on the bridged channel */
ast_cond_t cond;
/*! Current bridged channel state */
- enum ast_bridge_channel_state state;
+ enum bridge_channel_state state;
/*! Asterisk channel participating in the bridge */
struct ast_channel *chan;
/*! Asterisk channel we are swapping with (if swapping) */
@@ -154,7 +154,7 @@
*
* \note Needs to be atomically settable.
*/
- enum ast_bridge_channel_thread_state activity;
+ enum bridge_channel_thread_state activity;
};
/*!
@@ -217,6 +217,24 @@
void ast_bridge_channel_lock_bridge(struct ast_bridge_channel *bridge_channel);
/*!
+ * \brief Lets the bridging indicate when a bridge channel has stopped or started talking.
+ *
+ * \note All DSP functionality on the bridge has been pushed down to the lowest possible
+ * layer, which in this case is the specific bridging technology being used. Since it
+ * is necessary for the knowledge of which channels are talking to make its way up to the
+ * application, this function has been created to allow the bridging technology to communicate
+ * that information with the bridging core.
+ *
+ * \param bridge_channel The bridge channel that has either started or stopped talking.
+ * \param started_talking set to 1 when this indicates the channel has started talking set to 0
+ * when this indicates the channel has stopped talking.
+ *
+ * \retval 0 on success.
+ * \retval -1 on error.
+ */
+int ast_bridge_channel_notify_talking(struct ast_bridge_channel *bridge_channel, int started_talking);
+
+/*!
* \brief Set bridge channel state to leave bridge (if not leaving already).
*
* \param bridge_channel Channel to change the state on
@@ -225,14 +243,14 @@
* Example usage:
*
* \code
- * ast_bridge_channel_leave_bridge(bridge_channel, AST_BRIDGE_CHANNEL_STATE_END);
+ * ast_bridge_channel_leave_bridge(bridge_channel, BRIDGE_CHANNEL_STATE_END);
* \endcode
*
* This places the channel pointed to by bridge_channel into the
- * state AST_BRIDGE_CHANNEL_STATE_END if it was
- * AST_BRIDGE_CHANNEL_STATE_WAIT before.
- */
-void ast_bridge_channel_leave_bridge(struct ast_bridge_channel *bridge_channel, enum ast_bridge_channel_state new_state);
+ * state BRIDGE_CHANNEL_STATE_END if it was
+ * BRIDGE_CHANNEL_STATE_WAIT before.
+ */
+void ast_bridge_channel_leave_bridge(struct ast_bridge_channel *bridge_channel, enum bridge_channel_state new_state);
/*!
* \brief Set bridge channel state to leave bridge (if not leaving already).
@@ -243,14 +261,82 @@
* Example usage:
*
* \code
- * ast_bridge_channel_leave_bridge(bridge_channel, AST_BRIDGE_CHANNEL_STATE_END);
+ * ast_bridge_channel_leave_bridge(bridge_channel, BRIDGE_CHANNEL_STATE_END);
* \endcode
*
* This places the channel pointed to by bridge_channel into the
- * state AST_BRIDGE_CHANNEL_STATE_END if it was
- * AST_BRIDGE_CHANNEL_STATE_WAIT before.
- */
-void ast_bridge_channel_leave_bridge_nolock(struct ast_bridge_channel *bridge_channel, enum ast_bridge_channel_state new_state);
+ * state BRIDGE_CHANNEL_STATE_END if it was
+ * BRIDGE_CHANNEL_STATE_WAIT before.
+ */
+void ast_bridge_channel_leave_bridge_nolock(struct ast_bridge_channel *bridge_channel, enum bridge_channel_state new_state);
+
+/*!
+ * \brief Get the peer bridge channel of a two party bridge.
+ * \since 12.0.0
+ *
+ * \param bridge_channel What to get the peer of.
+ *
+ * \note On entry, bridge_channel->bridge is already locked.
+ *
+ * \note This is an internal bridge function.
+ *
+ * \retval peer on success.
+ * \retval NULL no peer channel.
+ */
+struct ast_bridge_channel *ast_bridge_channel_peer(struct ast_bridge_channel *bridge_channel);
+
+/*!
+ * \brief Restore the formats of a bridge channel's channel to how they were before bridge_channel_internal_join
+ * \since 12.0.0
+ *
+ * \param bridge_channel Channel to restore
+ */
+void ast_bridge_channel_restore_formats(struct ast_bridge_channel *bridge_channel);
+
+/*!
+ * \brief Adjust the bridge_channel's bridge merge inhibit request count.
+ * \since 12.0.0
+ *
+ * \param bridge_channel What to operate on.
+ * \param request Inhibit request increment.
+ * (Positive to add requests. Negative to remove requests.)
+ *
+ * \note This API call is meant for internal bridging operations.
+ *
+ * \retval bridge adjusted merge inhibit with reference count.
+ */
+struct ast_bridge *ast_bridge_channel_merge_inhibit(struct ast_bridge_channel *bridge_channel, int request);
+
+/*!
+ * \internal
+ * \brief Update the linkedids for all channels in a bridge
+ * \since 12.0.0
+ *
+ * \param bridge_channel The channel joining the bridge
[... 3595 lines stripped ...]
More information about the svn-commits
mailing list