[svn-commits] qwell: branch certified-1.8.15 r370667 - in /certified/branches/1.8.15: ./ ap...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Jul 31 15:59:59 CDT 2012


Author: qwell
Date: Tue Jul 31 15:59:52 2012
New Revision: 370667

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=370667
Log:
Merge changes for Digium phone support, and default module building.

All of these changes are merged from certified/branches/1.8.11/

Added:
    certified/branches/1.8.15/funcs/func_presence_state.c
      - copied unchanged from r363673, branches/1.8-digiumphones/funcs/func_presence_state.c
    certified/branches/1.8.15/include/asterisk/custom_control_frame.h
      - copied unchanged from r363673, branches/1.8-digiumphones/include/asterisk/custom_control_frame.h
    certified/branches/1.8.15/include/asterisk/message.h
      - copied unchanged from r363673, branches/1.8-digiumphones/include/asterisk/message.h
    certified/branches/1.8.15/include/asterisk/presencestate.h
      - copied unchanged from r363673, branches/1.8-digiumphones/include/asterisk/presencestate.h
    certified/branches/1.8.15/main/custom_control_frame.c
      - copied unchanged from r363673, branches/1.8-digiumphones/main/custom_control_frame.c
    certified/branches/1.8.15/main/message.c
      - copied unchanged from r363673, branches/1.8-digiumphones/main/message.c
    certified/branches/1.8.15/main/presencestate.c
      - copied unchanged from r363673, branches/1.8-digiumphones/main/presencestate.c
    certified/branches/1.8.15/tests/test_custom_control.c
      - copied unchanged from r363673, branches/1.8-digiumphones/tests/test_custom_control.c
    certified/branches/1.8.15/tests/test_voicemail_api.c
      - copied, changed from r363673, branches/1.8-digiumphones/tests/test_voicemail_api.c
Modified:
    certified/branches/1.8.15/apps/app_adsiprog.c
    certified/branches/1.8.15/apps/app_alarmreceiver.c
    certified/branches/1.8.15/apps/app_amd.c
    certified/branches/1.8.15/apps/app_chanisavail.c
    certified/branches/1.8.15/apps/app_confbridge.c
    certified/branches/1.8.15/apps/app_dahdibarge.c
    certified/branches/1.8.15/apps/app_dahdiras.c
    certified/branches/1.8.15/apps/app_dictate.c
    certified/branches/1.8.15/apps/app_externalivr.c
    certified/branches/1.8.15/apps/app_festival.c
    certified/branches/1.8.15/apps/app_getcpeid.c
    certified/branches/1.8.15/apps/app_ices.c
    certified/branches/1.8.15/apps/app_image.c
    certified/branches/1.8.15/apps/app_jack.c
    certified/branches/1.8.15/apps/app_minivm.c
    certified/branches/1.8.15/apps/app_mixmonitor.c
    certified/branches/1.8.15/apps/app_morsecode.c
    certified/branches/1.8.15/apps/app_mp3.c
    certified/branches/1.8.15/apps/app_nbscat.c
    certified/branches/1.8.15/apps/app_osplookup.c
    certified/branches/1.8.15/apps/app_queue.c
    certified/branches/1.8.15/apps/app_readfile.c
    certified/branches/1.8.15/apps/app_setcallerid.c
    certified/branches/1.8.15/apps/app_sms.c
    certified/branches/1.8.15/apps/app_talkdetect.c
    certified/branches/1.8.15/apps/app_test.c
    certified/branches/1.8.15/apps/app_url.c
    certified/branches/1.8.15/apps/app_voicemail.c
    certified/branches/1.8.15/apps/app_waitforring.c
    certified/branches/1.8.15/apps/app_waitforsilence.c
    certified/branches/1.8.15/apps/app_zapateller.c
    certified/branches/1.8.15/cdr/cdr_csv.c
    certified/branches/1.8.15/cdr/cdr_odbc.c
    certified/branches/1.8.15/cdr/cdr_pgsql.c
    certified/branches/1.8.15/cdr/cdr_radius.c
    certified/branches/1.8.15/cdr/cdr_sqlite.c
    certified/branches/1.8.15/cdr/cdr_sqlite3_custom.c
    certified/branches/1.8.15/cdr/cdr_tds.c
    certified/branches/1.8.15/cel/cel_pgsql.c
    certified/branches/1.8.15/cel/cel_radius.c
    certified/branches/1.8.15/cel/cel_sqlite3_custom.c
    certified/branches/1.8.15/cel/cel_tds.c
    certified/branches/1.8.15/channels/chan_alsa.c
    certified/branches/1.8.15/channels/chan_console.c
    certified/branches/1.8.15/channels/chan_gtalk.c
    certified/branches/1.8.15/channels/chan_h323.c
    certified/branches/1.8.15/channels/chan_jingle.c
    certified/branches/1.8.15/channels/chan_mgcp.c
    certified/branches/1.8.15/channels/chan_misdn.c
    certified/branches/1.8.15/channels/chan_nbs.c
    certified/branches/1.8.15/channels/chan_oss.c
    certified/branches/1.8.15/channels/chan_phone.c
    certified/branches/1.8.15/channels/chan_sip.c
    certified/branches/1.8.15/channels/chan_skinny.c
    certified/branches/1.8.15/channels/chan_unistim.c
    certified/branches/1.8.15/channels/sip/include/sip.h
    certified/branches/1.8.15/configs/jabber.conf.sample
    certified/branches/1.8.15/configs/manager.conf.sample
    certified/branches/1.8.15/configs/sip.conf.sample
    certified/branches/1.8.15/configure
    certified/branches/1.8.15/formats/format_jpeg.c
    certified/branches/1.8.15/formats/format_vox.c
    certified/branches/1.8.15/funcs/func_frame_trace.c
    certified/branches/1.8.15/funcs/func_pitchshift.c
    certified/branches/1.8.15/include/asterisk/_private.h
    certified/branches/1.8.15/include/asterisk/app.h
    certified/branches/1.8.15/include/asterisk/callerid.h
    certified/branches/1.8.15/include/asterisk/channel.h
    certified/branches/1.8.15/include/asterisk/config.h
    certified/branches/1.8.15/include/asterisk/event_defs.h
    certified/branches/1.8.15/include/asterisk/file.h
    certified/branches/1.8.15/include/asterisk/frame.h
    certified/branches/1.8.15/include/asterisk/jabber.h
    certified/branches/1.8.15/include/asterisk/manager.h
    certified/branches/1.8.15/include/asterisk/pbx.h
    certified/branches/1.8.15/main/app.c
    certified/branches/1.8.15/main/asterisk.c
    certified/branches/1.8.15/main/callerid.c
    certified/branches/1.8.15/main/channel.c
    certified/branches/1.8.15/main/config.c
    certified/branches/1.8.15/main/event.c
    certified/branches/1.8.15/main/features.c
    certified/branches/1.8.15/main/file.c
    certified/branches/1.8.15/main/manager.c
    certified/branches/1.8.15/main/pbx.c
    certified/branches/1.8.15/pbx/pbx_ael.c
    certified/branches/1.8.15/pbx/pbx_dundi.c
    certified/branches/1.8.15/pbx/pbx_lua.c
    certified/branches/1.8.15/pbx/pbx_realtime.c
    certified/branches/1.8.15/res/res_ael_share.c
    certified/branches/1.8.15/res/res_ais.c
    certified/branches/1.8.15/res/res_config_ldap.c
    certified/branches/1.8.15/res/res_config_pgsql.c
    certified/branches/1.8.15/res/res_config_sqlite.c
    certified/branches/1.8.15/res/res_fax_spandsp.c
    certified/branches/1.8.15/res/res_jabber.c
    certified/branches/1.8.15/res/res_phoneprov.c
    certified/branches/1.8.15/res/res_snmp.c
    certified/branches/1.8.15/res/res_timing_kqueue.c
    certified/branches/1.8.15/res/res_timing_pthread.c
    certified/branches/1.8.15/tests/test_config.c

