[asterisk-commits] oej: branch oej/func-queue-exists-trunk r275902 - /team/oej/func-queue-exists...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Jul 13 07:46:49 CDT 2010
Author: oej
Date: Tue Jul 13 07:46:45 2010
New Revision: 275902
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=275902
Log:
Adding "forwarded" patch to check if a queue exists
Modified:
team/oej/func-queue-exists-trunk/apps/app_queue.c
Modified: team/oej/func-queue-exists-trunk/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/func-queue-exists-trunk/apps/app_queue.c?view=diff&rev=275902&r1=275901&r2=275902
==============================================================================
--- team/oej/func-queue-exists-trunk/apps/app_queue.c (original)
+++ team/oej/func-queue-exists-trunk/apps/app_queue.c Tue Jul 13 07:46:45 2010
@@ -469,6 +469,17 @@
<ref type="function">QUEUE_MEMBER_LIST</ref>
</see-also>
</function>
+ <function name="QUEUE_EXISTS" language="en_US">
+ <synopsis>
+ Check if a named queue exists on this server
+ </synopsis>
+ <syntax>
+ <parameter name="queuename" />
+ </syntax>
+ <description>
+ <para>Returns 1 if the specified queue exists, 0 if it does not</para>
+ </description>
+ </function>
<function name="QUEUE_WAITING_COUNT" language="en_US">
<synopsis>
Count number of calls currently waiting in a queue.
@@ -5916,6 +5927,28 @@
return 0;
}
+/*!
+ * \brief Check if a given queue exists
+ *
+ */
+static int queue_function_exists(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
+{
+ buf[0] = '\0';
+ struct call_queue *q;
+
+ if (ast_strlen_zero(data)) {
+ ast_log(LOG_ERROR, "%s requires an argument: queuename\n", cmd);
+ return -1;
+ }
+ q = load_realtime_queue(data);
+ snprintf(buf, len, "%d", q != NULL? 1 : 0);
+ if (q) {
+ queue_t_unref(q, "Done with temporary reference in QUEUE_EXISTS()");
+ }
+
+ return 0;
+}
+
/*!
* \brief Get number either busy / free / ready or total members of a specific queue
* \retval number of members (busy / free / ready / total)
@@ -6181,6 +6214,11 @@
return 0;
}
+
+static struct ast_custom_function queueexists_function = {
+ .name = "QUEUE_EXISTS",
+ .read = queue_function_exists,
+};
static struct ast_custom_function queuevar_function = {
.name = "QUEUE_VARIABLES",
@@ -8028,6 +8066,7 @@
res |= ast_unregister_application(app_upqm);
res |= ast_unregister_application(app_ql);
res |= ast_unregister_application(app);
+ res |= ast_custom_function_unregister(&queueexists_function);
res |= ast_custom_function_unregister(&queuevar_function);
res |= ast_custom_function_unregister(&queuemembercount_function);
res |= ast_custom_function_unregister(&queuemembercount_dep);
@@ -8102,6 +8141,7 @@
res |= ast_manager_register_xml("QueueReload", 0, manager_queue_reload);
res |= ast_manager_register_xml("QueueReset", 0, manager_queue_reset);
res |= ast_custom_function_register(&queuevar_function);
+ res |= ast_custom_function_register(&queueexists_function);
res |= ast_custom_function_register(&queuemembercount_function);
res |= ast_custom_function_register(&queuemembercount_dep);
res |= ast_custom_function_register(&queuememberlist_function);
More information about the asterisk-commits
mailing list