[asterisk-commits] kharwell: branch kharwell/stasis_aoc_event r392850 - in /team/kharwell/stasis...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jun 25 09:38:34 CDT 2013


Author: kharwell
Date: Tue Jun 25 09:38:28 2013
New Revision: 392850

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=392850
Log:
Multiple revisions 392729,392747,392777-392779,392797,392812,392829

........
  r392729 | mmichelson | 2013-06-24 13:33:13 -0500 (Mon, 24 Jun 2013) | 8 lines
  
  Add documentation for features configuration.
  
  Review: https://reviewboard.asterisk.org/r/2616
  
  (closes issue ASTERISK-21542)
  Reported by Matt Jordan
........
  r392747 | mmichelson | 2013-06-24 14:28:51 -0500 (Mon, 24 Jun 2013) | 3 lines
  
  Remove stray properties from merge.
........
  r392777 | rmudgett | 2013-06-24 16:40:52 -0500 (Mon, 24 Jun 2013) | 5 lines
  
  Fix menuselect display for stasis modules.
  
  The menuselect parser is very simple.  It looks for AST_MODULE_INFO and
  uses any quoted string on that line as the module summary display.
........
  r392778 | dlee | 2013-06-24 16:48:39 -0500 (Mon, 24 Jun 2013) | 3 lines
  
  Fixed templates so that the changes from r392777 won't be overwritten the next
  time we run the generators.
........
  r392779 | dlee | 2013-06-24 17:05:28 -0500 (Mon, 24 Jun 2013) | 1 line
  
  Few more menuselect fixes missed in r392777