Modified: certified/branches/1.8.15/apps/app_adsiprog.c
URL: http://svnview.digium.com/svn/asterisk/certified/branches/1.8.15/apps/app_adsiprog.c?view=diff&rev=370667&r1=370666&r2=370667
==============================================================================
--- certified/branches/1.8.15/apps/app_adsiprog.c (original)
+++ certified/branches/1.8.15/apps/app_adsiprog.c Tue Jul 31 15:59:52 2012
@@ -28,6 +28,7 @@
 /*** MODULEINFO
 	<depend>res_adsi</depend>
 	<support_level>extended</support_level>
+	<defaultenabled>no</defaultenabled>
  ***/
 
 #include "asterisk.h"

Modified: certified/branches/1.8.15/apps/app_alarmreceiver.c
URL: http://svnview.digium.com/svn/asterisk/certified/branches/1.8.15/apps/app_alarmreceiver.c?view=diff&rev=370667&r1=370666&r2=370667
==============================================================================
--- certified/branches/1.8.15/apps/app_alarmreceiver.c (original)
+++ certified/branches/1.8.15/apps/app_alarmreceiver.c Tue Jul 31 15:59:52 2012
@@ -31,6 +31,7 @@
 
 /*** MODULEINFO
 	<support_level>extended</support_level>
+	<defaultenabled>no</defaultenabled>
  ***/
 
 #include "asterisk.h"

Modified: certified/branches/1.8.15/apps/app_amd.c
URL: http://svnview.digium.com/svn/asterisk/certified/branches/1.8.15/apps/app_amd.c?view=diff&rev=370667&r1=370666&r2=370667
==============================================================================
--- certified/branches/1.8.15/apps/app_amd.c (original)
+++ certified/branches/1.8.15/apps/app_amd.c Tue Jul 31 15:59:52 2012
@@ -28,6 +28,7 @@
 
 /*** MODULEINFO
 	<support_level>extended</support_level>
+	<defaultenabled>no</defaultenabled>
  ***/
 
 #include "asterisk.h"

Modified: certified/branches/1.8.15/apps/app_chanisavail.c
URL: http://svnview.digium.com/svn/asterisk/certified/branches/1.8.15/apps/app_chanisavail.c?view=diff&rev=370667&r1=370666&r2=370667
==============================================================================
--- certified/branches/1.8.15/apps/app_chanisavail.c (original)
+++ certified/branches/1.8.15/apps/app_chanisavail.c Tue Jul 31 15:59:52 2012
@@ -29,6 +29,7 @@
 
 /*** MODULEINFO
 	<support_level>extended</support_level>
+	<defaultenabled>no</defaultenabled>
  ***/
 
 #include "asterisk.h"

Modified: certified/branches/1.8.15/apps/app_confbridge.c
URL: http://svnview.digium.com/svn/asterisk/certified/branches/1.8.15/apps/app_confbridge.c?view=diff&rev=370667&r1=370666&r2=370667
==============================================================================
--- certified/branches/1.8.15/apps/app_confbridge.c (original)
+++ certified/branches/1.8.15/apps/app_confbridge.c Tue Jul 31 15:59:52 2012
@@ -28,6 +28,7 @@
 
 /*** MODULEINFO
 	<support_level>extended</support_level>
+	<defaultenabled>no</defaultenabled>
  ***/
 
 #include "asterisk.h"

