[asterisk-commits] may: branch may/ooh323_qsig r397669 - in /team/may/ooh323_qsig: ./ apps/ brid...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Aug 26 14:52:40 CDT 2013


Author: may
Date: Mon Aug 26 14:52:28 2013
New Revision: 397669

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=397669
Log:
Multiple revisions 393066,393083,393100,393128,393130,393144,393164,393182,393184,393190,393197,393219,393239-393241,393262,393264,393284,393309,393326,393332,393361,393364,393383,393396

........
  r393066 | rmudgett | 2013-06-28 01:01:04 +0400 (Fri, 28 Jun 2013) | 1 line
  
  Change the name of some local variables in bridging.c to reflect what they really mean.
........
  r393083 | dlee | 2013-06-28 05:07:32 +0400 (Fri, 28 Jun 2013) | 7 lines
  
  Removed the automatic 302 redirects for ARI URL's that end with a slash.
  
  There were some problems redirecting RESTful API requests; notably the client
  would change the request method to GET on the redirected requests. After some
  looking into, I decided that a 404 would be simpler and have more consistent
  behavior.
........
  r393100 | dlee | 2013-06-28 06:14:27 +0400 (Fri, 28 Jun 2013) | 6 lines
  
  Removed stray apostrophe.
  
  Apparently the pluralization of an acronym does not use an apostophe,
  according to most modern style guides. I feel like I've been living a
  lie this whole time.
........
  r393128 | qwell | 2013-06-28 19:36:49 +0400 (Fri, 28 Jun 2013) | 1 line
  
  Change some 500 errors to 400.
........
  r393130 | mjordan | 2013-06-28 19:50:56 +0400 (Fri, 28 Jun 2013) | 32 lines
  
  Better handle parking in CDRs
  
  Parking typically occurs when a channel is transferred to a parking extension.
  When this occurs, the channel never actually hits the dialplan if the extension
  it was transferred to was a "parking extension", that is, the extension in
  the first priority calls the Park application. Instead, the channel is
  immediately sent into the holding bridge acting as the parking bridge.
  
  This is problematic.
  
  Because we never go out to the dialplan, the CDRs won't transition properly
  and the application field will not be set to "Park". CDRs typically swallow
  holding bridges, so the CDR itself won't even be generated.
  
  This patch handles this by pulling out the holding bridge handling into its
  own CDR state. CDRs now have an explicit parking state that accounts for this
  specific subclass of the holding bridge. In addition, we handle the parking
  stasis message to set application specific data on the CDR such that the
  last known application for the CDR properly reflects "Park".
  
  This is a bit sad since we're working around the odd internal implementation
  of parking that exists in Asterisk (and that we had to maintain in order to
  continue to meet some odd use cases of parking), but at least the code to
  handle that is where it belongs: in CDRs as opposed to sprinkled liberally
  throughout the codebase.
  
  This patch also properly clears the OUTBOUND channel flag from a channel when
  it leaves a bridge, and tweaks up dialing handling to properly compare the
  correct CDR with the channel calling/being dialed.
........
  r393144 | qwell | 2013-06-28 20:23:24 +0400 (Fri, 28 Jun 2013) | 8 lines
  
  Change ARI originate to also allow dialing an exten/context/priority.
  
  The old way didn't make much sense, so some of the fields were repurposed.
  
  (closes issue ASTERISK-21658)
  
  Review: https://reviewboard.asterisk.org/r/2626/
........
  r393164 | mjordan | 2013-06-28 21:31:33 +0400 (Fri, 28 Jun 2013) | 18 lines
  
  Handle an originated channel being sent into a non-empty bridge
  
  Originated channels are a bit odd - they are technically a dialed channel (thus
  the party B or peer) but, since there is no caller, they are treated as the
  party A. When entering into a bridge that already contains participants, the CDR
  engine - if the CDR record is in the Dial state - attempts to match the person
  entering the bridge with an existing participant. The idea is that if you dialed
  someone and the person you dialed is already in the bridge, you don't need a new
  CDR record, the existing CDR record describes the relationship.
  
  Unfortunately, for an originated channel, there is no Party B. If no one was in
  the bridge this didn't cause any issues; however, if participants were in the
  bridge the CDR engine would attempt to match a non-existant Party B on the
  channel's CDR record and explode.
  
  This patch fixes that, and a unit test has been added to cover this case.
........
  r393182 | mmichelson | 2013-06-28 22:42:24 +0400 (Fri, 28 Jun 2013) | 12 lines
  
  Add stasis publications for blind and attended transfers.
  
  This creates stasis messages that are sent during a blind or
  attended transfer. The stasis messages also are converted to
  AMI events.
  
  Review: https://reviewboard.asterisk.org/r/2619
  
  (closes issue ASTERISK-21337)
  Reported by Matt Jordan