........
  r392797 | mjordan | 2013-06-24 18:56:54 -0500 (Mon, 24 Jun 2013) | 26 lines
  
  Fix a variety of memory leaks
  
  This patch addresses the following memory/ref counting leaks:
  
   * main/devicestate.c - unsubscribe and join our devicestate message
     subscription
   * main/cel.c - clean up the datastore and config objects on exist
   * main/parking.c - cleanup memory leak of retriever snapshot on message
     payload destruction
   * res/parking/parking_bridge.c - cleanup memory leak of retrieve snapshot
     on message payload destruction
   * main/presencestate.c - unsubscribe and join the caching topic on exit
   * manager.c - properly unregister the manager action "BlindTransfer"
   * sorcery.c - shutdown the threadpool on exit and dispose of any wizards
  
  (issue ASTERISK-21906)
  Reported by: John Hardin
  patches:
    cel.patch uploaded by jhardin (license #6512)
    devicestate.patch uploaded by jhardin (license #6512)
    manager.patch uploaded by jardin (license #6512)
    presencestate.patch uploaded by jhardin (license #6512)
    retriever-channel-snapshot.patch uploaded by jhardin (license #6512)
    sorcery.patch uploaded by jhardin (license #6512)
........
  r392812 | mjordan | 2013-06-24 20:12:58 -0500 (Mon, 24 Jun 2013) | 26 lines
  
  Fix memory/ref counting leaks in a variety of locations
  
  This patch fixes the following memory leaks:
   * http.c: The structure containing the addresses to bind to was not being
     deallocated when no longer used
   * named_acl.c: The global configuration information was not disposed of
   * config_options.c: An invalid read was occurring for certain option types.
   * res_calendar.c: The loaded calendars on module unload were not being
     properly disposed of.
   * chan_motif.c: The format capabilities needed to be disposed of on module
     unload. In addition, this now specifies the default options for the
     maxpayloads and maxicecandidates in such a way that it doesn't cause the
     invalid read in config_options.c to occur.
  
  (issue ASTERISK-21906)
  Reported by: John Hardin
  patches:
    http.patch uploaded by jhardin (license 6512)
    named_acl.patch uploaded by jhardin (license 6512)
    config_options.patch uploaded by jhardin (license 6512)
    res_calendar.patch uploaded by jhardin (license 6512)
    chan_motif.patch uploaded by jhardin (license 6512)
  ........
  
  Merged revisions 392810 from http://svn.asterisk.org/svn/asterisk/branches/11
........
  r392829 | kmoore | 2013-06-25 08:03:17 -0500 (Tue, 25 Jun 2013) | 11 lines
  
  CEL refactoring cleanup
  
  This change removes AST_CEL_BRIDGE_UPDATE since it should no longer be
  used because masquerade situations are now accounted for in other ways.
  
  This also refactors usage of AST_CEL_FORWARD to be produced by a Dial
  message which has been extended with a "forward" field.
  
  (closes issue ASTERISK-21566)
  Review: https://reviewboard.asterisk.org/r/2635/
........

Merged revisions 392729,392747,392777-392779,392797,392812,392829 from http://svn.asterisk.org/svn/asterisk/trunk

Modified:
    team/kharwell/stasis_aoc_event/   (props changed)
    team/kharwell/stasis_aoc_event/apps/app_celgenuserevent.c
    team/kharwell/stasis_aoc_event/apps/app_dial.c
    team/kharwell/stasis_aoc_event/apps/app_queue.c
    team/kharwell/stasis_aoc_event/apps/app_stasis.c
    team/kharwell/stasis_aoc_event/channels/chan_motif.c
    team/kharwell/stasis_aoc_event/doc/appdocsxml.dtd
    team/kharwell/stasis_aoc_event/include/asterisk/cel.h
    team/kharwell/stasis_aoc_event/include/asterisk/stasis_channels.h
    team/kharwell/stasis_aoc_event/main/cdr.c
    team/kharwell/stasis_aoc_event/main/cel.c
    team/kharwell/stasis_aoc_event/main/config_options.c
    team/kharwell/stasis_aoc_event/main/devicestate.c
    team/kharwell/stasis_aoc_event/main/features_config.c
    team/kharwell/stasis_aoc_event/main/http.c
    team/kharwell/stasis_aoc_event/main/manager.c
    team/kharwell/stasis_aoc_event/main/named_acl.c
    team/kharwell/stasis_aoc_event/main/parking.c
    team/kharwell/stasis_aoc_event/main/presencestate.c
    team/kharwell/stasis_aoc_event/main/sorcery.c
    team/kharwell/stasis_aoc_event/main/stasis_channels.c
    team/kharwell/stasis_aoc_event/res/parking/parking_bridge.c
    team/kharwell/stasis_aoc_event/res/res_calendar.c
    team/kharwell/stasis_aoc_event/res/res_chan_stats.c
    team/kharwell/stasis_aoc_event/res/res_stasis.c
    team/kharwell/stasis_aoc_event/res/res_stasis_answer.c
    team/kharwell/stasis_aoc_event/res/res_stasis_bridge_add.c
    team/kharwell/stasis_aoc_event/res/res_stasis_http.c
    team/kharwell/stasis_aoc_event/res/res_stasis_http_asterisk.c
    team/kharwell/stasis_aoc_event/res/res_stasis_http_bridges.c
    team/kharwell/stasis_aoc_event/res/res_stasis_http_channels.c
    team/kharwell/stasis_aoc_event/res/res_stasis_http_endpoints.c
    team/kharwell/stasis_aoc_event/res/res_stasis_http_events.c
    team/kharwell/stasis_aoc_event/res/res_stasis_http_playback.c
    team/kharwell/stasis_aoc_event/res/res_stasis_http_recordings.c
    team/kharwell/stasis_aoc_event/res/res_stasis_http_sounds.c
    team/kharwell/stasis_aoc_event/res/res_stasis_json_asterisk.c
    team/kharwell/stasis_aoc_event/res/res_stasis_json_bridges.c
    team/kharwell/stasis_aoc_event/res/res_stasis_json_channels.c
    team/kharwell/stasis_aoc_event/res/res_stasis_json_endpoints.c
    team/kharwell/stasis_aoc_event/res/res_stasis_json_events.c
    team/kharwell/stasis_aoc_event/res/res_stasis_json_playback.c
    team/kharwell/stasis_aoc_event/res/res_stasis_json_recordings.c
    team/kharwell/stasis_aoc_event/res/res_stasis_json_sounds.c
    team/kharwell/stasis_aoc_event/res/res_stasis_playback.c
    team/kharwell/stasis_aoc_event/res/res_stasis_test.c
    team/kharwell/stasis_aoc_event/res/res_stasis_websocket.c
    team/kharwell/stasis_aoc_event/res/res_statsd.c
    team/kharwell/stasis_aoc_event/res/stasis_json/resource_sounds.h
    team/kharwell/stasis_aoc_event/rest-api-templates/res_stasis_http_resource.c.mustache
    team/kharwell/stasis_aoc_event/rest-api-templates/res_stasis_json_resource.c.mustache
    team/kharwell/stasis_aoc_event/tests/test_endpoints.c
    team/kharwell/stasis_aoc_event/tests/test_stasis_endpoints.c

Propchange: team/kharwell/stasis_aoc_event/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/kharwell/stasis_aoc_event/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.

Propchange: team/kharwell/stasis_aoc_event/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Jun 25 09:38:28 2013
@@ -1,1 +1,1 @@
-/trunk:1-392703
+/trunk:1-392848

Modified: team/kharwell/stasis_aoc_event/apps/app_celgenuserevent.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/stasis_aoc_event/apps/app_celgenuserevent.c?view=diff&rev=392850&r1=392849&r2=392850
==============================================================================
--- team/kharwell/stasis_aoc_event/apps/app_celgenuserevent.c (original)
+++ team/kharwell/stasis_aoc_event/apps/app_celgenuserevent.c Tue Jun 25 09:38:28 2013
@@ -62,6 +62,7 @@
 {
 	int res = 0;
 	char *parse;
+	RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref);
 	AST_DECLARE_APP_ARGS(args,
 		AST_APP_ARG(event);
 		AST_APP_ARG(extra);
@@ -74,7 +75,13 @@
 	parse = ast_strdupa(data);
 	AST_STANDARD_APP_ARGS(args, parse);
 
-	ast_cel_report_event(chan, AST_CEL_USER_DEFINED, args.event, args.extra, NULL);
+	blob = ast_json_pack("{s: s, s: s}",
+		"event", args.event,
+		"extra", args.extra);
+	if (!blob) {
+		return res;
+	}
+	ast_cel_publish_event(chan, AST_CEL_USER_DEFINED, blob);
 	return res;
 }
 

Modified: team/kharwell/stasis_aoc_event/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/stasis_aoc_event/apps/app_dial.c?view=diff&rev=392850&r1=392849&r2=392850
==============================================================================
--- team/kharwell/stasis_aoc_event/apps/app_dial.c (original)
+++ team/kharwell/stasis_aoc_event/apps/app_dial.c Tue Jun 25 09:38:28 2013
@@ -859,8 +859,6 @@
 		ast_clear_flag64(o, OPT_IGNORE_CONNECTEDLINE);
 	}
 
-	ast_cel_report_event(in, AST_CEL_FORWARD, NULL, ast_channel_call_forward(c), NULL);
-
 	/* Before processing channel, go ahead and check for forwarding */
 	ast_verb(3, "Now forwarding %s to '%s/%s' (thanks to %s)\n", ast_channel_name(in), tech, stuff, ast_channel_name(c));
 	/* If we have been told to ignore forwards, just set this channel to null and continue processing extensions normally */
@@ -1004,7 +1002,8 @@
 			ast_channel_unlock(c);
 
 			ast_channel_lock_both(original, in);
-			ast_channel_publish_dial(in, original, NULL, "CANCEL");
+			ast_channel_publish_dial_forward(in, original, NULL, "CANCEL",
+				ast_channel_call_forward(c));
 			ast_channel_unlock(in);
 			ast_channel_unlock(original);
 

Modified: team/kharwell/stasis_aoc_event/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/stasis_aoc_event/apps/app_queue.c?view=diff&rev=392850&r1=392849&r2=392850
==============================================================================
--- team/kharwell/stasis_aoc_event/apps/app_queue.c (original)
+++ team/kharwell/stasis_aoc_event/apps/app_queue.c Tue Jun 25 09:38:28 2013
@@ -4449,8 +4449,6 @@
 						o->block_connected_update = 0;
 					}
 
-					ast_cel_report_event(in, AST_CEL_FORWARD, NULL, ast_channel_call_forward(o->chan), NULL);
-
 					ast_verb(3, "Now forwarding %s to '%s/%s' (thanks to %s)\n", inchan_name, tech, stuff, ochan_name);
 					/* Setup parameters */
 					o->chan = ast_request(tech, ast_channel_nativeformats(in), in, stuff, &status);
@@ -4544,7 +4542,8 @@
 					ast_channel_unlock(qe->chan);
 
 					ast_channel_lock_both(qe->chan, original);
-					ast_channel_publish_dial(qe->chan, original, NULL, "CANCEL");
+					ast_channel_publish_dial_forward(qe->chan, original, NULL, "CANCEL",
+						ast_channel_call_forward(original));
 					ast_channel_unlock(original);
 					ast_channel_unlock(qe->chan);
 					/* Hangup the original channel now, in case we needed it */

Modified: team/kharwell/stasis_aoc_event/apps/app_stasis.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/stasis_aoc_event/apps/app_stasis.c?view=diff&rev=392850&r1=392849&r2=392850
==============================================================================
--- team/kharwell/stasis_aoc_event/apps/app_stasis.c (original)
+++ team/kharwell/stasis_aoc_event/apps/app_stasis.c Tue Jun 25 09:38:28 2013
@@ -106,9 +106,7 @@
 	return r;
 }
 
-AST_MODULE_INFO(ASTERISK_GPL_KEY,
-	AST_MODFLAG_DEFAULT,
-	"Stasis dialplan application",
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Stasis dialplan application",
 	.load = load_module,
 	.unload = unload_module,
 	.nonoptreq = "res_stasis",

Modified: team/kharwell/stasis_aoc_event/channels/chan_motif.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/stasis_aoc_event/channels/chan_motif.c?view=diff&rev=392850&r1=392849&r2=392850
==============================================================================
--- team/kharwell/stasis_aoc_event/channels/chan_motif.c (original)
+++ team/kharwell/stasis_aoc_event/channels/chan_motif.c Tue Jun 25 09:38:28 2013
@@ -2711,9 +2711,9 @@
 	aco_option_register_custom(&cfg_info, "connection", ACO_EXACT, endpoint_options, NULL, custom_connection_handler, 0);
 	aco_option_register_custom(&cfg_info, "transport", ACO_EXACT, endpoint_options, NULL, custom_transport_handler, 0);
 	aco_option_register(&cfg_info, "maxicecandidates", ACO_EXACT, endpoint_options, DEFAULT_MAX_ICE_CANDIDATES, OPT_UINT_T, PARSE_DEFAULT,
-			    FLDSET(struct jingle_endpoint, maxicecandidates));
+			    FLDSET(struct jingle_endpoint, maxicecandidates), DEFAULT_MAX_ICE_CANDIDATES);
 	aco_option_register(&cfg_info, "maxpayloads", ACO_EXACT, endpoint_options, DEFAULT_MAX_PAYLOADS, OPT_UINT_T, PARSE_DEFAULT,
-			    FLDSET(struct jingle_endpoint, maxpayloads));
+			    FLDSET(struct jingle_endpoint, maxpayloads), DEFAULT_MAX_PAYLOADS);
 
 	ast_format_cap_add_all_by_type(jingle_tech.capabilities, AST_FORMAT_TYPE_AUDIO);
 
@@ -2764,6 +2764,8 @@
 static int unload_module(void)
 {
 	ast_channel_unregister(&jingle_tech);
+	ast_format_cap_destroy(jingle_tech.capabilities);
+	jingle_tech.capabilities = NULL;
 	ast_rtp_glue_unregister(&jingle_rtp_glue);
 	ast_sched_context_destroy(sched);
 	aco_info_destroy(&cfg_info);

Modified: team/kharwell/stasis_aoc_event/doc/appdocsxml.dtd
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/stasis_aoc_event/doc/appdocsxml.dtd?view=diff&rev=392850&r1=392849&r2=392850
==============================================================================
--- team/kharwell/stasis_aoc_event/doc/appdocsxml.dtd (original)
+++ team/kharwell/stasis_aoc_event/doc/appdocsxml.dtd Tue Jun 25 09:38:28 2013
@@ -71,7 +71,7 @@
   <!ELEMENT see-also (ref|xi:include)*>
 
   <!ELEMENT ref (#PCDATA)>
-  <!ATTLIST ref type (application|function|astcli|link|manpage|filename|agi|manager|managerEvent) #REQUIRED>
+  <!ATTLIST ref type (application|function|astcli|link|manpage|filename|agi|manager|managerEvent|configOption) #REQUIRED>
   <!ATTLIST ref module CDATA #IMPLIED>
 
   <!ELEMENT synopsis (#PCDATA)>

Modified: team/kharwell/stasis_aoc_event/include/asterisk/cel.h
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/stasis_aoc_event/include/asterisk/cel.h?view=diff&rev=392850&r1=392849&r2=392850
==============================================================================
--- team/kharwell/stasis_aoc_event/include/asterisk/cel.h (original)
+++ team/kharwell/stasis_aoc_event/include/asterisk/cel.h Tue Jun 25 09:38:28 2013
@@ -83,8 +83,6 @@
 	AST_CEL_USER_DEFINED = 21,
 	/*! \brief the last channel with the given linkedid is retired  */
 	AST_CEL_LINKEDID_END = 22,
-	/*! \brief a masquerade happened to alter the participants on a bridge  */
-	AST_CEL_BRIDGE_UPDATE = 23,
 	/*! \brief a directed pickup was performed on this channel  */
 	AST_CEL_PICKUP = 24,
 	/*! \brief this call was forwarded somewhere else  */
@@ -245,6 +243,26 @@
  */
 int ast_cel_fill_record(const struct ast_event *event, struct ast_cel_event_record *r);
 
+/*!
+ * \brief Publish a CEL event
+ * \since 12
+ *
+ * \param chan This is the primary channel associated with this channel event.
+ * \param event_type This is the type of call event being reported.
+ * \param blob This contains any additional parameters that need to be conveyed for this event.
+ */
+void ast_cel_publish_event(struct ast_channel *chan,
+	enum ast_cel_event_type event_type,
+	struct ast_json *blob);
+
+/*!
+ * \brief Get the CEL topic
+ *
+ * \retval The CEL topic
+ * \retval NULL if not allocated
+ */
+struct stasis_topic *ast_cel_topic(void);
+
 #if defined(__cplusplus) || defined(c_plusplus)
 }
 #endif

Modified: team/kharwell/stasis_aoc_event/include/asterisk/stasis_channels.h
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/stasis_aoc_event/include/asterisk/stasis_channels.h?view=diff&rev=392850&r1=392849&r2=392850
==============================================================================
--- team/kharwell/stasis_aoc_event/include/asterisk/stasis_channels.h (original)
+++ team/kharwell/stasis_aoc_event/include/asterisk/stasis_channels.h Tue Jun 25 09:38:28 2013
@@ -456,6 +456,24 @@
 
 /*!
  * \since 12
+ * \brief Publish in the \ref ast_channel_topic or \ref ast_channel_topic_all
+ * topics a stasis message for the channels involved in a dial operation that
+ * is forwarded.
+ *
+ * \param caller The channel performing the dial operation
+ * \param peer The channel being dialed
+ * \param dialstring The information passed to the dialing application when beginning a dial
+ * \param dialstatus The current status of the dial operation
+ * \param forward The call forward string provided by the dialed channel
+ */
+void ast_channel_publish_dial_forward(struct ast_channel *caller,
+		struct ast_channel *peer,
+		const char *dialstring,
+		const char *dialstatus,
+		const char *forward);
+
+/*!
+ * \since 12
  * \brief Publish in the \ref ast_channel_topic a \ref ast_channel_snapshot
  * message indicating a change in channel state
  *

Modified: team/kharwell/stasis_aoc_event/main/cdr.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/stasis_aoc_event/main/cdr.c?view=diff&rev=392850&r1=392849&r2=392850
==============================================================================
--- team/kharwell/stasis_aoc_event/main/cdr.c (original)
+++ team/kharwell/stasis_aoc_event/main/cdr.c Tue Jun 25 09:38:28 2013
@@ -3514,7 +3514,6 @@
 	ao2_callback(active_cdrs_by_channel, OBJ_NODATA, cdr_object_dispatch_all_cb,
 		NULL);
 	finalize_batch_mode();
-	aco_info_destroy(&cfg_info);
 	ast_cli_unregister(&cli_status);
 	ast_cli_unregister(&cli_debug);
 	ast_sched_context_destroy(sched);
@@ -3522,6 +3521,12 @@
 	ast_free(batch);
 	batch = NULL;
 
+	channel_subscription = stasis_unsubscribe_and_join(channel_subscription);
+	bridge_subscription = stasis_unsubscribe_and_join(bridge_subscription);
+	stasis_message_router_unsubscribe_and_join(stasis_router);
+	aco_info_destroy(&cfg_info);
+	ao2_global_obj_release(module_configs);
+
 	ao2_ref(active_cdrs_by_channel, -1);
 	ao2_ref(active_cdrs_by_bridge, -1);
 }

Modified: team/kharwell/stasis_aoc_event/main/cel.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/stasis_aoc_event/main/cel.c?view=diff&rev=392850&r1=392849&r2=392850
==============================================================================
--- team/kharwell/stasis_aoc_event/main/cel.c (original)
+++ team/kharwell/stasis_aoc_event/main/cel.c Tue Jun 25 09:38:28 2013
@@ -96,7 +96,6 @@
 						<enum name="APP_END"/>
 						<enum name="BRIDGE_START"/>
 						<enum name="BRIDGE_END"/>
-						<enum name="BRIDGE_UPDATE"/>
 						<enum name="BRIDGE_TO_CONF"/>
 						<enum name="CONF_START"/>
 						<enum name="CONF_END"/>
@@ -126,8 +125,11 @@
 /*! Message router for state that CEL needs to know about */
 static struct stasis_message_router *cel_state_router;
 
+/*! Topic for CEL-specific messages */
+static struct stasis_topic *cel_topic;
+
 /*! Aggregation topic for all topics CEL needs to know about */
-static struct stasis_topic *cel_state_topic;
+static struct stasis_topic *cel_aggregation_topic;
 
 /*! Subscription for forwarding the channel caching topic */
 static struct stasis_subscription *cel_channel_forwarder;
@@ -138,8 +140,14 @@
 /*! Subscription for forwarding the parking topic */
 static struct stasis_subscription *cel_parking_forwarder;
 
+/*! Subscription for forwarding the CEL-specific topic */
+static struct stasis_subscription *cel_cel_forwarder;
+
 /*! Container for primary channel/bridge ID listing for 2 party bridges */
 static struct ao2_container *bridge_primaries;
+
+struct stasis_message_type *cel_generic_type(void);
+STASIS_MESSAGE_TYPE_DEFN(cel_generic_type);
 
 /*! The number of buckets into which primary channel uniqueids will be hashed */
 #define BRIDGE_PRIMARY_BUCKETS 251
@@ -305,7 +313,6 @@
 	[AST_CEL_APP_END]          = "APP_END",
 	[AST_CEL_BRIDGE_START]     = "BRIDGE_START",
 	[AST_CEL_BRIDGE_END]       = "BRIDGE_END",
-	[AST_CEL_BRIDGE_UPDATE]    = "BRIDGE_UPDATE",
 	[AST_CEL_BRIDGE_TO_CONF]   = "BRIDGE_TO_CONF",
 	[AST_CEL_CONF_START]       = "CONF_START",
 	[AST_CEL_CONF_END]         = "CONF_END",
@@ -1050,14 +1057,14 @@
 	return ao2_find(cel_dialstatus_store, uniqueid, OBJ_KEY | OBJ_UNLINK);
 }
 
-static const char *get_caller_dialstatus(struct ast_multi_channel_blob *blob)
+static const char *get_blob_variable(struct ast_multi_channel_blob *blob, const char *varname)
 {
 	struct ast_json *json = ast_multi_channel_blob_get_json(blob);
 	if (!json) {
 		return NULL;
 	}
 
-	json = ast_json_object_get(json, "dialstatus");
+	json = ast_json_object_get(json, varname);
 	if (!json) {
 		return NULL;
 	}
@@ -1090,8 +1097,8 @@
 		RAII_VAR(struct ast_str *, extra_str, ast_str_create(128), ast_free);
 		RAII_VAR(struct ast_multi_channel_blob *, blob, get_dialstatus_blob(new_snapshot->uniqueid), ao2_cleanup);
 		const char *dialstatus = "";
-		if (blob && !ast_strlen_zero(get_caller_dialstatus(blob))) {
-			dialstatus = get_caller_dialstatus(blob);
+		if (blob && !ast_strlen_zero(get_blob_variable(blob, "dialstatus"))) {
+			dialstatus = get_blob_variable(blob, "dialstatus");
 		}
 		ast_str_set(&extra_str, 0, "%d,%s,%s",
 			new_snapshot->hangupcause,
@@ -1406,27 +1413,67 @@
 		return;
 	}
 
-	if (ast_strlen_zero(get_caller_dialstatus(blob))) {
+	if (!ast_strlen_zero(get_blob_variable(blob, "forward"))) {
+		struct ast_channel_snapshot *caller = ast_multi_channel_blob_get_channel(blob, "caller");
+		if (!caller) {
+			return;
+		}
+
+		report_event_snapshot(caller, AST_CEL_FORWARD, NULL, get_blob_variable(blob, "forward"), NULL);
+	}
+
+	if (ast_strlen_zero(get_blob_variable(blob, "dialstatus"))) {
 		return;
 	}
 
 	save_dialstatus(blob);
 }
 
+static void cel_generic_cb(
+	void *data, struct stasis_subscription *sub,
+	struct stasis_topic *topic,
+	struct stasis_message *message)
+{
+	struct ast_channel_blob *obj = stasis_message_data(message);
+	int event_type = ast_json_integer_get(ast_json_object_get(obj->blob, "event_type"));
+	struct ast_json *event_details = ast_json_object_get(obj->blob, "event_details");
+
+	switch (event_type) {
+	case AST_CEL_USER_DEFINED:
+		{
+			const char *event = ast_json_string_get(ast_json_object_get(event_details, "event"));
+			const char *extra = ast_json_string_get(ast_json_object_get(event_details, "extra"));
+			report_event_snapshot(obj->snapshot, event_type, event, extra, NULL);
+			break;
+		}
+	default:
+		ast_log(LOG_ERROR, "Unhandled %s event blob\n", ast_cel_get_type_name(event_type));
+		break;
+	}
+}
+
 static void ast_cel_engine_term(void)
 {
+	aco_info_destroy(&cel_cfg_info);
+	ao2_global_obj_release(cel_configs);
 	stasis_message_router_unsubscribe_and_join(cel_state_router);
 	cel_state_router = NULL;
-	ao2_cleanup(cel_state_topic);
-	cel_state_topic = NULL;
+	ao2_cleanup(cel_aggregation_topic);
+	cel_aggregation_topic = NULL;
+	ao2_cleanup(cel_topic);
+	cel_topic = NULL;
 	cel_channel_forwarder = stasis_unsubscribe_and_join(cel_channel_forwarder);
 	cel_bridge_forwarder = stasis_unsubscribe_and_join(cel_bridge_forwarder);
 	cel_parking_forwarder = stasis_unsubscribe_and_join(cel_parking_forwarder);
+	cel_cel_forwarder = stasis_unsubscribe_and_join(cel_cel_forwarder);
+	ao2_cleanup(bridge_primaries);
+	bridge_primaries = NULL;
+	ast_cli_unregister(&cli_status);
+	ao2_cleanup(cel_dialstatus_store);
+	cel_dialstatus_store = NULL;
 	ao2_cleanup(linkedids);
 	linkedids = NULL;
-	ast_cli_unregister(&cli_status);
-	ao2_cleanup(bridge_primaries);
-	bridge_primaries = NULL;
+	STASIS_MESSAGE_TYPE_CLEANUP(cel_generic_type);
 }
 
 int ast_cel_engine_init(void)
@@ -1440,6 +1487,10 @@
 		return -1;
 	}
 
+	if (STASIS_MESSAGE_TYPE_INIT(cel_generic_type)) {
+		return -1;
+	}
+
 	if (ast_cli_register(&cli_status)) {
 		return -1;
 	}
@@ -1449,33 +1500,45 @@
 		return -1;
 	}
 
-	cel_state_topic = stasis_topic_create("cel_state_topic");
-	if (!cel_state_topic) {
+	cel_aggregation_topic = stasis_topic_create("cel_aggregation_topic");
+	if (!cel_aggregation_topic) {
+		return -1;
+	}
+
+	cel_topic = stasis_topic_create("cel_topic");
+	if (!cel_topic) {
 		return -1;
 	}
 
 	cel_channel_forwarder = stasis_forward_all(
 		stasis_caching_get_topic(ast_channel_topic_all_cached()),
-		cel_state_topic);
+		cel_aggregation_topic);
 	if (!cel_channel_forwarder) {
 		return -1;
 	}
 
 	cel_bridge_forwarder = stasis_forward_all(
 		stasis_caching_get_topic(ast_bridge_topic_all_cached()),
-		cel_state_topic);
+		cel_aggregation_topic);
 	if (!cel_bridge_forwarder) {
 		return -1;
 	}
 
 	cel_parking_forwarder = stasis_forward_all(
 		ast_parking_topic(),
-		cel_state_topic);
+		cel_aggregation_topic);
 	if (!cel_parking_forwarder) {
 		return -1;
 	}
 
-	cel_state_router = stasis_message_router_create(cel_state_topic);
+	cel_cel_forwarder = stasis_forward_all(
+		ast_cel_topic(),
+		cel_aggregation_topic);
+	if (!cel_cel_forwarder) {
+		return -1;
+	}
+
+	cel_state_router = stasis_message_router_create(cel_aggregation_topic);
 	if (!cel_state_router) {
 		return -1;
 	}
@@ -1503,6 +1566,11 @@
 	ret |= stasis_message_router_add(cel_state_router,
 		ast_parked_call_type(),
 		cel_parking_cb,
+		NULL);
+
+	ret |= stasis_message_router_add(cel_state_router,
+		cel_generic_type(),
+		cel_generic_cb,
 		NULL);
 
 	/* If somehow we failed to add any routes, just shut down the whole
@@ -1534,3 +1602,24 @@
 	return do_reload();
 }
 
+void ast_cel_publish_event(struct ast_channel *chan,
+	enum ast_cel_event_type event_type,
+	struct ast_json *blob)
+{
+	RAII_VAR(struct ast_channel_blob *, obj, NULL, ao2_cleanup);
+	RAII_VAR(struct ast_json *, cel_blob, NULL, ast_json_unref);
+	RAII_VAR(struct stasis_message *, message, NULL, ao2_cleanup);
+	cel_blob = ast_json_pack("{s: i, s: O}",
+		"event_type", event_type,
+		"event_details", blob);
+
+	message = ast_channel_blob_create(chan, cel_generic_type(), cel_blob);
+	if (message) {
+		stasis_publish(ast_cel_topic(), message);
+	}
+}
+
+struct stasis_topic *ast_cel_topic(void)
+{
+	return cel_topic;
+}

Modified: team/kharwell/stasis_aoc_event/main/config_options.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/stasis_aoc_event/main/config_options.c?view=diff&rev=392850&r1=392849&r2=392850
==============================================================================
--- team/kharwell/stasis_aoc_event/main/config_options.c (original)
+++ team/kharwell/stasis_aoc_event/main/config_options.c Tue Jun 25 09:38:28 2013
@@ -186,14 +186,15 @@
 				|| xmldoc_update_config_option(types, info->module, opt->name, type->name, opt->default_val, opt->match_type == ACO_REGEX, opt->type)
 #endif /* AST_XML_DOCS */
 		) {
-			while (--idx) {
+			do {
 				ao2_unlink(types[idx]->internal->opts, opt);
-			}
+			} while (--idx);
 			return -1;
 		}