Modified: certified/branches/1.8.15/apps/app_dahdibarge.c
URL: http://svnview.digium.com/svn/asterisk/certified/branches/1.8.15/apps/app_dahdibarge.c?view=diff&rev=370667&r1=370666&r2=370667
==============================================================================
--- certified/branches/1.8.15/apps/app_dahdibarge.c (original)
+++ certified/branches/1.8.15/apps/app_dahdibarge.c Tue Jul 31 15:59:52 2012
@@ -34,6 +34,7 @@
 /*** MODULEINFO
 	<depend>dahdi</depend>
 	<support_level>deprecated</support_level>
+	<defaultenabled>no</defaultenabled>
 	<replacement>app_chanspy</replacement>
  ***/
 

Modified: certified/branches/1.8.15/apps/app_dahdiras.c
URL: http://svnview.digium.com/svn/asterisk/certified/branches/1.8.15/apps/app_dahdiras.c?view=diff&rev=370667&r1=370666&r2=370667
==============================================================================
--- certified/branches/1.8.15/apps/app_dahdiras.c (original)
+++ certified/branches/1.8.15/apps/app_dahdiras.c Tue Jul 31 15:59:52 2012
@@ -28,6 +28,7 @@
 /*** MODULEINFO
 	<depend>dahdi</depend>
 	<support_level>extended</support_level>
+	<defaultenabled>no</defaultenabled>
  ***/
 
 #include "asterisk.h"

Modified: certified/branches/1.8.15/apps/app_dictate.c
URL: http://svnview.digium.com/svn/asterisk/certified/branches/1.8.15/apps/app_dictate.c?view=diff&rev=370667&r1=370666&r2=370667
==============================================================================
--- certified/branches/1.8.15/apps/app_dictate.c (original)
+++ certified/branches/1.8.15/apps/app_dictate.c Tue Jul 31 15:59:52 2012
@@ -29,6 +29,7 @@
 
 /*** MODULEINFO
 	<support_level>extended</support_level>
+	<defaultenabled>no</defaultenabled>
  ***/
 
 #include "asterisk.h"

Modified: certified/branches/1.8.15/apps/app_externalivr.c
URL: http://svnview.digium.com/svn/asterisk/certified/branches/1.8.15/apps/app_externalivr.c?view=diff&rev=370667&r1=370666&r2=370667
==============================================================================
--- certified/branches/1.8.15/apps/app_externalivr.c (original)
+++ certified/branches/1.8.15/apps/app_externalivr.c Tue Jul 31 15:59:52 2012
@@ -33,6 +33,7 @@
 
 /*** MODULEINFO
 	<support_level>extended</support_level>
+	<defaultenabled>no</defaultenabled>
  ***/
 
 #include "asterisk.h"

Modified: certified/branches/1.8.15/apps/app_festival.c
URL: http://svnview.digium.com/svn/asterisk/certified/branches/1.8.15/apps/app_festival.c?view=diff&rev=370667&r1=370666&r2=370667
==============================================================================
--- certified/branches/1.8.15/apps/app_festival.c (original)
+++ certified/branches/1.8.15/apps/app_festival.c Tue Jul 31 15:59:52 2012
@@ -29,6 +29,7 @@
 
 /*** MODULEINFO
 	<support_level>extended</support_level>
+	<defaultenabled>no</defaultenabled>
  ***/
 
 #include "asterisk.h"

Modified: certified/branches/1.8.15/apps/app_getcpeid.c
URL: http://svnview.digium.com/svn/asterisk/certified/branches/1.8.15/apps/app_getcpeid.c?view=diff&rev=370667&r1=370666&r2=370667
==============================================================================
--- certified/branches/1.8.15/apps/app_getcpeid.c (original)
+++ certified/branches/1.8.15/apps/app_getcpeid.c Tue Jul 31 15:59:52 2012
@@ -27,6 +27,7 @@
 
 /*** MODULEINFO
 	<support_level>extended</support_level>
+	<defaultenabled>no</defaultenabled>
  ***/
 
 #include "asterisk.h"

Modified: certified/branches/1.8.15/apps/app_ices.c
URL: http://svnview.digium.com/svn/asterisk/certified/branches/1.8.15/apps/app_ices.c?view=diff&rev=370667&r1=370666&r2=370667
==============================================================================
--- certified/branches/1.8.15/apps/app_ices.c (original)
+++ certified/branches/1.8.15/apps/app_ices.c Tue Jul 31 15:59:52 2012
@@ -29,6 +29,7 @@
 
 /*** MODULEINFO
 	<support_level>extended</support_level>
+	<defaultenabled>no</defaultenabled>
  ***/
  
 #include "asterisk.h"

Modified: certified/branches/1.8.15/apps/app_image.c
URL: http://svnview.digium.com/svn/asterisk/certified/branches/1.8.15/apps/app_image.c?view=diff&rev=370667&r1=370666&r2=370667
==============================================================================
--- certified/branches/1.8.15/apps/app_image.c (original)
+++ certified/branches/1.8.15/apps/app_image.c Tue Jul 31 15:59:52 2012
@@ -27,6 +27,7 @@
 
 /*** MODULEINFO
 	<support_level>extended</support_level>
+	<defaultenabled>no</defaultenabled>
  ***/
  
 #include "asterisk.h"

Modified: certified/branches/1.8.15/apps/app_jack.c
URL: http://svnview.digium.com/svn/asterisk/certified/branches/1.8.15/apps/app_jack.c?view=diff&rev=370667&r1=370666&r2=370667
==============================================================================
--- certified/branches/1.8.15/apps/app_jack.c (original)
+++ certified/branches/1.8.15/apps/app_jack.c Tue Jul 31 15:59:52 2012
@@ -38,6 +38,7 @@
 	<depend>jack</depend>
 	<depend>resample</depend>
 	<support_level>extended</support_level>
+	<defaultenabled>no</defaultenabled>
  ***/
 
 #include "asterisk.h"

