[asterisk-commits] dlee: branch dlee/stasis-cache-split r393739 - in /team/dlee/stasis-cache-spl...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jul 5 12:22:41 CDT 2013


Author: dlee
Date: Fri Jul  5 12:22:38 2013
New Revision: 393739

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=393739
Log:
Merged revisions 393463-393729 from http://svn.asterisk.org/svn/asterisk/trunk

Added:
    team/dlee/stasis-cache-split/configs/ari.conf.sample
      - copied unchanged from r393729, trunk/configs/ari.conf.sample
    team/dlee/stasis-cache-split/configs/stasis.conf.sample
      - copied unchanged from r393729, trunk/configs/stasis.conf.sample
    team/dlee/stasis-cache-split/doc/rest-api/   (props changed)
      - copied from r393729, trunk/doc/rest-api/
    team/dlee/stasis-cache-split/include/asterisk/stasis_app_recording.h
      - copied unchanged from r393729, trunk/include/asterisk/stasis_app_recording.h
    team/dlee/stasis-cache-split/main/crypt.c
      - copied unchanged from r393729, trunk/main/crypt.c
    team/dlee/stasis-cache-split/main/stasis_config.c
      - copied unchanged from r393729, trunk/main/stasis_config.c
    team/dlee/stasis-cache-split/res/res_ari_model.c
      - copied unchanged from r393729, trunk/res/res_ari_model.c
    team/dlee/stasis-cache-split/res/res_ari_model.exports.in
      - copied unchanged from r393729, trunk/res/res_ari_model.exports.in
    team/dlee/stasis-cache-split/res/res_stasis_recording.c
      - copied unchanged from r393729, trunk/res/res_stasis_recording.c
    team/dlee/stasis-cache-split/res/res_stasis_recording.exports.in
      - copied unchanged from r393729, trunk/res/res_stasis_recording.exports.in
    team/dlee/stasis-cache-split/res/stasis_http/ari_model_validators.c
      - copied unchanged from r393729, trunk/res/stasis_http/ari_model_validators.c
    team/dlee/stasis-cache-split/res/stasis_http/ari_model_validators.h
      - copied unchanged from r393729, trunk/res/stasis_http/ari_model_validators.h
    team/dlee/stasis-cache-split/res/stasis_http/ari_websockets.c
      - copied unchanged from r393729, trunk/res/stasis_http/ari_websockets.c
    team/dlee/stasis-cache-split/res/stasis_http/cli.c
      - copied unchanged from r393729, trunk/res/stasis_http/cli.c
    team/dlee/stasis-cache-split/res/stasis_http/config.c
      - copied unchanged from r393729, trunk/res/stasis_http/config.c
    team/dlee/stasis-cache-split/res/stasis_http/internal.h
      - copied unchanged from r393729, trunk/res/stasis_http/internal.h
    team/dlee/stasis-cache-split/rest-api-templates/api.wiki.mustache
      - copied unchanged from r393729, trunk/rest-api-templates/api.wiki.mustache
    team/dlee/stasis-cache-split/rest-api-templates/ari_model_validators.c.mustache
      - copied unchanged from r393729, trunk/rest-api-templates/ari_model_validators.c.mustache
    team/dlee/stasis-cache-split/rest-api-templates/ari_model_validators.h.mustache
      - copied unchanged from r393729, trunk/rest-api-templates/ari_model_validators.h.mustache
    team/dlee/stasis-cache-split/rest-api-templates/make_ari_stubs.py
      - copied unchanged from r393729, trunk/rest-api-templates/make_ari_stubs.py
    team/dlee/stasis-cache-split/rest-api-templates/models.wiki.mustache
      - copied unchanged from r393729, trunk/rest-api-templates/models.wiki.mustache
    team/dlee/stasis-cache-split/rest-api-templates/param_parsing.mustache
      - copied unchanged from r393729, trunk/rest-api-templates/param_parsing.mustache
    team/dlee/stasis-cache-split/tests/test_ari_model.c
      - copied unchanged from r393729, trunk/tests/test_ari_model.c
Removed:
    team/dlee/stasis-cache-split/configs/stasis_core.conf.sample
    team/dlee/stasis-cache-split/configs/stasis_http.conf.sample
    team/dlee/stasis-cache-split/res/res_stasis_json_asterisk.c
    team/dlee/stasis-cache-split/res/res_stasis_json_asterisk.exports.in
    team/dlee/stasis-cache-split/res/res_stasis_json_bridges.c
    team/dlee/stasis-cache-split/res/res_stasis_json_bridges.exports.in
    team/dlee/stasis-cache-split/res/res_stasis_json_channels.c
    team/dlee/stasis-cache-split/res/res_stasis_json_channels.exports.in
    team/dlee/stasis-cache-split/res/res_stasis_json_endpoints.c
    team/dlee/stasis-cache-split/res/res_stasis_json_endpoints.exports.in
    team/dlee/stasis-cache-split/res/res_stasis_json_events.c
    team/dlee/stasis-cache-split/res/res_stasis_json_events.exports.in
    team/dlee/stasis-cache-split/res/res_stasis_json_playback.c
    team/dlee/stasis-cache-split/res/res_stasis_json_playback.exports.in
    team/dlee/stasis-cache-split/res/res_stasis_json_recordings.c
    team/dlee/stasis-cache-split/res/res_stasis_json_recordings.exports.in
    team/dlee/stasis-cache-split/res/res_stasis_json_sounds.c
    team/dlee/stasis-cache-split/res/res_stasis_json_sounds.exports.in
    team/dlee/stasis-cache-split/res/res_stasis_websocket.c
    team/dlee/stasis-cache-split/res/stasis_json/
    team/dlee/stasis-cache-split/rest-api-templates/event_function_decl.mustache
    team/dlee/stasis-cache-split/rest-api-templates/make_stasis_http_stubs.py
    team/dlee/stasis-cache-split/rest-api-templates/res_stasis_json_resource.c.mustache
    team/dlee/stasis-cache-split/rest-api-templates/res_stasis_json_resource.exports.mustache
    team/dlee/stasis-cache-split/rest-api-templates/stasis_json_resource.h.mustache
