[asterisk-commits] irroot: trunk r322111 - /trunk/apps/app_queue.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Jun 6 14:31:01 CDT 2011
Author: irroot
Date: Mon Jun 6 14:30:56 2011
New Revision: 322111
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=322111
Log:
Refactor rt_handle_member_record
Review: https://reviewboard.asterisk.org/r/1172
Modified:
trunk/apps/app_queue.c
Modified: trunk/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_queue.c?view=diff&rev=322111&r1=322110&r2=322111
==============================================================================
--- trunk/apps/app_queue.c (original)
+++ trunk/apps/app_queue.c Mon Jun 6 14:30:56 2011
@@ -2072,15 +2072,22 @@
* \brief Find rt member record to update otherwise create one.
*
* Search for member in queue, if found update penalty/paused state,
- * if no member exists create one flag it as a RT member and add to queue member list.
+ * if no member exists create one flag it as a RT member and add to queue member list.
*/
-static void rt_handle_member_record(struct call_queue *q, char *interface, const char *rt_uniqueid, const char *membername, const char *penalty_str, const char *paused_str, const char* state_interface)
+static void rt_handle_member_record(struct call_queue *q, char *interface, struct ast_config *member_config)
{
struct member *m;
struct ao2_iterator mem_iter;
int penalty = 0;
int paused = 0;
int found = 0;
+
+ const char *config_val;
+ const char *rt_uniqueid = ast_variable_retrieve(member_config, interface, "uniqueid");
+ const char *membername = S_OR(ast_variable_retrieve(member_config, interface, "membername"), interface);
+ const char *state_interface = S_OR(ast_variable_retrieve(member_config, interface, "state_interface"), interface);
+ const char *penalty_str = ast_variable_retrieve(member_config, interface, "penalty");
+ const char *paused_str = ast_variable_retrieve(member_config, interface, "paused");
if (ast_strlen_zero(rt_uniqueid)) {
ast_log(LOG_WARNING, "Realtime field uniqueid is empty for member %s\n", S_OR(membername, "NULL"));
@@ -2299,12 +2306,7 @@
ao2_iterator_destroy(&mem_iter);
while ((interface = ast_category_browse(member_config, interface))) {
- rt_handle_member_record(q, interface,
- ast_variable_retrieve(member_config, interface, "uniqueid"),
- S_OR(ast_variable_retrieve(member_config, interface, "membername"),interface),
- ast_variable_retrieve(member_config, interface, "penalty"),
- ast_variable_retrieve(member_config, interface, "paused"),
- S_OR(ast_variable_retrieve(member_config, interface, "state_interface"),interface));
+ rt_handle_member_record(q, interface, member_config);
}
/* Delete all realtime members that have been deleted in DB. */
@@ -2426,12 +2428,7 @@
ao2_iterator_destroy(&mem_iter);
while ((interface = ast_category_browse(member_config, interface))) {
- rt_handle_member_record(q, interface,
- ast_variable_retrieve(member_config, interface, "uniqueid"),
- S_OR(ast_variable_retrieve(member_config, interface, "membername"), interface),
- ast_variable_retrieve(member_config, interface, "penalty"),
- ast_variable_retrieve(member_config, interface, "paused"),
- S_OR(ast_variable_retrieve(member_config, interface, "state_interface"), interface));
+ rt_handle_member_record(q, interface, member_config);
}
/* Delete all realtime members that have been deleted in DB. */
More information about the asterisk-commits
mailing list