[asterisk-commits] rmudgett: branch dvossel/generic_aoc r258764 - in /team/dvossel/generic_aoc: ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Apr 22 19:21:19 CDT 2010


Author: rmudgett
Date: Thu Apr 22 19:21:08 2010
New Revision: 258764

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=258764
Log:
Merged revisions 258489,258540,258580,258618,258655,258732,258760 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/team/rmudgett/aoc_event

................
  r258489 | root | 2010-04-21 17:28:55 -0500 (Wed, 21 Apr 2010) | 29 lines
  
  Merged revisions 258439 via svnmerge from 
  file:///srv/subversion/repos/asterisk/team/group/CCSS
  
  ................
    r258439 | root | 2010-04-21 17:17:46 -0500 (Wed, 21 Apr 2010) | 22 lines
    
    Merged revisions 258433 via svnmerge from 
    file:///srv/subversion/repos/asterisk/trunk
    
    ................
      r258433 | jpeeler | 2010-04-21 16:56:09 -0500 (Wed, 21 Apr 2010) | 15 lines
      
      Merged revisions 258432 via svnmerge from 
      https://origsvn.digium.com/svn/asterisk/branches/1.4
      
      ........
        r258432 | jpeeler | 2010-04-21 16:45:36 -0500 (Wed, 21 Apr 2010) | 8 lines
        
        Fix looping forever when no input received in certain voicemail menu scenarios.
        
        Specifically, prompting for an extension (when leaving or forwarding a message)
        or when prompting for a digit (when saving a message or changing folders).
        
        ABE-2122
        SWP-1268
      ........
    ................
  ................
................
  r258540 | root | 2010-04-22 13:26:22 -0500 (Thu, 22 Apr 2010) | 31 lines
  
  Merged revisions 258519 via svnmerge from 
  file:///srv/subversion/repos/asterisk/team/group/CCSS
  
  ................
    r258519 | root | 2010-04-22 13:19:09 -0500 (Thu, 22 Apr 2010) | 24 lines
    
    Merged revisions 258515,258517 via svnmerge from 
    file:///srv/subversion/repos/asterisk/trunk
    
    ........
      r258515 | russell | 2010-04-22 12:36:34 -0500 (Thu, 22 Apr 2010) | 2 lines
      
      Add MEETMEBOOKID from r256019.
    ........
      r258517 | eliel | 2010-04-22 13:07:02 -0500 (Thu, 22 Apr 2010) | 14 lines
      
      Asterisk data retrieval API.
      
      This module implements an abstraction for retrieving and exporting
      asterisk data.
      Developed by:
      	Brett Bryant <brettbryant at gmail.com>
      	Eliel C. Sardanons (LU1ALY) <eliels at gmail.com>
      For the Google Summer of code 2009 Project.
      Documentation can be found in doxygen format and inside the
      header include/asterisk/data.h
      
      Review: https://reviewboard.asterisk.org/r/275/
    ........
  ................
................
  r258580 | root | 2010-04-22 14:23:24 -0500 (Thu, 22 Apr 2010) | 22 lines
  
  Merged revisions 258559 via svnmerge from 
  file:///srv/subversion/repos/asterisk/team/group/CCSS
  
  ................
    r258559 | root | 2010-04-22 14:17:48 -0500 (Thu, 22 Apr 2010) | 15 lines
    
    Merged revisions 258557 via svnmerge from 
    file:///srv/subversion/repos/asterisk/trunk
    
    ........
      r258557 | qwell | 2010-04-22 14:08:01 -0500 (Thu, 22 Apr 2010) | 8 lines
      
      Remove ABI differences that occured when compiling with DEBUG_THREADS.
      
      "Bad Things" would happen if Asterisk was compiled with DEBUG_THREADS, but a
      loaded module was not (or vice versa).  This also immensely simplifies the
      lock code, since there are no longer 2 separate versions of them.
      
      Review: https://reviewboard.asterisk.org/r/508/
    ........
  ................
................
  r258618 | root | 2010-04-22 15:23:13 -0500 (Thu, 22 Apr 2010) | 16 lines
  
  Merged revisions 258597 via svnmerge from 
  file:///srv/subversion/repos/asterisk/team/group/CCSS
  
  ................
    r258597 | root | 2010-04-22 15:17:45 -0500 (Thu, 22 Apr 2010) | 9 lines
    
    Merged revisions 258595 via svnmerge from 
    file:///srv/subversion/repos/asterisk/trunk
    
    ........
      r258595 | eliel | 2010-04-22 15:04:23 -0500 (Thu, 22 Apr 2010) | 3 lines
      
      Pass interactive = 0 and fix a compile error.
    ........
  ................
................
  r258655 | root | 2010-04-22 16:23:23 -0500 (Thu, 22 Apr 2010) | 36 lines
  
  Merged revisions 258634 via svnmerge from 
  file:///srv/subversion/repos/asterisk/team/group/CCSS
  
  ................
    r258634 | root | 2010-04-22 16:17:47 -0500 (Thu, 22 Apr 2010) | 29 lines
    
    Merged revisions 258632 via svnmerge from 
    file:///srv/subversion/repos/asterisk/trunk
    
    ........
      r258632 | russell | 2010-04-22 16:06:53 -0500 (Thu, 22 Apr 2010) | 22 lines
      
      Add ast_event subscription unit test and fix some ast_event API bugs.
      
      This patch introduces another test in test_event.c that exercises most of the
      subscription related ast_event API calls.  I made some minor additions to the
      existing event allocation test to increase API coverage by the test code.
      Finally, I made a list in a comment of API calls not yet touched by the test
      module as a to-do list for future test development.
      
      During the development of this test code, I discovered a number of bugs in
      the event API.
      
      1) subscriptions to AST_EVENT_ALL were not handled appropriately in a couple
         of different places.  The API allows a subscription to all event types,
         but with IE parameters, just as if it was a subscription to a specific
         event type.  However, the parameters were being ignored.  This affected
         ast_event_check_subscriber() and event distribution to subscribers.
      
      2) Some of the logic in ast_event_check_subscriber() for checking subscriptions
         against query parameters was wrong.
      
      Review: https://reviewboard.asterisk.org/r/617/
    ........
  ................
