--- asterisk-1.2.14/apps/app_queue.c	2006-10-03 21:14:13.000000000 +0100
+++ ../asterisk-1.2.14/apps/app_queue.c	2007-01-21 01:50:17.000000000 +0000
@@ -219,6 +219,13 @@
 "            UNPAUSED | NOTFOUND\n"
 "Example: UnpauseQueueMember(|SIP/3000)\n";
 
+static char *app_ql = "QueueLog" ;
+static char *app_ql_synopsis = "Writes to the queue_log" ;
+static char *app_ql_descrip =
+"   QueueLog(queuename|uniqueid|agent|event[|additionalinfo]):\n"
+"Allows you to write your own events into the queue log\n"
+"Example: QueueLog(101|${UNIQUEID}|${AGENT}|WENTONBREAK|600)\n";
+
 /*! \brief Persistent Members astdb family */
 static const char *pm_family = "/Queue/PersistentMembers";
 /* The maximum lengh of each persistent member queue database entry */
@@ -3004,6 +3023,49 @@
 	return res;
 }
 
+static int ql_exec(struct ast_channel *chan, void *data)
+{
+	struct localuser *u;
+	char *parse;
+
+	AST_DECLARE_APP_ARGS(args,
+		AST_APP_ARG(queuename);
+		AST_APP_ARG(uniqueid);
+		AST_APP_ARG(membername);
+		AST_APP_ARG(event);
+		AST_APP_ARG(params);
+	);
+
+	if (ast_strlen_zero(data)) {
+		ast_log(LOG_WARNING, "QueueLog requires arguments (queuename|uniqueid|membername|event[|additionalinfo]\n");
+		return -1;
+	}
+
+	LOCAL_USER_ADD(u);
+
+	if (!(parse = ast_strdupa(data))) {
+		ast_log(LOG_WARNING, "Memory Error!\n");
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
+
+	AST_STANDARD_APP_ARGS(args, parse);
+
+	if (ast_strlen_zero(args.queuename) || ast_strlen_zero(args.uniqueid)
+	    || ast_strlen_zero(args.membername) || ast_strlen_zero(args.event)) {
+		ast_log(LOG_WARNING, "QueueLog requires arguments (queuename|uniqueid|membername|event[|additionalinfo])\n");
+	        LOCAL_USER_REMOVE(u);
+		return -1;
+	}
+
+	ast_queue_log(args.queuename, args.uniqueid, args.membername, args.event,
+		"%s", args.params ? args.params : "");
+
+	LOCAL_USER_REMOVE(u);
+
+	return 0;
+}
+
 static int queue_exec(struct ast_channel *chan, void *data)
 {
 	int res=-1;
@@ -3991,6 +4053,7 @@
 	res |= ast_unregister_application(app_rqm);
 	res |= ast_unregister_application(app_pqm);
 	res |= ast_unregister_application(app_upqm);
+	res |= ast_unregister_application(app_ql);
 	res |= ast_custom_function_unregister(&queueagentcount_function);
 	res |= ast_unregister_application(app);
 
@@ -4018,6 +4081,7 @@
 	res |= ast_register_application(app_rqm, rqm_exec, app_rqm_synopsis, app_rqm_descrip) ;
 	res |= ast_register_application(app_pqm, pqm_exec, app_pqm_synopsis, app_pqm_descrip) ;
 	res |= ast_register_application(app_upqm, upqm_exec, app_upqm_synopsis, app_upqm_descrip) ;
+	res |= ast_register_application(app_ql, ql_exec, app_ql_synopsis, app_ql_descrip);
 	res |= ast_custom_function_register(&queueagentcount_function);
 
 	if (!res) {	