........
  r393184 | rmudgett | 2013-06-28 23:05:52 +0400 (Fri, 28 Jun 2013) | 5 lines
  
  Fix overlapping enum ast_bridge_feature_flags.
  
  Things may no longer behave in an unexpected fashion.  Local channel
  optimization to holding bridges will work again.
........
  r393190 | jrose | 2013-06-28 23:19:15 +0400 (Fri, 28 Jun 2013) | 6 lines
  
  features: call pickup stasis refactoring
  
  (issue ASTERISK-21544)
  Reported by: Matt Jordan
  Review: https://reviewboard.asterisk.org/r/2588/
........
  r393197 | jrose | 2013-06-28 23:22:16 +0400 (Fri, 28 Jun 2013) | 6 lines
  
  res_parking: Dynamic Parking Lots
  
  (closes issue ASTERISK-21644)
  Reported by: Matt Jordan
  Review: https://reviewboard.asterisk.org/r/2615/
........
  r393219 | rmudgett | 2013-06-29 00:43:48 +0400 (Sat, 29 Jun 2013) | 1 line
  
  Promote local channel optimizing debug messages to verbose 3 messages.
........
  r393239 | rmudgett | 2013-06-29 04:18:57 +0400 (Sat, 29 Jun 2013) | 1 line
  
  This is no longer needed.
........
  r393240 | rmudgett | 2013-06-29 04:26:07 +0400 (Sat, 29 Jun 2013) | 1 line
  
  Fix after bridge callback datastore data memory leak.
........
  r393241 | rmudgett | 2013-06-29 04:31:00 +0400 (Sat, 29 Jun 2013) | 2 lines
  
  Tweak after bridge callback reason to string strings.
........
  r393262 | file | 2013-06-29 17:42:19 +0400 (Sat, 29 Jun 2013) | 6 lines
  
  Implement the defined PUBLISH ESC API within res_sip_pubsub.
  
  (closes issue ASTERISK-21452)
  
  Review: https://reviewboard.asterisk.org/r/2630/
........
  r393264 | file | 2013-06-29 17:47:22 +0400 (Sat, 29 Jun 2013) | 2 lines
  
  Nothing to see here, move along.
........
  r393284 | kmoore | 2013-07-01 17:16:09 +0400 (Mon, 01 Jul 2013) | 18 lines
  
  Refactor extraneous channel events
  
  This change removes JitterBufStats, ChannelReload, and ChannelUpdate
  and refactors the following events to travel over Stasis-Core:
  * LocalBridge
  * DAHDIChannel
  * AlarmClear
  * SpanAlarmClear
  * Alarm
  * SpanAlarm
  * DNDState
  * MCID
  * SIPQualifyPeerDone
  * SessionTimeout
  
  Review: https://reviewboard.asterisk.org/r/2627/
  (closes issue ASTERISK-21476)
........
  r393309 | jrose | 2013-07-01 20:01:24 +0400 (Mon, 01 Jul 2013) | 11 lines
  
  bridge_features: Support One touch Monitor/MixMonitor
  
  In addition to porting those features, they now enjoy greater feature parity
  with one another. Specifically, AutoMixMon now has a start and stop
  message that can be specified with TOUCH_MIXMONITOR_MESSAGE_START and
  TOUCH_MIXMONITOR_MESSAGE_STOP.
  
  (closes issue ASTERISK-21553)
  Reported by: Matt Jordan
  Review: https://reviewboard.asterisk.org/r/2620/
........
  r393326 | qwell | 2013-07-01 22:19:15 +0400 (Mon, 01 Jul 2013) | 9 lines
  
  ARI: Implement channel dial.
  
  This creates a new outbound channel, and bridges it to a channel already in
  the Stasis application.
  
  (closes issue ASTERISK-21620)
  
  Review: https://reviewboard.asterisk.org/r/2634/
........
  r393332 | qwell | 2013-07-01 22:56:21 +0400 (Mon, 01 Jul 2013) | 8 lines
  
  ARI: Implement channel hold/unhold.
  
  This puts the channel on hold (rather than queueing a frame from the channel).
  
  (closes issue ASTERISK-21619)
  
  Review: https://reviewboard.asterisk.org/r/2647/
