Asterisk - The Open Source Telephony Project
21.4.1
|
Call center agent pool. More...
#include "asterisk.h"
#include "asterisk/cli.h"
#include "asterisk/app.h"
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "asterisk/channel.h"
#include "asterisk/bridge.h"
#include "asterisk/bridge_internal.h"
#include "asterisk/bridge_basic.h"
#include "asterisk/bridge_after.h"
#include "asterisk/config_options.h"
#include "asterisk/features_config.h"
#include "asterisk/astobj2.h"
#include "asterisk/stringfields.h"
#include "asterisk/stasis_channels.h"
#include "asterisk/causes.h"
Go to the source code of this file.
Data Structures | |
struct | agent_cfg |
struct | agent_complete |
struct | agent_pvt |
Structure representing an agent. More... | |
struct | agents_cfg |
Macros | |
#define | agent_lock(agent) _agent_lock(agent, __FILE__, __PRETTY_FUNCTION__, __LINE__, #agent) |
Lock the agent. More... | |
#define | agent_unlock(agent) _agent_unlock(agent, __FILE__, __PRETTY_FUNCTION__, __LINE__, #agent) |
Unlock the agent. More... | |
#define | AST_MAX_BUF 256 |
#define | CALLER_SAFETY_TIMEOUT_TIME (2 * 60 * 1000) |
#define | FORMAT_HDR "%-8s %-20s %-11s %-30s %s\n" |
#define | FORMAT_ROW "%-8s %-20s %-11s %-30s %s\n" |
#define | LOGIN_WAIT_TIMEOUT_TIME 5 |
Enumerations | |
enum | AGENT_LOGIN_OPT_FLAGS { OPT_SILENT = (1 << 0) } |
enum | agent_override_flags { AGENT_FLAG_ACK_CALL = (1 << 0), AGENT_FLAG_DTMF_ACCEPT = (1 << 1), AGENT_FLAG_AUTO_LOGOFF = (1 << 2), AGENT_FLAG_WRAPUP_TIME = (1 << 3) } |
enum | agent_state { AGENT_STATE_LOGGED_OUT, AGENT_STATE_PROBATION_WAIT, AGENT_STATE_READY_FOR_CALL, AGENT_STATE_CALL_PRESENT, AGENT_STATE_CALL_WAIT_ACK, AGENT_STATE_ON_CALL, AGENT_STATE_CALL_WRAPUP, AGENT_STATE_LOGGING_OUT } |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static void | _agent_lock (struct agent_pvt *agent, const char *file, const char *function, int line, const char *var) |
static void | _agent_unlock (struct agent_pvt *agent, const char *file, const char *function, int line, const char *var) |
static int | action_agent_logoff (struct mansession *s, const struct message *m) |
static int | action_agents (struct mansession *s, const struct message *m) |
static void | agent_after_bridge_cb (struct ast_channel *chan, void *data) |
static void | agent_after_bridge_cb_failed (enum ast_bridge_after_cb_reason reason, void *data) |
static void | agent_alert (struct ast_bridge_channel *bridge_channel, const void *payload, size_t payload_size) |
static struct ast_bridge_channel * | agent_bridge_channel_get_lock (struct agent_pvt *agent) |
static void * | agent_cfg_alloc (const char *name) |
static void | agent_cfg_destructor (void *vdoomed) |
static void * | agent_cfg_find (struct ao2_container *agents, const char *username) |
static int | agent_cfg_sort_cmp (const void *obj_left, const void *obj_right, int flags) |
static void | agent_connect_caller (struct ast_bridge_channel *bridge_channel, struct agent_pvt *agent) |
static void | agent_devstate_changed (const char *agent_id) |
static int | agent_function_read (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) |
static char * | agent_handle_logoff_cmd (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | agent_handle_show_all (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | agent_handle_show_online (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | agent_handle_show_specific (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static struct ast_channel * | agent_lock_logged (struct agent_pvt *agent) |
static void | agent_login_channel_config (struct agent_pvt *agent, struct ast_channel *chan) |
static int | agent_login_exec (struct ast_channel *chan, const char *data) |
Dialplan AgentLogin application to log in an agent. More... | |
static int | agent_logoff_request (const char *agent_id, int soft) |
static void | agent_logout (struct agent_pvt *agent) |
static int | agent_mark (void *obj, void *arg, int flags) |
static int | agent_pvt_cmp (void *obj, void *arg, int flags) |
static void | agent_pvt_destructor (void *vdoomed) |
static enum ast_device_state | agent_pvt_devstate_get (const char *agent_id) |
static struct agent_pvt * | agent_pvt_new (struct agent_cfg *cfg) |
static int | agent_pvt_sort_cmp (const void *obj_left, const void *obj_right, int flags) |
static int | agent_request_exec (struct ast_channel *chan, const char *data) |
Dialplan AgentRequest application to locate an agent to talk with. More... | |
static void | agent_run (struct agent_pvt *agent, struct ast_channel *logged) |
static void | agent_show_requested (struct ast_cli_args *a, int online_only) |
static int | agent_sweep (void *obj, void *arg, int flags) |
static void * | agents_cfg_alloc (void) |
static void | agents_cfg_destructor (void *vdoomed) |
static void | agents_mark (void) |
static void | agents_post_apply_config (void) |
static void | agents_sweep (void) |
static | AO2_GLOBAL_OBJ_STATIC (cfg_handle) |
static | AO2_GLOBAL_OBJ_STATIC (agent_holding) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
static int | bridge_agent_hold_ack (struct ast_bridge_channel *bridge_channel, void *hook_pvt) |
static int | bridge_agent_hold_deferred_create (void) |
static void | bridge_agent_hold_dissolving (struct ast_bridge *self) |
The bridge is being dissolved. More... | |
static int | bridge_agent_hold_heartbeat (struct ast_bridge_channel *bridge_channel, void *hook_pvt) |
static struct ast_bridge * | bridge_agent_hold_new (void) |
static void | bridge_agent_hold_pull (struct ast_bridge *self, struct ast_bridge_channel *bridge_channel) |
static int | bridge_agent_hold_push (struct ast_bridge *self, struct ast_bridge_channel *bridge_channel, struct ast_bridge_channel *swap) |
static void | bridge_init_agent_hold (void) |
static void | caller_abort_agent (struct agent_pvt *agent) |
static int | caller_joined_bridge (struct ast_bridge_channel *bridge_channel, void *hook_pvt) |
static int | caller_safety_timeout (struct ast_bridge_channel *bridge_channel, void *hook_pvt) |
static void | clear_agent_status (struct ast_bridge_channel *bridge_channel, const void *payload, size_t payload_size) |
static char * | complete_agent (const char *word, int state) |
static char * | complete_agent_logoff (const char *word, int state) |
static int | complete_agent_logoff_search (void *obj, void *arg, void *data, int flags) |
static int | complete_agent_search (void *obj, void *arg, void *data, int flags) |
CONFIG_INFO_STANDARD (cfg_info, cfg_handle, agents_cfg_alloc,.files=ACO_FILES(&agents_conf),.post_apply_config=agents_post_apply_config,) | |
static void | destroy_config (void) |
static int | load_config (void) |
static int | load_module (void) |
static int | reload (void) |
static void | send_agent_login (struct ast_channel *chan, const char *agent) |
static void | send_agent_logoff (struct ast_channel *chan, const char *agent, long logintime) |
static int | send_alert_to_agent (struct ast_bridge_channel *bridge_channel, const char *agent_id) |
static int | send_colp_to_agent (struct ast_bridge_channel *bridge_channel, struct ast_party_connected_line *connected) |
static int | unload_module (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Call center agent pool applications" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "da6642af068ee5e6490c5b1d2cc1d238" , .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .reload = reload, .load_pri = AST_MODPRI_DEVSTATE_PROVIDER, } |
static struct ast_custom_function | agent_function |
static ast_mutex_t | agent_holding_lock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} } |
static const struct ast_app_option | agent_login_opts [128] = { [ 's' ] = { .flag = OPT_SILENT }, } |
static struct aco_type | agent_type |
static struct aco_type * | agent_types [] = ACO_TYPES(&agent_type) |
static struct ao2_container * | agents |
static struct aco_file | agents_conf |
static const char | app_agent_login [] = "AgentLogin" |
static const char | app_agent_request [] = "AgentRequest" |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static struct ast_bridge_methods | bridge_agent_hold_v_table |
static struct ast_cli_entry | cli_agents [] |
static struct aco_type | general_type |
#define agent_lock | ( | agent | ) | _agent_lock(agent, __FILE__, __PRETTY_FUNCTION__, __LINE__, #agent) |
Lock the agent.
agent | Agent to lock |
Definition at line 656 of file app_agent_pool.c.
Referenced by agent_login_exec(), agent_request_exec(), and bridge_agent_hold_push().
#define agent_unlock | ( | agent | ) | _agent_unlock(agent, __FILE__, __PRETTY_FUNCTION__, __LINE__, #agent) |
Unlock the agent.
agent | Agent to unlock |
Definition at line 667 of file app_agent_pool.c.
Referenced by agent_login_exec(), agent_request_exec(), and bridge_agent_hold_push().
#define CALLER_SAFETY_TIMEOUT_TIME (2 * 60 * 1000) |
Maximum wait time (in ms) for the custom_beep file to play announcing the caller.
Definition at line 345 of file app_agent_pool.c.
Referenced by agent_request_exec().
#define LOGIN_WAIT_TIMEOUT_TIME 5 |
Number of seconds to wait for local channel optimizations to complete.
Definition at line 348 of file app_agent_pool.c.
enum agent_override_flags |
Agent config option override flags.
Definition at line 586 of file app_agent_pool.c.
enum agent_state |
Definition at line 566 of file app_agent_pool.c.
|
static |
Dialplan AgentLogin application to log in an agent.
chan | Channel attempting to login as an agent. |
data | Application parameters |
0 | To continue in dialplan. |
-1 | To hangup. |
Definition at line 2090 of file app_agent_pool.c.
References agent_lock, agent_unlock, ast_answer(), AST_APP_ARG, ast_app_parse_options(), ast_channel_ref, AST_DECLARE_APP_ARGS, AST_DIGIT_NONE, ast_format_get_name(), AST_STANDARD_APP_ARGS, AST_STATE_UP, ast_strdupa, ast_stream_and_wait(), ast_tvnow(), agent_pvt::deferred_logoff, agent_pvt::last_disconnect, agent_pvt::logged, agent_pvt::login_start, OBJ_KEY, pbx_builtin_setvar_helper(), RAII_VAR, and agent_pvt::username.
|
static |
Dialplan AgentRequest application to locate an agent to talk with.
chan | Channel wanting to talk with an agent. |
data | Application parameters |
0 | To continue in dialplan. |
-1 | To hangup. |
Definition at line 1869 of file app_agent_pool.c.
References __ao2_cleanup(), agent_lock, AGENT_STATE_CALL_PRESENT, AGENT_STATE_LOGGED_OUT, AGENT_STATE_LOGGING_OUT, AGENT_STATE_READY_FOR_CALL, agent_unlock, ao2_ref, AST_APP_ARG, ast_bridge_basic_new(), ast_bridge_channel_unlock, ast_bridge_destroy(), ast_bridge_features_cleanup(), ast_bridge_features_init(), AST_BRIDGE_HOOK_REMOVE_ON_PULL, ast_bridge_interval_hook(), ast_bridge_join(), ast_bridge_join_hook(), AST_BRIDGE_JOIN_PASS_REFERENCE, ast_check_hangup(), ast_connected_line_copy_from_caller(), AST_DECLARE_APP_ARGS, AST_DEVICE_INUSE, AST_FLAG_ZOMBIE, ast_party_connected_line_free(), ast_party_connected_line_init(), AST_SOFTHANGUP_ASYNCGOTO, AST_STANDARD_APP_ARGS, ast_strdupa, agent_pvt::caller_bridge, CALLER_SAFETY_TIMEOUT_TIME, agent_pvt::devstate, OBJ_KEY, pbx_builtin_getvar_helper(), pbx_builtin_setvar_helper(), RAII_VAR, agent_pvt::state, and agent_pvt::username.
|
static |
Agent holding bridge instance holder.
|
static |
The bridge is being dissolved.
self | Bridge to operate upon. |
The bridge is being dissolved. Remove any external references to the bridge so it can be destroyed.
Definition at line 1372 of file app_agent_pool.c.
References ao2_global_obj_release, ast_bridge_base_v_table, and ast_bridge_methods::dissolving.
|
static |
Need to determine if there are any local channels that can optimize and wait until they actually do before leaving the AGENT_STATE_PROBATION_WAIT state. For now, the blind timer of LOGIN_WAIT_TIMEOUT_TIME will do.
Definition at line 1184 of file app_agent_pool.c.
References __ao2_cleanup(), agent_cfg::ack_call, agent_lock, AGENT_STATE_CALL_PRESENT, AGENT_STATE_CALL_WAIT_ACK, AGENT_STATE_CALL_WRAPUP, AGENT_STATE_LOGGED_OUT, AGENT_STATE_ON_CALL, AGENT_STATE_PROBATION_WAIT, AGENT_STATE_READY_FOR_CALL, agent_unlock, ao2_ref, ast_bridge_base_v_table, ast_bridge_channel_leave_bridge(), ast_bridge_dtmf_hook(), AST_BRIDGE_HOOK_REMOVE_ON_PULL, ast_bridge_interval_hook(), ast_bridge_set_after_callback(), ast_channel_add_bridge_role(), ast_channel_ref, ast_channel_remove_bridge_role(), ast_channel_set_bridge_role_option(), ast_channel_unref, ast_copy_string(), ast_debug, AST_DEVICE_NOT_INUSE, ast_strdupa, BRIDGE_CHANNEL_STATE_END, agent_pvt::cfg, ast_bridge_channel::chan, agent_pvt::devstate, agent_cfg::dtmf_accept, ast_bridge_channel::features, agent_pvt::logged, agent_cfg::moh, agent_pvt::override_ack_call, agent_pvt::override_dtmf_accept, agent_pvt::override_wrapup_time, agent_pvt::probation_start, ast_bridge_methods::push, RAII_VAR, agent_pvt::state, agent_pvt::username, and agent_cfg::wrapup_time.
|
static |
Definition at line 2233 of file app_agent_pool.c.
|
static |
Agent holding bridge deferred creation lock.
Definition at line 995 of file app_agent_pool.c.
|
static |
Container of defined agents.
Definition at line 649 of file app_agent_pool.c.
|
static |
Definition at line 485 of file app_agent_pool.c.