[asterisk-commits] branch oej/metermaids-trunk r34910 - in /team/oej/metermaids-trunk: channels/...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Jun 19 13:23:43 MST 2006


Author: oej
Date: Mon Jun 19 15:23:43 2006
New Revision: 34910

URL: http://svn.digium.com/view/asterisk?rev=34910&view=rev
Log:
Moving metermaids fully into res_features (as requested by kpfleming)

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

Modified: team/oej/metermaids-trunk/channels/chan_local.c
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids-trunk/channels/chan_local.c?rev=34910&r1=34909&r2=34910&view=diff
==============================================================================
--- team/oej/metermaids-trunk/channels/chan_local.c (original)
+++ team/oej/metermaids-trunk/channels/chan_local.c Mon Jun 19 15:23:43 2006
@@ -65,8 +65,6 @@
 
 static const char tdesc[] = "Local Proxy Channel Driver";
 
-static int watchid;	/* Metermaid watcher ID assigned by res_features */
-
 #define IS_OUTBOUND(a,b) (a == b->chan ? 1 : 0)
 
 static struct ast_channel *local_request(const char *type, int format, void *data, int *cause);
@@ -119,14 +117,6 @@
 };
 
 static AST_LIST_HEAD_STATIC(locals, local_pvt);
-
-/*! \brief Watcher callback for extension state changes in res_features */
-void local_watcher(char *exten, char *context) {
-	if (option_debug > 1)
-		ast_log(LOG_DEBUG, "Got notification of state change for %s@%s\n", exten, context);
-	ast_device_state_changed("local/%s@%s", exten, context);
-	return;
-}
 
 /*! \brief Adds devicestate to local channels */
 static int local_devicestate(void *data)
@@ -631,7 +621,6 @@
 	}
 
 	/* Register watcher for parking lots in res_features */
-	watchid = ast_park_metermaid_add(&local_watcher, NULL);
 	ast_cli_register(&cli_show_locals);
 	return 0;
 }
@@ -643,7 +632,6 @@
 
 	/* First, take us out of the channel loop */
 	ast_cli_unregister(&cli_show_locals);
-	ast_park_metermaid_remove(watchid);
 	ast_channel_unregister(&local_tech);
 	if (!AST_LIST_LOCK(&locals)) {
 		/* Hangup all interfaces if they have an owner */

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=34910&r1=34909&r2=34910&view=diff
==============================================================================
--- team/oej/metermaids-trunk/res/res_features.c (original)
+++ team/oej/metermaids-trunk/res/res_features.c Mon Jun 19 15:23:43 2006
@@ -76,23 +76,24 @@
 
 static char *parkedcall = "ParkedCall";
 
-static int parkingtime = DEFAULT_PARK_TIME; 		/*!< No more than 45 seconds parked before you do something with them */
-static char parking_con[AST_MAX_EXTENSION];		/*!< Context for which parking is made accessible */
-static char parking_con_dial[AST_MAX_EXTENSION];	/*!< Context for dialback for parking (KLUDGE) */
-static char parking_ext[AST_MAX_EXTENSION];		/*!< Extension you type to park the call */
-static char pickup_ext[AST_MAX_EXTENSION];		/*!< Call pickup extension */
-static int parking_start;				/*!< First available extension for parking */
-static int parking_stop;				/*!< Last available extension for parking */
-
-static char courtesytone[256];				/*!< Courtesy tone */
-static int parkedplay = 0;				/*!< Who to play the courtesy tone to */
-static char xfersound[256];				/*!< Call transfer sound */
-static char xferfailsound[256];				/*!< Call transfer failure sound */
+static int parkingtime = DEFAULT_PARK_TIME;                /*!< No more than 45 seconds parked before you do something with them */
+static char parking_con[AST_MAX_EXTENSION];                /*!< Context for which parking is made accessible */
+static char parking_con_dial[AST_MAX_EXTENSION];           /*!< Context for dialback for parking (KLUDGE) */
+static char parking_ext[AST_MAX_EXTENSION];                /*!< Extension you type to park the call */
+static char pickup_ext[AST_MAX_EXTENSION];                 /*!< Call pickup extension */
+static int parking_start;                                  /*!< First available extension for parking */
+static int parking_stop;                                   /*!< Last available extension for parking */
+
+static char courtesytone[256];                             /*!< Courtesy tone */
+static int parkedplay = 0;                                 /*!< Who to play the courtesy tone to */
+static char xfersound[256];                                /*!< Call transfer sound */
+static char xferfailsound[256];				   /*!< Call transfer failure sound */
 
 static int parking_offset;
 static int parkfindnext;
 
 static int adsipark;
+static int watchid;                                        /*!< Metermaid watcher ID */
 
 static int transferdigittimeout;
 static int featuredigittimeout;
@@ -1960,6 +1961,15 @@
 	}
 	return res;
 }
+
+/*! \brief Watcher callback for extension state changes (metermaids) */
+void local_watcher(char *exten, char *context) {
+	if (option_debug > 1)
+		ast_log(LOG_DEBUG, "Got notification of state change for %s@%s\n", exten, context);
+	ast_device_state_changed("local/%s@%s", exten, context);
+	return;
+}
+
 
 static int load_config(void) 
 {
@@ -2171,6 +2181,10 @@
 		ast_manager_register2("Park", EVENT_FLAG_CALL, manager_park,
 			"Park a channel", mandescr_park); 
 	}
+
+	/* Register watcher for parking lots */
+        watchid = ast_park_metermaid_add(&local_watcher, NULL);
+
 	return res;
 }
 
@@ -2181,6 +2195,7 @@
 
 	ast_manager_unregister("ParkedCalls");
 	ast_manager_unregister("Park");
+	ast_park_metermaid_remove(watchid);
 	ast_cli_unregister(&showfeatures);
 	ast_cli_unregister(&showparked);
 	ast_unregister_application(parkcall);



More information about the asterisk-commits mailing list