........
  r393361 | mjordan | 2013-07-02 01:24:20 +0400 (Tue, 02 Jul 2013) | 17 lines
  
  Prevent crash during synchronous AMI origination by ref bumping returned channel
  
  The originate APIs allow callers to provide a pointer to a channel that will
  point to the originated channel if the function call succeeds. This is used by AMI
  to provide channel information when the originate is performed synchronously.
  Unfortunately, if the originate fails in certain ways, the outbound channel is
  already disposed of during the dialing itself. This results in the channel being
  improperly dereferenced by the internal originate function in pbx.c.
  
  This patch ref bumps the channel to prevent this from occurring. Callers must now
  unlock and unref the channel (which is more in line with general channel management
  guidelines anyway).
  
  This only affects manager, as it is the only consumer of this API function that
  actually passes in a channel pointer.
  
  Review: https://reviewboard.asterisk.org/r/2617/
........
  r393364 | kharwell | 2013-07-02 01:28:32 +0400 (Tue, 02 Jul 2013) | 11 lines
  
  New SIP Channel Driver - Add CLI/AMI initiated NOTIFY requests
  
  Added the ability to send unsolicited NOTIFY requests to a particular endpoint
  with a configured payload.  Added both CLI and AMI support.  For a given
  endpoint, this module will iterate over all its contacts sending the appropriate
  NOTIFY request to each.
  
  (closes issue ASTERISK-21436)
  Reported by: Matt Jordan
  Review: https://reviewboard.asterisk.org/r/2623/
........
  r393383 | tzafrir | 2013-07-02 12:23:16 +0400 (Tue, 02 Jul 2013) | 7 lines
  
  ast_tls_cert: don't recreate generated files
  
  Don't regenrate cat.cfg, ca.crt and ca.key if they were already created
  on a previous run.
  
  (closes issue ASTERISK-21932)
........
  r393396 | igorg | 2013-07-02 14:16:27 +0400 (Tue, 02 Jul 2013) | 8 lines
  
  
  Fix issue with inability to cancell call transfer made by on-sceen menus.
  
  Reported by: Igor Olhovskiy
  ........
  
  Merged revisions 393395 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 393066,393083,393100,393128,393130,393144,393164,393182,393184,393190,393197,393219,393239-393241,393262,393264,393284,393309,393326,393332,393361,393364,393383,393396 from http://svn.asterisk.org/svn/asterisk/trunk

Added:
    team/may/ooh323_qsig/include/asterisk/mixmonitor.h
      - copied unchanged from r393396, trunk/include/asterisk/mixmonitor.h
    team/may/ooh323_qsig/main/mixmonitor.c
      - copied unchanged from r393396, trunk/main/mixmonitor.c
    team/may/ooh323_qsig/res/res_sip_notify.c
      - copied unchanged from r393396, trunk/res/res_sip_notify.c
