summaryrefslogtreecommitdiff
path: root/main/core_unreal.c
diff options
context:
space:
mode:
authorMatthew Jordan <mjordan@digium.com>2013-07-08 14:26:40 +0000
committerMatthew Jordan <mjordan@digium.com>2013-07-08 14:26:40 +0000
commit30d379851e2d614d1b8bcc65fdb5952feb6d62de (patch)
treeb3b42beaee73c653cc07a38ff1c85a3d9cc87091 /main/core_unreal.c
parent7fdeb52910cd267ea8837d1246712e1a06812337 (diff)
Create Local channel messages on the Stasis message bus and produce AMI events
This patch does the following: * It adds a virtual table of callbacks to core_unreal. These callbacks can be supplied by concrete implementations of "unreal" channel drivers, which lets the unreal channel driver call specific functionality when it performs some action. Currently, this is done to notify implementations when an optimization operation has begun, and when an optimization operation has succeeded. * It adds Stasis-Core messages for Local channel bridging and Local channel optimization. Local channel optimization is now two events: a Begin and an End. Some consumers of Stasis-Core may want to know when an operation is beginning so that they can 'prepare' their information; others will be more concerned about when the operation has completed, so that they can 'fix up' information. Stasis-Core allows for both, as does AMI. Review: https://reviewboard.asterisk.org/r/2552 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393801 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/core_unreal.c')
-rw-r--r--main/core_unreal.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/main/core_unreal.c b/main/core_unreal.c
index d5e588111..71d0f6c8f 100644
--- a/main/core_unreal.c
+++ b/main/core_unreal.c
@@ -281,18 +281,20 @@ int ast_unreal_answer(struct ast_channel *ast)
*/
static int got_optimized_out(struct ast_channel *ast, struct ast_unreal_pvt *p)
{
+ int res = 0;
+
/* Do a few conditional checks early on just to see if this optimization is possible */
if (ast_test_flag(p, AST_UNREAL_NO_OPTIMIZATION) || !p->chan || !p->owner) {
- return 0;
+ return res;
}
+
if (ast == p->owner) {
- return ast_bridge_unreal_optimized_out(p->owner, p->chan);
+ res = ast_bridge_unreal_optimize_out(p->owner, p->chan, p);
+ } else if (ast == p->chan) {
+ res = ast_bridge_unreal_optimize_out(p->chan, p->owner, p);
}
- if (ast == p->chan) {
- return ast_bridge_unreal_optimized_out(p->chan, p->owner);
- }
- /* ast is not valid to optimize. */
- return 0;
+
+ return res;
}
struct ast_frame *ast_unreal_read(struct ast_channel *ast)