Modified: certified/branches/1.8.15/apps/app_minivm.c
URL: http://svnview.digium.com/svn/asterisk/certified/branches/1.8.15/apps/app_minivm.c?view=diff&rev=370667&r1=370666&r2=370667
==============================================================================
--- certified/branches/1.8.15/apps/app_minivm.c (original)
+++ certified/branches/1.8.15/apps/app_minivm.c Tue Jul 31 15:59:52 2012
@@ -143,6 +143,7 @@
 
 /*** MODULEINFO
 	<support_level>extended</support_level>
+	<defaultenabled>no</defaultenabled>
  ***/
 
 #include "asterisk.h"

Modified: certified/branches/1.8.15/apps/app_mixmonitor.c
URL: http://svnview.digium.com/svn/asterisk/certified/branches/1.8.15/apps/app_mixmonitor.c?view=diff&rev=370667&r1=370666&r2=370667
==============================================================================
--- certified/branches/1.8.15/apps/app_mixmonitor.c (original)
+++ certified/branches/1.8.15/apps/app_mixmonitor.c Tue Jul 31 15:59:52 2012
@@ -42,6 +42,7 @@
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/paths.h"	/* use ast_config_AST_MONITOR_DIR */
+#include "asterisk/stringfields.h"
 #include "asterisk/file.h"
 #include "asterisk/audiohook.h"
 #include "asterisk/pbx.h"
@@ -51,6 +52,7 @@
 #include "asterisk/channel.h"
 #include "asterisk/autochan.h"
 #include "asterisk/manager.h"
+#include "asterisk/callerid.h"
 
 /*** DOCUMENTATION
 	<application name="MixMonitor" language="en_US">
@@ -92,6 +94,13 @@
 						<para>Adjust both, <emphasis>heard and spoken</emphasis> volumes by a factor
 						of <replaceable>x</replaceable> (range <literal>-4</literal> to <literal>4</literal>)</para>
 						<argument name="x" required="true" />
+					</option>
+					<option name="m">
+						<argument name="mailbox" required="true" />
+						<para>Create a copy of the recording as a voicemail in each indicated <emphasis>mailbox</emphasis>
+						separated by commas eg. m(1111 at default,2222 at default,...).  Folders can be optionally specified using
+						the syntax: mailbox at context/folder</para>
+						<note><para>The recording will be deleted once all the copies are made.</para></note>
 					</option>
 				</optionlist>
 			</parameter>
@@ -151,6 +160,54 @@
 			<para>This action may be used to mute a MixMonitor recording.</para>
 		</description>
 	</manager>
+	<manager name="MixMonitor" language="en_US">
+		<synopsis>
+			Record a call and mix the audio during the recording.  Use of StopMixMonitor is required
+			to guarantee the audio file is available for processing during dialplan execution.
+		</synopsis>
+		<syntax>
+			<xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+			<parameter name="Channel" required="true">
+				<para>Used to specify the channel to record.</para>
+			</parameter>
+			<parameter name="File">
+				<para>Is the name of the file created in the monitor spool directory.
+				Defaults to the same name as the channel (with slashes replaced with dashes).
+				This argument is optional if you specify to record unidirectional audio with
+				either the r(filename) or t(filename) options in the options field. If
+				neither MIXMONITOR_FILENAME or this parameter is set, the mixed stream won't
+				be recorded.</para>
+			</parameter>
+			<parameter name="options">
+				<para>Options that apply to the MixMonitor in the same way as they
+				would apply if invoked from the MixMonitor application. For a list of
+				available options, see the documentation for the mixmonitor application. </para>
+			</parameter>
+		</syntax>
+		<description>
+			<para>This action records the audio on the current channel to the specified file.</para>
+			<variablelist>
+				<variable name="MIXMONITOR_FILENAME">
+					<para>Will contain the filename used to record the mixed stream.</para>
+				</variable>
+			</variablelist>
+		</description>
+	</manager>
+	<manager name="StopMixMonitor" language="en_US">
+		<synopsis>
+			Stop recording a call through MixMonitor, and free the recording's file handle.
+		</synopsis>
+		<syntax>
+			<xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+			<parameter name="Channel" required="true">
+				<para>The name of the channel monitored.</para>
+			</parameter>
+		</syntax>
+		<description>
+			<para>This action stops the audio recording that was started with the <literal>MixMonitor</literal>
+			action on the current channel.</para>
+		</description>
+	</manager>
 
  ***/
 
@@ -161,6 +218,17 @@
 static const char * const stop_app = "StopMixMonitor";
 
 static const char * const mixmonitor_spy_type = "MixMonitor";
+
+/*!
+ * \internal
+ * \brief This struct is a list item holds data needed to find a vm_recipient within voicemail
+ */
+struct vm_recipient {
+	char mailbox[AST_MAX_CONTEXT];
+	char context[AST_MAX_EXTENSION];
+	char folder[80];
+	AST_LIST_ENTRY(vm_recipient) list;
+};
 
 struct mixmonitor {
 	struct ast_audiohook audiohook;
@@ -170,6 +238,20 @@
 	unsigned int flags;
 	struct ast_autochan *autochan;
 	struct mixmonitor_ds *mixmonitor_ds;
+
+	/* the below string fields describe data used for creating voicemails from the recording */
+	AST_DECLARE_STRING_FIELDS(
+		AST_STRING_FIELD(call_context);
+		AST_STRING_FIELD(call_macrocontext);
+		AST_STRING_FIELD(call_extension);
+		AST_STRING_FIELD(call_callerchan);
+		AST_STRING_FIELD(call_callerid);
+	);
+	int call_priority;
+
+	/* FUTURE DEVELOPMENT NOTICE
+	 * recipient_list will need locks if we make it editable after the monitor is started */
+	AST_LIST_HEAD_NOLOCK(, vm_recipient) recipient_list;
 };
 
 enum mixmonitor_flags {
@@ -178,12 +260,14 @@
 	MUXFLAG_VOLUME = (1 << 3),
 	MUXFLAG_READVOLUME = (1 << 4),
 	MUXFLAG_WRITEVOLUME = (1 << 5),
+	MUXFLAG_VMRECIPIENTS = (1 << 6),
 };
 
 enum mixmonitor_args {
 	OPT_ARG_READVOLUME = 0,
 	OPT_ARG_WRITEVOLUME,
 	OPT_ARG_VOLUME,
+	OPT_ARG_VMRECIPIENTS,
 	OPT_ARG_ARRAY_SIZE,
 };
 