Modified:
    team/dlee/stasis-cache-split/   (props changed)
    team/dlee/stasis-cache-split/CHANGES
    team/dlee/stasis-cache-split/Makefile
    team/dlee/stasis-cache-split/UPGRADE.txt
    team/dlee/stasis-cache-split/apps/app_minivm.c
    team/dlee/stasis-cache-split/apps/app_mixmonitor.c
    team/dlee/stasis-cache-split/apps/app_voicemail.c
    team/dlee/stasis-cache-split/bridges/bridge_builtin_features.c
    team/dlee/stasis-cache-split/channels/chan_dahdi.c
    team/dlee/stasis-cache-split/channels/chan_gtalk.c
    team/dlee/stasis-cache-split/configure
    team/dlee/stasis-cache-split/configure.ac
    team/dlee/stasis-cache-split/include/asterisk/app.h
    team/dlee/stasis-cache-split/include/asterisk/autoconfig.h.in
    team/dlee/stasis-cache-split/include/asterisk/bridging_features.h
    team/dlee/stasis-cache-split/include/asterisk/channel.h
    team/dlee/stasis-cache-split/include/asterisk/file.h
    team/dlee/stasis-cache-split/include/asterisk/http.h
    team/dlee/stasis-cache-split/include/asterisk/json.h
    team/dlee/stasis-cache-split/include/asterisk/parking.h
    team/dlee/stasis-cache-split/include/asterisk/paths.h
    team/dlee/stasis-cache-split/include/asterisk/stasis.h
    team/dlee/stasis-cache-split/include/asterisk/stasis_bridging.h
    team/dlee/stasis-cache-split/include/asterisk/stasis_channels.h
    team/dlee/stasis-cache-split/include/asterisk/stasis_http.h
    team/dlee/stasis-cache-split/include/asterisk/utils.h
    team/dlee/stasis-cache-split/main/Makefile
    team/dlee/stasis-cache-split/main/app.c
    team/dlee/stasis-cache-split/main/asterisk.c
    team/dlee/stasis-cache-split/main/bridging.c
    team/dlee/stasis-cache-split/main/cdr.c
    team/dlee/stasis-cache-split/main/cel.c
    team/dlee/stasis-cache-split/main/channel.c
    team/dlee/stasis-cache-split/main/config_options.c
    team/dlee/stasis-cache-split/main/features.c
    team/dlee/stasis-cache-split/main/file.c
    team/dlee/stasis-cache-split/main/http.c
    team/dlee/stasis-cache-split/main/json.c
    team/dlee/stasis-cache-split/main/manager.c
    team/dlee/stasis-cache-split/main/parking.c
    team/dlee/stasis-cache-split/main/stasis.c
    team/dlee/stasis-cache-split/main/stasis_bridging.c
    team/dlee/stasis-cache-split/main/stasis_channels.c
    team/dlee/stasis-cache-split/main/stasis_endpoints.c
    team/dlee/stasis-cache-split/main/utils.c
    team/dlee/stasis-cache-split/makeopts.in
    team/dlee/stasis-cache-split/res/Makefile
    team/dlee/stasis-cache-split/res/parking/parking_applications.c
    team/dlee/stasis-cache-split/res/parking/parking_bridge.c
    team/dlee/stasis-cache-split/res/parking/parking_bridge_features.c
    team/dlee/stasis-cache-split/res/parking/parking_controller.c
    team/dlee/stasis-cache-split/res/parking/parking_manager.c
    team/dlee/stasis-cache-split/res/parking/parking_ui.c
    team/dlee/stasis-cache-split/res/parking/res_parking.h
    team/dlee/stasis-cache-split/res/res_http_websocket.c
    team/dlee/stasis-cache-split/res/res_http_websocket.exports.in
    team/dlee/stasis-cache-split/res/res_sip_notify.c
    team/dlee/stasis-cache-split/res/res_stasis.c
    team/dlee/stasis-cache-split/res/res_stasis_http.c
    team/dlee/stasis-cache-split/res/res_stasis_http.exports.in
    team/dlee/stasis-cache-split/res/res_stasis_http_asterisk.c
    team/dlee/stasis-cache-split/res/res_stasis_http_bridges.c
    team/dlee/stasis-cache-split/res/res_stasis_http_channels.c
    team/dlee/stasis-cache-split/res/res_stasis_http_endpoints.c
    team/dlee/stasis-cache-split/res/res_stasis_http_events.c
    team/dlee/stasis-cache-split/res/res_stasis_http_playback.c
    team/dlee/stasis-cache-split/res/res_stasis_http_recordings.c
    team/dlee/stasis-cache-split/res/res_stasis_http_sounds.c
    team/dlee/stasis-cache-split/res/res_stasis_playback.c
    team/dlee/stasis-cache-split/res/stasis_http/resource_channels.c
    team/dlee/stasis-cache-split/res/stasis_http/resource_channels.h
    team/dlee/stasis-cache-split/res/stasis_http/resource_events.c
    team/dlee/stasis-cache-split/res/stasis_http/resource_events.h
    team/dlee/stasis-cache-split/res/stasis_http/resource_recordings.c
    team/dlee/stasis-cache-split/res/stasis_http/resource_recordings.h
    team/dlee/stasis-cache-split/rest-api-templates/asterisk_processor.py
    team/dlee/stasis-cache-split/rest-api-templates/res_stasis_http_resource.c.mustache
    team/dlee/stasis-cache-split/rest-api-templates/rest_handler.mustache
    team/dlee/stasis-cache-split/rest-api-templates/stasis_http_resource.c.mustache
    team/dlee/stasis-cache-split/rest-api-templates/stasis_http_resource.h.mustache
    team/dlee/stasis-cache-split/rest-api-templates/swagger_model.py
    team/dlee/stasis-cache-split/rest-api-templates/transform.py
    team/dlee/stasis-cache-split/rest-api/api-docs/asterisk.json
    team/dlee/stasis-cache-split/rest-api/api-docs/bridges.json
    team/dlee/stasis-cache-split/rest-api/api-docs/channels.json
    team/dlee/stasis-cache-split/rest-api/api-docs/endpoints.json
    team/dlee/stasis-cache-split/rest-api/api-docs/events.json
    team/dlee/stasis-cache-split/rest-api/api-docs/playback.json
    team/dlee/stasis-cache-split/rest-api/api-docs/recordings.json
    team/dlee/stasis-cache-split/rest-api/api-docs/sounds.json
    team/dlee/stasis-cache-split/tests/test_res_stasis.c
    team/dlee/stasis-cache-split/tests/test_stasis_channels.c
    team/dlee/stasis-cache-split/tests/test_stasis_http.c
    team/dlee/stasis-cache-split/tests/test_utils.c

