diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-07-16 19:36:29 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-07-16 19:36:29 +0000 |
commit | 01a8d0a67bd1bd354da6f2dc2cf2efc623c1fd53 (patch) | |
tree | f74fbf8437f961189bd64d234d74e27b7ad8cdf8 /apps | |
parent | 72c0317f244af3c46a8c1b59ffe0cba8adc53af5 (diff) |
add a QueueLog application that allows for custom entries in the queue_log
(issue #7368, by stevedavies with some modifications)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@37734 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r-- | apps/app_queue.c | 66 |
1 files changed, 57 insertions, 9 deletions
diff --git a/apps/app_queue.c b/apps/app_queue.c index ee8141f94..b9b578df1 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -227,6 +227,13 @@ static char *app_upqm_descrip = " 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 length of each persistent member queue database entry */ @@ -3167,6 +3174,45 @@ static int aqm_exec(struct ast_channel *chan, void *data) 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(peer); + AST_APP_ARG(event); + AST_APP_ARG(params); + ); + + if (ast_strlen_zero(data)) { + ast_log(LOG_WARNING, "QueueLog requires arguments (queuename|uniqueid|peer|event[|additionalinfo]\n"); + return -1; + } + + LOCAL_USER_ADD(u); + + parse = ast_strdupa(data); + + AST_STANDARD_APP_ARGS(args, parse); + + if (ast_strlen_zero(args.queuename) || ast_strlen_zero(args.uniqueid) + || ast_strlen_zero(args.peer) || ast_strlen_zero(args.event)) { + ast_log(LOG_WARNING, "QueueLog requires arguments (queuename|uniqueid|peer|event[|additionalinfo])\n"); + LOCAL_USER_REMOVE(u); + return -1; + } + + ast_queue_log(args.queuename, args.uniqueid, args.peer, 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; @@ -4299,6 +4345,7 @@ static int unload_module(void *mod) 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_custom_function_unregister(&queuemembercount_function); res |= ast_custom_function_unregister(&queuememberlist_function); @@ -4321,15 +4368,16 @@ static int load_module(void *mod) res |= ast_cli_register(&cli_show_queues); res |= ast_cli_register(&cli_add_queue_member); res |= ast_cli_register(&cli_remove_queue_member); - res |= ast_manager_register( "Queues", 0, manager_queues_show, "Queues" ); - res |= ast_manager_register( "QueueStatus", 0, manager_queues_status, "Queue Status" ); - res |= ast_manager_register( "QueueAdd", EVENT_FLAG_AGENT, manager_add_queue_member, "Add interface to queue." ); - res |= ast_manager_register( "QueueRemove", EVENT_FLAG_AGENT, manager_remove_queue_member, "Remove interface from queue." ); - res |= ast_manager_register( "QueuePause", EVENT_FLAG_AGENT, manager_pause_queue_member, "Makes a queue member temporarily unavailable" ); - res |= ast_register_application(app_aqm, aqm_exec, app_aqm_synopsis, app_aqm_descrip) ; - 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_manager_register("Queues", 0, manager_queues_show, "Queues"); + res |= ast_manager_register("QueueStatus", 0, manager_queues_status, "Queue Status"); + res |= ast_manager_register("QueueAdd", EVENT_FLAG_AGENT, manager_add_queue_member, "Add interface to queue."); + res |= ast_manager_register("QueueRemove", EVENT_FLAG_AGENT, manager_remove_queue_member, "Remove interface from queue."); + res |= ast_manager_register("QueuePause", EVENT_FLAG_AGENT, manager_pause_queue_member, "Makes a queue member temporarily unavailable"); + res |= ast_register_application(app_aqm, aqm_exec, app_aqm_synopsis, app_aqm_descrip); + 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); res |= ast_custom_function_register(&queuemembercount_function); res |= ast_custom_function_register(&queuememberlist_function); |