static int queue_function_queuewaitingcount(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len) { int count = 0; struct call_queue *q; struct ast_module_user *lu; struct ast_variable *var = NULL; buf[0] = '\0'; if (ast_strlen_zero(data)) { ast_log(LOG_ERROR, "%s requires an argument: queuename\n", cmd); return -1; } lu = ast_module_user_add(chan); load_realtime_queue(data); AST_LIST_LOCK(&queues); AST_LIST_TRAVERSE(&queues, q, list) { if (!strcasecmp(q->name, data)) { ast_mutex_lock(&q->lock); break; } } AST_LIST_UNLOCK(&queues);