Propchange: team/dlee/stasis-cache-split/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.

Propchange: team/dlee/stasis-cache-split/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Jul  5 12:22:38 2013
@@ -1,1 +1,1 @@
-/trunk:1-393454
+/trunk:1-393738

Modified: team/dlee/stasis-cache-split/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/CHANGES?view=diff&rev=393739&r1=393738&r2=393739
==============================================================================
--- team/dlee/stasis-cache-split/CHANGES (original)
+++ team/dlee/stasis-cache-split/CHANGES Fri Jul  5 12:22:38 2013
@@ -136,6 +136,10 @@
    feature on the bridge peer in a multi-party bridge will execute it on all
    peers of the activating channel.
 
+ * A channel variable ATTENDEDTRANSFER is now set which indicates which channel
+   was responsible for an attended transfer in a similar fashion to
+   BLINDTRANSFER.
+
 AMI (Asterisk Manager Interface)
 ------------------
  * The SIPshowpeer action will now include a 'SubscribeContext' field for a peer
@@ -176,12 +180,24 @@
 
  * The AMI events 'ParkedCall', 'ParkedCallTimeOut', 'ParkedCallGiveUp', and
    'UnParkedCall' have changed significantly in the new res_parking module.
-   First, channel snapshot data is included for both the parker and the parkee
-   in lieu of the "From" and "Channel" fields. They follow standard channel
-   snapshot format but each field is suffixed with 'Parker' or 'Parkee'
-   depending on which side it applies to. The 'Exten' field is replaced with
-   'ParkingSpace' since the registration of extensions as for parking spaces
-   is no longer mandatory.
+
+   The 'Channel' and 'From' headers are gone. For the channel that was parked
+   or is coming out of parking, a 'Parkee' channel snapshot is issued and it
+   has a number of fields associated with it. The old 'Channel' header relayed
+   the same data as the new 'ParkeeChannel' header.
+
+   The 'From' field was ambiguous and changed meaning depending on the event.
+   for most of these, it was the name of the channel that parked the call
+   (the 'Parker'). There is no longer a header that provides this channel name,
+   however the 'ParkerDialString' will contain a dialstring to redial the
+   device that parked the call.
+
+   On UnParkedCall events, the 'From' header would instead represent the
+   channel responsible for retrieving the parkee. It receives a channel
+   snapshot labeled 'Retriever'. The 'from' field is is replaced with
+   'RetrieverChannel'.
+
+   Lastly, the 'Exten' field has been replaced with 'ParkingSpace'.
 
  * The AMI event 'Parkinglot' (response to 'Parkinglots' command) in a similar
    fashion has changed the field names 'StartExten' and 'StopExten' to
@@ -196,8 +212,8 @@
    event, the various ChanVariable fields will contain a suffix that specifies
    which channel they correspond to.
 
-* The NewPeerAccount AMI event is no longer raised. The NewAccountCode AMI
-  event always conveys the AMI event for a particular channel.
+ * The NewPeerAccount AMI event is no longer raised. The NewAccountCode AMI
+   event always conveys the AMI event for a particular channel.
 
  * All "Reload" events have been consolidated into a single event type. This
    event will always contain a Module field specifying the name of the module
@@ -251,6 +267,8 @@
    renamed "DAHDIChannel" since it does not convey an Asterisk channel name.
 
  * "ChannelUpdate" events have been removed.
+
+ * AMI events now contain a SystemName field, if available.
 
 AGI (Asterisk Gateway Interface)
 ------------------

Modified: team/dlee/stasis-cache-split/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/Makefile?view=diff&rev=393739&r1=393738&r2=393739
==============================================================================
--- team/dlee/stasis-cache-split/Makefile (original)
+++ team/dlee/stasis-cache-split/Makefile Fri Jul  5 12:22:38 2013
@@ -416,6 +416,7 @@
 	rm -f main/version.c
 	rm -f doc/core-en_US.xml
 	rm -f doc/full-en_US.xml
