[svn-commits] russell: branch russell/events r103657 - in /team/russell/events: configs/ in...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Feb 13 09:32:01 CST 2008


Author: russell
Date: Wed Feb 13 09:32:00 2008
New Revision: 103657

URL: http://svn.digium.com/view/asterisk?view=rev&rev=103657
Log:
 - Enable device state as a supported event type in res_ais
 - update res_ais for API changes to let it compile again

Modified:
    team/russell/events/configs/ais.conf.sample
    team/russell/events/include/asterisk/utils.h
    team/russell/events/main/netsock.c
    team/russell/events/res/ais/clm.c
    team/russell/events/res/ais/evt.c
    team/russell/events/res/ais/lck.c
    team/russell/events/res/res_eventtest.c

Modified: team/russell/events/configs/ais.conf.sample
URL: http://svn.digium.com/view/asterisk/team/russell/events/configs/ais.conf.sample?view=diff&rev=103657&r1=103656&r2=103657
==============================================================================
--- team/russell/events/configs/ais.conf.sample (original)
+++ team/russell/events/configs/ais.conf.sample Wed Feb 13 09:32:00 2008
@@ -38,7 +38,7 @@
 ; from other nodes in the event channel by using the subscribe_event directive.
 ;    subscribe_event=mwi
 ;
-; Supported event types include: mwi
+; Supported event types include: mwi, device_state
 ;
 
 ;

Modified: team/russell/events/include/asterisk/utils.h
URL: http://svn.digium.com/view/asterisk/team/russell/events/include/asterisk/utils.h?view=diff&rev=103657&r1=103656&r2=103657
==============================================================================
--- team/russell/events/include/asterisk/utils.h (original)
+++ team/russell/events/include/asterisk/utils.h Wed Feb 13 09:32:00 2008
@@ -672,6 +672,6 @@
 
 int ast_str_to_eid(struct ast_eid *eid, const char *s);
 
-int ast_eid_cmp(struct ast_eid *eid1, struct ast_eid *eid2);
+int ast_eid_cmp(const struct ast_eid *eid1, const struct ast_eid *eid2);
 
 #endif /* _ASTERISK_UTILS_H */

Modified: team/russell/events/main/netsock.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/main/netsock.c?view=diff&rev=103657&r1=103656&r2=103657
==============================================================================
--- team/russell/events/main/netsock.c (original)
+++ team/russell/events/main/netsock.c Wed Feb 13 09:32:00 2008
@@ -286,7 +286,7 @@
 	return 0;
 }
 
-int ast_eid_cmp(struct ast_eid *eid1, struct ast_eid *eid2)
+int ast_eid_cmp(const struct ast_eid *eid1, const struct ast_eid *eid2)
 {
 	return memcmp(eid1, eid2, sizeof(*eid1));
 }

Modified: team/russell/events/res/ais/clm.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/res/ais/clm.c?view=diff&rev=103657&r1=103656&r2=103657
==============================================================================
--- team/russell/events/res/ais/clm.c (original)
+++ team/russell/events/res/ais/clm.c Wed Feb 13 09:32:00 2008
@@ -129,7 +129,7 @@
 }
 
 static struct ast_cli_entry ais_cli[] = {
-	NEW_CLI(ais_clm_show_members, "List current members of the cluster"),
+	AST_CLI_DEFINE(ais_clm_show_members, "List current members of the cluster"),
 };
 
 int ast_ais_clm_load_module(void)

Modified: team/russell/events/res/ais/evt.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/res/ais/evt.c?view=diff&rev=103657&r1=103656&r2=103657
==============================================================================
--- team/russell/events/res/ais/evt.c (original)
+++ team/russell/events/res/ais/evt.c Wed Feb 13 09:32:00 2008
@@ -64,15 +64,12 @@
 	const char *str;
 	enum ast_event_type type;
 } supported_event_types[] = {
-	{ "mwi", AST_EVENT_MWI },	
+	{ "mwi", AST_EVENT_MWI },
+	{ "device_state", AST_EVENT_DEVICE_STATE_CHANGE },
 };
 
 /*! Used to provide unique id's to egress subscriptions */
 static int unique_id;