Modified:
    team/may/ooh323_qsig/   (props changed)
    team/may/ooh323_qsig/CHANGES
    team/may/ooh323_qsig/apps/app_meetme.c
    team/may/ooh323_qsig/apps/app_mixmonitor.c
    team/may/ooh323_qsig/apps/app_queue.c
    team/may/ooh323_qsig/bridges/bridge_builtin_features.c
    team/may/ooh323_qsig/channels/chan_dahdi.c
    team/may/ooh323_qsig/channels/chan_gtalk.c
    team/may/ooh323_qsig/channels/chan_iax2.c
    team/may/ooh323_qsig/channels/chan_sip.c
    team/may/ooh323_qsig/channels/chan_skinny.c
    team/may/ooh323_qsig/channels/chan_unistim.c
    team/may/ooh323_qsig/channels/sig_analog.c
    team/may/ooh323_qsig/channels/sig_pri.c
    team/may/ooh323_qsig/channels/sip/include/sip.h
    team/may/ooh323_qsig/configs/features.conf.sample
    team/may/ooh323_qsig/configs/sip.conf.sample
    team/may/ooh323_qsig/contrib/scripts/ast_tls_cert
    team/may/ooh323_qsig/include/asterisk/bridging.h
    team/may/ooh323_qsig/include/asterisk/bridging_features.h
    team/may/ooh323_qsig/include/asterisk/cdr.h
    team/may/ooh323_qsig/include/asterisk/channel.h
    team/may/ooh323_qsig/include/asterisk/features.h
    team/may/ooh323_qsig/include/asterisk/features_config.h
    team/may/ooh323_qsig/include/asterisk/json.h
    team/may/ooh323_qsig/include/asterisk/parking.h
    team/may/ooh323_qsig/include/asterisk/pbx.h
    team/may/ooh323_qsig/include/asterisk/res_sip.h
    team/may/ooh323_qsig/include/asterisk/res_sip_pubsub.h
    team/may/ooh323_qsig/include/asterisk/stasis.h
    team/may/ooh323_qsig/include/asterisk/stasis_app.h
    team/may/ooh323_qsig/include/asterisk/stasis_bridging.h
    team/may/ooh323_qsig/main/asterisk.c
    team/may/ooh323_qsig/main/bridging.c
    team/may/ooh323_qsig/main/cdr.c
    team/may/ooh323_qsig/main/core_local.c
    team/may/ooh323_qsig/main/datastore.c
    team/may/ooh323_qsig/main/features.c
    team/may/ooh323_qsig/main/features_config.c
    team/may/ooh323_qsig/main/json.c
    team/may/ooh323_qsig/main/manager.c
    team/may/ooh323_qsig/main/manager_bridging.c
    team/may/ooh323_qsig/main/pbx.c
    team/may/ooh323_qsig/main/stasis_bridging.c
    team/may/ooh323_qsig/res/parking/parking_applications.c
    team/may/ooh323_qsig/res/parking/parking_ui.c
    team/may/ooh323_qsig/res/parking/res_parking.h
    team/may/ooh323_qsig/res/res_agi.c
    team/may/ooh323_qsig/res/res_parking.c
    team/may/ooh323_qsig/res/res_sip.exports.in
    team/may/ooh323_qsig/res/res_sip/include/res_sip_private.h
    team/may/ooh323_qsig/res/res_sip/sip_configuration.c
    team/may/ooh323_qsig/res/res_sip/sip_options.c
    team/may/ooh323_qsig/res/res_sip_pubsub.c
    team/may/ooh323_qsig/res/res_sip_pubsub.exports.in
    team/may/ooh323_qsig/res/res_sip_refer.c
    team/may/ooh323_qsig/res/res_stasis_http.c
    team/may/ooh323_qsig/res/res_stasis_http_channels.c
    team/may/ooh323_qsig/res/stasis/control.c
    team/may/ooh323_qsig/res/stasis_http/resource_channels.c
    team/may/ooh323_qsig/res/stasis_http/resource_channels.h
    team/may/ooh323_qsig/rest-api/api-docs/channels.json
    team/may/ooh323_qsig/tests/test_cdr.c

Propchange: team/may/ooh323_qsig/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.

Propchange: team/may/ooh323_qsig/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Aug 26 14:52:28 2013
@@ -1,1 +1,1 @@
-/trunk:1-380157,380165-391000,391012,391016-393000,393005-393034
+/trunk:1-380157,380165-391000,391012,391016-393400

Modified: team/may/ooh323_qsig/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_qsig/CHANGES?view=diff&rev=397669&r1=397668&r2=397669
==============================================================================
--- team/may/ooh323_qsig/CHANGES (original)
+++ team/may/ooh323_qsig/CHANGES Mon Aug 26 14:52:28 2013
@@ -143,7 +143,7 @@
 
  * The SIPqualifypeer action now acknowledges the request once it has established
    that the request is against a known peer. It also issues a new event,
-   'SIPqualifypeerdone', once the qualify action has been completed.
+   'SIPQualifyPeerDone', once the qualify action has been completed.
 
  * The PlayDTMF action now supports an optional 'Duration' parameter.  This
    specifies the duration of the digit to be played, in milliseconds.
@@ -238,6 +238,20 @@
    information about each channel.  The (infamous) "Join" and "Leave" AMI
    events have been changed to "QueueCallerJoin" and "QueueCallerLeave".
 
+ * The MCID AMI event now publishes a channel snapshot when available and
+   its non-channel-snapshot parameters now use either the "MCallerID" or
+   "MConnectedID" prefixes with Subaddr*, Name*, and Num* suffixes instead
+   of "CallerID" and "ConnectedID" to avoid confusion with similarly named
+   parameters in the channel snapshot.
+
+ * The "Agentlogin" and "Agentlogoff" events have been renamed "AgentLogin" and
+   "AgentLogoff" respectively.
+
+ * The "Channel" key used in the "AlarmClear", "Alarm", and "DNDState" has been
+   renamed "DAHDIChannel" since it does not convey an Asterisk channel name.
+
+ * "ChannelUpdate" events have been removed.
+
 AGI (Asterisk Gateway Interface)
 ------------------
  * The manager event AGIExec has been split into AGIExecStart and AGIExecEnd.
@@ -269,7 +283,7 @@
    will now apply the feature to the calling party while use of a lowercase
    letter will apply that feature to the called party.
 