+	rm -f docs/rest-api/*.wiki
 	@$(MAKE) -C menuselect clean
 	cp -f .cleancount .lastclean
 
@@ -535,7 +536,8 @@
 INSTALLDIRS="$(ASTLIBDIR)" "$(ASTMODDIR)" "$(ASTSBINDIR)" "$(ASTETCDIR)" "$(ASTVARRUNDIR)" \
 	"$(ASTSPOOLDIR)" "$(ASTSPOOLDIR)/dictate" "$(ASTSPOOLDIR)/meetme" \
 	"$(ASTSPOOLDIR)/monitor" "$(ASTSPOOLDIR)/system" "$(ASTSPOOLDIR)/tmp" \
-	"$(ASTSPOOLDIR)/voicemail" "$(ASTHEADERDIR)" "$(ASTHEADERDIR)/doxygen" \
+	"$(ASTSPOOLDIR)/voicemail" "$(ASTSPOOLDIR)/recording" \
+	"$(ASTHEADERDIR)" "$(ASTHEADERDIR)/doxygen" \
 	"$(ASTLOGDIR)" "$(ASTLOGDIR)/cdr-csv" "$(ASTLOGDIR)/cdr-custom" \
 	"$(ASTLOGDIR)/cel-custom" "$(ASTDATADIR)" "$(ASTDATADIR)/documentation" \
 	"$(ASTDATADIR)/documentation/thirdparty" "$(ASTDATADIR)/firmware" \
@@ -963,15 +965,15 @@
 
 # We don't want to require Python or Pystache for every build, so this is its
 # own target.
-stasis-stubs:
+ari-stubs:
 ifeq ($(PYTHON),:)
 	@echo "--------------------------------------------------------------------------"
-	@echo "---        Please install python to build Stasis HTTP stubs            ---"
+	@echo "---        Please install python to build ARI stubs            ---"
 	@echo "--------------------------------------------------------------------------"
 	@false
 else
-	$(PYTHON) rest-api-templates/make_stasis_http_stubs.py \
-		rest-api/resources.json res/
+	$(PYTHON) rest-api-templates/make_ari_stubs.py \
+		rest-api/resources.json .
 endif
 
 .PHONY: menuselect
@@ -993,7 +995,7 @@
 .PHONY: installdirs
 .PHONY: validate-docs
 .PHONY: _clean
-.PHONY: stasis-stubs
+.PHONY: ari-stubs
 .PHONY: $(SUBDIRS_INSTALL)
 .PHONY: $(SUBDIRS_DIST_CLEAN)
 .PHONY: $(SUBDIRS_CLEAN)

Modified: team/dlee/stasis-cache-split/UPGRADE.txt
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/UPGRADE.txt?view=diff&rev=393739&r1=393738&r2=393739
==============================================================================
--- team/dlee/stasis-cache-split/UPGRADE.txt (original)
+++ team/dlee/stasis-cache-split/UPGRADE.txt Fri Jul  5 12:22:38 2013
@@ -75,6 +75,22 @@
    - Channels no longer swap Uniqueid's as a result of the masquerade.
    - Instead of a shell game of renames, there's now a single rename, appending
      <ZOMBIE> to the name of the original channel.
+ - The AMI events 'ParkedCall', 'ParkedCallTimeOut', 'ParkedCallGiveUp', and
+   'UnParkedCall' have changed significantly in the new res_parking module.
+   - The 'Channel' and 'From' headers are gone. For the channel that was parked
+     or is coming out of parking, a 'Parkee' channel snapshot is issued and it
+     has a number of fields associated with it. The old 'Channel' header relayed
+     the same data as the new 'ParkeeChannel' header.
+   - The 'From' field was ambiguous and changed meaning depending on the event.
+     for most of these, it was the name of the channel that parked the call
+     (the 'Parker'). There is no longer a header that provides this channel name,
+     however the 'ParkerDialString' will contain a dialstring to redial the
+     device that parked the call.
+   - On UnParkedCall events, the 'From' header would instead represent the
+     channel responsible for retrieving the parkee. It receives a channel
+     snapshot labeled 'Retriever'. The 'from' field is is replaced with
+     'RetrieverChannel'.
+   - Lastly, the 'Exten' field has been replaced with 'ParkingSpace'.
 
 CEL:
  - The Uniqueid field for a channel is now a stable identifier, and will not

Modified: team/dlee/stasis-cache-split/apps/app_minivm.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/apps/app_minivm.c?view=diff&rev=393739&r1=393738&r2=393739
==============================================================================
--- team/dlee/stasis-cache-split/apps/app_minivm.c (original)
+++ team/dlee/stasis-cache-split/apps/app_minivm.c Fri Jul  5 12:22:38 2013
@@ -1674,7 +1674,7 @@
 				ast_channel_setoption(chan, AST_OPTION_RXGAIN, &record_gain, sizeof(record_gain), 0);
 			if (ast_test_flag(vmu, MVM_OPERATOR))
 				canceldtmf = "0";
-			cmd = ast_play_and_record_full(chan, playfile, recordfile, maxtime, fmt, duration, sound_duration, global_silencethreshold, global_maxsilence, unlockdir, acceptdtmf, canceldtmf);
+			cmd = ast_play_and_record_full(chan, playfile, recordfile, maxtime, fmt, duration, sound_duration, global_silencethreshold, global_maxsilence, unlockdir, acceptdtmf, canceldtmf, 0, AST_RECORD_IF_EXISTS_OVERWRITE);
 			if (record_gain)
 				ast_channel_setoption(chan, AST_OPTION_RXGAIN, &zero_gain, sizeof(zero_gain), 0);
 			if (cmd == -1) /* User has hung up, no options to give */

Modified: team/dlee/stasis-cache-split/apps/app_mixmonitor.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/apps/app_mixmonitor.c?view=diff&rev=393739&r1=393738&r2=393739
==============================================================================
--- team/dlee/stasis-cache-split/apps/app_mixmonitor.c (original)
+++ team/dlee/stasis-cache-split/apps/app_mixmonitor.c Fri Jul  5 12:22:38 2013
@@ -79,7 +79,6 @@
 					</option>
 					<option name="b">
 						<para>Only save audio to the file while the channel is bridged.</para>
-						<note><para>Does not include conferences or sounds played to each bridged party</para></note>
 						<note><para>If you utilize this option inside a Local channel, you must make sure the Local
 						channel is not optimized away. To do this, be sure to call your Local channel with the
 						<literal>/n</literal> option. For example: Dial(Local/start at mycontext/n)</para></note>
@@ -104,7 +103,6 @@
 						<para>Use the specified file to record the <emphasis>receive</emphasis> audio feed.
 						Like with the basic filename argument, if an absolute path isn't given, it will create
 						the file in the configured monitoring directory.</para>
-
 					</option>
 					<option name="t">
 						<argument name="file" required="true" />
@@ -134,11 +132,7 @@
 			<para>Records the audio on the current channel to the specified file.</para>
 			<para>This application does not automatically answer and should be preceeded by
 			an application such as Answer or Progress().</para>
-			<note><para>MixMonitor runs as an audiohook. In order to keep it running through
-			a transfer, AUDIOHOOK_INHERIT must be set for the channel which ran mixmonitor.
-			For more information, including dialplan configuration set for using
-			AUDIOHOOK_INHERIT with MixMonitor, see the function documentation for
-			AUDIOHOOK_INHERIT.</para></note>
+			<note><para>MixMonitor runs as an audiohook.</para></note>
 			<variablelist>
 				<variable name="MIXMONITOR_FILENAME">
 					<para>Will contain the filename used to record.</para>