@@ -193,6 +277,7 @@
 	AST_APP_OPTION_ARG('v', MUXFLAG_READVOLUME, OPT_ARG_READVOLUME),
 	AST_APP_OPTION_ARG('V', MUXFLAG_WRITEVOLUME, OPT_ARG_WRITEVOLUME),
 	AST_APP_OPTION_ARG('W', MUXFLAG_VOLUME, OPT_ARG_VOLUME),
+	AST_APP_OPTION_ARG('m', MUXFLAG_VMRECIPIENTS, OPT_ARG_VMRECIPIENTS),
 });
 
 struct mixmonitor_ds {
@@ -267,6 +352,70 @@
 	return res;
 }
 
+/*!
+ * \internal
+ * \brief adds recipients to a mixmonitor's recipient list
+ * \param mixmonitor mixmonitor being affected
+ * \param vm_recipients string containing the desired recipients to add
+ */
+static void add_vm_recipients_from_string(struct mixmonitor *mixmonitor, const char *vm_recipients)
+{
+	/* recipients are in a single string with a format format resembling "mailbox at context/INBOX,mailbox2 at context2,mailbox3 at context3/Work" */
+	char *cur_mailbox = ast_strdupa(vm_recipients);
+	char *cur_context;
+	char *cur_folder;
+	char *next;
+	int elements_processed = 0;
+
+	while (!ast_strlen_zero(cur_mailbox)) {
+		ast_debug(3, "attempting to add next element %d from %s\n", elements_processed, cur_mailbox);
+		if ((next = strchr(cur_mailbox, ',')) || (next = strchr(cur_mailbox, '&'))) {
+			*(next++) = '\0';
+		}
+
+		if ((cur_folder = strchr(cur_mailbox, '/'))) {
+			*(cur_folder++) = '\0';
+		} else {
+			cur_folder = "INBOX";
+		}
+
+		if ((cur_context = strchr(cur_mailbox, '@'))) {
+			*(cur_context++) = '\0';
+		} else {
+			cur_context = "default";
+		}
+
+		if (!ast_strlen_zero(cur_mailbox) && !ast_strlen_zero(cur_context)) {
+			struct vm_recipient *recipient;
+			if (!(recipient = ast_malloc(sizeof(*recipient)))) {
+				ast_log(LOG_ERROR, "Failed to allocate recipient. Aborting function.\n");
+				return;
+			}
+			ast_copy_string(recipient->context, cur_context, sizeof(recipient->context));
+			ast_copy_string(recipient->mailbox, cur_mailbox, sizeof(recipient->mailbox));
+			ast_copy_string(recipient->folder, cur_folder, sizeof(recipient->folder));
+
+			/* Add to list */
+			ast_verb(5, "Adding %s@%s to recipient list\n", recipient->mailbox, recipient->context);
+			AST_LIST_INSERT_HEAD(&mixmonitor->recipient_list, recipient, list);
+		} else {
+			ast_log(LOG_ERROR, "Failed to properly parse extension and/or context from element %d of recipient string: %s\n", elements_processed, vm_recipients);
+		}
+
+		cur_mailbox = next;
+		elements_processed++;
+	}
+}
+
+static void clear_mixmonitor_recipient_list(struct mixmonitor *mixmonitor)
+{
+	struct vm_recipient *current;
+	while ((current = AST_LIST_REMOVE_HEAD(&mixmonitor->recipient_list, list))) {
+		/* Clear list element data */
+		ast_free(current);
+	}
+}
+
 #define SAMPLES_PER_FRAME 160
 
 static void mixmonitor_free(struct mixmonitor *mixmonitor)
@@ -277,15 +426,72 @@
 			ast_cond_destroy(&mixmonitor->mixmonitor_ds->destruction_condition);
 			ast_free(mixmonitor->mixmonitor_ds);
 		}
+
+		/* Free everything in the recipient list */
+		clear_mixmonitor_recipient_list(mixmonitor);
+
+		/* clean stringfields */
+		ast_string_field_free_memory(mixmonitor);
+
 		ast_free(mixmonitor);
 	}
 }