- * Add support for automixmonitor to the BRIDGE_FEATURES channel variable.
+ * Add support for automixmon to the BRIDGE_FEATURES channel variable.
 
  * Parking has been pulled from core and placed into a separate module called
    res_parking. See Parking changes below for more details.
@@ -277,6 +291,14 @@
  * You can now have the settings for a channel updated using the FEATURE()
    and FEATUREMAP() functions inherited to child channels by setting
    FEATURE(inherit)=yes.
+
+ * automixmon now supports additional channel variables from automon including:
+   TOUCH_MIXMONITOR_PREFIX, TOUCH_MIXMONITOR_MESSAGE_START,
+   and TOUCH_MIXMONITOR_MESSAGE_STOP
+
+ * A new general features.conf option 'recordingfailsound' has been added which
+   allowssetting a failure sound for a user tries to invoke a recording feature
+   such as automon or automixmon and it fails.
 
 Logging
 -------------------
@@ -341,6 +363,22 @@
  * ParkAndAnnounce will no longer go to the next position in dialplan on timeout
    by default. Instead, it will follow the timeout rules of the parking lot. The
    old behavior can be reproduced by using the 'c' option.
+
+ * Dynamic parking lots will now fail to be created if the parking lot specified
+   by PARKINGDYNAMIC does not exist.
+
+ * Dynamic parking lots will also fail to be created now if they require exclusive
+   park and parkedcall extensions which overlap with other parking lots.
+
+ * Dynamic parking lots will be cleared on reload for dynamic parking lots that
+   currently contain no calls. Dynamic parking lots containing parked calls will
+   persist through the reloads without alteration.
+
+ * If parkext_exclusive is set for a parking lot and that extension is already in
+   use when that parking lot tries to register it, this is now considered a parking
+   system configuration error. Configurations which do this will be rejected.
+   Dynamic parking lots which try to register extensions that already exist will
+   also be rejected.
 
  * Added a channel variable PARKER_FLAT which stores the name of the extension
    that would be used to come back to if comebacktoorigin was set to use. This can

Modified: team/may/ooh323_qsig/apps/app_meetme.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_qsig/apps/app_meetme.c?view=diff&rev=397669&r1=397668&r2=397669
==============================================================================
--- team/may/ooh323_qsig/apps/app_meetme.c (original)
+++ team/may/ooh323_qsig/apps/app_meetme.c Mon Aug 26 14:52:28 2013
@@ -1117,75 +1117,15 @@
 	15,
 };
 
-/*!
- * \internal
- * \brief accessor for join message type
- * \since 12.0.0
- *
- * \retval pointer to the stasis message type
- * \retval NULL if not initialized
- */
-static struct stasis_message_type *meetme_join_type(void);
-
-/*!
- * \internal
- * \brief accessor for leave message type
- * \since 12.0.0
- *
- * \retval pointer to the stasis message type
- * \retval NULL if not initialized
- */
-static struct stasis_message_type *meetme_leave_type(void);
-
-/*!
- * \internal
- * \brief accessor for end message type
- * \since 12.0.0
- *
- * \retval pointer to the stasis message type
- * \retval NULL if not initialized
- */
-static struct stasis_message_type *meetme_end_type(void);
-
-/*!
- * \internal
- * \brief accessor for mute message type
- * \since 12.0.0
- *
- * \retval pointer to the stasis message type
- * \retval NULL if not initialized
- */
-static struct stasis_message_type *meetme_mute_type(void);
-
-/*!
- * \internal
- * \brief accessor for talking message type
- * \since 12.0.0
- *
- * \retval pointer to the stasis message type
- * \retval NULL if not initialized
- */
-static struct stasis_message_type *meetme_talking_type(void);
-
-/*!
- * \internal
- * \brief accessor for talk request message type
- * \since 12.0.0
- *
- * \retval pointer to the stasis message type
- * \retval NULL if not initialized
- */
-static struct stasis_message_type *meetme_talk_request_type(void);
-
 /* Routes the various meetme message types to the meetme stasis callback function to turn them into events */
 static struct stasis_message_router *meetme_event_message_router;
 