@@ -649,7 +643,9 @@
 		 * Unlock it, but remember to lock it before looping or exiting */
 		ast_audiohook_unlock(&mixmonitor->audiohook);
 
-		if (!ast_test_flag(mixmonitor, MUXFLAG_BRIDGED) || (mixmonitor->autochan->chan && ast_bridged_channel(mixmonitor->autochan->chan))) {
+		if (!ast_test_flag(mixmonitor, MUXFLAG_BRIDGED)
+			|| (mixmonitor->autochan->chan
+				&& ast_channel_is_bridged(mixmonitor->autochan->chan))) {
 			ast_mutex_lock(&mixmonitor->mixmonitor_ds->lock);
 
 			/* Write out the frame(s) */
@@ -808,7 +804,9 @@
 				*p2 = '$';
 			}
 		}
+		ast_channel_lock(chan);
 		pbx_substitute_variables_helper(chan, p1, postprocess2, sizeof(postprocess2) - 1);
+		ast_channel_unlock(chan);
 	}
 
 	/* Pre-allocate mixmonitor structure and spy */
@@ -947,7 +945,7 @@
 	char *filename_read = NULL;
 	char *filename_write = NULL;
 	char filename_buffer[1024] = "";
-        char *uid_channel_var = NULL;
+	char *uid_channel_var = NULL;
 
 	struct ast_flags flags = { 0 };
 	char *recipients = NULL;
@@ -1072,9 +1070,10 @@
 
 	ast_channel_lock(chan);
 
-	if (!(datastore = ast_channel_datastore_find(chan, &mixmonitor_ds_info, args.mixmonid))) {
+	datastore = ast_channel_datastore_find(chan, &mixmonitor_ds_info, args.mixmonid);
+	if (!datastore) {
 		ast_channel_unlock(chan);
-                return -1;
+		return -1;
 	}
 	mixmonitor_ds = datastore->data;
 
@@ -1124,9 +1123,11 @@
 	case CLI_INIT:
 		e->command = "mixmonitor {start|stop|list}";
 		e->usage =
-			"Usage: mixmonitor <start|stop|list> <chan_name> [args]\n"
-			"       The optional arguments are passed to the MixMonitor\n"
-			"       application when the 'start' command is used.\n";
+			"Usage: mixmonitor start <chan_name> [args]\n"
+			"         The optional arguments are passed to the MixMonitor application.\n"
+			"       mixmonitor stop <chan_name> [args]\n"
+			"         The optional arguments are passed to the StopMixMonitor application.\n"
+			"       mixmonitor list <chan_name>\n";
 		return NULL;
 	case CLI_GENERATE:
 		return ast_complete_channels(a->line, a->word, a->pos, a->n, 2);
@@ -1142,35 +1143,35 @@
 		return CLI_SUCCESS;
 	}
 
-	ast_channel_lock(chan);
-
 	if (!strcasecmp(a->argv[1], "start")) {
 		mixmonitor_exec(chan, (a->argc >= 4) ? a->argv[3] : "");
-		ast_channel_unlock(chan);
 	} else if (!strcasecmp(a->argv[1], "stop")){
-		ast_channel_unlock(chan);
 		stop_mixmonitor_exec(chan, (a->argc >= 4) ? a->argv[3] : "");
 	} else if (!strcasecmp(a->argv[1], "list")) {
 		ast_cli(a->fd, "MixMonitor ID\tFile\tReceive File\tTransmit File\n");
 		ast_cli(a->fd, "=========================================================================\n");
+		ast_channel_lock(chan);
 		AST_LIST_TRAVERSE(ast_channel_datastores(chan), datastore, entry) {
 			if (datastore->info == &mixmonitor_ds_info) {
 				char *filename = "";
 				char *filename_read = "";
 				char *filename_write = "";
+
 				mixmonitor_ds = datastore->data;
-				if (mixmonitor_ds->fs)
-					filename = ast_strdupa(mixmonitor_ds->fs->filename);
-				if (mixmonitor_ds->fs_read)
-					filename_read = ast_strdupa(mixmonitor_ds->fs_read->filename);
-				if (mixmonitor_ds->fs_write)
-					filename_write = ast_strdupa(mixmonitor_ds->fs_write->filename);
+				if (mixmonitor_ds->fs) {
+					filename = mixmonitor_ds->fs->filename;
+				}
+				if (mixmonitor_ds->fs_read) {
+					filename_read = mixmonitor_ds->fs_read->filename;
+				}
+				if (mixmonitor_ds->fs_write) {
+					filename_write = mixmonitor_ds->fs_write->filename;
+				}
 				ast_cli(a->fd, "%p\t%s\t%s\t%s\n", mixmonitor_ds, filename, filename_read, filename_write);
 			}
 		}
 		ast_channel_unlock(chan);
 	} else {
-		ast_channel_unlock(chan);
 		chan = ast_channel_unref(chan);
 		return CLI_SHOWUSAGE;
 	}
