[asterisk-commits] jrose: branch jrose/bridge_projects r386336 - in /team/jrose/bridge_projects:...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Apr 23 09:37:18 CDT 2013
Author: jrose
Date: Tue Apr 23 09:37:14 2013
New Revision: 386336
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=386336
Log:
deal with automerge conflicts
Added:
team/jrose/bridge_projects/configs/stasis_http.conf.sample
- copied unchanged from r386303, team/group/bridge_construction/configs/stasis_http.conf.sample
team/jrose/bridge_projects/include/asterisk/stasis_http.h
- copied unchanged from r386303, team/group/bridge_construction/include/asterisk/stasis_http.h
team/jrose/bridge_projects/res/res_stasis_http.c
- copied unchanged from r386303, team/group/bridge_construction/res/res_stasis_http.c
team/jrose/bridge_projects/res/res_stasis_http.exports.in
- copied unchanged from r386303, team/group/bridge_construction/res/res_stasis_http.exports.in
team/jrose/bridge_projects/res/res_stasis_http_asterisk.c
- copied unchanged from r386303, team/group/bridge_construction/res/res_stasis_http_asterisk.c
team/jrose/bridge_projects/res/res_stasis_http_bridges.c
- copied unchanged from r386303, team/group/bridge_construction/res/res_stasis_http_bridges.c
team/jrose/bridge_projects/res/res_stasis_http_channels.c
- copied unchanged from r386303, team/group/bridge_construction/res/res_stasis_http_channels.c
team/jrose/bridge_projects/res/res_stasis_http_endpoints.c
- copied unchanged from r386303, team/group/bridge_construction/res/res_stasis_http_endpoints.c
team/jrose/bridge_projects/res/res_stasis_http_events.c
- copied unchanged from r386303, team/group/bridge_construction/res/res_stasis_http_events.c
team/jrose/bridge_projects/res/res_stasis_http_playback.c
- copied unchanged from r386303, team/group/bridge_construction/res/res_stasis_http_playback.c
team/jrose/bridge_projects/res/res_stasis_http_recordings.c
- copied unchanged from r386303, team/group/bridge_construction/res/res_stasis_http_recordings.c
team/jrose/bridge_projects/res/res_stasis_http_sounds.c
- copied unchanged from r386303, team/group/bridge_construction/res/res_stasis_http_sounds.c
team/jrose/bridge_projects/res/stasis_http/ (props changed)
- copied from r386303, team/group/bridge_construction/res/stasis_http/
team/jrose/bridge_projects/res/stasis_http.make
- copied unchanged from r386303, team/group/bridge_construction/res/stasis_http.make
team/jrose/bridge_projects/res/stasis_http/resource_asterisk.c
- copied unchanged from r386303, team/group/bridge_construction/res/stasis_http/resource_asterisk.c
team/jrose/bridge_projects/res/stasis_http/resource_asterisk.h
- copied unchanged from r386303, team/group/bridge_construction/res/stasis_http/resource_asterisk.h
team/jrose/bridge_projects/res/stasis_http/resource_bridges.c
- copied unchanged from r386303, team/group/bridge_construction/res/stasis_http/resource_bridges.c
team/jrose/bridge_projects/res/stasis_http/resource_bridges.h
- copied unchanged from r386303, team/group/bridge_construction/res/stasis_http/resource_bridges.h
team/jrose/bridge_projects/res/stasis_http/resource_channels.c
- copied unchanged from r386303, team/group/bridge_construction/res/stasis_http/resource_channels.c
team/jrose/bridge_projects/res/stasis_http/resource_channels.h
- copied unchanged from r386303, team/group/bridge_construction/res/stasis_http/resource_channels.h
team/jrose/bridge_projects/res/stasis_http/resource_endpoints.c
- copied unchanged from r386303, team/group/bridge_construction/res/stasis_http/resource_endpoints.c
team/jrose/bridge_projects/res/stasis_http/resource_endpoints.h
- copied unchanged from r386303, team/group/bridge_construction/res/stasis_http/resource_endpoints.h
team/jrose/bridge_projects/res/stasis_http/resource_events.c
- copied unchanged from r386303, team/group/bridge_construction/res/stasis_http/resource_events.c
team/jrose/bridge_projects/res/stasis_http/resource_events.h
- copied unchanged from r386303, team/group/bridge_construction/res/stasis_http/resource_events.h
team/jrose/bridge_projects/res/stasis_http/resource_playback.c
- copied unchanged from r386303, team/group/bridge_construction/res/stasis_http/resource_playback.c
team/jrose/bridge_projects/res/stasis_http/resource_playback.h
- copied unchanged from r386303, team/group/bridge_construction/res/stasis_http/resource_playback.h
team/jrose/bridge_projects/res/stasis_http/resource_recordings.c
- copied unchanged from r386303, team/group/bridge_construction/res/stasis_http/resource_recordings.c
team/jrose/bridge_projects/res/stasis_http/resource_recordings.h
- copied unchanged from r386303, team/group/bridge_construction/res/stasis_http/resource_recordings.h
team/jrose/bridge_projects/res/stasis_http/resource_sounds.c
- copied unchanged from r386303, team/group/bridge_construction/res/stasis_http/resource_sounds.c
team/jrose/bridge_projects/res/stasis_http/resource_sounds.h
- copied unchanged from r386303, team/group/bridge_construction/res/stasis_http/resource_sounds.h
team/jrose/bridge_projects/rest-api/
- copied from r386303, team/group/bridge_construction/rest-api/
team/jrose/bridge_projects/rest-api-templates/ (props changed)
- copied from r386303, team/group/bridge_construction/rest-api-templates/
team/jrose/bridge_projects/rest-api-templates/README.txt
- copied unchanged from r386303, team/group/bridge_construction/rest-api-templates/README.txt
team/jrose/bridge_projects/rest-api-templates/asterisk_processor.py
- copied unchanged from r386303, team/group/bridge_construction/rest-api-templates/asterisk_processor.py
team/jrose/bridge_projects/rest-api-templates/do-not-edit.mustache
- copied unchanged from r386303, team/group/bridge_construction/rest-api-templates/do-not-edit.mustache
team/jrose/bridge_projects/rest-api-templates/make_stasis_http_stubs.py
- copied unchanged from r386303, team/group/bridge_construction/rest-api-templates/make_stasis_http_stubs.py
team/jrose/bridge_projects/rest-api-templates/odict.py
- copied unchanged from r386303, team/group/bridge_construction/rest-api-templates/odict.py
team/jrose/bridge_projects/rest-api-templates/res_stasis_http_resource.c.mustache
- copied unchanged from r386303, team/group/bridge_construction/rest-api-templates/res_stasis_http_resource.c.mustache
team/jrose/bridge_projects/rest-api-templates/rest_handler.mustache
- copied unchanged from r386303, team/group/bridge_construction/rest-api-templates/rest_handler.mustache
team/jrose/bridge_projects/rest-api-templates/stasis_http.make.mustache
- copied unchanged from r386303, team/group/bridge_construction/rest-api-templates/stasis_http.make.mustache
team/jrose/bridge_projects/rest-api-templates/stasis_http_resource.c.mustache
- copied unchanged from r386303, team/group/bridge_construction/rest-api-templates/stasis_http_resource.c.mustache
team/jrose/bridge_projects/rest-api-templates/stasis_http_resource.h.mustache
- copied unchanged from r386303, team/group/bridge_construction/rest-api-templates/stasis_http_resource.h.mustache
team/jrose/bridge_projects/rest-api-templates/swagger_model.py
- copied unchanged from r386303, team/group/bridge_construction/rest-api-templates/swagger_model.py
team/jrose/bridge_projects/rest-api-templates/transform.py
- copied unchanged from r386303, team/group/bridge_construction/rest-api-templates/transform.py
team/jrose/bridge_projects/rest-api/README.txt
- copied unchanged from r386303, team/group/bridge_construction/rest-api/README.txt
team/jrose/bridge_projects/rest-api/api-docs/
- copied from r386303, team/group/bridge_construction/rest-api/api-docs/
team/jrose/bridge_projects/rest-api/api-docs/asterisk.json
- copied unchanged from r386303, team/group/bridge_construction/rest-api/api-docs/asterisk.json
team/jrose/bridge_projects/rest-api/api-docs/bridges.json
- copied unchanged from r386303, team/group/bridge_construction/rest-api/api-docs/bridges.json
team/jrose/bridge_projects/rest-api/api-docs/channels.json
- copied unchanged from r386303, team/group/bridge_construction/rest-api/api-docs/channels.json
team/jrose/bridge_projects/rest-api/api-docs/endpoints.json
- copied unchanged from r386303, team/group/bridge_construction/rest-api/api-docs/endpoints.json
team/jrose/bridge_projects/rest-api/api-docs/events.json
- copied unchanged from r386303, team/group/bridge_construction/rest-api/api-docs/events.json
team/jrose/bridge_projects/rest-api/api-docs/playback.json
- copied unchanged from r386303, team/group/bridge_construction/rest-api/api-docs/playback.json
team/jrose/bridge_projects/rest-api/api-docs/recordings.json
- copied unchanged from r386303, team/group/bridge_construction/rest-api/api-docs/recordings.json
team/jrose/bridge_projects/rest-api/api-docs/sounds.json
- copied unchanged from r386303, team/group/bridge_construction/rest-api/api-docs/sounds.json
team/jrose/bridge_projects/rest-api/resources.json
- copied unchanged from r386303, team/group/bridge_construction/rest-api/resources.json
team/jrose/bridge_projects/tests/test_stasis_http.c
- copied unchanged from r386303, team/group/bridge_construction/tests/test_stasis_http.c
Modified:
team/jrose/bridge_projects/ (props changed)
team/jrose/bridge_projects/Makefile
team/jrose/bridge_projects/bridges/bridge_builtin_features.c
team/jrose/bridge_projects/channels/chan_local.c
team/jrose/bridge_projects/include/asterisk/bridging.h
team/jrose/bridge_projects/include/asterisk/http.h
team/jrose/bridge_projects/include/asterisk/json.h
team/jrose/bridge_projects/include/asterisk/srv.h
team/jrose/bridge_projects/include/asterisk/stasis_app.h
team/jrose/bridge_projects/include/asterisk/strings.h
team/jrose/bridge_projects/main/bridging.c
team/jrose/bridge_projects/main/channel.c
team/jrose/bridge_projects/main/http.c
team/jrose/bridge_projects/main/json.c
team/jrose/bridge_projects/res/Makefile
team/jrose/bridge_projects/res/parking/parking_bridge_features.c
team/jrose/bridge_projects/res/res_stasis.c
team/jrose/bridge_projects/tests/test_stasis.c
team/jrose/bridge_projects/tests/test_strings.c
Propchange: team/jrose/bridge_projects/
------------------------------------------------------------------------------
automerge = *
Propchange: team/jrose/bridge_projects/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.
Propchange: team/jrose/bridge_projects/
------------------------------------------------------------------------------
--- bridge_construction-integrated (original)
+++ bridge_construction-integrated Tue Apr 23 09:37:14 2013
@@ -1,1 +1,1 @@
-/trunk:1-386211
+/trunk:1-386289
Propchange: team/jrose/bridge_projects/
------------------------------------------------------------------------------
--- bridge_projects-integrated (original)
+++ bridge_projects-integrated Tue Apr 23 09:37:14 2013
@@ -1,1 +1,1 @@
-/team/group/bridge_construction:1-386214
+/team/group/bridge_construction:1-386328
Modified: team/jrose/bridge_projects/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/Makefile?view=diff&rev=386336&r1=386335&r2=386336
==============================================================================
--- team/jrose/bridge_projects/Makefile (original)
+++ team/jrose/bridge_projects/Makefile Tue Apr 23 09:37:14 2013
@@ -453,6 +453,9 @@
$(INSTALL) -m 644 $$x "$(DESTDIR)$(ASTDATADIR)/images" ; \
done
$(MAKE) -C sounds install
+ find rest-api -name "*.json" | while read x; do \
+ $(INSTALL) -m 644 $$x "$(DESTDIR)$(ASTDATADIR)/rest-api" ; \
+ done
ifneq ($(GREP),)
XML_core_en_US = $(foreach dir,$(MOD_SUBDIRS),$(shell $(GREP) -l "language=\"en_US\"" $(dir)/*.c $(dir)/*.cc 2>/dev/null))
@@ -537,8 +540,8 @@
"$(ASTLOGDIR)/cel-custom" "$(ASTDATADIR)" "$(ASTDATADIR)/documentation" \
"$(ASTDATADIR)/documentation/thirdparty" "$(ASTDATADIR)/firmware" \
"$(ASTDATADIR)/firmware/iax" "$(ASTDATADIR)/images" "$(ASTDATADIR)/keys" \
- "$(ASTDATADIR)/phoneprov" "$(ASTDATADIR)/static-http" "$(ASTDATADIR)/sounds" \
- "$(ASTDATADIR)/moh" "$(ASTMANDIR)/man8" "$(AGI_DIR)" "$(ASTDBDIR)"
+ "$(ASTDATADIR)/phoneprov" "$(ASTDATADIR)/rest-api" "$(ASTDATADIR)/static-http" \
+ "$(ASTDATADIR)/sounds" "$(ASTDATADIR)/moh" "$(ASTMANDIR)/man8" "$(AGI_DIR)" "$(ASTDBDIR)"
installdirs:
@for i in $(INSTALLDIRS); do \
@@ -958,6 +961,19 @@
@cat sounds/sounds.xml >> $@
@echo "</menu>" >> $@
+# We don't want to require Python or Pystache for every build, so this is its
+# own target.
+stasis-stubs:
+ifeq ($(PYTHON),:)
+ @echo "--------------------------------------------------------------------------"
+ @echo "--- Please install python to build Stasis HTTP stubs ---"
+ @echo "--------------------------------------------------------------------------"
+ @false
+else
+ $(PYTHON) rest-api-templates/make_stasis_http_stubs.py \
+ rest-api/resources.json res/
+endif
+
.PHONY: menuselect
.PHONY: main
.PHONY: sounds
@@ -977,6 +993,7 @@
.PHONY: installdirs
.PHONY: validate-docs
.PHONY: _clean
+.PHONY: stasis-stubs
.PHONY: $(SUBDIRS_INSTALL)
.PHONY: $(SUBDIRS_DIST_CLEAN)
.PHONY: $(SUBDIRS_CLEAN)
Modified: team/jrose/bridge_projects/bridges/bridge_builtin_features.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/bridges/bridge_builtin_features.c?view=diff&rev=386336&r1=386335&r2=386336
==============================================================================
--- team/jrose/bridge_projects/bridges/bridge_builtin_features.c (original)
+++ team/jrose/bridge_projects/bridges/bridge_builtin_features.c Tue Apr 23 09:37:14 2013
@@ -205,7 +205,7 @@
}
/* Impart the new channel onto the bridge, and have it take our place. */
- if (ast_bridge_impart(bridge, chan, bridge_channel->chan, NULL, 1)) {
+ if (ast_bridge_impart(bridge_channel->bridge, chan, bridge_channel->chan, NULL, 1)) {
ast_hangup(chan);
return 0;
}
@@ -267,6 +267,8 @@
const char *context;
enum atxfer_code transfer_code = ATXFER_INCOMPLETE;
+ bridge = ast_bridge_channel_merge_inhibit(bridge_channel, +1);
+
/* BUGBUG the peer needs to be put on hold for the transfer. */
ast_channel_lock(bridge_channel->chan);
context = ast_strdupa(get_transfer_context(bridge_channel->chan,
@@ -275,12 +277,16 @@
/* Grab the extension to transfer to */
if (grab_transfer(bridge_channel->chan, exten, sizeof(exten), context)) {
+ ast_bridge_merge_inhibit(bridge, -1);
+ ao2_ref(bridge, -1);
return 0;
}
/* Get a channel that is the destination we wish to call */
peer = dial_transfer(bridge_channel->chan, exten, context);
if (!peer) {
+ ast_bridge_merge_inhibit(bridge, -1);
+ ao2_ref(bridge, -1);
/* BUGBUG beeperr needs to be configurable from features.conf */
ast_stream_and_wait(bridge_channel->chan, "beeperr", AST_DIGIT_NONE);
return 0;
@@ -306,6 +312,8 @@
attended_transfer_threeway, &transfer_code, NULL, 0)) {
ast_bridge_features_cleanup(&caller_features);
ast_hangup(peer);
+ ast_bridge_merge_inhibit(bridge, -1);
+ ao2_ref(bridge, -1);
/* BUGBUG beeperr needs to be configurable from features.conf */
ast_stream_and_wait(bridge_channel->chan, "beeperr", AST_DIGIT_NONE);
return 0;
@@ -318,10 +326,13 @@
if (!attended_bridge) {
ast_bridge_features_cleanup(&caller_features);
ast_hangup(peer);
+ ast_bridge_merge_inhibit(bridge, -1);
+ ao2_ref(bridge, -1);
/* BUGBUG beeperr needs to be configurable from features.conf */
ast_stream_and_wait(bridge_channel->chan, "beeperr", AST_DIGIT_NONE);
return 0;
}
+ ast_bridge_merge_inhibit(attended_bridge, +1);
/* This is how this is going down, we are imparting the channel we called above into this bridge first */
/* BUGBUG we should impart the peer as an independent and move it to the original bridge. */
@@ -329,6 +340,8 @@
ast_bridge_destroy(attended_bridge);
ast_bridge_features_cleanup(&caller_features);
ast_hangup(peer);
+ ast_bridge_merge_inhibit(bridge, -1);
+ ao2_ref(bridge, -1);
/* BUGBUG beeperr needs to be configurable from features.conf */
ast_stream_and_wait(bridge_channel->chan, "beeperr", AST_DIGIT_NONE);
return 0;
@@ -373,7 +386,7 @@
case ATXFER_COMPLETE:
/* The peer takes our place in the bridge. */
ast_bridge_change_state(bridge_channel, AST_BRIDGE_CHANNEL_STATE_HANGUP);
- xfer_failed = ast_bridge_impart(bridge, peer, bridge_channel->chan, NULL, 1);
+ xfer_failed = ast_bridge_impart(bridge_channel->bridge, peer, bridge_channel->chan, NULL, 1);
break;
case ATXFER_THREEWAY:
/*
@@ -382,12 +395,14 @@
* Just impart the peer onto the bridge and have us return to it
* as normal.
*/
- xfer_failed = ast_bridge_impart(bridge, peer, NULL, NULL, 1);
+ xfer_failed = ast_bridge_impart(bridge_channel->bridge, peer, NULL, NULL, 1);
break;
case ATXFER_ABORT:
/* Transferer decided not to transfer the call after all. */
break;
}
+ ast_bridge_merge_inhibit(bridge, -1);
+ ao2_ref(bridge, -1);
if (xfer_failed) {
ast_hangup(peer);
if (!ast_check_hangup_locked(bridge_channel->chan)) {
Modified: team/jrose/bridge_projects/channels/chan_local.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/channels/chan_local.c?view=diff&rev=386336&r1=386335&r2=386336
==============================================================================
--- team/jrose/bridge_projects/channels/chan_local.c (original)
+++ team/jrose/bridge_projects/channels/chan_local.c Tue Apr 23 09:37:14 2013
@@ -54,6 +54,7 @@
#include "asterisk/stringfields.h"
#include "asterisk/devicestate.h"
#include "asterisk/astobj2.h"
+#include "asterisk/bridging.h"
/*** DOCUMENTATION
<manager name="LocalOptimizeAway" language="en_US">
@@ -151,10 +152,9 @@
struct ast_channel *chan; /*!< Outbound channel - PBX is run here */
};
-#define LOCAL_ALREADY_MASQED (1 << 0) /*!< Already masqueraded */
-#define LOCAL_LAUNCHED_PBX (1 << 1) /*!< PBX was launched */
-#define LOCAL_NO_OPTIMIZATION (1 << 2) /*!< Do not optimize using masquerading */
-#define LOCAL_MOH_PASSTHRU (1 << 3) /*!< Pass through music on hold start/stop frames */
+#define LOCAL_LAUNCHED_PBX (1 << 0) /*!< PBX was launched */
+#define LOCAL_NO_OPTIMIZATION (1 << 1) /*!< Do not optimize using masquerading */
+#define LOCAL_MOH_PASSTHRU (1 << 2) /*!< Pass through music on hold start/stop frames */
/*!
* \brief Send a pvt in with no locks held and get all locks
@@ -449,146 +449,32 @@
/*!
* \internal
- * \note This function assumes that we're only called from the "outbound" local channel side
+ * \brief Check and optimize out the local channels between bridges.
+ * \since 12.0.0
*
- * \note it is assummed p is locked and reffed before entering this function
+ * \param ast Channel writing a frame into the local channels.
+ * \param p Local channel private.
+ *
+ * \note It is assumed that ast is locked.
+ * \note It is assumed that p is locked.
+ *
+ * \retval 0 if local channels were not optimized out.
+ * \retval non-zero if local channels were optimized out.
*/
-static void check_bridge(struct ast_channel *ast, struct local_pvt *p)
-{
- struct ast_channel *owner;
- struct ast_channel *chan;
- struct ast_channel *bridged_chan;
- struct ast_frame *f;
-
+static int got_optimized_out(struct ast_channel *ast, struct local_pvt *p)
+{
/* Do a few conditional checks early on just to see if this optimization is possible */
- if (ast_test_flag(p, LOCAL_NO_OPTIMIZATION | LOCAL_ALREADY_MASQED)
- || !p->chan || !p->owner) {
- return;
- }
-
- /* Safely get the channel bridged to p->chan */
- chan = ast_channel_ref(p->chan);
-
- ao2_unlock(p); /* don't call bridged channel with the pvt locked */
- bridged_chan = ast_bridged_channel(chan);
- ao2_lock(p);
-
- chan = ast_channel_unref(chan);
-
- /* since we had to unlock p to get the bridged chan, validate our
- * data once again and verify the bridged channel is what we expect
- * it to be in order to perform this optimization */
- if (ast_test_flag(p, LOCAL_NO_OPTIMIZATION | LOCAL_ALREADY_MASQED)
- || !p->chan || !p->owner
- || (ast_channel_internal_bridged_channel(p->chan) != bridged_chan)) {
- return;
- }
-
- /* only do the masquerade if we are being called on the outbound channel,
- if it has been bridged to another channel and if there are no pending
- frames on the owner channel (because they would be transferred to the
- outbound channel during the masquerade)
- */
- if (!ast_channel_internal_bridged_channel(p->chan) /* Not ast_bridged_channel! Only go one step! */
- || !AST_LIST_EMPTY(ast_channel_readq(p->owner))
- || ast != p->chan /* Sanity check (should always be false) */) {
- return;
- }
-
- /* Masquerade bridged channel into owner */
- /* Lock everything we need, one by one, and give up if
- we can't get everything. Remember, we'll get another
- chance in just a little bit */
- if (ast_channel_trylock(ast_channel_internal_bridged_channel(p->chan))) {
- return;
- }
- if (ast_check_hangup(ast_channel_internal_bridged_channel(p->chan))
- || ast_channel_trylock(p->owner)) {
- ast_channel_unlock(ast_channel_internal_bridged_channel(p->chan));
- return;
- }
-
- /*
- * At this point we have 4 locks:
- * p, p->chan (same as ast), p->chan->_bridge, p->owner
- *
- * Flush a voice or video frame on the outbound channel to make
- * the queue empty faster so we can get optimized out.
- */
- f = AST_LIST_FIRST(ast_channel_readq(p->chan));
- if (f && (f->frametype == AST_FRAME_VOICE || f->frametype == AST_FRAME_VIDEO)) {
- AST_LIST_REMOVE_HEAD(ast_channel_readq(p->chan), frame_list);
- ast_frfree(f);
- f = AST_LIST_FIRST(ast_channel_readq(p->chan));
- }
-
- if (f
- || ast_check_hangup(p->owner)
- || ast_channel_masquerade(p->owner, ast_channel_internal_bridged_channel(p->chan))) {
- ast_channel_unlock(p->owner);
- ast_channel_unlock(ast_channel_internal_bridged_channel(p->chan));
- return;
- }
-
- /* Masquerade got setup. */
- ast_debug(4, "Masquerading %s <- %s\n",
- ast_channel_name(p->owner),
- ast_channel_name(ast_channel_internal_bridged_channel(p->chan)));
- if (ast_channel_monitor(p->owner)
- && !ast_channel_monitor(ast_channel_internal_bridged_channel(p->chan))) {
- struct ast_channel_monitor *tmp;
-
- /* If a local channel is being monitored, we don't want a masquerade
- * to cause the monitor to go away. Since the masquerade swaps the monitors,
- * pre-swapping the monitors before the masquerade will ensure that the monitor
- * ends up where it is expected.
- */
- tmp = ast_channel_monitor(p->owner);
- ast_channel_monitor_set(p->owner, ast_channel_monitor(ast_channel_internal_bridged_channel(p->chan)));
- ast_channel_monitor_set(ast_channel_internal_bridged_channel(p->chan), tmp);
- }
- if (ast_channel_audiohooks(p->chan)) {
- struct ast_audiohook_list *audiohooks_swapper;
-
- audiohooks_swapper = ast_channel_audiohooks(p->chan);
- ast_channel_audiohooks_set(p->chan, ast_channel_audiohooks(p->owner));
- ast_channel_audiohooks_set(p->owner, audiohooks_swapper);
- }
-
- /* If any Caller ID was set, preserve it after masquerade like above. We must check
- * to see if Caller ID was set because otherwise we'll mistakingly copy info not
- * set from the dialplan and will overwrite the real channel Caller ID. The reason
- * for this whole preswapping action is because the Caller ID is set on the channel
- * thread (which is the to be masqueraded away local channel) before both local
- * channels are optimized away.
- */
- if (ast_channel_caller(p->owner)->id.name.valid || ast_channel_caller(p->owner)->id.number.valid
- || ast_channel_caller(p->owner)->id.subaddress.valid || ast_channel_caller(p->owner)->ani.name.valid
- || ast_channel_caller(p->owner)->ani.number.valid || ast_channel_caller(p->owner)->ani.subaddress.valid) {
- SWAP(*ast_channel_caller(p->owner), *ast_channel_caller(ast_channel_internal_bridged_channel(p->chan)));
- }
- if (ast_channel_redirecting(p->owner)->from.name.valid || ast_channel_redirecting(p->owner)->from.number.valid
- || ast_channel_redirecting(p->owner)->from.subaddress.valid || ast_channel_redirecting(p->owner)->to.name.valid
- || ast_channel_redirecting(p->owner)->to.number.valid || ast_channel_redirecting(p->owner)->to.subaddress.valid) {
- SWAP(*ast_channel_redirecting(p->owner), *ast_channel_redirecting(ast_channel_internal_bridged_channel(p->chan)));
- }
- if (ast_channel_dialed(p->owner)->number.str || ast_channel_dialed(p->owner)->subaddress.valid) {
- SWAP(*ast_channel_dialed(p->owner), *ast_channel_dialed(ast_channel_internal_bridged_channel(p->chan)));
- }
- ast_app_group_update(p->chan, p->owner);
- ast_set_flag(p, LOCAL_ALREADY_MASQED);
-
- ast_channel_unlock(p->owner);
- ast_channel_unlock(ast_channel_internal_bridged_channel(p->chan));
-
- /* Do the masquerade now. */
- owner = ast_channel_ref(p->owner);
- ao2_unlock(p);
- ast_channel_unlock(ast);
- ast_do_masquerade(owner);
- ast_channel_unref(owner);
- ast_channel_lock(ast);
- ao2_lock(p);
+ if (ast_test_flag(p, LOCAL_NO_OPTIMIZATION) || !p->chan || !p->owner) {
+ return 0;
+ }
+ if (ast == p->owner) {
+ return ast_bridge_local_optimized_out(p->owner, p->chan);
+ }
+ if (ast == p->chan) {
+ return ast_bridge_local_optimized_out(p->chan, p->owner);
+ }
+ /* ast is not valid to optimize. */
+ return 0;
}
static struct ast_frame *local_read(struct ast_channel *ast)
@@ -600,28 +486,24 @@
{
struct local_pvt *p = ast_channel_tech_pvt(ast);
int res = -1;
- int isoutbound;
if (!p) {
return -1;
}
/* Just queue for delivery to the other side */
- ao2_ref(p, 1); /* ref for local_queue_frame */
+ ao2_ref(p, 1);
ao2_lock(p);
- isoutbound = IS_OUTBOUND(ast, p);
-
- if (isoutbound
- && (f->frametype == AST_FRAME_VOICE || f->frametype == AST_FRAME_VIDEO)) {
- check_bridge(ast, p);
- }
-
- if (!ast_test_flag(p, LOCAL_ALREADY_MASQED)) {
- res = local_queue_frame(p, isoutbound, f, ast, 1);
- } else {
- ast_debug(1, "Not posting to '%s' queue since already masqueraded out\n",
- ast_channel_name(ast));
- res = 0;
+ switch (f->frametype) {
+ case AST_FRAME_VOICE:
+ case AST_FRAME_VIDEO:
+ if (got_optimized_out(ast, p)) {
+ break;
+ }
+ /* fall through */
+ default:
+ res = local_queue_frame(p, IS_OUTBOUND(ast, p), f, ast, 1);
+ break;
}
ao2_unlock(p);
ao2_ref(p, -1);
Modified: team/jrose/bridge_projects/include/asterisk/bridging.h
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/include/asterisk/bridging.h?view=diff&rev=386336&r1=386335&r2=386336
==============================================================================
--- team/jrose/bridge_projects/include/asterisk/bridging.h (original)
+++ team/jrose/bridge_projects/include/asterisk/bridging.h Tue Apr 23 09:37:14 2013
@@ -96,6 +96,15 @@
AST_BRIDGE_CHANNEL_STATE_END,
/*! Bridged channel was forced out and should be hung up */
AST_BRIDGE_CHANNEL_STATE_HANGUP,
+};
+
+enum ast_bridge_channel_thread_state {
+ /*! Bridge channel thread is idle/waiting. */
+ AST_BRIDGE_CHANNEL_THREAD_IDLE,
+ /*! Bridge channel thread is writing a normal/simple frame. */
+ AST_BRIDGE_CHANNEL_THREAD_SIMPLE,
+ /*! Bridge channel thread is processing a frame. */
+ AST_BRIDGE_CHANNEL_THREAD_FRAME,
};
struct ast_bridge_technology;
@@ -186,6 +195,15 @@
int alert_pipe[2];
/*! TRUE if the bridge channel thread is waiting on channels (needs to be atomically settable) */
int waiting;
+ /*!
+ * \brief The bridge channel thread activity.
+ *
+ * \details Used by local channel optimization to determine if
+ * the thread is in an acceptable state to optimize.
+ *
+ * \note Needs to be atomically settable.
+ */
+ enum ast_bridge_channel_thread_state activity;
};
enum ast_bridge_action_type {
@@ -778,6 +796,20 @@
void ast_bridge_merge_inhibit(struct ast_bridge *bridge, int request);
/*!
+ * \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);
+
+/*!
* \brief Suspend a channel temporarily from a bridge
*
* \param bridge Bridge to suspend the channel from
@@ -823,6 +855,20 @@
* Doing so may result in bad things happening.
*/
int ast_bridge_unsuspend(struct ast_bridge *bridge, struct ast_channel *chan);
+
+/*!
+ * \brief Check and optimize out the local channels between bridges.
+ * \since 12.0.0
+ *
+ * \param chan Local channel writing a frame into the channel driver.
+ * \param peer Other local channel in the pair.
+ *
+ * \note It is assumed that chan is already locked.
+ *
+ * \retval 0 if local channels were not optimized out.
+ * \retval non-zero if local channels were optimized out.
+ */
+int ast_bridge_local_optimized_out(struct ast_channel *chan, struct ast_channel *peer);
/*!
* \brief Try locking the bridge_channel.
Modified: team/jrose/bridge_projects/include/asterisk/http.h
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/include/asterisk/http.h?view=diff&rev=386336&r1=386335&r2=386336
==============================================================================
--- team/jrose/bridge_projects/include/asterisk/http.h (original)
+++ team/jrose/bridge_projects/include/asterisk/http.h Tue Apr 23 09:37:14 2013
@@ -58,7 +58,10 @@
AST_HTTP_GET = 0,
AST_HTTP_POST,
AST_HTTP_HEAD,
- AST_HTTP_PUT, /*!< Not supported in Asterisk */
+ AST_HTTP_PUT,
+ AST_HTTP_DELETE,
+ AST_HTTP_OPTIONS,
+ AST_HTTP_MAX_METHOD, /*!< Last entry in ast_http_method enum */
};
struct ast_http_uri;
Modified: team/jrose/bridge_projects/include/asterisk/json.h
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/include/asterisk/json.h?view=diff&rev=386336&r1=386335&r2=386336
==============================================================================
--- team/jrose/bridge_projects/include/asterisk/json.h (original)
+++ team/jrose/bridge_projects/include/asterisk/json.h Tue Apr 23 09:37:14 2013
@@ -586,16 +586,33 @@
/*!@{*/
/*!
+ * \brief Encoding format type.
+ * \since 12.0.0
+ */
+enum ast_json_encoding_format
+{
+ /*! Compact format, low human readability */
+ AST_JSON_COMPACT,
+ /*! Formatted for human readability */
+ AST_JSON_PRETTY,
+};
+
+#define ast_json_dump_string(root) ast_json_dump_string_format(root, AST_JSON_COMPACT)
+
+/*!
* \brief Encode a JSON value to a string.
* \since 12.0.0
*
* Returned string must be freed by calling ast_free().
*
- * \param JSON value.
+ * \param root JSON value.
+ * \param format encoding format type.
* \return String encoding of \a root.
* \return \c NULL on error.
*/
-char *ast_json_dump_string(struct ast_json *root);
+char *ast_json_dump_string_format(struct ast_json *root, enum ast_json_encoding_format format);
+
+#define ast_json_dump_str(root, dst) ast_json_dump_str_format(root, dst, AST_JSON_COMPACT)
/*!
* \brief Encode a JSON value to an \ref ast_str.
@@ -605,10 +622,13 @@
*
* \param root JSON value.
* \param dst \ref ast_str to store JSON encoding.
+ * \param format encoding format type.
* \return 0 on success.
* \return -1 on error. The contents of \a dst are undefined.
*/
-int ast_json_dump_str(struct ast_json *root, struct ast_str **dst);
+int ast_json_dump_str_format(struct ast_json *root, struct ast_str **dst, enum ast_json_encoding_format format);
+
+#define ast_json_dump_file(root, output) ast_json_dump_file_format(root, output, AST_JSON_COMPACT)
/*!
* \brief Encode a JSON value to a \c FILE.
@@ -616,10 +636,13 @@
*
* \param root JSON value.
* \param output File to write JSON encoding to.
+ * \param format encoding format type.
* \return 0 on success.
* \return -1 on error. The contents of \a output are undefined.
*/
-int ast_json_dump_file(struct ast_json *root, FILE *output);
+int ast_json_dump_file_format(struct ast_json *root, FILE *output, enum ast_json_encoding_format format);
+
+#define ast_json_dump_new_file(root, path) ast_json_dump_new_file_format(root, path, AST_JSON_COMPACT)
/*!
* \brief Encode a JSON value to a file at the given location.
@@ -627,10 +650,11 @@
*
* \param root JSON value.
* \param path Path to file to write JSON encoding to.
+ * \param format encoding format type.
* \return 0 on success.
* \return -1 on error. The contents of \a output are undefined.
*/
-int ast_json_dump_new_file(struct ast_json *root, const char *path);
+int ast_json_dump_new_file_format(struct ast_json *root, const char *path, enum ast_json_encoding_format format);
#define AST_JSON_ERROR_TEXT_LENGTH 160
#define AST_JSON_ERROR_SOURCE_LENGTH 80
Modified: team/jrose/bridge_projects/include/asterisk/srv.h
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/include/asterisk/srv.h?view=diff&rev=386336&r1=386335&r2=386336
==============================================================================
--- team/jrose/bridge_projects/include/asterisk/srv.h (original)
+++ team/jrose/bridge_projects/include/asterisk/srv.h Tue Apr 23 09:37:14 2013
@@ -1,7 +1,7 @@
/*
* Asterisk -- An open source telephony toolkit.
*
- * Copyright (C) 1999 - 2005, Digium, Inc.
+ * Copyright (C) 1999 - 2013, Digium, Inc.
*
* Mark Spencer <markster at digium.com>
*
@@ -23,41 +23,47 @@
#ifndef _ASTERISK_SRV_H
#define _ASTERISK_SRV_H
-/*!
- \file srv.h
- \brief Support for DNS SRV records, used in to locate SIP services.
- \note Note: This SRV record support will respect the priority and
- weight elements of the records that are returned, but there are
- no provisions for retrying or failover between records.
-*/
+/*! \file srv.h
+ *
+ * \brief Support for DNS SRV records, used in to locate SIP services.
+ *
+ * \note Note: This SRV record support will respect the priority and weight
+ * elements of the records that are returned, but there are no provisions
+ * for retrying or failover between records.
+ */
-/*!\brief An opaque type, for lookup usage */
+/*! \brief An opaque type, for lookup usage */
struct srv_context;
-/*!\brief Retrieve set of SRV lookups, in order
+/*! \brief Retrieve set of SRV lookups, in order
+ *
* \param[in] context A pointer in which to hold the result
* \param[in] service The service name to look up
* \param[out] host Result host
* \param[out] port Associated TCP portnum
+ *
* \retval -1 Query failed
* \retval 0 Result exists in host and port
* \retval 1 No more results
*/
extern int ast_srv_lookup(struct srv_context **context, const char *service, const char **host, unsigned short *port);
-/*!\brief Cleanup resources associated with ast_srv_lookup
+/*! \brief Cleanup resources associated with ast_srv_lookup
+ *
* \param context Pointer passed into ast_srv_lookup
*/
void ast_srv_cleanup(struct srv_context **context);
-/*! Lookup entry in SRV records Returns 1 if found, 0 if not found, -1 on hangup
- Only do SRV record lookup if you get a domain without a port. If you get a port #, it's a DNS host name.
-! \param chan Ast channel
- \param host host name (return value)
- \param hostlen Length of string "host"
- \param port Port number (return value)
- \param service Service tag for SRV lookup (like "_sip._udp" or "_stun._udp"
-*/
+/*! \brief Lookup entry in SRV records Returns 1 if found, 0 if not found, -1 on hangup
+ *
+ * Only do SRV record lookup if you get a domain without a port. If you get a port #, it's a DNS host name.
+ *
+ * \param chan Ast channel
+ * \param host host name (return value)
+ * \param hostlen Length of string "host"
+ * \param port Port number (return value)
+ * \param service Service tag for SRV lookup (like "_sip._udp" or "_stun._udp"
+ */
extern int ast_get_srv(struct ast_channel *chan, char *host, int hostlen, int *port, const char *service);
/*!
@@ -69,6 +75,7 @@
* SRV lookup.
*
* \param context The context returned by ast_srv_lookup
+ *
* \return Number of records in context
*/
unsigned int ast_srv_get_record_count(struct srv_context *context);
@@ -89,8 +96,9 @@
* \param[out] port The port portion of the record
* \param[out] priority The priority portion of the record
* \param[out] weight The weight portion of the record
- * \retval -1 Failed to retrieve information. Likely due to an out of
- * range record_num
+ *
+ * \retval -1 Failed to retrieve information.
+ * Likely due to an out of range record_num
* \retval 0 Success
*/
int ast_srv_get_nth_record(struct srv_context *context, int record_num, const char **host,
Modified: team/jrose/bridge_projects/include/asterisk/stasis_app.h
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/include/asterisk/stasis_app.h?view=diff&rev=386336&r1=386335&r2=386336
==============================================================================
--- team/jrose/bridge_projects/include/asterisk/stasis_app.h (original)
+++ team/jrose/bridge_projects/include/asterisk/stasis_app.h Tue Apr 23 09:37:14 2013
@@ -66,7 +66,7 @@
* \param argv Arguments for the application.
*/
int stasis_app_exec(struct ast_channel *chan, const char *app_name, int argc,
- char *argv[]);
+ char *argv[]);
/*! @} */
@@ -126,22 +126,50 @@
struct stasis_app_control;
/*!
- * \brief Returns the handler for the given channel
+ * \brief Returns the handler for the given channel.
* \param chan Channel to handle.
- * \return NULL channel not in Stasis application
- * \return Pointer to stasis handler.
+ * \return NULL channel not in Stasis application.
+ * \return Pointer to \c res_stasis handler.
*/
struct stasis_app_control *stasis_app_control_find_by_channel(
const struct ast_channel *chan);
/*!
- * \brief Exit \c app_stasis and continue execution in the dialplan.
+ * \brief Returns the handler for the channel with the given id.
+ * \param channel_id Uniqueid of the channel.
+ * \return NULL channel not in Stasis application, or channel does not exist.
+ * \return Pointer to \c res_stasis handler.
+ */
+struct stasis_app_control *stasis_app_control_find_by_channel_id(
+ const char *channel_id);
+
+/*!
+ * \brief Exit \c res_stasis and continue execution in the dialplan.
*
- * If the channel is no longer in \c app_stasis, this function does nothing.
+ * If the channel is no longer in \c res_stasis, this function does nothing.
*
- * \param handler Handler for \c app_stasis
+ * \param control Control for \c res_stasis
*/
-void stasis_app_control_continue(struct stasis_app_control *handler);
+void stasis_app_control_continue(struct stasis_app_control *control);
+
+/*!
+ * \brief Answer the channel associated with this control.
+ * \param control Control for \c res_stasis.
+ * \return 0 for success.
+ * \return -1 for error.
+ */
+int stasis_app_control_answer(struct stasis_app_control *control);
+
+/*! @} */
+
+/*! @{ */
+
+/*!
+ * \brief Build a JSON object from a \ref ast_channel_snapshot.
+ * \return JSON object representing channel snapshot.
+ * \return \c NULL on error
+ */
+struct ast_json *ast_channel_snapshot_to_json(const struct ast_channel_snapshot *snapshot);
/*! @} */
Modified: team/jrose/bridge_projects/include/asterisk/strings.h
[... 1084 lines stripped ...]
More information about the asterisk-commits
mailing list