-STASIS_MESSAGE_TYPE_DEFN(meetme_join_type);
-STASIS_MESSAGE_TYPE_DEFN(meetme_leave_type);
-STASIS_MESSAGE_TYPE_DEFN(meetme_end_type);
-STASIS_MESSAGE_TYPE_DEFN(meetme_mute_type);
-STASIS_MESSAGE_TYPE_DEFN(meetme_talking_type);
-STASIS_MESSAGE_TYPE_DEFN(meetme_talk_request_type);
+STASIS_MESSAGE_TYPE_DEFN_LOCAL(meetme_join_type);
+STASIS_MESSAGE_TYPE_DEFN_LOCAL(meetme_leave_type);
+STASIS_MESSAGE_TYPE_DEFN_LOCAL(meetme_end_type);
+STASIS_MESSAGE_TYPE_DEFN_LOCAL(meetme_mute_type);
+STASIS_MESSAGE_TYPE_DEFN_LOCAL(meetme_talking_type);
+STASIS_MESSAGE_TYPE_DEFN_LOCAL(meetme_talk_request_type);
 
 static void meetme_stasis_cb(void *data, struct stasis_subscription *sub,
 	struct stasis_topic *topic, struct stasis_message *message);

Modified: team/may/ooh323_qsig/apps/app_mixmonitor.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_qsig/apps/app_mixmonitor.c?view=diff&rev=397669&r1=397668&r2=397669
==============================================================================
--- team/may/ooh323_qsig/apps/app_mixmonitor.c (original)
+++ team/may/ooh323_qsig/apps/app_mixmonitor.c Mon Aug 26 14:52:28 2013
@@ -56,6 +56,7 @@
 #include "asterisk/mod_format.h"
 #include "asterisk/linkedlists.h"
 #include "asterisk/test.h"