@@ -1183,15 +1184,12 @@
 /*! \brief  Mute / unmute  a MixMonitor channel */
 static int manager_mute_mixmonitor(struct mansession *s, const struct message *m)
 {
-	struct ast_channel *c = NULL;
-
+	struct ast_channel *c;
 	const char *name = astman_get_header(m, "Channel");
 	const char *id = astman_get_header(m, "ActionID");
 	const char *state = astman_get_header(m, "State");
 	const char *direction = astman_get_header(m,"Direction");
-
 	int clearmute = 1;
-
 	enum ast_audiohook_flags flag;
 
 	if (ast_strlen_zero(direction)) {
@@ -1221,15 +1219,15 @@
 	}
 
 	clearmute = ast_false(state);
+
 	c = ast_channel_get_by_name(name);
-
 	if (!c) {
 		astman_send_error(s, m, "No such channel");
 		return AMI_SUCCESS;
 	}
 
 	if (ast_audiohook_set_mute(c, mixmonitor_spy_type, flag, clearmute)) {
-		c = ast_channel_unref(c);
+		ast_channel_unref(c);
 		astman_send_error(s, m, "Cannot set mute flag");
 		return AMI_SUCCESS;
 	}
@@ -1242,29 +1240,22 @@
 
 	astman_append(s, "\r\n");
 
-	c = ast_channel_unref(c);
+	ast_channel_unref(c);
 
 	return AMI_SUCCESS;
 }
 
 static int start_mixmonitor_callback(struct ast_channel *chan, const char *filename, const char *options)
 {
-	char *opts[OPT_ARG_ARRAY_SIZE] = { NULL, };
-	struct ast_flags flags = { 0 };
-	char args[PATH_MAX] = "";
-	int res;
-
-	if (!ast_strlen_zero(options)) {
-		ast_app_parse_options(mixmonitor_opts, &flags, opts, ast_strdupa(options));
-	}
-
-	snprintf(args, sizeof(args), "%s,%s", filename, options);
-
-	ast_channel_lock(chan);
-	res = mixmonitor_exec(chan, args);
-	ast_channel_unlock(chan);
-
-	return res;
+	char args[PATH_MAX];
+
+	if (ast_strlen_zero(options)) {
+		snprintf(args, sizeof(args), "%s", filename);
+	} else {
+		snprintf(args, sizeof(args), "%s,%s", filename, options);
+	}
+
+	return mixmonitor_exec(chan, args);
 }
 
 static int stop_mixmonitor_callback(struct ast_channel *chan, const char *mixmonitor_id)
@@ -1274,8 +1265,7 @@
 
 static int manager_mixmonitor(struct mansession *s, const struct message *m)
 {
-	struct ast_channel *c = NULL;
-
+	struct ast_channel *c;
 	const char *name = astman_get_header(m, "Channel");
 	const char *id = astman_get_header(m, "ActionID");
 	const char *file = astman_get_header(m, "File");
@@ -1284,16 +1274,15 @@
 	struct ast_flags flags = { 0 };
 	char *uid_channel_var = NULL;
 	const char *mixmonitor_id = NULL;
-
 	int res;
-	char args[PATH_MAX] = "";
+	char args[PATH_MAX];
+
 	if (ast_strlen_zero(name)) {
 		astman_send_error(s, m, "No channel specified");
 		return AMI_SUCCESS;
 	}
 
 	c = ast_channel_get_by_name(name);
-
 	if (!c) {
 		astman_send_error(s, m, "No such channel");
 		return AMI_SUCCESS;
@@ -1305,17 +1294,18 @@
 
 	snprintf(args, sizeof(args), "%s,%s", file, options);
 
-	ast_channel_lock(c);
 	res = mixmonitor_exec(c, args);
 
 	if (ast_test_flag(&flags, MUXFLAG_UID)) {
 		uid_channel_var = opts[OPT_ARG_UID];
+		ast_channel_lock(c);
 		mixmonitor_id = pbx_builtin_getvar_helper(c, uid_channel_var);
-	}
-	ast_channel_unlock(c);
+		mixmonitor_id = ast_strdupa(S_OR(mixmonitor_id, ""));
+		ast_channel_unlock(c);
+	}
 
 	if (res) {
-		c = ast_channel_unref(c);
+		ast_channel_unref(c);
 		astman_send_error(s, m, "Could not start monitoring channel");
 		return AMI_SUCCESS;
 	}
@@ -1332,35 +1322,33 @@
 
 	astman_append(s, "\r\n");
 
-	c = ast_channel_unref(c);
+	ast_channel_unref(c);
 
 	return AMI_SUCCESS;
 }
 
 static int manager_stop_mixmonitor(struct mansession *s, const struct message *m)
 {
-	struct ast_channel *c = NULL;
-
+	struct ast_channel *c;
 	const char *name = astman_get_header(m, "Channel");
 	const char *id = astman_get_header(m, "ActionID");
 	const char *mixmonitor_id = astman_get_header(m, "MixMonitorID");
-
 	int res;
+
 	if (ast_strlen_zero(name)) {
 		astman_send_error(s, m, "No channel specified");
 		return AMI_SUCCESS;
 	}
 
 	c = ast_channel_get_by_name(name);
-
 	if (!c) {
 		astman_send_error(s, m, "No such channel");
 		return AMI_SUCCESS;
 	}
 
 	res = stop_mixmonitor_full(c, mixmonitor_id);
-
 	if (res) {
+		ast_channel_unref(c);
 		astman_send_error(s, m, "Could not stop monitoring channel");
 		return AMI_SUCCESS;
 	}
@@ -1373,7 +1361,7 @@
 
 	astman_append(s, "\r\n");
 
-	c = ast_channel_unref(c);
+	ast_channel_unref(c);
 
 	return AMI_SUCCESS;
 }

Modified: team/dlee/stasis-cache-split/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/apps/app_voicemail.c?view=diff&rev=393739&r1=393738&r2=393739
==============================================================================
--- team/dlee/stasis-cache-split/apps/app_voicemail.c (original)
+++ team/dlee/stasis-cache-split/apps/app_voicemail.c Fri Jul  5 12:22:38 2013
@@ -14684,7 +14684,7 @@
 				ast_channel_setoption(chan, AST_OPTION_RXGAIN, &record_gain, sizeof(record_gain), 0);
 			if (ast_test_flag(vmu, VM_OPERATOR))
 				canceldtmf = "0";