+
+/*!
+ * \internal
+ * \brief Copies the mixmonitor to all voicemail recipients
+ * \param mixmonitor The mixmonitor that needs to forward its file to recipients
+ * \param ext Format of the file that was saved
+ */
+static void copy_to_voicemail(struct mixmonitor *mixmonitor, char *ext)
+{
+	struct vm_recipient *recipient = NULL;
+	struct ast_vm_recording_data recording_data;
+	char filename[PATH_MAX];
+
+	if (ast_string_field_init(&recording_data, 512)) {
+		ast_log(LOG_ERROR, "Failed to string_field_init, skipping copy_to_voicemail\n");
+		return;
+	}
+
+	/* Copy strings to stringfields that will be used for all recipients */
+	ast_string_field_set(&recording_data, recording_file, mixmonitor->filename);
+	ast_string_field_set(&recording_data, recording_ext, ext);
+	ast_string_field_set(&recording_data, call_context, mixmonitor->call_context);
+	ast_string_field_set(&recording_data, call_macrocontext, mixmonitor->call_macrocontext);
+	ast_string_field_set(&recording_data, call_extension, mixmonitor->call_extension);
+	ast_string_field_set(&recording_data, call_callerchan, mixmonitor->call_callerchan);
+	ast_string_field_set(&recording_data, call_callerid, mixmonitor->call_callerid);
+	/* and call_priority gets copied too */
+	recording_data.call_priority = mixmonitor->call_priority;
+
+	AST_LIST_TRAVERSE(&mixmonitor->recipient_list, recipient, list) {
+		/* context, mailbox, and folder need to be set per recipient */
+		ast_string_field_set(&recording_data, context, recipient->context);
+		ast_string_field_set(&recording_data, mailbox, recipient->mailbox);
+		ast_string_field_set(&recording_data, folder, recipient->folder);
+
+		ast_verb(4, "MixMonitor attempting to send voicemail copy to %s@%s\n", recording_data.mailbox,
+			recording_data.context);
+		ast_app_copy_recording_to_vm(&recording_data);
+	}
+
+	/* Delete the source file */
+	snprintf(filename, sizeof(filename), "%s.%s", mixmonitor->filename, ext);
+	if (remove(filename)) {
+		ast_log(LOG_ERROR, "Failed to delete recording source file %s\n", filename);
+	}
+
+	/* Free the string fields for recording_data before exiting the function. */
+	ast_string_field_free_memory(&recording_data);
+}
+
 static void *mixmonitor_thread(void *obj) 
 {
 	struct mixmonitor *mixmonitor = obj;
 	struct ast_filestream **fs = NULL;
 	unsigned int oflags;
-	char *ext;
+	char *ext = "";
 	char *last_slash;
 	int errflag = 0;
 
@@ -366,6 +572,19 @@
 	}
 
 	ast_verb(2, "End MixMonitor Recording %s\n", mixmonitor->name);
+
+	if (!AST_LIST_EMPTY(&mixmonitor->recipient_list)) {
+		if (ast_strlen_zero(ext)) {
+			ast_log(LOG_ERROR, "No file extension set for Mixmonitor %s. Skipping copy to voicemail.\n",
+				mixmonitor -> name);
+		} else {
+			ast_verb(3, "Copying recordings for Mixmonitor %s to voicemail recipients\n", mixmonitor->name);
+			copy_to_voicemail(mixmonitor, ext);
+		}
+	} else {
+		ast_debug(3, "No recipients to forward monitor to, moving on.\n");
+	}
+
 	mixmonitor_free(mixmonitor);
 	return NULL;
 }
@@ -401,7 +620,7 @@
 }
 
 static void launch_monitor_thread(struct ast_channel *chan, const char *filename, unsigned int flags,
-				  int readvol, int writevol, const char *post_process) 
+				  int readvol, int writevol, const char *post_process, const char *recipients)
 {
 	pthread_t thread;
 	struct mixmonitor *mixmonitor;
@@ -431,6 +650,12 @@
 		return;
 	}
 
+	/* Now that the struct has been calloced, go ahead and initialize the string fields. */
+	if (ast_string_field_init(mixmonitor, 512)) {
+		mixmonitor_free(mixmonitor);
+		return;
+	}
+
 	/* Setup the actual spy before creating our thread */
 	if (ast_audiohook_init(&mixmonitor->audiohook, AST_AUDIOHOOK_TYPE_SPY, mixmonitor_spy_type)) {
 		mixmonitor_free(mixmonitor);
@@ -454,6 +679,32 @@
 	if (!ast_strlen_zero(postprocess2)) {
 		mixmonitor->post_process = mixmonitor->name + strlen(mixmonitor->name) + strlen(filename) + 2;
 		strcpy(mixmonitor->post_process, postprocess2);
+	}
+
+	if (!ast_strlen_zero(recipients)) {
+		char callerid[256];
+
+		ast_channel_lock(chan);
+
+		/* We use the connected line of the invoking channel for caller ID. */
+		ast_debug(3, "Connected Line CID = %d - %s : %d - %s\n", chan->connected.id.name.valid,
+			chan->connected.id.name.str, chan->connected.id.number.valid,
+			chan->connected.id.number.str);
+		ast_callerid_merge(callerid, sizeof(callerid),
+			S_COR(chan->connected.id.name.valid, chan->connected.id.name.str, NULL),
+			S_COR(chan->connected.id.number.valid, chan->connected.id.number.str, NULL),
+			"Unknown");
+
+		ast_string_field_set(mixmonitor, call_context, chan->context);
+		ast_string_field_set(mixmonitor, call_macrocontext, chan->macrocontext);
+		ast_string_field_set(mixmonitor, call_extension, chan->exten);
+		ast_string_field_set(mixmonitor, call_callerchan, chan->name);
+		ast_string_field_set(mixmonitor, call_callerid, callerid);
+		mixmonitor->call_priority = chan->priority;
+
+		ast_channel_unlock(chan);
+
+		add_vm_recipients_from_string(mixmonitor, recipients);
 	}
 
 	mixmonitor->filename = (char *) mixmonitor + sizeof(*mixmonitor) + strlen(chan->name) + 1;
@@ -481,6 +732,7 @@
 {
 	int x, readvol = 0, writevol = 0;
 	struct ast_flags flags = {0};
+	char *recipients = NULL;
 	char *parse, *tmp, *slash;
 	AST_DECLARE_APP_ARGS(args,
 		AST_APP_ARG(filename);
@@ -536,6 +788,14 @@
 				readvol = writevol = get_volfactor(x);
 			}
 		}
+
+		if (ast_test_flag(&flags, MUXFLAG_VMRECIPIENTS)) {
+			if (ast_strlen_zero(opts[OPT_ARG_VMRECIPIENTS])) {
+				ast_log(LOG_WARNING, "No voicemail recipients were specified for the vm copy ('m') option.\n");
+			} else {
+				recipients = ast_strdupa(opts[OPT_ARG_VMRECIPIENTS]);
+			}
+		}
 	}
 
 	/* if not provided an absolute path, use the system-configured monitoring directory */
