[asterisk-commits] kmoore: branch kmoore/channel_event_refactor r392843 - in /team/kmoore/channe...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jun 25 08:29:16 CDT 2013


Author: kmoore
Date: Tue Jun 25 08:29:13 2013
New Revision: 392843

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=392843
Log:
Resolve merge conflict

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

Propchange: team/kmoore/channel_event_refactor/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/kmoore/channel_event_refactor/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.

Propchange: team/kmoore/channel_event_refactor/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Jun 25 08:29:13 2013
@@ -1,1 +1,1 @@
-/trunk:1-392705
+/trunk:1-392830

Modified: team/kmoore/channel_event_refactor/apps/app_celgenuserevent.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/channel_event_refactor/apps/app_celgenuserevent.c?view=diff&rev=392843&r1=392842&r2=392843
==============================================================================
--- team/kmoore/channel_event_refactor/apps/app_celgenuserevent.c (original)
+++ team/kmoore/channel_event_refactor/apps/app_celgenuserevent.c Tue Jun 25 08:29:13 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/kmoore/channel_event_refactor/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/channel_event_refactor/apps/app_dial.c?view=diff&rev=392843&r1=392842&r2=392843
==============================================================================
--- team/kmoore/channel_event_refactor/apps/app_dial.c (original)
+++ team/kmoore/channel_event_refactor/apps/app_dial.c Tue Jun 25 08:29:13 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/kmoore/channel_event_refactor/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/channel_event_refactor/apps/app_queue.c?view=diff&rev=392843&r1=392842&r2=392843
==============================================================================
--- team/kmoore/channel_event_refactor/apps/app_queue.c (original)
+++ team/kmoore/channel_event_refactor/apps/app_queue.c Tue Jun 25 08:29:13 2013
@@ -4432,8 +4432,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);
@@ -4527,7 +4525,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/kmoore/channel_event_refactor/apps/app_stasis.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/channel_event_refactor/apps/app_stasis.c?view=diff&rev=392843&r1=392842&r2=392843
==============================================================================
--- team/kmoore/channel_event_refactor/apps/app_stasis.c (original)
+++ team/kmoore/channel_event_refactor/apps/app_stasis.c Tue Jun 25 08:29:13 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/kmoore/channel_event_refactor/channels/chan_motif.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/channel_event_refactor/channels/chan_motif.c?view=diff&rev=392843&r1=392842&r2=392843
==============================================================================
--- team/kmoore/channel_event_refactor/channels/chan_motif.c (original)
+++ team/kmoore/channel_event_refactor/channels/chan_motif.c Tue Jun 25 08:29:13 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/kmoore/channel_event_refactor/doc/appdocsxml.dtd
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/channel_event_refactor/doc/appdocsxml.dtd?view=diff&rev=392843&r1=392842&r2=392843
==============================================================================
--- team/kmoore/channel_event_refactor/doc/appdocsxml.dtd (original)
+++ team/kmoore/channel_event_refactor/doc/appdocsxml.dtd Tue Jun 25 08:29:13 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/kmoore/channel_event_refactor/include/asterisk/cel.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/channel_event_refactor/include/asterisk/cel.h?view=diff&rev=392843&r1=392842&r2=392843
==============================================================================
--- team/kmoore/channel_event_refactor/include/asterisk/cel.h (original)
+++ team/kmoore/channel_event_refactor/include/asterisk/cel.h Tue Jun 25 08:29:13 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/kmoore/channel_event_refactor/include/asterisk/stasis_channels.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/channel_event_refactor/include/asterisk/stasis_channels.h?view=diff&rev=392843&r1=392842&r2=392843
==============================================================================
--- team/kmoore/channel_event_refactor/include/asterisk/stasis_channels.h (original)
+++ team/kmoore/channel_event_refactor/include/asterisk/stasis_channels.h Tue Jun 25 08:29:13 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/kmoore/channel_event_refactor/main/cdr.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/channel_event_refactor/main/cdr.c?view=diff&rev=392843&r1=392842&r2=392843
==============================================================================
--- team/kmoore/channel_event_refactor/main/cdr.c (original)
+++ team/kmoore/channel_event_refactor/main/cdr.c Tue Jun 25 08:29:13 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/kmoore/channel_event_refactor/main/cel.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/channel_event_refactor/main/cel.c?view=diff&rev=392843&r1=392842&r2=392843
==============================================================================
--- team/kmoore/channel_event_refactor/main/cel.c (original)
+++ team/kmoore/channel_event_refactor/main/cel.c Tue Jun 25 08:29:13 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/kmoore/channel_event_refactor/main/config_options.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/channel_event_refactor/main/config_options.c?view=diff&rev=392843&r1=392842&r2=392843
==============================================================================
--- team/kmoore/channel_event_refactor/main/config_options.c (original)
+++ team/kmoore/channel_event_refactor/main/config_options.c Tue Jun 25 08:29:13 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/kmoore/channel_event_refactor/main/devicestate.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/channel_event_refactor/main/devicestate.c?view=diff&rev=392843&r1=392842&r2=392843
==============================================================================
--- team/kmoore/channel_event_refactor/main/devicestate.c (original)
+++ team/kmoore/channel_event_refactor/main/devicestate.c Tue Jun 25 08:29:13 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/kmoore/channel_event_refactor/main/features_config.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/channel_event_refactor/main/features_config.c?view=diff&rev=392843&r1=392842&r2=392843
==============================================================================
--- team/kmoore/channel_event_refactor/main/features_config.c (original)
+++ team/kmoore/channel_event_refactor/main/features_config.c Tue Jun 25 08:29:13 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>
+						<para>    eggs = *5,self,Playback,hello-world,default</para>
+						<para>    eggs = *5,self,Playback,"hello-world",default</para>
+					</description>
+					<syntax argsep=",">
+						<parameter name="dtmf" required="true">
+							<para>The DTMF sequence used to trigger the option</para>
+						</parameter>
+						<parameter name="activate_on" required="true">
+							<para>The party that the feature will be invoked on</para>
+							<optionlist>
+								<option name="self"><para>Feature is invoked on party that presses the DTMF sequence</para></option>
+								<option name="peer"><para>Feature is invoked on other parties in the bridge</para></option>
+							</optionlist>
+						</parameter>
+						<parameter name="app" required="true">
+							<para>The dialplan application to run when the DTMF sequence is pressed</para>
+							<argument name="app_args" required="false">
+								<para>The arguments to the dialplan application to run</para>
+							</argument>
+						</parameter>
+						<parameter name="moh_class" required="false">
+							<para>Music on hold class to play to bridge participants that are not the target of the application invocation</para>
+						</parameter>
+					</syntax>
+				</configOption>
+			</configObject>
+			<configObject name="featuregroup">
+				<synopsis>Groupings of items from the applicationmap</synopsis>
+				<description>
+					<para>Feature groups allow for multiple applicationmap items to be
+					grouped together. Like with individual applicationmap items, feature groups
+					can be part of the <replaceable>DYNAMIC_FEATURES</replaceable> channel variable.
+					In addition to creating groupings, the feature group section allows for the
+					DTMF sequence used to invoke an applicationmap item to be overridden with
+					a different sequence.</para>
+				</description>
+				<configOption name="^.*$" regex="true">
+					<synopsis>Applicationmap item to place in the feature group</synopsis>
+					<description>
+						<para>Each item here must be a name of an item in the applicationmap. The
+						argument may either be a new DTMF sequence to use for the item or it
+						may be left blank in order to use the DTMF sequence specified in the
+						applicationmap. For example:</para>
+						<para>	eggs => *1</para>
+						<para>	bacon =></para>
+						<para>would result in the applicationmap items <literal>eggs</literal> and
+						<literal>bacon</literal> being in the featuregroup. The former would have its
+						default DTMF trigger overridden with <literal>*1</literal> and the latter would
+						have the DTMF value specified in the applicationmap.</para>
+					</description>
+				</configOption>
+			</configObject>
+		</configFile>
+	</configInfo>
 	<function name="FEATURE" language="en_US">
 		<synopsis>
 			Get or set a feature option on a channel.
@@ -37,21 +277,21 @@
 				<para>The allowed values are:</para>
 				<enumlist>
 					<enum name="inherit"><para>Inherit feature settings made in FEATURE or FEATUREMAP to child channels.</para></enum>
-					<enum name="featuredigittimeout"><para>Milliseconds allowed between digits when entering a feature code.</para></enum>
-					<enum name="transferdigittimeout"><para>Milliseconds allowed between digits when dialing a transfer destination</para></enum>
-					<enum name="atxfernoanswertimeout"><para>Milliseconds to wait for transfer destination to answer</para></enum>
-					<enum name="atxferdropcall"><para>Hang up the call entirely if the attended transfer fails</para></enum>
-					<enum name="atxferloopdelay"><para>Milliseconds to wait between attempts to re-dial transfer destination</para></enum>

[... 774 lines stripped ...]



More information about the asterisk-commits mailing list