................
  r258732 | root | 2010-04-22 17:30:40 -0500 (Thu, 22 Apr 2010) | 57 lines
  
  Merged revisions 258679 via svnmerge from 
  file:///srv/subversion/repos/asterisk/team/group/CCSS
  
  ................
    r258679 | root | 2010-04-22 17:18:08 -0500 (Thu, 22 Apr 2010) | 50 lines
    
    Merged revisions 258671,258673-258675 via svnmerge from 
    file:///srv/subversion/repos/asterisk/trunk
    
    ................
      r258671 | mnicholson | 2010-04-22 16:57:59 -0500 (Thu, 22 Apr 2010) | 32 lines
      
      Merged revisions 193391,258670 via svnmerge from 
      https://origsvn.digium.com/svn/asterisk/branches/1.4
      
      ........
        r193391 | mnicholson | 2009-05-08 16:01:25 -0500 (Fri, 08 May 2009) | 8 lines
        
        Set the proper disposition on originated calls.
        
        (closes issue #14167)
        Reported by: jpt
        Patches:
              call-file-missing-cdr2.diff uploaded by mnicholson (license 96)
        Tested by: dlotina, rmartinez, mnicholson
      ........
        r258670 | mnicholson | 2010-04-22 16:49:07 -0500 (Thu, 22 Apr 2010) | 11 lines
        
        Fix broken CDR behavior.
        
        This change allows a CDR record previously marked with disposition ANSWERED to be set as BUSY or NO ANSWER.
        
        Additionally this change partially reverts r235635 and does not set the AST_CDR_FLAG_ORIGINATED flag on CDRs generated from ast_call().  To preserve proper CDR behavior, the AST_CDR_FLAG_DIALED flag is now cleared from all brige CDRs in ast_bridge_call().
        
        (closes issue #16797)
        Reported by: VarnishedOtter
        Tested by: mnicholson
      ........
      
      (closes issue #16222)
      Reported by: telles
      Tested by: mnicholson
    ................
      r258673 | qwell | 2010-04-22 17:02:22 -0500 (Thu, 22 Apr 2010) | 1 line
      
      Let utils/ dir compile when DEBUG_THREADS is not enabled.
    ................
      r258674 | qwell | 2010-04-22 17:10:17 -0500 (Thu, 22 Apr 2010) | 1 line
      
      Make utils/ stuff *actually* compile this time.
    ................
      r258675 | mnicholson | 2010-04-22 17:11:23 -0500 (Thu, 22 Apr 2010) | 2 lines
      
      Fix previous commit.
    ................
  ................
................
  r258760 | root | 2010-04-22 18:19:35 -0500 (Thu, 22 Apr 2010) | 16 lines
  
  Merged revisions 258755 via svnmerge from 
  file:///srv/subversion/repos/asterisk/team/group/CCSS
  
  ................
    r258755 | root | 2010-04-22 18:17:47 -0500 (Thu, 22 Apr 2010) | 9 lines
    
    Merged revisions 258685 via svnmerge from 
    file:///srv/subversion/repos/asterisk/trunk
    
    ........
      r258685 | qwell | 2010-04-22 17:19:34 -0500 (Thu, 22 Apr 2010) | 1 line
      
      Add another random function that does nothing to make the utils/ dir happy.
    ........
  ................
................

Added:
    team/dvossel/generic_aoc/include/asterisk/data.h
      - copied unchanged from r258760, team/rmudgett/aoc_event/include/asterisk/data.h
    team/dvossel/generic_aoc/main/data.c
      - copied unchanged from r258760, team/rmudgett/aoc_event/main/data.c
    team/dvossel/generic_aoc/main/lock.c
      - copied unchanged from r258760, team/rmudgett/aoc_event/main/lock.c
Modified:
    team/dvossel/generic_aoc/   (props changed)
    team/dvossel/generic_aoc/CHANGES
    team/dvossel/generic_aoc/apps/app_queue.c
    team/dvossel/generic_aoc/apps/app_voicemail.c
    team/dvossel/generic_aoc/doc/manager_1_1.txt
    team/dvossel/generic_aoc/doc/tex/channelvariables.tex
    team/dvossel/generic_aoc/include/asterisk/_private.h
    team/dvossel/generic_aoc/include/asterisk/astobj2.h
    team/dvossel/generic_aoc/include/asterisk/channel.h
    team/dvossel/generic_aoc/include/asterisk/doxyref.h
    team/dvossel/generic_aoc/include/asterisk/heap.h
    team/dvossel/generic_aoc/include/asterisk/lock.h
    team/dvossel/generic_aoc/include/asterisk/res_odbc.h
    team/dvossel/generic_aoc/include/asterisk/xml.h
    team/dvossel/generic_aoc/main/asterisk.c
    team/dvossel/generic_aoc/main/astobj2.c
    team/dvossel/generic_aoc/main/cdr.c
    team/dvossel/generic_aoc/main/channel.c
    team/dvossel/generic_aoc/main/event.c
    team/dvossel/generic_aoc/main/features.c
    team/dvossel/generic_aoc/main/heap.c
    team/dvossel/generic_aoc/main/xml.c
    team/dvossel/generic_aoc/res/res_odbc.c
    team/dvossel/generic_aoc/tests/test_event.c
    team/dvossel/generic_aoc/utils/Makefile
    team/dvossel/generic_aoc/utils/extconf.c

Propchange: team/dvossel/generic_aoc/
------------------------------------------------------------------------------
--- aoc_event-integrated (original)
+++ aoc_event-integrated Thu Apr 22 19:21:08 2010
@@ -1,1 +1,1 @@
-/team/group/CCSS:1-258415
+/team/group/CCSS:1-258759

Propchange: team/dvossel/generic_aoc/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/dvossel/generic_aoc/
------------------------------------------------------------------------------
--- generic_aoc-integrated (original)
+++ generic_aoc-integrated Thu Apr 22 19:21:08 2010
@@ -1,1 +1,1 @@
-/team/rmudgett/aoc_event:1-258424
+/team/rmudgett/aoc_event:1-258763

Modified: team/dvossel/generic_aoc/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/generic_aoc/CHANGES?view=diff&rev=258764&r1=258763&r2=258764
==============================================================================
--- team/dvossel/generic_aoc/CHANGES (original)
+++ team/dvossel/generic_aoc/CHANGES Thu Apr 22 19:21:08 2010
@@ -785,6 +785,10 @@
 
 CLI Changes
 -----------
+  * New CLI command, "data get <path> [<search> [<filter>]]" which retrieves the
+     data tree based on the given <path>.
+  * New CLI command "data show providers" that will display all the registered
+     callbacks.
   * 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.

Modified: team/dvossel/generic_aoc/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/generic_aoc/apps/app_queue.c?view=diff&rev=258764&r1=258763&r2=258764
==============================================================================
--- team/dvossel/generic_aoc/apps/app_queue.c (original)
+++ team/dvossel/generic_aoc/apps/app_queue.c Thu Apr 22 19:21:08 2010
@@ -97,6 +97,7 @@
 #include "asterisk/aoc.h"
 #include "asterisk/callerid.h"
 #include "asterisk/cel.h"
+#include "asterisk/data.h"
 
 /* Define, to debug reference counts on queues, without debugging reference counts on queue members */
 /* #define REF_DEBUG_ONLY_QUEUES */
@@ -7646,6 +7647,281 @@
 	AST_CLI_DEFINE(handle_queue_reset, "Reset statistics for a queue"),
 };
 
+/* struct call_queue astdata mapping. */
+#define DATA_EXPORT_CALL_QUEUE(MEMBER)					\
+	MEMBER(call_queue, name, AST_DATA_STRING)			\
+	MEMBER(call_queue, moh, AST_DATA_STRING)			\
+	MEMBER(call_queue, announce, AST_DATA_STRING)			\
+	MEMBER(call_queue, context, AST_DATA_STRING)			\
+	MEMBER(call_queue, membermacro, AST_DATA_STRING)		\
+	MEMBER(call_queue, membergosub, AST_DATA_STRING)		\
+	MEMBER(call_queue, defaultrule, AST_DATA_STRING)		\
+	MEMBER(call_queue, sound_next, AST_DATA_STRING)			\
+	MEMBER(call_queue, sound_thereare, AST_DATA_STRING)		\
+	MEMBER(call_queue, sound_calls, AST_DATA_STRING)		\
+	MEMBER(call_queue, queue_quantity1, AST_DATA_STRING)		\
+	MEMBER(call_queue, queue_quantity2, AST_DATA_STRING)		\
+	MEMBER(call_queue, sound_holdtime, AST_DATA_STRING)		\
+	MEMBER(call_queue, sound_minutes, AST_DATA_STRING)		\
+	MEMBER(call_queue, sound_minute, AST_DATA_STRING)		\
+	MEMBER(call_queue, sound_seconds, AST_DATA_STRING)		\
+	MEMBER(call_queue, sound_thanks, AST_DATA_STRING)		\
+	MEMBER(call_queue, sound_callerannounce, AST_DATA_STRING)	\
+	MEMBER(call_queue, sound_reporthold, AST_DATA_STRING)		\
+	MEMBER(call_queue, dead, AST_DATA_BOOLEAN)			\
+	MEMBER(call_queue, eventwhencalled, AST_DATA_BOOLEAN)		\
+	MEMBER(call_queue, ringinuse, AST_DATA_INTEGER)			\
+	MEMBER(call_queue, setinterfacevar, AST_DATA_BOOLEAN)		\
+	MEMBER(call_queue, setqueuevar, AST_DATA_BOOLEAN)		\
+	MEMBER(call_queue, setqueueentryvar, AST_DATA_BOOLEAN)		\
+	MEMBER(call_queue, reportholdtime, AST_DATA_BOOLEAN)		\
+	MEMBER(call_queue, wrapped, AST_DATA_BOOLEAN)			\
+	MEMBER(call_queue, timeoutrestart, AST_DATA_BOOLEAN)		\
+	MEMBER(call_queue, announceholdtime, AST_DATA_INTEGER)		\
+	MEMBER(call_queue, announceposition, AST_DATA_INTEGER)		\
+	MEMBER(call_queue, strategy, AST_DATA_INTEGER)			\
+	MEMBER(call_queue, maskmemberstatus, AST_DATA_BOOLEAN)		\
+	MEMBER(call_queue, realtime, AST_DATA_BOOLEAN)			\
+	MEMBER(call_queue, found, AST_DATA_BOOLEAN)			\
+	MEMBER(call_queue, announcepositionlimit, AST_DATA_INTEGER)	\
+	MEMBER(call_queue, announcefrequency, AST_DATA_INTEGER)		\
+	MEMBER(call_queue, minannouncefrequency, AST_DATA_INTEGER)	\
+	MEMBER(call_queue, periodicannouncefrequency, AST_DATA_INTEGER)	\
+	MEMBER(call_queue, numperiodicannounce, AST_DATA_INTEGER)	\
+	MEMBER(call_queue, randomperiodicannounce, AST_DATA_INTEGER)	\
+	MEMBER(call_queue, roundingseconds, AST_DATA_INTEGER)		\
+	MEMBER(call_queue, holdtime, AST_DATA_INTEGER)			\
+	MEMBER(call_queue, talktime, AST_DATA_INTEGER)			\
+	MEMBER(call_queue, callscompleted, AST_DATA_INTEGER)		\
+	MEMBER(call_queue, callsabandoned, AST_DATA_INTEGER)		\
+	MEMBER(call_queue, servicelevel, AST_DATA_INTEGER)		\
+	MEMBER(call_queue, callscompletedinsl, AST_DATA_INTEGER)	\
+	MEMBER(call_queue, monfmt, AST_DATA_STRING)			\
+	MEMBER(call_queue, montype, AST_DATA_INTEGER)			\
+	MEMBER(call_queue, count, AST_DATA_INTEGER)			\
+	MEMBER(call_queue, maxlen, AST_DATA_INTEGER)			\
+	MEMBER(call_queue, wrapuptime, AST_DATA_INTEGER)		\
+	MEMBER(call_queue, retry, AST_DATA_INTEGER)			\
+	MEMBER(call_queue, timeout, AST_DATA_INTEGER)			\
+	MEMBER(call_queue, weight, AST_DATA_INTEGER)			\
+	MEMBER(call_queue, autopause, AST_DATA_INTEGER)			\
+	MEMBER(call_queue, timeoutpriority, AST_DATA_INTEGER)		\
+	MEMBER(call_queue, rrpos, AST_DATA_INTEGER)			\
+	MEMBER(call_queue, memberdelay, AST_DATA_INTEGER)		\
+	MEMBER(call_queue, autofill, AST_DATA_INTEGER)			\
+	MEMBER(call_queue, members, AST_DATA_CONTAINER)			\
+	MEMBER(call_queue, membercount, AST_DATA_INTEGER)
+
+AST_DATA_STRUCTURE(call_queue, DATA_EXPORT_CALL_QUEUE);
+
+/* struct member astdata mapping. */
+#define DATA_EXPORT_MEMBER(MEMBER)					\
+	MEMBER(member, interface, AST_DATA_STRING)			\
+	MEMBER(member, state_interface, AST_DATA_STRING)		\
+	MEMBER(member, membername, AST_DATA_STRING)			\
+	MEMBER(member, penalty, AST_DATA_INTEGER)			\
+	MEMBER(member, calls, AST_DATA_INTEGER)				\
+	MEMBER(member, dynamic, AST_DATA_INTEGER)			\
+	MEMBER(member, realtime, AST_DATA_INTEGER)			\
+	MEMBER(member, status, AST_DATA_INTEGER)			\
+	MEMBER(member, paused, AST_DATA_BOOLEAN)			\
+	MEMBER(member, rt_uniqueid, AST_DATA_STRING)
+
+AST_DATA_STRUCTURE(member, DATA_EXPORT_MEMBER);
+
+#define DATA_EXPORT_QUEUE_ENT(MEMBER)						\
+	MEMBER(queue_ent, moh, AST_DATA_STRING)					\
+	MEMBER(queue_ent, announce, AST_DATA_STRING)				\
+	MEMBER(queue_ent, context, AST_DATA_STRING)				\
+	MEMBER(queue_ent, digits, AST_DATA_STRING)				\
+	MEMBER(queue_ent, valid_digits, AST_DATA_INTEGER)			\
+	MEMBER(queue_ent, pos, AST_DATA_INTEGER)				\
+	MEMBER(queue_ent, prio, AST_DATA_INTEGER)				\
+	MEMBER(queue_ent, last_pos_said, AST_DATA_INTEGER)			\
+	MEMBER(queue_ent, last_periodic_announce_time, AST_DATA_INTEGER)	\
+	MEMBER(queue_ent, last_periodic_announce_sound, AST_DATA_INTEGER)	\
+	MEMBER(queue_ent, last_pos, AST_DATA_INTEGER)				\
+	MEMBER(queue_ent, opos, AST_DATA_INTEGER)				\
+	MEMBER(queue_ent, handled, AST_DATA_INTEGER)				\
+	MEMBER(queue_ent, pending, AST_DATA_INTEGER)				\
+	MEMBER(queue_ent, max_penalty, AST_DATA_INTEGER)			\
+	MEMBER(queue_ent, min_penalty, AST_DATA_INTEGER)			\
+	MEMBER(queue_ent, linpos, AST_DATA_INTEGER)				\
+	MEMBER(queue_ent, linwrapped, AST_DATA_INTEGER)				\
+	MEMBER(queue_ent, start, AST_DATA_INTEGER)				\
+	MEMBER(queue_ent, expire, AST_DATA_INTEGER)				\
+	MEMBER(queue_ent, cancel_answered_elsewhere, AST_DATA_INTEGER)
+
+AST_DATA_STRUCTURE(queue_ent, DATA_EXPORT_QUEUE_ENT);
+
+/*!
+ * \internal
+ * \brief Add a queue to the data_root node.
+ * \param[in] search The search tree.
+ * \param[in] data_root The main result node.
+ * \param[in] queue The queue to add.
+ */
+static void queues_data_provider_get_helper(const struct ast_data_search *search,
+	struct ast_data *data_root, struct call_queue *queue)
+{
+	int member_notmatch, caller_notmatch, caller_channel_notmatch;
+	struct ao2_iterator im;
+	struct member *member;
+	struct queue_ent *qe;
+	struct ast_data *data_queue, *data_members = NULL;
+	struct ast_data *data_member, *data_callers = NULL, *data_caller, *data_caller_channel;
+
+	/* compare the search pattern. */
+	if (ast_data_search_cmp_structure(search, call_queue, queue, "queue")) {
+		/* this doesn't match! continue! */
+		return;
+	}
+
+	data_queue = ast_data_add_node(data_root, "queue");
+	if (!data_queue) {
+		return;
+	}
+
+	ast_data_add_structure(call_queue, data_queue, queue);
+
+	member_notmatch = ast_data_search_has_condition(search, "queue/members/member");
+	/* add queue members */
+	im = ao2_iterator_init(queue->members, 0);
+	while ((member = ao2_iterator_next(&im))) {
+		/* compare the member structure. */
+		if (!ast_data_search_cmp_structure(search, member, member,
+					"queue/members/member")) {
+			member_notmatch = 0;
+		}
+
+		if (!data_members) {
+			data_members = ast_data_add_node(data_queue, "members");
+			if (!data_members) {
+				ao2_ref(member, -1);
+				continue;
+			}
+		}
+
+		data_member = ast_data_add_node(data_members, "member");
+		if (!data_member) {
+			ao2_ref(member, -1);
+			continue;
+		}
+
+		ast_data_add_structure(member, data_member, member);
+
+		ao2_ref(member, -1);
+	}
+
+	if (member_notmatch) {
+		ast_data_remove_node(data_root, data_queue);
+		return;
+	}
+
+	caller_notmatch = ast_data_search_has_condition(search, "queue/callers/caller");
+	caller_channel_notmatch = ast_data_search_has_condition(search,
+		"queue/callers/caller/channel");
+	/* include the callers inside the result. */
+	if (queue->head) {
+		for (qe = queue->head; qe; qe = qe->next) {
+			/* compare the member structure. */
+			if (!ast_data_search_cmp_structure(search, queue_ent, qe,
+						"queue/callers/caller")) {
+				caller_notmatch = 0;
+			}
+
+			if (!ast_channel_data_cmp_structure(search, qe->chan,
+				"queue/callers/caller/channel")) {
+				caller_channel_notmatch = 0;
+			}
+
+			if (!data_callers) {
+				data_callers = ast_data_add_node(data_queue, "callers");
+				if (!data_callers) {
+					continue;
+				}
+			}
+
+			data_caller = ast_data_add_node(data_callers, "caller");
+			if (!data_caller) {
+				continue;
+			}
+
+			ast_data_add_structure(queue_ent, data_caller, qe);
+
+			/* add the caller channel. */
+			data_caller_channel = ast_data_add_node(data_caller, "channel");
+			if (!data_caller_channel) {
+				continue;
+			}
+
+			ast_channel_data_add_structure(data_caller_channel, qe->chan);
+		}
+	}
+
+	/* if this queue doesn't match remove the added queue. */
+	if (caller_notmatch || caller_channel_notmatch) {
+		ast_data_remove_node(data_root, data_queue);
+	}
+}
+
+/*!
+ * \internal
+ * \brief Callback used to generate the queues tree.
+ * \param[in] search The search pattern tree.
+ * \retval NULL on error.
+ * \retval non-NULL The generated tree.
+ */
+static int queues_data_provider_get(const struct ast_data_search *search,
+	struct ast_data *data_root)
+{
+	struct ao2_iterator i;
+	struct call_queue *queue, *queue_realtime = NULL;
+	struct ast_config *cfg;
+	char *queuename;
+
+	/* load realtime queues. */
+	cfg = ast_load_realtime_multientry("queues", "name LIKE", "%", SENTINEL);
+	if (cfg) {
+		for (queuename = ast_category_browse(cfg, NULL);
+				!ast_strlen_zero(queuename);
+				queuename = ast_category_browse(cfg, queuename)) {
+			if ((queue = load_realtime_queue(queuename))) {
+				queue_unref(queue);
+			}
+		}
+		ast_config_destroy(cfg);
+	}
+
+	/* static queues. */
+	i = ao2_iterator_init(queues, 0);
+	while ((queue = ao2_iterator_next(&i))) {
+		ao2_lock(queue);
+		if (queue->realtime && !(queue_realtime = load_realtime_queue(queue->name))) {
+			ao2_unlock(queue);
+			queue_unref(queue);
+			continue;
+		} else if (queue->realtime) {
+			queue_unref(queue_realtime);
+		}
+
+		queues_data_provider_get_helper(search, data_root, queue);
+		ao2_unlock(queue);
+		queue_unref(queue);
+	}
+
+	return 0;
+}
+
+static const struct ast_data_handler queues_data_provider = {
+	.version = AST_DATA_HANDLER_VERSION,
+	.get = queues_data_provider_get
+};
+
+static const struct ast_data_entry queue_data_providers[] = {
+	AST_DATA_ENTRY("asterisk/application/app_queue/queues", &queues_data_provider),
+};
+
 static int unload_module(void)
 {
 	int res;
@@ -7676,6 +7952,8 @@
 	res |= ast_custom_function_unregister(&queuewaitingcount_function);
 	res |= ast_custom_function_unregister(&queuememberpenalty_function);
 
+	res |= ast_data_unregister(NULL);
+
 	if (device_state_sub)
 		ast_event_unsubscribe(device_state_sub);
 
@@ -7719,6 +7997,8 @@
 
 	if (queue_persistent_members)
 		reload_queue_members();
+
+	ast_data_register_multiple(queue_data_providers, ARRAY_LEN(queue_data_providers));
 
 	ast_cli_register_multiple(cli_queue, ARRAY_LEN(cli_queue));
 	res = ast_register_application_xml(app, queue_exec);

Modified: team/dvossel/generic_aoc/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/generic_aoc/apps/app_voicemail.c?view=diff&rev=258764&r1=258763&r2=258764
==============================================================================
--- team/dvossel/generic_aoc/apps/app_voicemail.c (original)
+++ team/dvossel/generic_aoc/apps/app_voicemail.c Thu Apr 22 19:21:08 2010
@@ -6501,10 +6501,16 @@
 static int get_folder2(struct ast_channel *chan, char *fn, int start)
 {
 	int res = 0;
+	int loops = 0;
 	res = ast_play_and_wait(chan, fn);	/* Folder name */
 	while (((res < '0') || (res > '9')) &&
-			(res != '#') && (res >= 0)) {
+			(res != '#') && (res >= 0) &&
+			loops < 4) {
 		res = get_folder(chan, 0);
+		loops++;
+	}
+	if (loops == 4) { /* give up */
+		return '#';
 	}
 	return res;
 }
@@ -6819,6 +6825,7 @@
 	int curmsg;
 	char urgent_str[7] = "";
 	char tmptxtfile[PATH_MAX];
+	int prompt_played = 0;
 #ifndef IMAP_STORAGE
 	char msgfile[PATH_MAX], textfile[PATH_MAX], backup[PATH_MAX], backup_textfile[PATH_MAX];
 #endif
@@ -6904,7 +6911,8 @@
 		} else {
 			/* Ask for an extension */
 			res = ast_streamfile(chan, "vm-extension", chan->language);	/* "extension" */
-			if (res)
+			prompt_played++;
+			if (res || prompt_played > 4)
 				break;
 			if ((res = ast_readstring(chan, username, sizeof(username) - 1, 2000, 10000, "#") < 0))
 				break;
@@ -10731,6 +10739,206 @@
 	AST_CLI_DEFINE(handle_voicemail_reload, "Reload voicemail configuration"),
 };
 
+#ifdef IMAP_STORAGE
+	#define DATA_EXPORT_VM_USERS(USER)					\
+		USER(ast_vm_user, context, AST_DATA_STRING)			\
+		USER(ast_vm_user, mailbox, AST_DATA_STRING)			\
+		USER(ast_vm_user, password, AST_DATA_STRING)			\
+		USER(ast_vm_user, fullname, AST_DATA_STRING)			\
+		USER(ast_vm_user, email, AST_DATA_STRING)			\
+		USER(ast_vm_user, emailsubject, AST_DATA_STRING)		\
+		USER(ast_vm_user, emailbody, AST_DATA_STRING)			\
+		USER(ast_vm_user, pager, AST_DATA_STRING)			\
+		USER(ast_vm_user, serveremail, AST_DATA_STRING)			\
+		USER(ast_vm_user, mailcmd, AST_DATA_STRING)			\
+		USER(ast_vm_user, language, AST_DATA_STRING)			\
+		USER(ast_vm_user, zonetag, AST_DATA_STRING)			\
+		USER(ast_vm_user, callback, AST_DATA_STRING)			\
+		USER(ast_vm_user, dialout, AST_DATA_STRING)			\
+		USER(ast_vm_user, uniqueid, AST_DATA_STRING)			\
+		USER(ast_vm_user, exit, AST_DATA_STRING)			\
+		USER(ast_vm_user, attachfmt, AST_DATA_STRING)			\
+		USER(ast_vm_user, flags, AST_DATA_UNSIGNED_INTEGER)		\
+		USER(ast_vm_user, saydurationm, AST_DATA_INTEGER)		\
+		USER(ast_vm_user, maxmsg, AST_DATA_INTEGER)			\
+		USER(ast_vm_user, maxdeletedmsg, AST_DATA_INTEGER)		\
+		USER(ast_vm_user, maxsecs, AST_DATA_INTEGER)			\
+		USER(ast_vm_user, imapuser, AST_DATA_STRING)			\
+		USER(ast_vm_user, imappassword, AST_DATA_STRING)		\
+		USER(ast_vm_user, imapvmshareid, AST_DATA_STRING)		\
+		USER(ast_vm_user, volgain, AST_DATA_DOUBLE)
+#else
+	#define DATA_EXPORT_VM_USERS(USER)					\
+		USER(ast_vm_user, context, AST_DATA_STRING)			\
+		USER(ast_vm_user, mailbox, AST_DATA_STRING)			\
+		USER(ast_vm_user, password, AST_DATA_STRING)			\
+		USER(ast_vm_user, fullname, AST_DATA_STRING)			\
+		USER(ast_vm_user, email, AST_DATA_STRING)			\
+		USER(ast_vm_user, emailsubject, AST_DATA_STRING)		\
+		USER(ast_vm_user, emailbody, AST_DATA_STRING)			\
+		USER(ast_vm_user, pager, AST_DATA_STRING)			\
+		USER(ast_vm_user, serveremail, AST_DATA_STRING)			\
+		USER(ast_vm_user, mailcmd, AST_DATA_STRING)			\
+		USER(ast_vm_user, language, AST_DATA_STRING)			\
+		USER(ast_vm_user, zonetag, AST_DATA_STRING)			\
+		USER(ast_vm_user, callback, AST_DATA_STRING)			\
+		USER(ast_vm_user, dialout, AST_DATA_STRING)			\
+		USER(ast_vm_user, uniqueid, AST_DATA_STRING)			\
+		USER(ast_vm_user, exit, AST_DATA_STRING)			\
+		USER(ast_vm_user, attachfmt, AST_DATA_STRING)			\
+		USER(ast_vm_user, flags, AST_DATA_UNSIGNED_INTEGER)		\
+		USER(ast_vm_user, saydurationm, AST_DATA_INTEGER)		\
+		USER(ast_vm_user, maxmsg, AST_DATA_INTEGER)			\
+		USER(ast_vm_user, maxdeletedmsg, AST_DATA_INTEGER)		\
+		USER(ast_vm_user, maxsecs, AST_DATA_INTEGER)			\
+		USER(ast_vm_user, volgain, AST_DATA_DOUBLE)
+#endif
+
+AST_DATA_STRUCTURE(ast_vm_user, DATA_EXPORT_VM_USERS);
+
+#define DATA_EXPORT_VM_ZONES(ZONE)			\
+	ZONE(vm_zone, name, AST_DATA_STRING)		\
+	ZONE(vm_zone, timezone, AST_DATA_STRING)	\
+	ZONE(vm_zone, msg_format, AST_DATA_STRING)
+
+AST_DATA_STRUCTURE(vm_zone, DATA_EXPORT_VM_ZONES);
+
+#ifdef IMAP_STORAGE
+	#define DATA_EXPORT_VM_STATES(STATE)						\
+		STATE(vm_state, curbox, AST_DATA_STRING)				\
+		STATE(vm_state, username, AST_DATA_STRING)				\
+		STATE(vm_state, context, AST_DATA_STRING)				\
+		STATE(vm_state, curdir, AST_DATA_STRING)				\
+		STATE(vm_state, vmbox, AST_DATA_STRING)					\
+		STATE(vm_state, fn, AST_DATA_STRING)					\
+		STATE(vm_state, intro, AST_DATA_STRING)					\
+		STATE(vm_state, curmsg, AST_DATA_INTEGER)				\
+		STATE(vm_state, lastmsg, AST_DATA_INTEGER)				\
+		STATE(vm_state, newmessages, AST_DATA_INTEGER)				\
+		STATE(vm_state, oldmessages, AST_DATA_INTEGER)				\
+		STATE(vm_state, urgentmessages, AST_DATA_INTEGER)			\
+		STATE(vm_state, starting, AST_DATA_INTEGER)				\
+		STATE(vm_state, repeats, AST_DATA_INTEGER)				\
+		STATE(vm_state, updated, AST_DATA_INTEGER)				\
+		STATE(vm_state, msgArray, AST_DATA_CONTAINER)				\
+		STATE(vm_state, vmArrayIndex, AST_DATA_INTEGER)				\
+		STATE(vm_state, imapuser, AST_DATA_STRING)				\
+		STATE(vm_state, interactive, AST_DATA_INTEGER)				\
+		STATE(vm_state, introfn, AST_DATA_STRING)				\
+		STATE(vm_state, quota_limit, AST_DATA_UNSIGNED_INTEGER)			\
+		STATE(vm_state, quota_usage, AST_DATA_UNSIGNED_INTEGER)
+#else
+	#define DATA_EXPORT_VM_STATES(STATE)						\
+		STATE(vm_state, curbox, AST_DATA_STRING)				\
+		STATE(vm_state, username, AST_DATA_STRING)				\
+		STATE(vm_state, context, AST_DATA_STRING)				\
+		STATE(vm_state, curdir, AST_DATA_STRING)				\
+		STATE(vm_state, vmbox, AST_DATA_STRING)					\
+		STATE(vm_state, fn, AST_DATA_STRING)					\
+		STATE(vm_state, intro, AST_DATA_STRING)					\
+		STATE(vm_state, curmsg, AST_DATA_INTEGER)				\
+		STATE(vm_state, lastmsg, AST_DATA_INTEGER)				\
+		STATE(vm_state, newmessages, AST_DATA_INTEGER)				\
+		STATE(vm_state, oldmessages, AST_DATA_INTEGER)				\
+		STATE(vm_state, urgentmessages, AST_DATA_INTEGER)			\
+		STATE(vm_state, starting, AST_DATA_INTEGER)				\
+		STATE(vm_state, repeats, AST_DATA_INTEGER)
+#endif
+
+AST_DATA_STRUCTURE(vm_state, DATA_EXPORT_VM_STATES);
+
+/*!
+ * \internal
+ * \brief Add voicemail user to the data_root.
+ * \param[in] search The search tree.
+ * \param[in] data_root The main result node.
+ * \param[in] user The voicemail user.
+ */
+static void vm_users_data_provider_get_helper(const struct ast_data_search *search,
+    struct ast_data *data_root, struct ast_vm_user *user)
+{
+	struct ast_data *data_user, *data_zone;
+#ifdef IMAP_STORAGE
+	struct ast_data *data_state;
+	struct vm_state *state;
+#endif
+	struct vm_zone *zone = NULL;
+
+	/* check the search pattern to make sure it's valid to add it */
+	if (ast_data_search_cmp_structure(search, ast_vm_user, user, "user")) {
+		return;
+	}
+
+	data_user = ast_data_add_node(data_root, "user");
+	if (!data_user) {
+		return;
+	}
+
+	ast_data_add_structure(ast_vm_user, data_user, user);
+
+#ifdef IMAP_STORAGE
+	state = get_vm_state_by_mailbox(user->mailbox, user->context, 0);
+#endif
+
+	AST_LIST_LOCK(&zones);
+	AST_LIST_TRAVERSE(&zones, zone, list) {
+		if (!strcmp(zone->name, user->zonetag)) {
+			break;
+		}
+	}
+	AST_LIST_UNLOCK(&zones);
+
+	/* TODO: Should a user's vm state be accessible without compiling in
+	 *       IMAP support? */
+
+	if (
+#ifdef IMAP_STORAGE
+		!ast_data_search_cmp_structure(search, vm_state, state, "user/state") ||
+#endif
+		(zone && !ast_data_search_cmp_structure(search, vm_zone,
+							zone, "user/zone"))) {
+		ast_data_remove_node(data_root, data_user);
+		return;
+	}
+
+#ifdef IMAP_STORAGE
+	data_state = ast_data_add_node(data_user, "state");
+	ast_data_add_structure(vm_state, data_state, state);
+	ast_data_add_int(data_state, "deleted", *(state->deleted));
+	ast_data_add_int(data_state, "heard", *(state->heard));
+#endif
+
+	if (zone) {
+		data_zone = ast_data_add_node(data_user, "zone");
+		ast_data_add_structure(vm_zone, data_zone, zone);
+	}
+
+	return;
+}
+
+static int vm_data_provider_get(const struct ast_data_search *search,
+	struct ast_data *data_root)
+{
+	struct ast_vm_user *user;
+
+	AST_LIST_LOCK(&users);
+	AST_LIST_TRAVERSE(&users, user, list) {
+		vm_users_data_provider_get_helper(search, data_root, user);
+	}
+	AST_LIST_UNLOCK(&users);
+
+	return 0;
+}
+
+static const struct ast_data_handler vm_data_provider = {
+	.version = AST_DATA_HANDLER_VERSION,
+	.get = vm_data_provider_get
+};
+
+static const struct ast_data_entry vm_data_providers[] = {
+	AST_DATA_ENTRY("asterisk/application/app_voicemail/voicemail", &vm_data_provider)
+};
+
 static void poll_subscribed_mailbox(struct mwi_sub *mwi_sub)
 {
 	int new = 0, old = 0, urgent = 0;
@@ -12233,6 +12441,7 @@
 	res |= ast_unregister_application(app4);
 	res |= ast_custom_function_unregister(&mailbox_exists_acf);
 	res |= ast_manager_unregister("VoicemailUsersList");
+	res |= ast_data_unregister(NULL);
 #ifdef TEST_FRAMEWORK
 	res |= AST_TEST_UNREGISTER(test_voicemail_vmsayname);
 	res |= AST_TEST_UNREGISTER(test_voicemail_msgcount);
@@ -12293,6 +12502,7 @@
 		return res;
 
 	ast_cli_register_multiple(cli_voicemail, ARRAY_LEN(cli_voicemail));
+	ast_data_register_multiple(vm_data_providers, ARRAY_LEN(vm_data_providers));
 
 	ast_install_vm_functions(has_voicemail, inboxcount, inboxcount2, messagecount, sayname);
 	ast_realtime_require_field("voicemail", "uniqueid", RQ_UINTEGER3, 11, "password", RQ_CHAR, 10, SENTINEL);

Modified: team/dvossel/generic_aoc/doc/manager_1_1.txt
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/generic_aoc/doc/manager_1_1.txt?view=diff&rev=258764&r1=258763&r2=258764
==============================================================================
--- team/dvossel/generic_aoc/doc/manager_1_1.txt (original)
+++ team/dvossel/generic_aoc/doc/manager_1_1.txt Thu Apr 22 19:21:08 2010
@@ -137,6 +137,16 @@
 
 * NEW ACTIONS
 -------------
+- Action: DataGet
+	Modules: data.c
+	Purpose:
+		To be able to retrieve the asterisk data tree.
+	Variables:
+	  ActionID: <id>          Action ID for this transaction. Will be returned.
+	  Path: <data path>       The path to the callback node to retrieve.
+	  Filter: <filter>        Which nodes to retrieve.
+	  Search: <search>        Search condition.
+
 - Action: IAXregistry
 	Modules: chan_iax2
 	Purpose:

Modified: team/dvossel/generic_aoc/doc/tex/channelvariables.tex
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/generic_aoc/doc/tex/channelvariables.tex?view=diff&rev=258764&r1=258763&r2=258764
==============================================================================
--- team/dvossel/generic_aoc/doc/tex/channelvariables.tex (original)
+++ team/dvossel/generic_aoc/doc/tex/channelvariables.tex Thu Apr 22 19:21:08 2010
@@ -883,6 +883,7 @@
 ${CONF_LIMIT_TIMEOUT_FILE}   File to play when time is up.  Used with the L() option.
 ${CONF_LIMIT_WARNING_FILE}   File to play as warning if 'y' is defined.
                              The default is to say the time remaining.  Used with the L() option.
+${MEETMEBOOKID}            * This variable exposes the bookid column for a realtime configured conference bridge.
 \end{verbatim}
 
 \subsection{The VoiceMail() application}

Modified: team/dvossel/generic_aoc/include/asterisk/_private.h
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/generic_aoc/include/asterisk/_private.h?view=diff&rev=258764&r1=258763&r2=258764
==============================================================================
--- team/dvossel/generic_aoc/include/asterisk/_private.h (original)
+++ team/dvossel/generic_aoc/include/asterisk/_private.h Thu Apr 22 19:21:08 2010
@@ -35,6 +35,7 @@
 int ast_file_init(void);		/*!< Provided by file.c */
 int ast_features_init(void);            /*!< Provided by features.c */
 void ast_autoservice_init(void);	/*!< Provided by autoservice.c */
+int ast_data_init(void);		/*!< Provided by data.c */
 int ast_http_init(void);		/*!< Provided by http.c */
 int ast_http_reload(void);		/*!< Provided by http.c */
 int ast_tps_init(void); 		/*!< Provided by taskprocessor.c */

Modified: team/dvossel/generic_aoc/include/asterisk/astobj2.h
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/generic_aoc/include/asterisk/astobj2.h?view=diff&rev=258764&r1=258763&r2=258764
==============================================================================
--- team/dvossel/generic_aoc/include/asterisk/astobj2.h (original)
+++ team/dvossel/generic_aoc/include/asterisk/astobj2.h Thu Apr 22 19:21:08 2010
@@ -472,12 +472,8 @@
  * \param a A pointer to the object we want to lock.
  * \return 0 on success, other values on error.
  */
-#ifndef DEBUG_THREADS
-int ao2_lock(void *a);
-#else
+int __ao2_lock(void *a, const char *file, const char *func, int line, const char *var);
 #define ao2_lock(a) __ao2_lock(a, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a)
-int __ao2_lock(void *a, const char *file, const char *func, int line, const char *var);
-#endif
 
 /*! \brief
  * Unlock an object.
@@ -485,12 +481,8 @@
  * \param a A pointer to the object we want unlock.
  * \return 0 on success, other values on error.
  */
-#ifndef DEBUG_THREADS
-int ao2_unlock(void *a);
-#else
+int __ao2_unlock(void *a, const char *file, const char *func, int line, const char *var);
 #define ao2_unlock(a) __ao2_unlock(a, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a)
-int __ao2_unlock(void *a, const char *file, const char *func, int line, const char *var);
-#endif
 
 /*! \brief
  * Try locking-- (don't block if fail)
@@ -498,12 +490,8 @@
  * \param a A pointer to the object we want to lock.
  * \return 0 on success, other values on error.
  */
-#ifndef DEBUG_THREADS
-int ao2_trylock(void *a);
-#else
+int __ao2_trylock(void *a, const char *file, const char *func, int line, const char *var);
 #define ao2_trylock(a) __ao2_trylock(a, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a)
-int __ao2_trylock(void *a, const char *file, const char *func, int line, const char *var);
-#endif
 
 /*!
  * \brief Return the lock address of an object

Modified: team/dvossel/generic_aoc/include/asterisk/channel.h
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/generic_aoc/include/asterisk/channel.h?view=diff&rev=258764&r1=258763&r2=258764
==============================================================================
--- team/dvossel/generic_aoc/include/asterisk/channel.h (original)
+++ team/dvossel/generic_aoc/include/asterisk/channel.h Thu Apr 22 19:21:08 2010
@@ -148,6 +148,7 @@
 #include "asterisk/linkedlists.h"
 #include "asterisk/stringfields.h"
 #include "asterisk/datastore.h"
+#include "asterisk/data.h"
 #include "asterisk/channelstate.h"
 #include "asterisk/ccss.h"
 
@@ -2758,6 +2759,26 @@
  */
 int ast_channel_connected_line_macro(struct ast_channel *autoservice_chan, struct ast_channel *macro_chan, const void *connected_info, int caller, int frame);
 
+/*!
+ * \brief Insert into an astdata tree, the channel structure.
+ * \param[in] tree The ast data tree.
+ * \param[in] chan The channel structure to add to tree.
+ * \retval <0 on error.
+ * \retval 0 on success.
+ */
+int ast_channel_data_add_structure(struct ast_data *tree, struct ast_channel *chan);
+
+/*!
+ * \brief Compare to channel structures using the data api.
+ * \param[in] tree The search tree generated by the data api.
+ * \param[in] chan The channel to compare.
+ * \param[in] structure_name The name of the node of the channel structure.
+ * \retval 0 The structure matches.
+ * \retval 1 The structure doesn't matches.
+ */
+int ast_channel_data_cmp_structure(const struct ast_data_search *tree, struct ast_channel *chan,
+	const char *structure_name);
+
 #include "asterisk/ccss.h"
 
 /*!

Modified: team/dvossel/generic_aoc/include/asterisk/doxyref.h
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/generic_aoc/include/asterisk/doxyref.h?view=diff&rev=258764&r1=258763&r2=258764
==============================================================================
--- team/dvossel/generic_aoc/include/asterisk/doxyref.h (original)
+++ team/dvossel/generic_aoc/include/asterisk/doxyref.h Thu Apr 22 19:21:08 2010
@@ -90,6 +90,7 @@
  * \arg \ref AstThreadStorage
  * \arg \ref DataStores
  * \arg \ref AstExtState
+ * \arg \ref AstDataRetrieval
  *

[... 3507 lines stripped ...]



More information about the asterisk-commits mailing list