-		/* The container should hold the only ref to opt */
-		ao2_ref(opt, -1);
-	}
+	}
+	/* The container(s) should hold the only ref to opt */
+	ao2_ref(opt, -1);
+
 	return 0;
 }
 

Modified: team/kharwell/stasis_aoc_event/main/devicestate.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/stasis_aoc_event/main/devicestate.c?view=diff&rev=392850&r1=392849&r2=392850
==============================================================================
--- team/kharwell/stasis_aoc_event/main/devicestate.c (original)
+++ team/kharwell/stasis_aoc_event/main/devicestate.c Tue Jun 25 09:38:28 2013
@@ -774,6 +774,7 @@
 
 static void devstate_cleanup(void)
 {
+	devstate_message_sub = stasis_unsubscribe_and_join(devstate_message_sub);
 	ao2_cleanup(device_state_topic_all);
 	device_state_topic_all = NULL;
 	device_state_topic_cached = stasis_caching_unsubscribe_and_join(device_state_topic_cached);

Modified: team/kharwell/stasis_aoc_event/main/features_config.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/stasis_aoc_event/main/features_config.c?view=diff&rev=392850&r1=392849&r2=392850
==============================================================================
--- team/kharwell/stasis_aoc_event/main/features_config.c (original)
+++ team/kharwell/stasis_aoc_event/main/features_config.c Tue Jun 25 09:38:28 2013
@@ -26,8 +26,248 @@
 #include "asterisk/app.h"
 #include "asterisk/cli.h"
 
-/* BUGBUG XML Documentation is still needed for configuration options */
 /*** DOCUMENTATION
+	<configInfo name="features" language="en_US">
+		<synopsis>Features Configuration</synopsis>
+		<configFile name="features.conf">
+			<configObject name="globals">
+				<synopsis>
+				</synopsis>
+				<configOption name="featuredigittimeout" default="1000">
+					<synopsis>Milliseconds allowed between digit presses when entering a feature code.</synopsis>
+				</configOption>
+				<configOption name="courtesytone">
+					<synopsis>Sound to play when automon or automixmon is activated</synopsis>
+				</configOption>
+				<configOption name="transferdigittimeout" default="3000">
+					<synopsis>Milliseconds allowed between digit presses when dialing a transfer destination</synopsis>
+				</configOption>
+				<configOption name="atxfernoanswertimeout" default="15000">
+					<synopsis>Milliseconds to wait for attended transfer destination to answer</synopsis>
+				</configOption>
+				<configOption name="atxferdropcall" default="no">
+					<synopsis>Hang up the call entirely if the attended transfer fails</synopsis>
+					<description>
+						<para>When this option is set to <literal>no</literal>, then Asterisk will attempt to
+						re-call the transferrer if the call to the transfer target fails. If the call to the
+						transferrer fails, then Asterisk will wait <replaceable>atxferloopdelay</replaceable>
+						milliseconds and then attempt to dial the transfer target again. This process will
+						repeat until <replaceable>atxfercallbackretries</replaceable> attempts to re-call
+						the transferrer have occurred.</para>
+						<para>When this option is set to <literal>yes</literal>, then Asterisk will not attempt
+						to re-call the transferrer if the call to the transfer target fails. Asterisk will instead
+						hang up all channels involved in the transfer.</para>
+					</description>
+				</configOption>
+				<configOption name="atxferloopdelay" default="10000">
+					<synopsis>Milliseconds to wait between attempts to re-dial transfer destination</synopsis>
+					<see-also><ref type="configOption">atxferdropcall</ref></see-also>
+				</configOption>
+				<configOption name="atxfercallbackretries" default="2">
+					<synopsis>Number of times to re-attempt dialing a transfer destination</synopsis>
+					<see-also><ref type="configOption">atxferdropcall</ref></see-also>
+				</configOption>
+				<configOption name="xfersound" default="beep">
+					<synopsis>Sound to play to during transfer and transfer-like operations.</synopsis>
+					<description>
+						<para>This sound will play to the transferrer and transfer target channels when
+						an attended transfer completes. This sound is also played to channels when performing
+						an AMI <literal>Bridge</literal> action.</para>
+					</description>
+				</configOption>
+				<configOption name="xferfailsound" default="beeperr">
+					<synopsis>Sound to play to a transferee when a transfer fails</synopsis>
+				</configOption>
+				<configOption name="atxferabort" default="*1">
+					<synopsis>Digits to dial to abort an attended transfer attempt</synopsis>
+					<description>
+						<para>This option is only available to the transferrer during an attended
+						transfer operation. Aborting a transfer results in the transfer being cancelled and
+						the original parties in the call being re-bridged.</para>
+					</description>
+				</configOption>
+				<configOption name="atxfercomplete" default="*2">
+					<synopsis>Digits to dial to complete an attended transfer</synopsis>
+					<description>
+						<para>This option is only available to the transferrer during an attended
+						transfer operation. Completing the transfer with a DTMF sequence is functionally
+						equivalent to hanging up the transferrer channel during an attended transfer. The
+						result is that the transfer target and transferees are bridged.</para>
+					</description>
+				</configOption>
+				<configOption name="atxferthreeway" default="*3">
+					<synopsis>Digits to dial to change an attended transfer into a three-way call</synopsis>
+					<description>
+						<para>This option is only available to the transferrer during an attended
+						transfer operation. Pressing this DTMF sequence will result in the transferrer,
+						the transferees, and the transfer target all being in a single bridge together.</para>
+					</description>
+				</configOption>
+				<configOption name="pickupexten" default="*8">
+					<synopsis>Digits used for picking up ringing calls</synopsis>
+					<description>
+						<para>In order for the pickup attempt to be successful, the party attempting to
+						pick up the call must either have a <replaceable>namedpickupgroup</replaceable> in
+						common with a ringing party's <replaceable>namedcallgroup</replaceable> or must
+						have a <replaceable>pickupgroup</replaceable> in common with a ringing party's
+						<replaceable>callgroup</replaceable>.</para>
+					</description>
+				</configOption>
+				<configOption name="pickupsound">
+					<synopsis>Sound to play to picker when a call is picked up</synopsis>
+				</configOption>
+				<configOption name="pickupfailsound">
+					<synopsis>Sound to play to picker when a call cannot be picked up</synopsis>
+				</configOption>
+			</configObject>
+			<configObject name="featuremap">
+				<synopsis>DTMF options that can be triggered during bridged calls</synopsis>
+				<configOption name="atxfer">
+					<synopsis>DTMF sequence to initiate an attended transfer</synopsis>
+					<description>
+						<para>The transferee parties will be placed on hold and the
+						transferrer may dial an extension to reach a transfer target. During an
+						attended transfer, the transferrer may consult with the transfer target
+						before completing the transfer. Once the transferrer has hung up or pressed
+						the <replaceable>atxfercomplete</replaceable> DTMF sequence, then the transferees
+						and transfer target will be bridged.</para>
+					</description>
+				</configOption>
+				<configOption name="blindxfer" default="#">
+					<synopsis>DTMF sequence to initiate a blind transfer</synopsis>
+					<description>
+						<para>The transferee parties will be placed on hold and the
+						transferrer may dial an extension to reach a transfer target. During a
+						blind transfer, as soon as the transfer target is dialed, the transferrer
+						is hung up.</para>
+					</description>
+				</configOption>
+				<configOption name="disconnect" default="*">
+					<synopsis>DTMF sequence to disconnect the current call</synopsis>
+					<description>
+						<para>Entering this DTMF sequence will cause the bridge to end, no
+						matter the number of parties present</para>
+					</description>
+				</configOption>
+				<configOption name="parkcall">
+					<synopsis>DTMF sequence to park a call</synopsis>
+					<description>
+						<para>The parking lot used to park the call is determined by using either the
+						<replaceable>PARKINGLOT</replaceable> channel variable or a configured value on
+						the channel (provided by the channel driver) if the variable is not present. If
+						no configured value on the channel is present, then <literal>"default"</literal>
+						is used. The call is parked in the next available space in the parking lot.</para>
+					</description>
+				</configOption>
+				<configOption name="automon">
+					<synopsis>DTMF sequence to start or stop monitoring a call</synopsis>
+					<description>
+						<para>This will cause the channel that pressed the DTMF sequence
+						to be monitored by the <literal>Monitor</literal> application. The
+						format for the recording is determined by the <replaceable>TOUCH_MONITOR_FORMAT</replaceable>
+						channel variable. If this variable is not specified, then <literal>wav</literal> is the
+						default. The filename is constructed in the following manner:</para>
+							
+						<para>    prefix-timestamp-filename</para>
+
+						<para>where prefix is either the value of the <replaceable>TOUCH_MONITOR_PREFIX</replaceable>
+						channel variable or <literal>auto</literal> if the variable is not set. The timestamp
+						is a UNIX timestamp. The filename is either the value of the <replaceable>TOUCH_MONITOR</replaceable>
+						channel variable or the callerID of the channels if the variable is not set.</para>
+					</description>
+				</configOption>
+				<configOption name="automixmon">
+					<synopsis>DTMF sequence to start or stop mixmonitoring a call </synopsis>
+					<description>
+						<para>Operation of the automixmon is similar to the <literal> automon </literal>
+						feature, with the following exceptions:
+							<replaceable>TOUCH_MIXMONITOR</replaceable> is used in place of <replaceable>TOUCH_MONITOR</replaceable>
+							<replaceable>TOUCH_MIXMONITOR_FORMAT</replaceable> is used in place of <replaceable>TOUCH_MIXMONITOR</replaceable>
+							There is no equivalent for <replaceable>TOUCH_MONITOR_PREFIX</replaceable>. <literal>"auto"</literal> is always how the filename begins.</para>
+					</description>
+					<see-also><ref type="configOption">automon</ref></see-also>
+				</configOption>
+			</configObject>
+			<configObject name="applicationmap">
+				<synopsis>Section for defining custom feature invocations during a call</synopsis>
+				<description>
+					<para>The applicationmap is an area where new custom features can be created. Items
+					defined in the applicationmap are not automatically accessible to bridged parties. Access
+					to the individual items is controled using the <replaceable>DYNAMIC_FEATURES</replaceable> channel variable.
+					The <replaceable>DYNAMIC_FEATURES</replaceable> is a <literal>#</literal> separated list of
+					either applicationmap item names or featuregroup names.</para>
+				</description>
+				<configOption name="^.*$" regex="true">
+					<synopsis>A custom feature to invoke during a bridged call</synopsis>
+					<description>
+						<para>Each item listed here is a comma-separated list of parameters that determine
+						how a feature may be invoked during a call</para>
+						<para>    Example:</para>
+						<para>    eggs = *5,self,Playback(hello-world),default</para>
+						<para>This would create a feature called <literal>eggs</literal> that could be invoked
+						during a call by pressing the <literal>*5</literal>. The party that presses the DTMF
+						sequence would then trigger the <literal>Playback</literal> application to play the
+						<literal>hello-world</literal> file. The application invocation would happen on the
+						party that pressed the DTMF sequence since <literal>self</literal> is specified. The
+						other parties in the bridge would hear the <literal>default</literal> music on hold
+						class during the playback.</para>
+						<para>In addition to the syntax outlined in this documentation, a backwards-compatible alternative
+						is also allowed. The following applicationmap lines are functionally identical:</para>
+						<para>    eggs = *5,self,Playback(hello-world),default</para>

[... 840 lines stripped ...]



More information about the asterisk-commits mailing list