[asterisk-commits] mmichelson: branch group/manager2 r113977 - in /team/group/manager2: ./ apps/...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Apr 9 16:41:27 CDT 2008


Author: mmichelson
Date: Wed Apr  9 16:41:26 2008
New Revision: 113977

URL: http://svn.digium.com/view/asterisk?view=rev&rev=113977
Log:
Reset automerge. Surprisingly, there were no conflicts to resolve.


Removed:
    team/group/manager2/codecs/ilbc/FrameClassify.c
    team/group/manager2/codecs/ilbc/FrameClassify.h
    team/group/manager2/codecs/ilbc/LPCdecode.c
    team/group/manager2/codecs/ilbc/LPCdecode.h
    team/group/manager2/codecs/ilbc/LPCencode.c
    team/group/manager2/codecs/ilbc/LPCencode.h
    team/group/manager2/codecs/ilbc/StateConstructW.c
    team/group/manager2/codecs/ilbc/StateConstructW.h
    team/group/manager2/codecs/ilbc/StateSearchW.c
    team/group/manager2/codecs/ilbc/StateSearchW.h
    team/group/manager2/codecs/ilbc/anaFilter.c
    team/group/manager2/codecs/ilbc/anaFilter.h
    team/group/manager2/codecs/ilbc/constants.c
    team/group/manager2/codecs/ilbc/constants.h
    team/group/manager2/codecs/ilbc/createCB.c
    team/group/manager2/codecs/ilbc/createCB.h
    team/group/manager2/codecs/ilbc/doCPLC.c
    team/group/manager2/codecs/ilbc/doCPLC.h
    team/group/manager2/codecs/ilbc/enhancer.c
    team/group/manager2/codecs/ilbc/enhancer.h
    team/group/manager2/codecs/ilbc/filter.c
    team/group/manager2/codecs/ilbc/filter.h
    team/group/manager2/codecs/ilbc/gainquant.c
    team/group/manager2/codecs/ilbc/gainquant.h
    team/group/manager2/codecs/ilbc/getCBvec.c
    team/group/manager2/codecs/ilbc/getCBvec.h
    team/group/manager2/codecs/ilbc/helpfun.c
    team/group/manager2/codecs/ilbc/helpfun.h
    team/group/manager2/codecs/ilbc/hpInput.c
    team/group/manager2/codecs/ilbc/hpInput.h
    team/group/manager2/codecs/ilbc/hpOutput.c
    team/group/manager2/codecs/ilbc/hpOutput.h
    team/group/manager2/codecs/ilbc/iCBConstruct.c
    team/group/manager2/codecs/ilbc/iCBConstruct.h
    team/group/manager2/codecs/ilbc/iCBSearch.c
    team/group/manager2/codecs/ilbc/iCBSearch.h
    team/group/manager2/codecs/ilbc/iLBC_decode.c
    team/group/manager2/codecs/ilbc/iLBC_decode.h
    team/group/manager2/codecs/ilbc/iLBC_define.h
    team/group/manager2/codecs/ilbc/iLBC_encode.c
    team/group/manager2/codecs/ilbc/iLBC_encode.h
    team/group/manager2/codecs/ilbc/libilbc.vcproj
    team/group/manager2/codecs/ilbc/lsf.c
    team/group/manager2/codecs/ilbc/lsf.h
    team/group/manager2/codecs/ilbc/packing.c
    team/group/manager2/codecs/ilbc/packing.h
    team/group/manager2/codecs/ilbc/syntFilter.c
    team/group/manager2/codecs/ilbc/syntFilter.h