-			cmd = ast_play_and_record_full(chan, playfile, tempfile, maxtime, fmt, duration, sound_duration, silencethreshold, maxsilence, unlockdir, acceptdtmf, canceldtmf);
+			cmd = ast_play_and_record_full(chan, playfile, tempfile, maxtime, fmt, duration, sound_duration, silencethreshold, maxsilence, unlockdir, acceptdtmf, canceldtmf, 0, AST_RECORD_IF_EXISTS_OVERWRITE);
 			if (strchr(canceldtmf, cmd)) {
 			/* need this flag here to distinguish between pressing '0' during message recording or after */
 				canceleddtmf = 1;

Modified: team/dlee/stasis-cache-split/bridges/bridge_builtin_features.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/bridges/bridge_builtin_features.c?view=diff&rev=393739&r1=393738&r2=393739
==============================================================================
--- team/dlee/stasis-cache-split/bridges/bridge_builtin_features.c (original)
+++ team/dlee/stasis-cache-split/bridges/bridge_builtin_features.c Fri Jul  5 12:22:38 2013
@@ -139,6 +139,9 @@
 
 	/* Who is transferring the call. */
 	pbx_builtin_setvar_helper(chan, "TRANSFERERNAME", ast_channel_name(caller));
+
+	/* To work as an analog to BLINDTRANSFER */
+	pbx_builtin_setvar_helper(chan, "ATTENDEDTRANSFER", ast_channel_name(caller));
 
 	/* Before we actually dial out let's inherit appropriate information. */
 	copy_caller_data(chan, caller);
@@ -466,15 +469,57 @@
 	return 0;
 }
 
-static void stop_automonitor(struct ast_bridge_channel *bridge_channel, struct ast_channel *peer_chan, struct ast_features_general_config *features_cfg)
-{
-	const char *stop_message;
-
-	ast_channel_lock(bridge_channel->chan);
-	stop_message = pbx_builtin_getvar_helper(bridge_channel->chan, "TOUCH_MONITOR_MESSAGE_STOP");
-	stop_message = ast_strdupa(S_OR(stop_message, ""));
-	ast_channel_unlock(bridge_channel->chan);
-
+enum set_touch_variables_res {
+	SET_TOUCH_SUCCESS,
+	SET_TOUCH_UNSET,
+	SET_TOUCH_ALLOC_FAILURE,
+};
+
+static void set_touch_variable(enum set_touch_variables_res *res, struct ast_channel *chan, const char *var_name, char **touch)
+{
+	const char *c_touch;
+
+	if (*res == SET_TOUCH_ALLOC_FAILURE) {
+		return;
+	}
+	c_touch = pbx_builtin_getvar_helper(chan, var_name);
+	if (!ast_strlen_zero(c_touch)) {
+		*touch = ast_strdup(c_touch);
+		if (!*touch) {
+			*res = SET_TOUCH_ALLOC_FAILURE;
+		} else {
+			*res = SET_TOUCH_SUCCESS;
+		}
+	}
+}
+
+static enum set_touch_variables_res set_touch_variables(struct ast_channel *chan, int is_mixmonitor, char **touch_format, char **touch_monitor, char **touch_monitor_prefix)
+{
+	enum set_touch_variables_res res = SET_TOUCH_UNSET;
+	const char *var_format;
+	const char *var_monitor;
+	const char *var_prefix;
+
+	SCOPED_CHANNELLOCK(lock, chan);
+
+	if (is_mixmonitor) {
+		var_format = "TOUCH_MIXMONITOR_FORMAT";
+		var_monitor = "TOUCH_MIXMONITOR";
+		var_prefix = "TOUCH_MIXMONITOR_PREFIX";
+	} else {
+		var_format = "TOUCH_MONITOR_FORMAT";
+		var_monitor = "TOUCH_MONITOR";
+		var_prefix = "TOUCH_MONITOR_PREFIX";
+	}
+	set_touch_variable(&res, chan, var_format, touch_format);
+	set_touch_variable(&res, chan, var_monitor, touch_monitor);
+	set_touch_variable(&res, chan, var_prefix, touch_monitor_prefix);
+
+	return res;
+}
+
+static void stop_automonitor(struct ast_bridge_channel *bridge_channel, struct ast_channel *peer_chan, struct ast_features_general_config *features_cfg, const char *stop_message)
+{
 	ast_verb(3, "AutoMonitor used to stop recording call.\n");
 
 	ast_channel_lock(peer_chan);
@@ -506,54 +551,10 @@
 	}
 }
 
