[asterisk-commits] branch oej/metermaids-trunk r35990 - /team/oej/metermaids-trunk/res/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Jun 26 01:41:15 MST 2006


Author: oej
Date: Mon Jun 26 03:41:14 2006
New Revision: 35990

URL: http://svn.digium.com/view/asterisk?rev=35990&view=rev
Log:
- Add check if PARKINGEXT exists

Modified:
    team/oej/metermaids-trunk/res/res_features.c

Modified: team/oej/metermaids-trunk/res/res_features.c
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids-trunk/res/res_features.c?rev=35990&r1=35989&r2=35990&view=diff
==============================================================================
--- team/oej/metermaids-trunk/res/res_features.c (original)
+++ team/oej/metermaids-trunk/res/res_features.c Mon Jun 26 03:41:14 2006
@@ -75,18 +75,6 @@
 
 #define AST_MAX_WATCHERS 256
 
-/*! \brief List of meter maids (parking lot watchers) */
-struct features_parkwatch {
-        void (*callback)(const char *exten, const char *context);        /*!< Callback for notification */
-        int id;                                               /*!< Meter maid ID */
-        char *context;                                        /*!< Watched context */
-        struct features_parkwatch *next;                      /*!< Next in this simple list */
-};
-
-/*! Metermaid ID */
-struct features_parkwatch *metermaids;
-int metermaidid = 0;
-
 static char *parkedcall = "ParkedCall";
 
 static int parkaddhints = 0;                               /*!< Add parking hints automatically */
@@ -278,83 +266,13 @@
 	return adsi_print(chan, message, justify, 1);
 }
 
-/*! \brief Add parking watcher (metermaid) to list. These will be notified when we create
- 	or remove parking extensions in the dial plan 
- */
-int ast_park_metermaid_add(void (*maid)(const char *exten, const char *context), const char *context)
-{
-	struct features_parkwatch *newmaid;
-	struct features_parkwatch *maids = metermaids;
-
-	newmaid = ast_calloc(1, sizeof(struct features_parkwatch));
-	if (!newmaid) {
-		ast_log(LOG_ERROR, "Can't allocate parking watcher, out of memory.\n");
-		return -1;
-	}
-
-	/* Spool till end of list */
-	while(maids && maids->next)
-		maids = maids->next;
-
-	newmaid->callback = maid;
-	if (context)
-		newmaid->context = strdup(context);
-	newmaid->id = metermaidid;
-
-	/* Generate new ID */
-	metermaidid++;
-
-	/* Link the new object to the list */
-	if (maids)
-		maids->next = newmaid;
-	else
-		metermaids = newmaid;
-	if (option_debug > 1)
-		ast_log(LOG_DEBUG, "Added metermaid # %d\n", metermaidid);
-	return metermaidid;
-}
-
-/*! \brief Remove parking watcher */
-int ast_park_metermaid_remove(int id)
-{
-	struct features_parkwatch *maids = metermaids;
-	struct features_parkwatch *prev = NULL;
-	struct features_parkwatch *kill = NULL;
-
-	while (maids && !kill) {
-		if (maids->id == id) {
-			if (prev)
-				prev->next = maids->next;
-			else
-				metermaids = maids->next;
-			kill = maids;
-		}
-		prev = maids;
-		maids = maids->next;
-	}
-	if (!kill)
-		return -1;		/* Did not find id */
-	if (kill->context)
-		free(kill->context);
-	free(kill);
-	return 0;
-}
-
 /*! \brief Notify metermaids that we've changed an extension */
 static void notify_metermaids(char *exten, char *context)
 {
-	struct features_parkwatch *maid = metermaids;
-	if (!maid)
-		return;
-	while (maid) {
-		if (!maid->context || !strcmp(context, maid->context))
-			maid->callback(exten, context);
-		maid = maid->next;
-	}
 	if (option_debug > 3)
 		ast_log(LOG_DEBUG, "Notification of state change to metermaids %s@%s\n", exten, context);
 
-	/* New system */
+	/* Send notification to devicestate subsystem */
 	ast_device_state_changed("park:%s@%s", exten, context);
 	return;
 }



More information about the asterisk-commits mailing list