Modified:
    team/group/manager2/   (props changed)
    team/group/manager2/CHANGES
    team/group/manager2/Makefile
    team/group/manager2/UPGRADE.txt
    team/group/manager2/apps/app_dial.c
    team/group/manager2/apps/app_playback.c
    team/group/manager2/apps/app_queue.c
    team/group/manager2/apps/app_voicemail.c
    team/group/manager2/build_tools/cflags.xml
    team/group/manager2/cdr/cdr_csv.c
    team/group/manager2/cdr/cdr_custom.c
    team/group/manager2/channels/chan_gtalk.c
    team/group/manager2/channels/chan_h323.c
    team/group/manager2/channels/chan_iax2.c
    team/group/manager2/channels/chan_misdn.c
    team/group/manager2/channels/chan_sip.c
    team/group/manager2/channels/chan_skinny.c
    team/group/manager2/channels/chan_usbradio.c
    team/group/manager2/channels/chan_vpb.cc
    team/group/manager2/channels/chan_zap.c
    team/group/manager2/channels/iax2-provision.c
    team/group/manager2/channels/misdn_config.c
    team/group/manager2/codecs/Makefile
    team/group/manager2/codecs/codec_g722.c
    team/group/manager2/codecs/codec_ilbc.c
    team/group/manager2/codecs/gsm/Makefile
    team/group/manager2/codecs/ilbc/   (props changed)
    team/group/manager2/configs/cdr.conf.sample
    team/group/manager2/configs/extensions.conf.sample
    team/group/manager2/configs/manager.conf.sample
    team/group/manager2/configs/sip.conf.sample
    team/group/manager2/configs/skinny.conf.sample
    team/group/manager2/configs/voicemail.conf.sample
    team/group/manager2/contrib/scripts/astgenkey.8
    team/group/manager2/contrib/scripts/autosupport
    team/group/manager2/doc/janitor-projects.txt
    team/group/manager2/doc/snmp.txt
    team/group/manager2/doc/valgrind.txt
    team/group/manager2/formats/format_wav.c
    team/group/manager2/formats/format_wav_gsm.c
    team/group/manager2/funcs/func_strings.c
    team/group/manager2/include/asterisk/ael_structs.h
    team/group/manager2/include/asterisk/audiohook.h
    team/group/manager2/include/asterisk/config.h
    team/group/manager2/include/asterisk/dnsmgr.h
    team/group/manager2/include/asterisk/dsp.h
    team/group/manager2/include/asterisk/features.h
    team/group/manager2/include/asterisk/http.h
    team/group/manager2/include/asterisk/linkedlists.h
    team/group/manager2/include/asterisk/mod_format.h
    team/group/manager2/include/asterisk/options.h
    team/group/manager2/include/asterisk/pbx.h
    team/group/manager2/include/asterisk/pval.h
    team/group/manager2/include/asterisk/slinfactory.h
    team/group/manager2/include/asterisk/udptl.h
    team/group/manager2/main/Makefile
    team/group/manager2/main/acl.c
    team/group/manager2/main/app.c
    team/group/manager2/main/asterisk.c
    team/group/manager2/main/audiohook.c
    team/group/manager2/main/autoservice.c
    team/group/manager2/main/cdr.c
    team/group/manager2/main/channel.c
    team/group/manager2/main/config.c
    team/group/manager2/main/dns.c
    team/group/manager2/main/dnsmgr.c
    team/group/manager2/main/dsp.c
    team/group/manager2/main/enum.c
    team/group/manager2/main/features.c
    team/group/manager2/main/file.c
    team/group/manager2/main/frame.c
    team/group/manager2/main/http.c
    team/group/manager2/main/loader.c
    team/group/manager2/main/logger.c
    team/group/manager2/main/manager.c
    team/group/manager2/main/pbx.c
    team/group/manager2/main/rtp.c
    team/group/manager2/main/slinfactory.c
    team/group/manager2/main/udptl.c
    team/group/manager2/pbx/pbx_ael.c
    team/group/manager2/phoneprov/000000000000-directory.xml
    team/group/manager2/phoneprov/polycom.xml
    team/group/manager2/res/ael/pval.c
    team/group/manager2/res/res_agi.c
    team/group/manager2/res/res_config_sqlite.c
    team/group/manager2/res/res_phoneprov.c
    team/group/manager2/sounds/Makefile

Propchange: team/group/manager2/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/group/manager2/
------------------------------------------------------------------------------
Binary property 'branch-1.4-blocked' - no diff available.

Propchange: team/group/manager2/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/group/manager2/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Apr  9 16:41:26 2008
@@ -1,1 +1,1 @@
-/trunk:1-110274
+/trunk:1-113976

Modified: team/group/manager2/CHANGES
URL: http://svn.digium.com/view/asterisk/team/group/manager2/CHANGES?view=diff&rev=113977&r1=113976&r2=113977
==============================================================================
--- team/group/manager2/CHANGES (original)
+++ team/group/manager2/CHANGES Wed Apr  9 16:41:26 2008
@@ -17,6 +17,39 @@
  * It is now possible to specify a pattern match as a hint. Once a phone subscribes
    to something that matches the pattern a hint will be created using the contents
    and variables evaluated.
+
+Application Changes
+-------------------
+ * Directory now permits both first and last names to be matched at the same
+   time.  In addition, the number of digits to enter of the name can be set in
+   the arguments to Directory; previously, you could enter only 3, regardless
+   of how many names are in your company.  For large companies, this should be
+   quite helpful.
+ * Voicemail now permits a mailbox setting to wrap around from first to last
+   messages, if the "messagewrap" option is set to a true value.
+ * Dial has a new option: F(context^extension^pri), which permits a callee to
+   continue in the dialplan, at the specified label, if the caller hangs up.
+
+SIP Changes
+-----------
+ * The ATTENDED_TRANSFER_COMPLETE_SOUND can now be set using setvar to cause a given
+   audio file to be played upon completion of an attended transfer.
+ * Added DNS manager support to registrations for peers referencing peer entries.
+
+IAX Changes
+-----------
+ * Existing DNS manager lookups extended to check for SRV records.
+
+CLI Changes
+-----------
+  * New CLI command, "config reload <file.conf>" which reloads any module that
+     references that particular configuration file.  Also added "config list"
+     which shows which configuration files are in use.
+
+DNS manager changes
+-------------------
+  * Addresses managed by DNS manager now can check to see if there is a DNS
+    SRV record for a given domain and will use that hostname/port if present.
 
 ------------------------------------------------------------------------------
 --- Functionality changes from Asterisk 1.4.X to Asterisk 1.6.0  -------------
@@ -171,11 +204,11 @@
   * Added SIP Session Timers support (RFC 4028).  This prevents stuck SIP sessions that
      were not properly torn down due to network or endpoint failures during an established
      SIP session.
-  * Added TCP and TLS support for SIP.  See doc/siptls.txt and configs/sip.conf.sample for
-     more information on how it is used.
+  * Added experimental TCP and TLS support for SIP.  See doc/siptls.txt and 
+     configs/sip.conf.sample for more information on how it is used.
   * Added a new configuration option "authfailureevents" that enables manager events when
     a peer can't authenticate properly. 
-  * Added DNS manager support to registrations not referencing a peer entry.
+  * Added DNS manager support to registrations for peers not referencing a peer entry.
 
 IAX2 changes
 ------------
@@ -587,4 +620,4 @@
   * Added a compiler flag, CHANNEL_TRACE, which permits channel tracing to be
      turned on, via the CHANNEL(trace) dialplan function.  Could be useful for
      dialplan debugging.