@@ -553,7 +813,7 @@
 	ast_mkdir(tmp, 0777);
 
 	pbx_builtin_setvar_helper(chan, "MIXMONITOR_FILENAME", args.filename);
-	launch_monitor_thread(chan, args.filename, flags.flags, readvol, writevol, args.post_process);
+	launch_monitor_thread(chan, args.filename, flags.flags, readvol, writevol, args.post_process, recipients);
 
 	return 0;
 }
@@ -702,6 +962,95 @@
 	return AMI_SUCCESS;
 }
 
+static int manager_mixmonitor(struct mansession *s, const struct message *m)
+{
+	struct ast_channel *c = NULL;
+
+	const char *name = astman_get_header(m, "Channel");
+	const char *id = astman_get_header(m, "ActionID");
+	const char *file = astman_get_header(m, "File");
+	const char *options = astman_get_header(m, "Options");
+
+	int res;
+	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;
+	}
+
+	strcpy(args, file);
+	strcat(args, ",");
+	strcat(args, options);
+
+	ast_channel_lock(c);
+	res = mixmonitor_exec(c, args);
+	ast_channel_unlock(c);
+
+	if (res) {
+		astman_send_error(s, m, "Could not start monitoring channel");
+		return AMI_SUCCESS;
+	}
+
+	astman_append(s, "Response: Success\r\n");
+
+	if (!ast_strlen_zero(id)) {
+		astman_append(s, "ActionID: %s\r\n", id);
+	}
+
+	astman_append(s, "\r\n");
+
+	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;
+
+	const char *name = astman_get_header(m, "Channel");
+	const char *id = astman_get_header(m, "ActionID");
+
+	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_exec(c, NULL);
+
+	if (res) {
+		astman_send_error(s, m, "Could not stop monitoring channel");
+		return AMI_SUCCESS;
+	}
+
+	astman_append(s, "Response: Success\r\n");
+
+	if (!ast_strlen_zero(id)) {
+		astman_append(s, "ActionID: %s\r\n", id);
+	}
+
+	astman_append(s, "\r\n");
+
+	c = ast_channel_unref(c);
+
+	return AMI_SUCCESS;
+}
+
 static struct ast_cli_entry cli_mixmonitor[] = {
 	AST_CLI_DEFINE(handle_cli_mixmonitor, "Execute a MixMonitor command")
 };
@@ -714,6 +1063,8 @@
 	res = ast_unregister_application(stop_app);
 	res |= ast_unregister_application(app);
 	res |= ast_manager_unregister("MixMonitorMute");
+	res |= ast_manager_unregister("MixMonitor");
+	res |= ast_manager_unregister("StopMixMonitor");
 	
 	return res;
 }
@@ -726,6 +1077,8 @@
 	res = ast_register_application_xml(app, mixmonitor_exec);
 	res |= ast_register_application_xml(stop_app, stop_mixmonitor_exec);
 	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);
 
 	return res;
 }

Modified: certified/branches/1.8.15/apps/app_morsecode.c
URL: http://svnview.digium.com/svn/asterisk/certified/branches/1.8.15/apps/app_morsecode.c?view=diff&rev=370667&r1=370666&r2=370667
==============================================================================
--- certified/branches/1.8.15/apps/app_morsecode.c (original)
+++ certified/branches/1.8.15/apps/app_morsecode.c Tue Jul 31 15:59:52 2012
@@ -26,6 +26,7 @@
 
 /*** MODULEINFO
 	<support_level>extended</support_level>
+	<defaultenabled>no</defaultenabled>
  ***/
 
 #include "asterisk.h"

Modified: certified/branches/1.8.15/apps/app_mp3.c
URL: http://svnview.digium.com/svn/asterisk/certified/branches/1.8.15/apps/app_mp3.c?view=diff&rev=370667&r1=370666&r2=370667
==============================================================================
--- certified/branches/1.8.15/apps/app_mp3.c (original)
+++ certified/branches/1.8.15/apps/app_mp3.c Tue Jul 31 15:59:52 2012
@@ -30,6 +30,7 @@
 
 /*** MODULEINFO
 	<support_level>extended</support_level>
+	<defaultenabled>no</defaultenabled>
  ***/
  
 #include "asterisk.h"

Modified: certified/branches/1.8.15/apps/app_nbscat.c
URL: http://svnview.digium.com/svn/asterisk/certified/branches/1.8.15/apps/app_nbscat.c?view=diff&rev=370667&r1=370666&r2=370667
==============================================================================
--- certified/branches/1.8.15/apps/app_nbscat.c (original)
+++ certified/branches/1.8.15/apps/app_nbscat.c Tue Jul 31 15:59:52 2012
@@ -27,6 +27,7 @@
 
 /*** MODULEINFO
 	<support_level>extended</support_level>
+	<defaultenabled>no</defaultenabled>
  ***/
  
 #include "asterisk.h"

Modified: certified/branches/1.8.15/apps/app_osplookup.c
URL: http://svnview.digium.com/svn/asterisk/certified/branches/1.8.15/apps/app_osplookup.c?view=diff&rev=370667&r1=370666&r2=370667
==============================================================================
--- certified/branches/1.8.15/apps/app_osplookup.c (original)
+++ certified/branches/1.8.15/apps/app_osplookup.c Tue Jul 31 15:59:52 2012
@@ -32,6 +32,7 @@
 	<depend>osptk</depend>
 	<depend>openssl</depend>
 	<support_level>extended</support_level>
+	<defaultenabled>no</defaultenabled>
  ***/
 
 #include "asterisk.h"

Modified: certified/branches/1.8.15/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/certified/branches/1.8.15/apps/app_queue.c?view=diff&rev=370667&r1=370666&r2=370667
==============================================================================
--- certified/branches/1.8.15/apps/app_queue.c (original)
+++ certified/branches/1.8.15/apps/app_queue.c Tue Jul 31 15:59:52 2012
@@ -1551,12 +1551,18 @@
 	return state;
 }
 