-
-/*! \brief This server's unique entity ID */
-static struct ast_eid g_eid;
-static char g_eid_str[32];
 
 struct subscribe_event {
 	AST_LIST_ENTRY(subscribe_event) entry;
@@ -109,6 +106,8 @@
 
 static void queue_event(struct ast_event *ast_event)
 {
+	enum ast_event_type type;
+
 	/*! 
 	 * \todo This hack macks me sad.  I need to come up with a better way to
 	 *       figure out whether an event should be cached or not, and what
@@ -120,10 +119,17 @@
 	 *       have it be the job of the event publishers.
 	 */
 
-	if (ast_event_get_type(ast_event) == AST_EVENT_MWI) {
+	type = ast_event_get_type(ast_event);
+
+	if (type == AST_EVENT_MWI) {
 		ast_event_queue_and_cache(ast_event,
 			AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR,
 			AST_EVENT_IE_CONTEXT, AST_EVENT_IE_PLTYPE_STR,
+			AST_EVENT_IE_END);
+	} else if (type == AST_EVENT_DEVICE_STATE_CHANGE) {
+		ast_event_queue_and_cache(ast_event,
+			AST_EVENT_IE_DEVICE, AST_EVENT_IE_PLTYPE_STR,
+			AST_EVENT_IE_EID, AST_EVENT_IE_PLTYPE_RAW,
 			AST_EVENT_IE_END);
 	} else {
 		ast_event_queue(ast_event);
@@ -309,7 +315,7 @@
 }
 
 static struct ast_cli_entry ais_cli[] = {
-	NEW_CLI(ais_evt_show_event_channels, "Show configured event channels"),
+	AST_CLI_DEFINE(ais_evt_show_event_channels, "Show configured event channels"),
 };
 
 static void add_publish_event(struct event_channel *event_channel, const char *event_type)
@@ -546,8 +552,6 @@
 {
 	SaAisErrorT ais_res;
 
-	ast_eid_to_str(g_eid_str, sizeof(g_eid_str), &g_eid);
-
 	ais_res = saEvtInitialize(&evt_handle, &evt_callbacks, &ais_version);
 	if (ais_res != SA_AIS_OK) {
 		ast_log(LOG_ERROR, "Could not initialize eventing service: %s\n",

Modified: team/russell/events/res/ais/lck.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/res/ais/lck.c?view=diff&rev=103657&r1=103656&r2=103657
==============================================================================
--- team/russell/events/res/ais/lck.c (original)
+++ team/russell/events/res/ais/lck.c Wed Feb 13 09:32:00 2008
@@ -48,6 +48,7 @@
 #include "asterisk/app.h"
 #include "asterisk/astobj2.h"
 #include "asterisk/strings.h"
+#include "asterisk/channel.h"
 
 SaLckHandleT lck_handle;
 

Modified: team/russell/events/res/res_eventtest.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/res/res_eventtest.c?view=diff&rev=103657&r1=103656&r2=103657
==============================================================================
--- team/russell/events/res/res_eventtest.c (original)
+++ team/russell/events/res/res_eventtest.c Wed Feb 13 09:32:00 2008
@@ -156,8 +156,8 @@
 }
 
 static struct ast_cli_entry cli_commands[] = {
-	NEW_CLI(event_gen, "Generate a test event"),
-	NEW_CLI(event_get_cached, "Get an event from the cache"),
+	AST_CLI_DEFINE(event_gen, "Generate a test event"),
+	AST_CLI_DEFINE(event_get_cached, "Get an event from the cache"),
 };
 
 static int load_module(void)




More information about the svn-commits mailing list