-
+  * iLBC source code no longer included (see UPGRADE.txt for details)

Modified: team/group/manager2/Makefile
URL: http://svn.digium.com/view/asterisk/team/group/manager2/Makefile?view=diff&rev=113977&r1=113976&r2=113977
==============================================================================
--- team/group/manager2/Makefile (original)
+++ team/group/manager2/Makefile Wed Apr  9 16:41:26 2008
@@ -674,6 +674,7 @@
 		echo ";cache_record_files = yes ; Cache recorded sound files to another directory during recording" ; \
 		echo ";record_cache_dir = /tmp ; Specify cache directory (used in cnjunction with cache_record_files)" ; \
 		echo ";transmit_silence_during_record = yes ; Transmit SLINEAR silence while a channel is being recorded" ; \
+		echo ";transmit_silence = yes ; Transmit SLINEAR silence while a channel is being recorded or DTMF is being generated" ; \
 		echo ";transcode_via_sln = yes ; Build transcode paths via SLINEAR, instead of directly" ; \
 		echo ";runuser = asterisk ; The user to run as" ; \
 		echo ";rungroup = asterisk ; The group to run as" ; \
@@ -844,7 +845,7 @@
 menuselect/nmenuselect: menuselect/makeopts
 	$(MAKE_MENUSELECT) nmenuselect
 