-enum set_touch_variables_res {
-	SET_TOUCH_SUCCESS = 0,
-	SET_TOUCH_UNSET,
-	SET_TOUCH_ALLOC_FAILURE,
-};
-
-static int set_touch_variables(struct ast_channel *chan, int is_mixmonitor, char **touch_format, char **touch_monitor, char **touch_monitor_prefix)
-{
-	enum set_touch_variables_res res = SET_TOUCH_UNSET;
-	const char *c_touch_format, *c_touch_monitor, *c_touch_monitor_prefix;
-
-	SCOPED_CHANNELLOCK(lock, chan);
-
-	c_touch_format = pbx_builtin_getvar_helper(chan, is_mixmonitor ? "TOUCH_MIXMONITOR_FORMAT" : "TOUCH_MONITOR_FORMAT");
-
-	if (!ast_strlen_zero(c_touch_format)) {
-		if (!(*touch_format = ast_strdup(c_touch_format))) {
-			return SET_TOUCH_ALLOC_FAILURE;
-		}
-		res = SET_TOUCH_SUCCESS;
-	}
-
-	c_touch_monitor = pbx_builtin_getvar_helper(chan, is_mixmonitor ? "TOUCH_MIXMONITOR" : "TOUCH_MONITOR");
-
-	if (!ast_strlen_zero(c_touch_monitor)) {
-		if (!(*touch_monitor = ast_strdup(c_touch_monitor))) {
-			return SET_TOUCH_ALLOC_FAILURE;
-		}
-		res = SET_TOUCH_SUCCESS;
-	}
-
-	c_touch_monitor_prefix = pbx_builtin_getvar_helper(chan, is_mixmonitor ? "TOUCH_MIXMONITOR_PREFIX" : "TOUCH_MONITOR_PREFIX");
-
-	if (!ast_strlen_zero(c_touch_monitor_prefix)) {
-		if (!(*touch_monitor_prefix = ast_strdup(c_touch_monitor_prefix))) {
-			return SET_TOUCH_ALLOC_FAILURE;
-		}
-		res = SET_TOUCH_SUCCESS;
-	}
-
-	return res;
-}
-
-static int feature_automonitor(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, void *hook_pvt)
-{
-	char *caller_chan_id = NULL, *peer_chan_id = NULL, *touch_filename = NULL;
+static void start_automonitor(struct ast_bridge_channel *bridge_channel, struct ast_channel *peer_chan, struct ast_features_general_config *features_cfg, const char *start_message)
+{
+	char *touch_filename;
 	size_t len;
-	const char *automon_message;
 	int x;
 	enum set_touch_variables_res set_touch_res;
 
@@ -561,49 +562,47 @@
 	RAII_VAR(char *, touch_monitor, NULL, ast_free);
 	RAII_VAR(char *, touch_monitor_prefix, NULL, ast_free);
 
-	RAII_VAR(struct ast_channel *, peer_chan, NULL, ast_channel_cleanup);
-	RAII_VAR(struct ast_features_general_config *, features_cfg, NULL, ao2_cleanup);
-
-	features_cfg = ast_get_chan_features_general_config(bridge_channel->chan);
-	peer_chan = ast_bridge_peer(bridge, bridge_channel->chan);
-
-	if (!peer_chan) {
-		ast_verb(3, "Cannot start AutoMonitor for %s - can not determine peer in bridge.\n", ast_channel_name(bridge_channel->chan));
-		if (features_cfg && !(ast_strlen_zero(features_cfg->recordingfailsound))) {
-			ast_bridge_channel_queue_playfile(bridge_channel, NULL, features_cfg->recordingfailsound, NULL);
-		}
-		return 0;
-	}
-
-	if (ast_channel_monitor(peer_chan)) {
-		stop_automonitor(bridge_channel, peer_chan, features_cfg);
-		return 0;
-	}
-
-	if ((set_touch_res = set_touch_variables(bridge_channel->chan, 0, &touch_format, &touch_monitor, &touch_monitor_prefix))) {
+	set_touch_res = set_touch_variables(bridge_channel->chan, 0, &touch_format,
+		&touch_monitor, &touch_monitor_prefix);
+	switch (set_touch_res) {
+	case SET_TOUCH_SUCCESS:
+		break;
+	case SET_TOUCH_UNSET:
+		set_touch_res = set_touch_variables(peer_chan, 0, &touch_format, &touch_monitor,
+			&touch_monitor_prefix);
 		if (set_touch_res == SET_TOUCH_ALLOC_FAILURE) {
-			return 0;
-		}
-		if (set_touch_variables(peer_chan, 0, &touch_format, &touch_monitor, &touch_monitor_prefix) == SET_TOUCH_ALLOC_FAILURE) {
-			return 0;
-		}
+			return;
+		}
+		break;
+	case SET_TOUCH_ALLOC_FAILURE:
+		return;
 	}
 
 	if (!ast_strlen_zero(touch_monitor)) {
 		len = strlen(touch_monitor) + 50;
 		touch_filename = ast_alloca(len);
-		snprintf(touch_filename, len, "%s-%ld-%s", S_OR(touch_monitor_prefix, "auto"), (long)time(NULL), touch_monitor);
+		snprintf(touch_filename, len, "%s-%ld-%s",
+			S_OR(touch_monitor_prefix, "auto"),
+			(long) time(NULL),
+			touch_monitor);
 	} else {
+		char *caller_chan_id;
+		char *peer_chan_id;
+
 		caller_chan_id = ast_strdupa(S_COR(ast_channel_caller(bridge_channel->chan)->id.number.valid,
 			ast_channel_caller(bridge_channel->chan)->id.number.str, ast_channel_name(bridge_channel->chan)));
 		peer_chan_id = ast_strdupa(S_COR(ast_channel_caller(peer_chan)->id.number.valid,
 			ast_channel_caller(peer_chan)->id.number.str, ast_channel_name(peer_chan)));
 		len = strlen(caller_chan_id) + strlen(peer_chan_id) + 50;
 		touch_filename = ast_alloca(len);
-		snprintf(touch_filename, len, "%s-%ld-%s-%s", S_OR(touch_monitor_prefix, "auto"), (long)time(NULL), caller_chan_id, peer_chan_id);
-	}
-
-	for ( x = 0; x < strlen(touch_filename); x++) {
+		snprintf(touch_filename, len, "%s-%ld-%s-%s",
+			S_OR(touch_monitor_prefix, "auto"),
+			(long) time(NULL),
+			caller_chan_id,
+			peer_chan_id);
+	}
+
+	for (x = 0; x < strlen(touch_filename); x++) {
 		if (touch_filename[x] == '/') {
 			touch_filename[x] = '-';
 		}
@@ -612,40 +611,102 @@
 	ast_verb(3, "AutoMonitor used to record call. Filename: %s\n", touch_filename);
 
 	if (ast_monitor_start(peer_chan, touch_format, touch_filename, 1, X_REC_IN | X_REC_OUT)) {
-		ast_verb(3, "automon feature was tried by '%s' but monitor failed to start.\n", ast_channel_name(bridge_channel->chan));
-		return 0;
-	}
-
-	ast_channel_lock(bridge_channel->chan);
-	if ((automon_message = pbx_builtin_getvar_helper(bridge_channel->chan, "TOUCH_MONITOR_MESSAGE_START"))) {
-		automon_message = ast_strdupa(automon_message);
-	}
-	ast_channel_unlock(bridge_channel->chan);
-
-	if ((features_cfg = ast_get_chan_features_general_config(bridge_channel->chan)) && !(ast_strlen_zero(features_cfg->courtesytone))) {
+		ast_verb(3, "automon feature was tried by '%s' but monitor failed to start.\n",
+			ast_channel_name(bridge_channel->chan));
+		return;
+	}
+
+	if (features_cfg && !ast_strlen_zero(features_cfg->courtesytone)) {
 		ast_bridge_channel_queue_playfile(bridge_channel, NULL, features_cfg->courtesytone, NULL);
 		ast_bridge_channel_write_playfile(bridge_channel, NULL, features_cfg->courtesytone, NULL);
 	}
 
-	if (!ast_strlen_zero(automon_message)) {

[... 9937 lines stripped ...]



More information about the asterisk-commits mailing list