+#include "asterisk/mixmonitor.h"
 
 /*** DOCUMENTATION
 	<application name="MixMonitor" language="en_US">
@@ -1246,6 +1247,31 @@
 	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;
+}
+
+static int stop_mixmonitor_callback(struct ast_channel *chan, const char *mixmonitor_id)
+{
+	return stop_mixmonitor_full(chan, mixmonitor_id);
+}
+
 static int manager_mixmonitor(struct mansession *s, const struct message *m)
 {
 	struct ast_channel *c = NULL;
@@ -1356,6 +1382,21 @@
 	AST_CLI_DEFINE(handle_cli_mixmonitor, "Execute a MixMonitor command")
 };
 
+static int set_mixmonitor_methods(void)
+{
+	struct ast_mixmonitor_methods mixmonitor_methods = {
+		.start = start_mixmonitor_callback,
+		.stop = stop_mixmonitor_callback,
+	};
+
+	return ast_set_mixmonitor_methods(&mixmonitor_methods);
+}
+
+static int clear_mixmonitor_methods(void)
+{
+	return ast_clear_mixmonitor_methods();
+}
+
 static int unload_module(void)
 {
 	int res;
@@ -1366,6 +1407,7 @@
 	res |= ast_manager_unregister("MixMonitorMute");
 	res |= ast_manager_unregister("MixMonitor");
 	res |= ast_manager_unregister("StopMixMonitor");
+	res |= clear_mixmonitor_methods();
 
 	return res;
 }
@@ -1380,6 +1422,7 @@
 	res |= ast_manager_register_xml("MixMonitorMute", 0, manager_mute_mixmonitor);
 	res |= ast_manager_register_xml("MixMonitor", 0, manager_mixmonitor);
 	res |= ast_manager_register_xml("StopMixMonitor", 0, manager_stop_mixmonitor);
+	res |= set_mixmonitor_methods();
 
 	return res;
 }

Modified: team/may/ooh323_qsig/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_qsig/apps/app_queue.c?view=diff&rev=397669&r1=397668&r2=397669
==============================================================================
--- team/may/ooh323_qsig/apps/app_queue.c (original)
+++ team/may/ooh323_qsig/apps/app_queue.c Mon Aug 26 14:52:28 2013
@@ -1811,39 +1811,22 @@
 	new->opos = *pos;
 }
 
-struct stasis_message_type *queue_caller_join_type(void);
-struct stasis_message_type *queue_caller_leave_type(void);
-struct stasis_message_type *queue_caller_abandon_type(void);
-
-struct stasis_message_type *queue_member_status_type(void);
-struct stasis_message_type *queue_member_added_type(void);
-struct stasis_message_type *queue_member_removed_type(void);
-struct stasis_message_type *queue_member_pause_type(void);
-struct stasis_message_type *queue_member_penalty_type(void);
-struct stasis_message_type *queue_member_ringinuse_type(void);
-
-struct stasis_message_type *queue_agent_called_type(void);
-struct stasis_message_type *queue_agent_connect_type(void);
-struct stasis_message_type *queue_agent_complete_type(void);
-struct stasis_message_type *queue_agent_dump_type(void);
-struct stasis_message_type *queue_agent_ringnoanswer_type(void);
-
-STASIS_MESSAGE_TYPE_DEFN(queue_caller_join_type);
-STASIS_MESSAGE_TYPE_DEFN(queue_caller_leave_type);
-STASIS_MESSAGE_TYPE_DEFN(queue_caller_abandon_type);
-
-STASIS_MESSAGE_TYPE_DEFN(queue_member_status_type);
-STASIS_MESSAGE_TYPE_DEFN(queue_member_added_type);
-STASIS_MESSAGE_TYPE_DEFN(queue_member_removed_type);
-STASIS_MESSAGE_TYPE_DEFN(queue_member_pause_type);
-STASIS_MESSAGE_TYPE_DEFN(queue_member_penalty_type);
-STASIS_MESSAGE_TYPE_DEFN(queue_member_ringinuse_type);
-
-STASIS_MESSAGE_TYPE_DEFN(queue_agent_called_type);
-STASIS_MESSAGE_TYPE_DEFN(queue_agent_connect_type);
-STASIS_MESSAGE_TYPE_DEFN(queue_agent_complete_type);
-STASIS_MESSAGE_TYPE_DEFN(queue_agent_dump_type);
-STASIS_MESSAGE_TYPE_DEFN(queue_agent_ringnoanswer_type);
+STASIS_MESSAGE_TYPE_DEFN_LOCAL(queue_caller_join_type);
+STASIS_MESSAGE_TYPE_DEFN_LOCAL(queue_caller_leave_type);
+STASIS_MESSAGE_TYPE_DEFN_LOCAL(queue_caller_abandon_type);
+
+STASIS_MESSAGE_TYPE_DEFN_LOCAL(queue_member_status_type);
+STASIS_MESSAGE_TYPE_DEFN_LOCAL(queue_member_added_type);
+STASIS_MESSAGE_TYPE_DEFN_LOCAL(queue_member_removed_type);
+STASIS_MESSAGE_TYPE_DEFN_LOCAL(queue_member_pause_type);
+STASIS_MESSAGE_TYPE_DEFN_LOCAL(queue_member_penalty_type);
+STASIS_MESSAGE_TYPE_DEFN_LOCAL(queue_member_ringinuse_type);
+
+STASIS_MESSAGE_TYPE_DEFN_LOCAL(queue_agent_called_type);
+STASIS_MESSAGE_TYPE_DEFN_LOCAL(queue_agent_connect_type);
+STASIS_MESSAGE_TYPE_DEFN_LOCAL(queue_agent_complete_type);
+STASIS_MESSAGE_TYPE_DEFN_LOCAL(queue_agent_dump_type);
+STASIS_MESSAGE_TYPE_DEFN_LOCAL(queue_agent_ringnoanswer_type);
 
 static void queue_channel_manager_event(void *data,
 	struct stasis_subscription *sub, struct stasis_topic *topic,

Modified: team/may/ooh323_qsig/bridges/bridge_builtin_features.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_qsig/bridges/bridge_builtin_features.c?view=diff&rev=397669&r1=397668&r2=397669
==============================================================================
--- team/may/ooh323_qsig/bridges/bridge_builtin_features.c (original)
+++ team/may/ooh323_qsig/bridges/bridge_builtin_features.c Mon Aug 26 14:52:28 2013
@@ -50,6 +50,9 @@
 #include "asterisk/pbx.h"
 #include "asterisk/parking.h"
 #include "asterisk/features_config.h"
+#include "asterisk/monitor.h"
+#include "asterisk/mixmonitor.h"
+#include "asterisk/audiohook.h"
 
 /*!
  * \brief Helper function that presents dialtone and grabs extension
@@ -218,7 +221,7 @@
 		ast_after_bridge_set_go_on(bridge_channel->chan, NULL, NULL, 0, goto_on_blindxfr);
 	}
 
-	if (ast_bridge_transfer_blind(bridge_channel->chan, exten, context, blind_transfer_cb,
+	if (ast_bridge_transfer_blind(0, bridge_channel->chan, exten, context, blind_transfer_cb,
 			bridge_channel->chan) != AST_BRIDGE_TRANSFER_SUCCESS &&
 			!ast_strlen_zero(goto_on_blindxfr)) {
 		ast_after_bridge_goto_discard(bridge_channel->chan);
@@ -463,6 +466,304 @@
 	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);
+
+	ast_verb(3, "AutoMonitor used to stop recording call.\n");
+
+	ast_channel_lock(peer_chan);
+	if (ast_channel_monitor(peer_chan)) {
+		if (ast_channel_monitor(peer_chan)->stop(peer_chan, 1)) {
+			ast_verb(3, "Cannot stop AutoMonitor for %s\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);
+			}
+			ast_channel_unlock(peer_chan);
+			return;
+		}
+	} else {
+		/* Something else removed the Monitor before we got to it. */
+		ast_channel_unlock(peer_chan);
+		return;
+	}
+
+	ast_channel_unlock(peer_chan);
+
+	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(stop_message)) {
+		ast_bridge_channel_queue_playfile(bridge_channel, NULL, stop_message, NULL);
+		ast_bridge_channel_write_playfile(bridge_channel, NULL, stop_message, NULL);
+	}
+}
+
+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;
+	size_t len;
+	const char *automon_message;
+	int x;
+	enum set_touch_variables_res set_touch_res;
+
+	RAII_VAR(char *, touch_format, NULL, ast_free);
+	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))) {
+		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;
+		}
+	}
+
+	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);
+	} else {
+		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++) {
+		if (touch_filename[x] == '/') {
+			touch_filename[x] = '-';
+		}
+	}
+
+	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_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)) {
+		ast_bridge_channel_queue_playfile(bridge_channel, NULL, automon_message, NULL);
+		ast_bridge_channel_write_playfile(bridge_channel, NULL, automon_message, NULL);
+	}
+
+	pbx_builtin_setvar_helper(peer_chan, "TOUCH_MONITOR_OUTPUT", touch_filename);
+
+	return 0;
+}
+
+static void stop_automixmonitor(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_MIXMONITOR_MESSAGE_STOP");
+	stop_message = ast_strdupa(S_OR(stop_message, ""));
+	ast_channel_unlock(bridge_channel->chan);
+
+	ast_verb(3, "AutoMixMonitor used to stop recording call.\n");
+
+	if (ast_stop_mixmonitor(peer_chan, NULL)) {
+		ast_verb(3, "Failed to stop Mixmonitor for %s.\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;
+	}
+
+	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(stop_message)) {
+		ast_bridge_channel_queue_playfile(bridge_channel, NULL, stop_message, NULL);
+		ast_bridge_channel_write_playfile(bridge_channel, NULL, stop_message, NULL);
+	}
+
+}
+
+static int feature_automixmonitor(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;
+	size_t len;
+	const char *automon_message;
+	static char *mixmonitor_spy_type = "MixMonitor";
+	int count, x;
+	enum set_touch_variables_res set_touch_res;
+
+	RAII_VAR(char *, touch_format, NULL, ast_free);
+	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 AutoMixMonitor 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;
+	}
+
+	count = ast_channel_audiohook_count_by_source(peer_chan, mixmonitor_spy_type, AST_AUDIOHOOK_TYPE_SPY);
+	if (count > 0) {
+		stop_automixmonitor(bridge_channel, peer_chan, features_cfg);
+		return 0;
+	}
+
+	if ((set_touch_res = set_touch_variables(bridge_channel->chan, 1, &touch_format, &touch_monitor, &touch_monitor_prefix))) {
+		if (set_touch_res == SET_TOUCH_ALLOC_FAILURE) {
+			return 0;
+		}
+		if (set_touch_variables(peer_chan, 1, &touch_format, &touch_monitor, &touch_monitor_prefix) == SET_TOUCH_ALLOC_FAILURE) {
+			return 0;
+		}
+	}
+
+	if (!ast_strlen_zero(touch_monitor)) {
+		len = strlen(touch_monitor) + 50;
+		touch_filename = ast_alloca(len);
+		snprintf(touch_filename, len, "%s-%ld-%s.%s", S_OR(touch_monitor_prefix, "auto"), (long)time(NULL), touch_monitor, S_OR(touch_format, "wav"));
+	} else {
+		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", S_OR(touch_monitor_prefix, "auto"), (long)time(NULL), caller_chan_id, peer_chan_id, S_OR(touch_format, "wav"));
+	}
+
+	for ( x = 0; x < strlen(touch_filename); x++) {
+		if (touch_filename[x] == '/') {
+			touch_filename[x] = '-';
+		}
+	}
+
+	ast_verb(3, "AutoMixMonitor used to record call. Filename: %s\n", touch_filename);
+
+	if (ast_start_mixmonitor(peer_chan, touch_filename, "b")) {
+		ast_verb(3, "automixmon feature was tried by '%s' but mixmonitor failed to start.\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;
+	}
+
+	ast_channel_lock(bridge_channel->chan);
+	if ((automon_message = pbx_builtin_getvar_helper(bridge_channel->chan, "TOUCH_MIXMONITOR_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_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)) {
+		ast_bridge_channel_queue_playfile(bridge_channel, NULL, automon_message, NULL);

[... 7385 lines stripped ...]



More information about the asterisk-commits mailing list