-menuselect/makeopts:
+menuselect/makeopts: makeopts
 	$(MAKE_MENUSELECT) makeopts
 
 menuselect-tree: $(foreach dir,$(filter-out main,$(MOD_SUBDIRS)),$(wildcard $(dir)/*.c) $(wildcard $(dir)/*.cc)) build_tools/cflags.xml build_tools/cflags-devmode.xml sounds/sounds.xml build_tools/embed_modules.xml configure

Modified: team/group/manager2/UPGRADE.txt
URL: http://svn.digium.com/view/asterisk/team/group/manager2/UPGRADE.txt?view=diff&rev=113977&r1=113976&r2=113977
==============================================================================
--- team/group/manager2/UPGRADE.txt (original)
+++ team/group/manager2/UPGRADE.txt Wed Apr  9 16:41:26 2008
@@ -187,3 +187,16 @@
 * The Originate command now requires the Originate write permission.  For
    Originate with the Application parameter, you need the additional System
    privilege if you want to do anything that calls out to a subshell.
+
+iLBC Codec:
+
+* Previously, the Asterisk source code distribution included the iLBC
+  encoder/decoder source code, from Global IP Solutions
+  (http://www.gipscorp.com). This code is not licensed for
+  distribution, and thus has been removed from the Asterisk source
+  code distribution. If you wish to use codec_ilbc to support iLBC
+  channels in Asterisk, you can run the contrib/scripts/get_ilbc_source.sh
+  script to download the source and put it in the proper place in
+  the Asterisk build tree. Once that is done you can follow your normal
+  steps of building Asterisk. You will need to run 'menuselect' and enable
+  the iLBC codec in the 'Codec  Translators' category.

Modified: team/group/manager2/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/group/manager2/apps/app_dial.c?view=diff&rev=113977&r1=113976&r2=113977
==============================================================================
--- team/group/manager2/apps/app_dial.c (original)
+++ team/group/manager2/apps/app_dial.c Wed Apr  9 16:41:26 2008
@@ -116,6 +116,8 @@
 "           extension associated with the channel using a dialplan 'hint'.\n"
 "           For example, some PSTNs do not allow CallerID to be set to anything\n"
 "           other than the number assigned to the caller.\n"
+"    F(context^exten^pri) - When the caller hangs up, transfer the called party\n"
+"           to the specified context and extension and continue execution.\n"
 "    g    - Proceed with dialplan execution at the current extension if the\n"
 "           destination channel hangs up.\n"
 "    G(context^exten^pri) - If the call is answered, transfer the calling party to\n"
@@ -147,7 +149,7 @@
 "           specified.\n"
 "    M(x[^arg]) - Execute the Macro for the *called* channel before connecting\n"
 "           to the calling channel. Arguments can be specified to the Macro\n"
-"           using '^' as a delimeter. The Macro can set the variable\n"
+"           using '^' as a delimiter. The Macro can set the variable\n"
 "           MACRO_RESULT to specify the following actions after the Macro is\n"
 "           finished executing.\n"
 "           * ABORT        Hangup both legs of the call.\n"
@@ -194,7 +196,7 @@
 "           DTMF sequence defined in features.conf.\n"
 "    U(x[^arg]) - Execute via Gosub the routine 'x' for the *called* channel before connecting\n"
 "           to the calling channel. Arguments can be specified to the Gosub\n"
-"           using '^' as a delimeter. The Gosub routine can set the variable\n"
+"           using '^' as a delimiter. The Gosub routine can set the variable\n"
 "           GOSUB_RESULT to specify the following actions after the Gosub returns.\n"
 "           * ABORT        Hangup both legs of the call.\n"
 "           * CONGESTION   Behave as if line congestion was encountered.\n"
@@ -269,6 +271,7 @@
 #define DIAL_NOFORWARDHTML   ((uint64_t)1 << 32) /* flags are now 64 bits, so keep it up! */
 #define OPT_CANCEL_ELSEWHERE ((uint64_t)1 << 33)
 #define OPT_PEER_H           ((uint64_t)1 << 34)
+#define OPT_CALLEE_GO_ON     ((uint64_t)1 << 35)
 
 enum {
 	OPT_ARG_ANNOUNCE = 0,
@@ -278,6 +281,7 @@
 	OPT_ARG_MUSICBACK,
 	OPT_ARG_CALLEE_MACRO,
 	OPT_ARG_CALLEE_GOSUB,
+	OPT_ARG_CALLEE_GO_ON,
 	OPT_ARG_PRIVACY,
 	OPT_ARG_DURATION_STOP,
 	OPT_ARG_OPERMODE,
@@ -293,6 +297,7 @@
 	AST_APP_OPTION_ARG('D', OPT_SENDDTMF, OPT_ARG_SENDDTMF),
 	AST_APP_OPTION('e', OPT_PEER_H),
 	AST_APP_OPTION('f', OPT_FORCECLID),
+	AST_APP_OPTION_ARG('F', OPT_CALLEE_GO_ON, OPT_ARG_CALLEE_GO_ON),
 	AST_APP_OPTION('g', OPT_GO_ON),
 	AST_APP_OPTION_ARG('G', OPT_GOTO, OPT_ARG_GOTO),
 	AST_APP_OPTION('h', OPT_CALLEE_HANGUP),
@@ -1919,9 +1924,15 @@
 			ast_set2_flag(peer, autoloopflag, AST_FLAG_IN_AUTOLOOP);  /* set it back the way it was */
 		}
 		if (res != AST_PBX_NO_HANGUP_PEER) {
-			if (!ast_check_hangup(chan))
-				chan->hangupcause = peer->hangupcause;
-			ast_hangup(peer);
+			if (!ast_check_hangup(peer) && ast_test_flag64(&opts, OPT_CALLEE_GO_ON) && !ast_strlen_zero(opt_args[OPT_ARG_CALLEE_GO_ON])) {		
+                        	replace_macro_delimiter(opt_args[OPT_ARG_CALLEE_GO_ON]);
+                        	ast_parseable_goto(peer, opt_args[OPT_ARG_CALLEE_GO_ON]);
+	                        ast_pbx_start(peer);
+			} else {
+				if (!ast_check_hangup(chan))
+					chan->hangupcause = peer->hangupcause;
+				ast_hangup(peer);
+			}
 		}
 	}
 out:

Modified: team/group/manager2/apps/app_playback.c
URL: http://svn.digium.com/view/asterisk/team/group/manager2/apps/app_playback.c?view=diff&rev=113977&r1=113976&r2=113977
==============================================================================
--- team/group/manager2/apps/app_playback.c (original)
+++ team/group/manager2/apps/app_playback.c Wed Apr  9 16:41:26 2008
@@ -55,6 +55,8 @@
 "This application sets the following channel variable upon completion:\n"
 " PLAYBACKSTATUS    The status of the playback attempt as a text string, one of\n"
 "               SUCCESS | FAILED\n"
+"See Also: Background (application) -- for playing soundfiles that are interruptible\n"
+"          WaitExten (application) -- wait for digits from caller, optionally play music on hold\n"
 ;
 
 

Modified: team/group/manager2/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/group/manager2/apps/app_queue.c?view=diff&rev=113977&r1=113976&r2=113977
==============================================================================
--- team/group/manager2/apps/app_queue.c (original)
+++ team/group/manager2/apps/app_queue.c Wed Apr  9 16:41:26 2008
@@ -1409,8 +1409,6 @@
 {
 	struct call_queue *q = obj;
 	int i;
-
-	ast_debug(0, "Queue destructor called for queue '%s'!\n", q->name);
 
 	free_members(q, 1);
 	ast_string_field_free_memory(q);
@@ -4410,7 +4408,7 @@
 	qe.start = time(NULL);
 
 	/* set the expire time based on the supplied timeout; */
-	if (args.queuetimeoutstr)
+	if (!ast_strlen_zero(args.queuetimeoutstr))
 		qe.expire = qe.start + atoi(args.queuetimeoutstr);
 	else
 		qe.expire = 0;
@@ -6193,6 +6191,8 @@
 {
 	int res;
 	struct ast_context *con;
+	struct ao2_iterator q_iter;
+	struct call_queue *q = NULL;
 
 	if (device_state.thread != AST_PTHREADT_NULL) {
 		device_state.stop = 1;
@@ -6205,7 +6205,7 @@
 	ast_cli_unregister_multiple(cli_queue, sizeof(cli_queue) / sizeof(struct ast_cli_entry));
 	res = ast_manager_unregister("QueueStatus");
 	res |= ast_manager_unregister("Queues");
-	res |= ast_manager_unregister("QueueStatus");
+	res |= ast_manager_unregister("QueueRule");
 	res |= ast_manager_unregister("QueueSummary");
 	res |= ast_manager_unregister("QueueAdd");
 	res |= ast_manager_unregister("QueueRemove");
@@ -6235,6 +6235,11 @@
 
 	clear_and_free_interfaces();
 
+	q_iter = ao2_iterator_init(queues, 0);
+	while ((q = ao2_iterator_next(&q_iter))) {
+		ao2_unlink(queues, q);
+		queue_unref(q);
+	}
 	ao2_ref(queues, -1);
 
 	return res;

Modified: team/group/manager2/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/group/manager2/apps/app_voicemail.c?view=diff&rev=113977&r1=113976&r2=113977
==============================================================================
--- team/group/manager2/apps/app_voicemail.c (original)
+++ team/group/manager2/apps/app_voicemail.c Wed Apr  9 16:41:26 2008
@@ -204,23 +204,24 @@
 #define MAX_DATETIME_FORMAT	512
 #define MAX_NUM_CID_CONTEXTS 10
 
-#define VM_REVIEW        (1 << 0)
-#define VM_OPERATOR      (1 << 1)
-#define VM_SAYCID        (1 << 2)
-#define VM_SVMAIL        (1 << 3)
-#define VM_ENVELOPE      (1 << 4)
-#define VM_SAYDURATION   (1 << 5)
-#define VM_SKIPAFTERCMD  (1 << 6)
+#define VM_REVIEW        (1 << 0)   /*!< After recording, permit the caller to review the recording before saving */
+#define VM_OPERATOR      (1 << 1)   /*!< Allow 0 to be pressed to go to 'o' extension */
+#define VM_SAYCID        (1 << 2)   /*!< Repeat the CallerID info during envelope playback */
+#define VM_SVMAIL        (1 << 3)   /*!< Allow the user to compose a new VM from within VoicemailMain */
+#define VM_ENVELOPE      (1 << 4)   /*!< Play the envelope information (who-from, time received, etc.) */
+#define VM_SAYDURATION   (1 << 5)   /*!< Play the length of the message during envelope playback */
+#define VM_SKIPAFTERCMD  (1 << 6)   /*!< After deletion, assume caller wants to go to the next message */
 #define VM_FORCENAME     (1 << 7)   /*!< Have new users record their name */
 #define VM_FORCEGREET    (1 << 8)   /*!< Have new users record their greetings */
-#define VM_PBXSKIP       (1 << 9)
-#define VM_DIRECFORWARD  (1 << 10)  /*!< directory_forward */
-#define VM_ATTACH        (1 << 11)
-#define VM_DELETE        (1 << 12)
-#define VM_ALLOCED       (1 << 13)
-#define VM_SEARCH        (1 << 14)
+#define VM_PBXSKIP       (1 << 9)   /*!< Skip the [PBX] preamble in the Subject line of emails */
+#define VM_DIRECFORWARD  (1 << 10)  /*!< Permit caller to use the Directory app for selecting to which mailbox to forward a VM */
+#define VM_ATTACH        (1 << 11)  /*!< Attach message to voicemail notifications? */
+#define VM_DELETE        (1 << 12)  /*!< Delete message after sending notification */
+#define VM_ALLOCED       (1 << 13)  /*!< Structure was malloc'ed, instead of placed in a return (usually static) buffer */
+#define VM_SEARCH        (1 << 14)  /*!< Search all contexts for a matching mailbox */
 #define VM_TEMPGREETWARN (1 << 15)  /*!< Remind user tempgreeting is set */
 #define VM_MOVEHEARD     (1 << 16)  /*!< Move a "heard" message to Old after listening to it */
+#define VM_MESSAGEWRAP   (1 << 17)  /*!< Wrap around from the last message to the first, and vice-versa */
 #define ERROR_LOCK_PATH  -100
 #define ERROR_MAILBOX_FULL	-200
 
@@ -399,6 +400,8 @@
 	char msg_format[512];
 };
 
+#define VMSTATE_MAX_MSG_ARRAY 256
+
 /*! Voicemail mailbox state */
 struct vm_state {
 	char curbox[80];
@@ -416,8 +419,9 @@
 	int starting;
 	int repeats;
 #ifdef IMAP_STORAGE
+	ast_mutex_t lock;
 	int updated;                         /*!< decremented on each mail check until 1 -allows delay */
-	long msgArray[256];
+	long msgArray[VMSTATE_MAX_MSG_ARRAY];
 	MAILSTREAM *mailstream;
 	int vmArrayIndex;
 	char imapuser[80];                   /*!< IMAP server login */
@@ -671,7 +675,18 @@
 #endif
 
 
-
+/*!
+ * \brief Sets default voicemail system options to a voicemail user.
+ *
+ * This applies select global settings to a newly created (dynamic) instance of a voicemail user.
+ * - all the globalflags
+ * - the saydurationminfo
+ * - the callcontext
+ * - the dialcontext
+ * - the exitcontext
+ * - vmmaxsecs, vmmaxmsg, maxdeletedmsg
+ * - volume gain.
+ */
 static void populate_defaults(struct ast_vm_user *vmu)
 {
 	ast_copy_flags(vmu, (&globalflags), AST_FLAGS_ALL);	
@@ -689,6 +704,14 @@
 	vmu->volgain = volgain;
 }
 
+/*!
+ * \brief Sets a a specific property value.
+ * \param vmu The voicemail user object to work with.
+ * \param var The name of the property to be set.
+ * \param value The value to be set to the property.
+ * 
+ * The property name must be one of the understood properties. See the source for details.
+ */
 static void apply_option(struct ast_vm_user *vmu, const char *var, const char *value)
 {
 	int x;
@@ -718,6 +741,8 @@
 		ast_set2_flag(vmu, ast_true(value), VM_REVIEW);
 	} else if (!strcasecmp(var, "tempgreetwarn")) {
 		ast_set2_flag(vmu, ast_true(value), VM_TEMPGREETWARN);	
+	} else if (!strcasecmp(var, "messagewrap")){
+		ast_set2_flag(vmu, ast_true(value), VM_MESSAGEWRAP);	
 	} else if (!strcasecmp(var, "operator")) {
 		ast_set2_flag(vmu, ast_true(value), VM_OPERATOR);	
 	} else if (!strcasecmp(var, "envelope")) {
@@ -782,6 +807,16 @@
 	}
 }
 
+/*! 
+ * \brief Performs a change of the voicemail passowrd in the realtime engine.
+ * \param vmu The voicemail user to change the password for.
+ * \param password The new value to be set to the password for this user.
+ * 
+ * This only works if the voicemail user has a unique id, and if there is a realtime engine configured.
+ * This is called from the (top level) vm_change_password.
+ *
+ * \return zero on success, -1 on error.
+ */
 static int change_password_realtime(struct ast_vm_user *vmu, const char *password)
 {
 	int res;
@@ -798,8 +833,11 @@
 	return -1;
 }
 
+/*!
+ * \brief Destructively Parse options and apply.
+ */
 static void apply_options(struct ast_vm_user *vmu, const char *options)
-{	/* Destructively Parse options and apply */
+{	
 	char *stringp;
 	char *s;
 	char *var, *value;
@@ -812,6 +850,11 @@
 	}	
 }
 
+/*!
+ * \brief Loads the options specific to a voicemail user.
+ * 
+ * This is called when a vm_user structure is being set up, such as from load_options.
+ */
 static void apply_options_full(struct ast_vm_user *retval, struct ast_variable *var)
 {
 	struct ast_variable *tmp;
@@ -844,6 +887,13 @@
 	} 
 }
 
+/*!
+ * \brief Determines if a DTMF key entered is valid.
+ * \param key The character to be compared. expects a single character. Though is capable of handling a string, this is internally copies using ast_strdupa.
+ *
+ * Tests the character entered against the set of valid DTMF characters. 
+ * \return 1 if the character entered is a valid DTMF digit, 0 if the character is invalid.
+ */
 static int is_valid_dtmf(const char *key)
 {
 	int i;
@@ -859,6 +909,16 @@
 	return 1;
 }
 
+/*!
+ * \brief Finds a voicemail user from the realtime engine.
+ * \param ivm
+ * \param context
+ * \param mailbox
+ *
+ * This is called as a fall through case when the normal find_user() was not able to find a user. That is, the default it so look in the usual voicemail users file first.
+ *
+ * \return The ast_vm_user structure for the user that was found.
+ */
 static struct ast_vm_user *find_user_realtime(struct ast_vm_user *ivm, const char *context, const char *mailbox)
 {
 	struct ast_variable *var;
@@ -888,6 +948,14 @@
 	return retval;
 }
 
+/*!
+ * \brief Finds a voicemail user from the users file or the realtime engine.
+ * \param ivm
+ * \param context
+ * \param mailbox
+ * 
+ * \return The ast_vm_user structure for the user that was found.
+ */
 static struct ast_vm_user *find_user(struct ast_vm_user *ivm, const char *context, const char *mailbox)
 {
 	/* This function could be made to generate one from a database, too */
@@ -916,6 +984,16 @@
 	return vmu;
 }
 
+/*!
+ * \brief Resets a user password to a specified password.
+ * \param context
+ * \param mailbox
+ * \param newpass
+ *
+ * This does the actual change password work, called by the vm_change_password() function.
+ *
+ * \return zero on success, -1 on error.
+ */
 static int reset_user_pw(const char *context, const char *mailbox, const char *newpass)
 {
 	/* This function could be made to generate one from a database, too */
@@ -935,6 +1013,13 @@
 	return res;
 }
 
+/*! 
+ * \brief The handler for the change password option.
+ * \param vmu The voicemail user to work with.
+ * \param newpassword The new password (that has been gathered from the appropriate prompting).
+ * This is called when a new user logs in for the first time and the option to force them to change their password is set.
+ * It is also called when the user wants to change their password from menu option '5' on the mailbox options menu.
+ */
 static void vm_change_password(struct ast_vm_user *vmu, const char *newpassword)
 {
 	struct ast_config *cfg = NULL;
@@ -1016,6 +1101,16 @@
 	}
 }
 
+/*! 
+ * \brief Creates a file system path expression for a folder within the voicemail data folder and the appropriate context.
+ * \param dest The variable to hold the output generated path expression. This buffer should be of size PATH_MAX.
+ * \param len The length of the path string that was written out.
+ * 
+ * The path is constructed as 
+ * 	VM_SPOOL_DIRcontext/ext/folder
+ *
+ * \return zero on success, -1 on error.
+ */
 static int make_dir(char *dest, int len, const char *context, const char *ext, const char *folder)
 {
 	return snprintf(dest, len, "%s%s/%s/%s", VM_SPOOL_DIR, context, ext, folder);
@@ -1123,6 +1218,20 @@
 	return stmt;
 }
 
+/*!
+ * \brief Retrieves a file from an ODBC data store.
+ * \param dir the path to the file to be retreived.
+ * \param msgnum the message number, such as within a mailbox folder.
+ * 
+ * This method is used by the RETRIEVE macro when mailboxes are stored in an ODBC back end.
+ * The purpose is to get the message from the database store to the local file system, so that the message may be played, or the information file may be read.
+ *
+ * The file is looked up by invoking a SQL on the odbc_table (default 'voicemessages') using the dir and msgnum input parameters.
+ * The output is the message information file with the name msgnum and the extension .txt
+ * and the message file with the extension of its format, in the directory with base file name of the msgnum.
+ * 
+ * \return 0 on success, -1 on error.
+ */
 static int retrieve_file(char *dir, int msgnum)
 {
 	int x = 0;
@@ -1159,11 +1268,14 @@
 			*c = '\0';
 		if (!strcasecmp(fmt, "wav49"))
 			strcpy(fmt, "WAV");
+
 		snprintf(msgnums, sizeof(msgnums), "%d", msgnum);
 		if (msgnum > -1)
 			make_file(fn, sizeof(fn), dir, msgnum);
 		else
 			ast_copy_string(fn, dir, sizeof(fn));
+
+		/* Create the information file */
 		snprintf(full_fn, sizeof(full_fn), "%s.txt", fn);
 		
 		if (!(f = fopen(full_fn, "w+"))) {
@@ -1274,6 +1386,17 @@
 	return x - 1;
 }
 
+/*!
+ * \brief Removes a voicemail message file.
+ * \param dir the path to the message file.
+ * \param msgnum the unique number for the message within the mailbox.
+ *
+ * Removes the message content file and the information file.
+ * This method is used by the DISPOSE macro when mailboxes are stored in an ODBC back end.
+ * Typical use is to clean up after a RETRIEVE operation. 
+ * Note that this does not remove the message from the mailbox folders, to do that we would use delete_file().
+ * \return zero on success, -1 on error.
+ */
 static int remove_file(char *dir, int msgnum)
 {
 	char fn[PATH_MAX];
@@ -1294,6 +1417,16 @@
 	return 0;
 }
 
+/*!
+ * \brief Determines the highest message number in use for a given user and mailbox folder.
+ * \param vmu 
+ * \param dir the folder the mailbox folder to look for messages. Used to construct the SQL where clause.
+ *
+ * This method is used when mailboxes are stored in an ODBC back end.
+ * Typical use to set the msgnum would be to take the value returned from this method and add one to it.
+ *
+ * \return the value of zero or greaterto indicate the last message index in use, -1 to indicate none.
+ */
 static int last_message_index(struct ast_vm_user *vmu, char *dir)
 {
 	int x = 0;
@@ -1338,6 +1471,15 @@
 	return x - 1;
 }
 
+/*!
+ * \brief Determines if the specified message exists.
+ * \param dir the folder the mailbox folder to look for messages. 
+ * \param msgnum the message index to query for.
+ *
+ * This method is used when mailboxes are stored in an ODBC back end.
+ *
+ * \return greater than zero if the message exists, zero when the message does not exist or on error.
+ */
 static int message_exists(char *dir, int msgnum)
 {
 	int x = 0;
@@ -1384,11 +1526,33 @@
 	return x;
 }
 
+/*!
+ * \brief returns the one-based count for messages.
+ * \param vmu
+ * \param dir the folder the mailbox folder to look for messages. Used to construct the SQL where clause.
+ *
+ * This method is used when mailboxes are stored in an ODBC back end.
+ * The message index is zero-based, the first message will be index 0. For convenient display it is good to have the
+ * one-based messages.
+ * This method just calls last_message_index and returns +1 of its value.
+ *
+ * \return the value greater than zero on success to indicate the one-based count of messages, less than zero on error.
+ */
 static int count_messages(struct ast_vm_user *vmu, char *dir)
 {
 	return last_message_index(vmu, dir) + 1;
 }
 
+/*!
+ * \brief Deletes a message from the mailbox folder.
+ * \param sdir The mailbox folder to work in.
+ * \param smsg The message index to be deleted.
+ *
+ * This method is used when mailboxes are stored in an ODBC back end.
+ * The specified message is directly deleted from the database 'voicemessages' table.
+ * 
+ * \return the value greater than zero on success to indicate the number of messages, less than zero on error.
+ */
 static void delete_file(char *sdir, int smsg)
 {
 	SQLHSTMT stmt;
@@ -1413,6 +1577,17 @@
 	return;	
 }
 
+/*!
+ * \brief Copies a voicemail from one mailbox to another.
+ * \param sdir the folder for which to look for the message to be copied.
+ * \param smsg the index of the message to be copied.
+ * \param ddir the destination folder to copy the message into.
+ * \param dmsg the index to be used for the copied message.
+ * \param dmailboxuser The user who owns the mailbox tha contains the destination folder.
+ * \param dmailboxcontext The context for the destination user.
+ *
+ * This method is used for the COPY macro when mailboxes are stored in an ODBC back end.
+ */
 static void copy_file(char *sdir, int smsg, char *ddir, int dmsg, char *dmailboxuser, char *dmailboxcontext)
 {
 	SQLHSTMT stmt;
@@ -1440,6 +1615,19 @@
 	return;	
 }
 
+/*!
+ * \brief Stores a voicemail into the database.
+ * \param dir the folder the mailbox folder to store the message.
+ * \param mailboxuser the user owning the mailbox folder.
+ * \param mailboxcontext
+ * \param msgnum the message index for the message to be stored.
+ *
+ * This method is used when mailboxes are stored in an ODBC back end.
+ * The message sound file and information file is looked up on the file system. 
+ * A SQL query is invoked to store the message into the (MySQL) database.
+ *
+ * \return the zero on success -1 on error.
+ */
 static int store_file(char *dir, char *mailboxuser, char *mailboxcontext, int msgnum)
 {
 	int x = 0;
@@ -1455,7 +1643,11 @@
 	char full_fn[PATH_MAX];
 	char fmt[80] = "";
 	char *c;
-	const char *context = "", *macrocontext = "", *callerid = "", *origtime = "", *duration = "";
+	const char *context = "";
+	const char *macrocontext = "";
+	const char *callerid = "";
+	const char *origtime = ""; 
+	const char *duration = "";
 	const char *category = "";
 	struct ast_config *cfg = NULL;
 	struct odbc_obj *obj;
@@ -1558,6 +1750,19 @@
 	return x;
 }
 
+/*!
+ * \brief Renames a message in a mailbox folder.
+ * \param sdir The folder of the message to be renamed.
+ * \param smsg The index of the message to be renamed.
+ * \param mailboxuser The user to become the owner of the message after it is renamed. Usually this will be the same as the original owner.
+ * \param mailboxcontext The context to be set for the message. Usually this will be the same as the original context.
+ * \param ddir The destination folder for the message to be renamed into
+ * \param dmsg The destination message for the message to be renamed.
+ *
+ * This method is used by the RENAME macro when mailboxes are stored in an ODBC back end.
+ * The is usually used to resequence the messages in the mailbox, such as to delete messag index 0, it would be called successively to slide all the other messages down one index.
+ * But in theory, because the SQL query performs an update on (dir, msgnum, mailboxuser, mailboxcontext) in the database, it should be possible to have the message relocated to another mailbox or context as well.
+ */
 static void rename_file(char *sdir, int smsg, char *mailboxuser, char *mailboxcontext, char *ddir, int dmsg)
 {
 	SQLHSTMT stmt;
@@ -1587,9 +1792,17 @@
 
 #else
 #ifndef IMAP_STORAGE
+/*!
+ * \brief Find all .txt files - even if they are not in sequence from 0000.
+ * \param vmu
+ * \param dir
+ *
+ * This method is used when mailboxes are stored on the filesystem. (not ODBC and not IMAP).
+ *
+ * \return the count of messages, zero or more.
+ */
 static int count_messages(struct ast_vm_user *vmu, char *dir)
 {
-	/* Find all .txt files - even if they are not in sequence from 0000 */
 
 	int vmcount = 0;
 	DIR *vmdir = NULL;
@@ -1610,6 +1823,13 @@
 	return vmcount;
 }
 
+/*!
+ * \brief Renames a message in a mailbox folder.
+ * \param sfn The path to the mailbox information and data file to be renamed.
+ * \param dfn The path for where the message data and information files will be renamed to.
+ *
+ * This method is used by the RENAME macro when mailboxes are stored on the filesystem. (not ODBC and not IMAP).
+ */
 static void rename_file(char *sfn, char *dfn)
 {
 	char stxt[PATH_MAX];
@@ -1625,9 +1845,16 @@
 #endif
 
 #ifndef IMAP_STORAGE
-/*! \brief
- * A negative return value indicates an error.
+/*! 
+ * \brief Determines the highest message number in use for a given user and mailbox folder.
+ * \param vmu 
+ * \param dir the folder the mailbox folder to look for messages. Used to construct the SQL where clause.
+ *
+ * This method is used when mailboxes are stored on the filesystem. (not ODBC and not IMAP).
+ * Typical use to set the msgnum would be to take the value returned from this method and add one to it.
+ *
  * \note Should always be called with a lock already set on dir.
+ * \return the value of zero or greaterto indicate the last message index in use, -1 to indicate none.
  */
 static int last_message_index(struct ast_vm_user *vmu, char *dir)
 {
@@ -1659,6 +1886,16 @@
 #endif /* #ifndef IMAP_STORAGE */
 #endif /* #else of #ifdef ODBC_STORAGE */
 
+/*!
+ * \brief Utility function to copy a file.
+ * \param infile The path to the file to be copied. The file must be readable, it is opened in read only mode.
+ * \param outfile The path for which to copy the file to. The directory permissions must allow the creation (or truncation) of the file, and allow for opening the file in write only mode.
+ *
+ * When the compiler option HARDLINK_WHEN_POSSIBLE is set, the copy operation will attempt to use the hard link facility instead of copy the file (to save disk space). If the link operation fails, it falls back to the copy operation.
+ * The copy operation copies up to 4096 bytes at once.
+ *
+ * \return zero on success, -1 on error.
+ */
 static int copy(char *infile, char *outfile)
 {
 	int ifd;
@@ -1709,6 +1946,15 @@
 #endif
 }
 
+/*!
+ * \brief Copies a voicemail information (envelope) file.
+ * \param frompath
+ * \param topath 
+ *
+ * Every voicemail has the data (.wav) file, and the information file.
+ * This function performs the file system copying of the information file for a voicemail, handling the internal fields and their values.
+ * This is used by the COPY macro when not using IMAP storage.
+ */
 static void copy_plain_file(char *frompath, char *topath)
 {
 	char frompath2[PATH_MAX], topath2[PATH_MAX];
@@ -1751,6 +1997,14 @@
 	ast_variables_destroy(var);
 }
 
+/*! 
+ * \brief Removes the voicemail sound and information file.
+ * \param file The path to the sound file. This will be the the folder and message index, without the extension.
+ *
+ * This is used by the DELETE macro when voicemails are stored on the file system.
+ *
+ * \return zero on success, -1 on error.
+ */
 static int vm_delete(char *file)
 {
 	char *txt;
@@ -1769,6 +2023,9 @@
 	return ast_filedelete(file, NULL);
 }
 
+/*!
+ * \brief utility used by inchar(), for base_encode()
+ */
 static int inbuf(struct baseio *bio, FILE *fi)
 {
 	int l;
@@ -1790,6 +2047,9 @@
 	return 1;
 }
 
+/*!
+ * \brief utility used by base_encode()
+ */
 static int inchar(struct baseio *bio, FILE *fi)
 {
 	if (bio->iocp >= bio->iolen) {
@@ -1800,6 +2060,9 @@
 	return bio->iobuf[bio->iocp++];
 }
 
+/*!
+ * \brief utility used by base_encode()
+ */
 static int ochar(struct baseio *bio, int c, FILE *so)
 {
 	if (bio->linelength >= BASELINELEN) {

[... 9573 lines stripped ...]



More information about the asterisk-commits mailing list