[asterisk-commits] kmoore: branch kmoore/stasis-cel_bridging r388916 - in /team/kmoore/stasis-ce...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed May 15 16:26:41 CDT 2013
Author: kmoore
Date: Wed May 15 16:26:39 2013
New Revision: 388916
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=388916
Log:
Pull in diff from channel refactor, add bridge tech caps to the snapshot, and stub things out
Modified:
team/kmoore/stasis-cel_bridging/include/asterisk/stasis_bridging.h
team/kmoore/stasis-cel_bridging/main/cel.c
team/kmoore/stasis-cel_bridging/main/pbx.c
team/kmoore/stasis-cel_bridging/main/stasis_bridging.c
Modified: team/kmoore/stasis-cel_bridging/include/asterisk/stasis_bridging.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-cel_bridging/include/asterisk/stasis_bridging.h?view=diff&rev=388916&r1=388915&r2=388916
==============================================================================
--- team/kmoore/stasis-cel_bridging/include/asterisk/stasis_bridging.h (original)
+++ team/kmoore/stasis-cel_bridging/include/asterisk/stasis_bridging.h Wed May 15 16:26:39 2013
@@ -45,6 +45,8 @@
struct ao2_container *channels;
/*! Bridge flags to tweak behavior */
struct ast_flags feature_flags;
+ /*! Bridge capabilities */
+ uint32_t capabilities;
/*! Number of channels participating in the bridge */
unsigned int num_channels;
/*! Number of active channels in the bridge. */
Modified: team/kmoore/stasis-cel_bridging/main/cel.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-cel_bridging/main/cel.c?view=diff&rev=388916&r1=388915&r2=388916
==============================================================================
--- team/kmoore/stasis-cel_bridging/main/cel.c (original)
+++ team/kmoore/stasis-cel_bridging/main/cel.c Wed May 15 16:26:39 2013
@@ -863,22 +863,19 @@
struct ast_channel_snapshot *old_snapshot,
struct ast_channel_snapshot *new_snapshot)
{
- /* No Newexten event on cache clear */
- if (!new_snapshot || !old_snapshot
- || !strcmp(old_snapshot->appl, new_snapshot->appl)) {
+ if (new_snapshot && old_snapshot
+ && !strcmp(old_snapshot->appl, new_snapshot->appl)) {
return;
}
/* old snapshot has an application, end it */
- if (!ast_strlen_zero(old_snapshot->appl)) {
- /* AST_CEL_APP_END */
- return;
+ if (old_snapshot && !ast_strlen_zero(old_snapshot->appl)) {
+ report_event_snapshot(old_snapshot, AST_CEL_APP_END, NULL, NULL);
}
/* new snapshot has an application, start it */
- if (!ast_strlen_zero(old_snapshot->appl)) {
- /* AST_CEL_APP_START */
- return;
+ if (new_snapshot && !ast_strlen_zero(new_snapshot->appl)) {
+ report_event_snapshot(new_snapshot, AST_CEL_APP_START, NULL, NULL);
}
}
@@ -918,6 +915,13 @@
{
struct ast_bridge_snapshot *snapshot = stasis_message_data(message);
+ if (snapshot->capabilities | AST_BRIDGE_CAPABILITY_1TO1MIX || snapshot->capabilities | AST_BRIDGE_CAPABILITY_NATIVE) {
+ /* AST_CEL_BRIDGE_START when second party enters */
+ } else if (snapshot->capabilities | AST_BRIDGE_CAPABILITY_MULTIMIX) {
+ /* AST_CEL_CONF_START */
+ } else if (snapshot->capabilities | AST_BRIDGE_CAPABILITY_HOLDING) {
+ /* AST_CEL_PARK_START */
+ }
}
static void cel_bridge_leave_cb(
@@ -927,6 +931,51 @@
{
struct ast_bridge_snapshot *snapshot = stasis_message_data(message);
+ if ((snapshot->capabilities | AST_BRIDGE_CAPABILITY_1TO1MIX)
+ || (snapshot->capabilities | AST_BRIDGE_CAPABILITY_NATIVE)) {
+ /* AST_CEL_BRIDGE_END when all parties have left */
+ } else if (snapshot->capabilities | AST_BRIDGE_CAPABILITY_MULTIMIX) {
+ /* AST_CEL_CONF_END */
+ } else if (snapshot->capabilities | AST_BRIDGE_CAPABILITY_HOLDING) {
+ /* AST_CEL_PARK_END */
+ }
+}
+
+static int snapshots_share_capability(
+ struct ast_bridge_snapshot *old_snapshot,
+ struct ast_bridge_snapshot *new_snapshot,
+ uint32_t capability)
+{
+ return ((old_snapshot->capabilities | capability)
+ && (new_snapshot->capabilities | capability))
+}
+
+static void cel_bridge_snapshot_update_cb(void *data, struct stasis_subscription *sub,
+ struct stasis_topic *topic,
+ struct stasis_message *message)
+{
+ struct stasis_cache_update *update;
+ struct ast_bridge_snapshot *old_snapshot;
+ struct ast_bridge_snapshot *new_snapshot;
+ size_t i;
+
+ update = stasis_message_data(message);
+
+ old_snapshot = stasis_message_data(update->old_snapshot);
+ new_snapshot = stasis_message_data(update->new_snapshot);
+
+ if (old_snapshot->capabilities == new_snapshot->capabilities) {
+ return;
+ }
+
+ if (snapshots_share_capability(old_snapshot, new_snapshot, AST_BRIDGE_CAPABILITY_1TO1MIX)
+ || snapshots_share_capability(old_snapshot, new_snapshot, AST_BRIDGE_CAPABILITY_NATIVE)
+ || snapshots_share_capability(old_snapshot, new_snapshot, AST_BRIDGE_CAPABILITY_HOLDING)
+ || snapshots_share_capability(old_snapshot, new_snapshot, AST_BRIDGE_CAPABILITY_MULTIMIX)) {
+ return;
+ }
+
+ /* Produce bridge capability change event */
}
static void ast_cel_engine_term(void)
@@ -1000,6 +1049,11 @@
cel_bridge_leave_cb,
NULL);
+ ret |= stasis_message_router_add(cel_bridge_state_router,
+ stasis_cache_update_type(),
+ cel_bridge_snapshot_update_cb,
+ NULL);
+
/* If somehow we failed to add any routes, just shut down the whole
* thing and fail it.
*/
Modified: team/kmoore/stasis-cel_bridging/main/pbx.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-cel_bridging/main/pbx.c?view=diff&rev=388916&r1=388915&r2=388916
==============================================================================
--- team/kmoore/stasis-cel_bridging/main/pbx.c (original)
+++ team/kmoore/stasis-cel_bridging/main/pbx.c Wed May 15 16:26:39 2013
@@ -1573,14 +1573,12 @@
ast_channel_appl_set(c, app->name);
ast_channel_data_set(c, data);
- ast_cel_report_event(c, AST_CEL_APP_START, NULL, NULL, NULL);
if (app->module)
u = __ast_module_user_add(app->module, c);
res = app->execute(c, S_OR(data, ""));
if (app->module && u)
__ast_module_user_remove(app->module, u);
- ast_cel_report_event(c, AST_CEL_APP_END, NULL, NULL, NULL);
/* restore channel values */
ast_channel_appl_set(c, saved_c_appl);
ast_channel_data_set(c, saved_c_data);
Modified: team/kmoore/stasis-cel_bridging/main/stasis_bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-cel_bridging/main/stasis_bridging.c?view=diff&rev=388916&r1=388915&r2=388916
==============================================================================
--- team/kmoore/stasis-cel_bridging/main/stasis_bridging.c (original)
+++ team/kmoore/stasis-cel_bridging/main/stasis_bridging.c Wed May 15 16:26:39 2013
@@ -94,6 +94,7 @@
ast_string_field_set(snapshot, technology, bridge->technology->name);
snapshot->feature_flags = bridge->feature_flags;
+ snapshot->capabilites = bridge->technology->capabilities;
snapshot->num_channels = bridge->num_channels;
snapshot->num_active = bridge->num_active;
More information about the asterisk-commits
mailing list