-static int extension_state_cb(char *context, char *exten, enum ast_extension_states state, void *data)
+static int extension_state_cb(char *context, char *exten, struct ast_state_cb_info *info, void *data)
 {
 	struct ao2_iterator miter, qiter;
 	struct member *m;
 	struct call_queue *q;
+	int state = info->exten_state;
 	int found = 0, device_state = extensionstate2devicestate(state);
+
+	/* only interested in extension state updates involving device states */
+	if (info->reason != AST_HINT_UPDATE_DEVICE) {
+		return 0;
+	}
 
 	qiter = ao2_iterator_init(queues, 0);
 	while ((q = ao2_t_iterator_next(&qiter, "Iterate through queues"))) {

Modified: certified/branches/1.8.15/apps/app_readfile.c
URL: http://svnview.digium.com/svn/asterisk/certified/branches/1.8.15/apps/app_readfile.c?view=diff&rev=370667&r1=370666&r2=370667
==============================================================================
--- certified/branches/1.8.15/apps/app_readfile.c (original)
+++ certified/branches/1.8.15/apps/app_readfile.c Tue Jul 31 15:59:52 2012
@@ -27,6 +27,7 @@
 
 /*** MODULEINFO
 	<support_level>deprecated</support_level>
+	<defaultenabled>no</defaultenabled>
 	<replacement>func_env (FILE())</replacement>
  ***/
 

Modified: certified/branches/1.8.15/apps/app_setcallerid.c
URL: http://svnview.digium.com/svn/asterisk/certified/branches/1.8.15/apps/app_setcallerid.c?view=diff&rev=370667&r1=370666&r2=370667
==============================================================================
--- certified/branches/1.8.15/apps/app_setcallerid.c (original)
+++ certified/branches/1.8.15/apps/app_setcallerid.c Tue Jul 31 15:59:52 2012
@@ -27,6 +27,7 @@
 
 /*** MODULEINFO
 	<support_level>deprecated</support_level>
+	<defaultenabled>no</defaultenabled>
 	<replacement>func_callerid</replacement>
  ***/
 

Modified: certified/branches/1.8.15/apps/app_sms.c
URL: http://svnview.digium.com/svn/asterisk/certified/branches/1.8.15/apps/app_sms.c?view=diff&rev=370667&r1=370666&r2=370667
==============================================================================
--- certified/branches/1.8.15/apps/app_sms.c (original)
+++ certified/branches/1.8.15/apps/app_sms.c Tue Jul 31 15:59:52 2012
@@ -36,6 +36,7 @@
 
 /*** MODULEINFO
 	<support_level>extended</support_level>
+	<defaultenabled>no</defaultenabled>
  ***/
 
 #include "asterisk.h"

Modified: certified/branches/1.8.15/apps/app_talkdetect.c
URL: http://svnview.digium.com/svn/asterisk/certified/branches/1.8.15/apps/app_talkdetect.c?view=diff&rev=370667&r1=370666&r2=370667
==============================================================================
--- certified/branches/1.8.15/apps/app_talkdetect.c (original)
+++ certified/branches/1.8.15/apps/app_talkdetect.c Tue Jul 31 15:59:52 2012
@@ -27,6 +27,7 @@
 
 /*** MODULEINFO
 	<support_level>extended</support_level>
+	<defaultenabled>no</defaultenabled>
  ***/
 
 #include "asterisk.h"

Modified: certified/branches/1.8.15/apps/app_test.c
URL: http://svnview.digium.com/svn/asterisk/certified/branches/1.8.15/apps/app_test.c?view=diff&rev=370667&r1=370666&r2=370667
==============================================================================
--- certified/branches/1.8.15/apps/app_test.c (original)
+++ certified/branches/1.8.15/apps/app_test.c Tue Jul 31 15:59:52 2012
@@ -29,6 +29,7 @@
 
 /*** MODULEINFO
 	<support_level>extended</support_level>
+	<defaultenabled>no</defaultenabled>
  ***/
 
 #include "asterisk.h"

Modified: certified/branches/1.8.15/apps/app_url.c
URL: http://svnview.digium.com/svn/asterisk/certified/branches/1.8.15/apps/app_url.c?view=diff&rev=370667&r1=370666&r2=370667
==============================================================================
--- certified/branches/1.8.15/apps/app_url.c (original)
+++ certified/branches/1.8.15/apps/app_url.c Tue Jul 31 15:59:52 2012
@@ -27,6 +27,7 @@
 
 /*** MODULEINFO
 	<support_level>extended</support_level>
+	<defaultenabled>no</defaultenabled>
  ***/
  
 #include "asterisk.h"

Modified: certified/branches/1.8.15/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/certified/branches/1.8.15/apps/app_voicemail.c?view=diff&rev=370667&r1=370666&r2=370667
==============================================================================
--- certified/branches/1.8.15/apps/app_voicemail.c (original)
+++ certified/branches/1.8.15/apps/app_voicemail.c Tue Jul 31 15:59:52 2012
@@ -119,6 +119,7 @@
 #include "asterisk/cli.h"
 #include "asterisk/utils.h"
 #include "asterisk/stringfields.h"
+#include "asterisk/strings.h"
 #include "asterisk/smdi.h"
 #include "asterisk/astobj2.h"
 #include "asterisk/event.h"
@@ -330,6 +331,30 @@
 			</enumlist>
 		</description>
 	</application>
+	<application name="VoiceMailPlayMsg" language="en_US">
+		<synopsis>
+			Play a single voice mail msg from a mailbox by msg id.
+		</synopsis>
+		<syntax>

[... 6365 lines stripped ...]



More information about the svn-commits mailing list