[asterisk-commits] russell: branch russell/events r73887 - /team/russell/events/res/res_features.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Jul 8 08:27:21 CDT 2007


Author: russell
Date: Sun Jul  8 08:27:21 2007
New Revision: 73887

URL: http://svn.digium.com/view/asterisk?view=rev&rev=73887
Log:
change the metermaids to include the state when indicating that the state changed

Modified:
    team/russell/events/res/res_features.c

Modified: team/russell/events/res/res_features.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/res/res_features.c?view=diff&rev=73887&r1=73886&r2=73887
==============================================================================
--- team/russell/events/res/res_features.c (original)
+++ team/russell/events/res/res_features.c Sun Jul  8 08:27:21 2007
@@ -322,13 +322,12 @@
 }
 
 /*! \brief Notify metermaids that we've changed an extension */
-static void notify_metermaids(const char *exten, char *context)
-{
-	ast_debug(4, "Notification of state change to metermaids %s@%s\n", exten, context);
-
-	/* Send notification to devicestate subsystem */
-	ast_device_state_changed("park:%s@%s", exten, context);
-	return;
+static void notify_metermaids(const char *exten, char *context, enum ast_device_state state)
+{
+	ast_debug(4, "Notification of state change to metermaids %s@%s\n to state '%s'", 
+		exten, context, devstate2str(state));
+
+	ast_devstate_changed(state, "park:%s@%s", exten, context);
 }
 
 /*! \brief metermaids callback from devicestate.c */
@@ -473,7 +472,7 @@
 		ast_say_digits(peer, pu->parkingnum, "", peer->language);
 	if (con) {
 		if (!ast_add_extension2(con, 1, pu->parkingexten, 1, NULL, NULL, parkedcall, ast_strdup(pu->parkingexten), ast_free, registrar))
-			notify_metermaids(pu->parkingexten, parking_con);
+			notify_metermaids(pu->parkingexten, parking_con, AST_DEVICE_INUSE);
 	}
 	if (pu->notquiteyet) {
 		/* Wake up parking thread if we're really done */
@@ -1986,7 +1985,7 @@
 					if (ast_context_remove_extension2(con, pt->parkingexten, 1, NULL))
 						ast_log(LOG_WARNING, "Whoa, failed to remove the extension!\n");
 					else
-						notify_metermaids(pt->parkingexten, parking_con);
+						notify_metermaids(pt->parkingexten, parking_con, AST_DEVICE_NOT_INUSE);
 				} else
 					ast_log(LOG_WARNING, "Whoa, no parking context?\n");
 				ast_free(pt);
@@ -2026,7 +2025,7 @@
 							if (ast_context_remove_extension2(con, pt->parkingexten, 1, NULL))
 								ast_log(LOG_WARNING, "Whoa, failed to remove the extension!\n");
 							else
-								notify_metermaids(pt->parkingexten, parking_con);
+								notify_metermaids(pt->parkingexten, parking_con, AST_DEVICE_NOT_INUSE);
 						} else
 							ast_log(LOG_WARNING, "Whoa, no parking context?\n");
 						ast_free(pt);
@@ -2145,7 +2144,7 @@
 			if (ast_context_remove_extension2(con, pu->parkingexten, 1, NULL))
 				ast_log(LOG_WARNING, "Whoa, failed to remove the extension!\n");
 			else
-				notify_metermaids(pu->parkingexten, parking_con);
+				notify_metermaids(pu->parkingexten, parking_con, AST_DEVICE_NOT_INUSE);
 		} else
 			ast_log(LOG_WARNING, "Whoa, no parking context?\n");
 
@@ -2880,7 +2879,7 @@
 	/* Remove the old parking extension */
 	if (!ast_strlen_zero(old_parking_con) && (con = ast_context_find(old_parking_con)))	{
 		if(ast_context_remove_extension2(con, old_parking_ext, 1, registrar))
-				notify_metermaids(old_parking_ext, old_parking_con);
+				notify_metermaids(old_parking_ext, old_parking_con, AST_DEVICE_NOT_INUSE);
 		ast_debug(1, "Removed old parking extension %s@%s\n", old_parking_ext, old_parking_con);
 	}
 	
@@ -2892,7 +2891,7 @@
 	if (parkaddhints)
 		park_add_hints(parking_con, parking_start, parking_stop);
 	if (!res)
-		notify_metermaids(ast_parking_ext(), parking_con);
+		notify_metermaids(ast_parking_ext(), parking_con, AST_DEVICE_INUSE);
 	return res;
 
 }




More information about the asterisk-commits mailing list