336 #define AST_MAX_BUF 256 339 #define CALLER_SAFETY_TIMEOUT_TIME (2 * 60 * 1000) 342 #define LOGIN_WAIT_TIMEOUT_TIME 5 407 const struct agent_cfg *cfg_left = obj_left;
408 const struct agent_cfg *cfg_right = obj_right;
409 const char *right_key = obj_right;
418 cmp = strcmp(cfg_left->
username, right_key);
421 cmp = strncmp(cfg_left->
username, right_key, strlen(right_key));
482 .category =
"general",
487 .types =
ACO_TYPES(&general_type, &agent_type),
636 struct timeval ack_time;
638 struct timeval last_disconnect;
658 #define agent_lock(agent) _agent_lock(agent, __FILE__, __PRETTY_FUNCTION__, __LINE__, #agent) 671 #define agent_unlock(agent) _agent_unlock(agent, __FILE__, __PRETTY_FUNCTION__, __LINE__, #agent) 708 if (logged != agent->
logged) {
822 const struct agent_pvt *agent_left = obj_left;
823 const struct agent_pvt *agent_right = obj_right;
824 const char *right_key = obj_right;
833 cmp = strcmp(agent_left->
username, right_key);
836 cmp = strncmp(agent_left->
username, right_key, strlen(right_key));
864 if (agent->
logged == arg) {
927 "Forced logoff of agent %s(%s). Agent no longer configured.\n",
951 if (!agent->logged) {
955 cfg_old = agent->cfg;
968 ast_debug(1,
"Agent %s: Created.\n", agent->username);
988 agent->deferred_logoff = 1;
1047 if (!caller_bridge) {
1070 if (record_agent_calls) {
1082 ao2_t_ref(caller_bridge, -1,
"Agent successfully in caller_bridge");
1090 switch (agent->
state) {
1106 int probation_timedout = 0;
1107 int ack_timedout = 0;
1108 int wrapup_timedout = 0;
1115 if (deferred_logoff) {
1119 switch (agent->
state) {
1121 probation_timedout =
1123 if (probation_timedout) {
1136 auto_logoff *= 1000;
1150 if (wrapup_timedout) {
1160 if (deferred_logoff) {
1164 }
else if (probation_timedout) {
1167 }
else if (ack_timedout) {
1171 }
else if (wrapup_timedout) {
1172 ast_debug(1,
"Agent %s: Wrapup timeout. Ready for new call.\n", agent->
username);
1202 const char *moh_class;
1205 chan = bridge_channel->
chan;
1225 ? agent->override_ack_call : agent->cfg->ack_call) {
1229 ? agent->override_dtmf_accept : agent->cfg->dtmf_accept;
1258 agent_after_bridge_cb_failed, chan);
1281 switch (agent->state) {
1301 time(&agent->probation_start);
1307 time(&agent->probation_start);
1326 ast_debug(1,
"Agent %s: Call abort recovery complete.\n", agent->username);
1331 wrapup_time = agent->cfg->wrapup_time;
1333 wrapup_time = agent->override_wrapup_time;
1344 ast_debug(1,
"Agent %s: Ready for new call.\n", agent->username);
1485 long time_logged_in;
1498 if (caller_bridge) {
1505 ast_verb(2,
"Agent '%s' logged out. Logged in for %ld seconds.\n",
1526 goto agent_run_cleanup;
1539 ast_debug(1,
"Agent %s: Someone destroyed the agent holding bridge.\n",
1551 if (logged != agent->
logged) {
1574 cfg_old = agent->
cfg;
1575 agent->
cfg = cfg_new;
1584 if (caller_bridge) {
1605 if (logged != agent->
logged) {
1611 ast_debug(1,
"Agent %s: Channel %s is no longer the agent.\n",
1627 ast_debug(1,
"Agent %s: New agent channel %s.\n",
1680 if (agent->
logged != logged) {
1687 if (bc->
chan != logged || agent->
logged != logged) {
1710 if (caller_bridge) {
1740 const char *agent_id = payload;
1741 const char *playfile;
1749 ast_debug(1,
"Agent '%s' does not exist. Where did it go?\n", agent_id);
1784 switch (agent->
state) {
1825 unsigned char data[1024];
1829 if (datalen == (
size_t) -1) {
1919 ast_verb(3,
"Agent '%s' does not exist.\n",
args.agent_id);
1947 if (!caller_bridge) {
1953 switch (agent->state) {
1959 ast_verb(3,
"Agent '%s' not logged in.\n", agent->username);
1964 agent->caller_bridge = caller_bridge;
1972 ast_verb(3,
"Agent '%s' is busy.\n", agent->username);
1991 ast_verb(3,
"Agent '%s' not logged in.\n", agent->username);
2004 ast_verb(3,
"Agent '%s': Caller %s failed to join the bridge.\n",
2027 return res ? -1 : 0;
2044 unsigned int override_ack_call = 0;
2045 unsigned int override_auto_logoff = 0;
2046 unsigned int override_wrapup_time = 0;
2047 const char *override_dtmf_accept =
NULL;
2058 override_ack_call =
ast_true(var) ? 1 : 0;
2070 if (sscanf(var,
"%u", &override_auto_logoff) == 1) {
2077 if (sscanf(var,
"%u", &override_wrapup_time) == 1) {
2148 ast_verb(3,
"Agent '%s' does not exist.\n",
args.agent_id);
2155 if (agent->logged) {
2157 ast_verb(3,
"Agent '%s' already logged in.\n", agent->username);
2163 time(&agent->login_start);
2164 agent->deferred_logoff = 0;
2173 ast_verb(2,
"Agent '%s' logged in (format %s/%s)\n", agent->username,
2204 args.item =
"status";
2214 if (!strcasecmp(
args.item,
"status")) {
2218 status =
"LOGGEDIN";
2220 status =
"LOGGEDOUT";
2223 }
else if (!strcasecmp(
args.item,
"name")) {
2225 }
else if (!strcasecmp(
args.item,
"mohclass")) {
2227 }
else if (!strcasecmp(
args.item,
"channel")) {
2236 pos = strrchr(buf,
'-');
2241 }
else if (!strcasecmp(
args.item,
"fullchannel")) {
2329 #define FORMAT_HDR "%-8s %-20s %-11s %-30s %s\n" 2330 #define FORMAT_ROW "%-8s %-20s %-11s %-30s %s\n" 2335 unsigned int agents_total = 0;
2336 unsigned int agents_logged_in = 0;
2337 unsigned int agents_talking = 0;
2349 const char *talking_with;
2369 if (!online_only || logged) {
2375 ast_cli(a->
fd,
"\nDefined agents: %u, Logged in: %u, Talking: %u\n",
2376 agents_total, agents_logged_in, agents_talking);
2386 e->
command =
"agent show online";
2388 "Usage: agent show online\n" 2389 " Provides summary information for logged in agents.\n";
2408 e->
command =
"agent show all";
2410 "Usage: agent show all\n" 2411 " Provides summary information for all agents.\n";
2436 "Usage: agent show <agent-id>\n" 2437 " Show information about the <agent-id> agent\n";
2465 const char *talking_with;
2491 "Usage: agent logoff <agent-id> [soft]\n" 2492 " Sets an agent as no longer logged in.\n" 2493 " If 'soft' is specified, do not hangup existing calls.\n";
2498 }
else if (a->
pos == 3 && a->
n == 0
2500 || !strncasecmp(
"soft", a->
word, strlen(a->
word)))) {
2509 if (a->
argc == 4 && strcasecmp(a->
argv[3],
"soft")) {
2537 snprintf(id_text,
sizeof(id_text),
"ActionID: %s\r\n",
id);
2561 const char *talking_to_chan;
2562 struct ast_str *logged_headers;
2565 if (!logged_snapshot
2566 || !(logged_headers =
2577 ast_str_append(&out, 0,
"TalkingToChan: %s\r\n", talking_to_chan);
2687 ast_log(
LOG_ERROR,
"Unable to register application. Not loading module.\n");
#define ao2_t_ref(o, delta, tag)
Reference/unreference an object and return the old refcount.
struct ast_party_caller * ast_channel_caller(struct ast_channel *chan)
static int agent_cfg_sort_cmp(const void *obj_left, const void *obj_right, int flags)
static int load_module(void)
enum sip_cc_notify_state state
void ast_party_connected_line_init(struct ast_party_connected_line *init)
Initialize the given connected line structure.
aco_type_item_find item_find
#define ast_channel_lock(chan)
Main Channel structure associated with a channel.
void ast_bridge_features_cleanup(struct ast_bridge_features *features)
Clean up the contents of a bridge features structure.
#define AST_CLI_DEFINE(fn, txt,...)
static void agent_run(struct agent_pvt *agent, struct ast_channel *logged)
const ast_string_field username
ast_device_state
Device States.
int ast_connected_line_build_data(unsigned char *data, size_t datalen, const struct ast_party_connected_line *connected, const struct ast_set_party_connected_line *update)
Build the connected line information data frame.
void ast_bridge_channel_clear_roles(struct ast_bridge_channel *bridge_channel)
Clear all roles from a bridge_channel's role list.
void astman_append(struct mansession *s, const char *fmt,...)
Asterisk main include file. File version handling, generic pbx functions.
struct ast_bridge_features * features
const char * ast_bridge_after_cb_reason_string(enum ast_bridge_after_cb_reason reason)
Get a string representation of an after bridge callback reason.
int ast_bridge_features_do(enum ast_bridge_builtin_feature feature, struct ast_bridge_channel *bridge_channel, void *hook_pvt)
Invoke a built in feature hook now.
static struct aco_file agents_conf
const ast_string_field override_dtmf_accept
struct ast_json * ast_json_pack(char const *format,...)
Helper for creating complex JSON values.
static void _agent_unlock(struct agent_pvt *agent, const char *file, const char *function, int line, const char *var)
#define CALLER_SAFETY_TIMEOUT_TIME
struct ast_bridge * bridge_register(struct ast_bridge *bridge)
Register the new bridge with the system.
static void send_agent_login(struct ast_channel *chan, const char *agent)
const ast_string_field full_name
#define agent_unlock(agent)
Unlock the agent.
void ast_bridge_channel_leave_bridge_nolock(struct ast_bridge_channel *bridge_channel, enum bridge_channel_state new_state, int cause)
Set bridge channel state to leave bridge (if not leaving already).
Structure that contains features information.
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
#define ast_channel_unref(c)
Decrease channel reference count.
#define ast_test_flag(p, flag)
static void agent_pvt_destructor(void *vdoomed)
int ast_indicate(struct ast_channel *chan, int condition)
Indicates condition of channel.
const ast_string_field beep_sound
void ast_json_unref(struct ast_json *value)
Decrease refcount on value. If refcount reaches zero, value is freed.
void ast_channel_hangupcause_set(struct ast_channel *chan, int value)
int ast_bridge_join_hook(struct ast_bridge_features *features, ast_bridge_hook_callback callback, void *hook_pvt, ast_bridge_hook_pvt_destructor destructor, enum ast_bridge_hook_remove_flags remove_flags)
Unregisters a handler for a built in interval feature.
static struct aco_type agent_type
void ast_channel_remove_bridge_role(struct ast_channel *chan, const char *role_name)
Removes a bridge role from a channel.
#define ast_set_flag(p, flag)
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
static int load_config(void)
int ast_check_hangup_locked(struct ast_channel *chan)
void astman_send_list_complete_start(struct mansession *s, const struct message *m, const char *event_name, int count)
Start the list complete event.
unsigned int deferred_logoff
descriptor for a cli entry.
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
AST_JSON_INT_T ast_json_int_t
Primarily used to cast when packing to an "I" type.
int __ao2_lock(void *a, enum ao2_lock_req lock_how, const char *file, const char *func, int line, const char *var)
Lock an object.
struct ao2_container * agents
#define ao2_callback(c, flags, cb_fn, arg)
void ast_channel_update_connected_line(struct ast_channel *chan, const struct ast_party_connected_line *connected, const struct ast_set_party_connected_line *update)
Indicate that the connected line information has changed.
int ast_bridge_features_init(struct ast_bridge_features *features)
Initialize bridge features structure.
int ast_bridge_channel_write_control_data(struct ast_bridge_channel *bridge_channel, enum ast_control_frame_type control, const void *data, size_t datalen)
Write a control frame into the bridge with data.
static struct ast_cli_entry cli_agents[]
static void agent_after_bridge_cb_failed(enum ast_bridge_after_cb_reason reason, void *data)
void __ao2_cleanup(void *obj)
#define aco_option_register(info, name, matchtype, types, default_val, opt_type, flags,...)
Register a config option.
struct ast_channel * logged
Structure representing a snapshot of channel state.
int __ao2_unlock(void *a, const char *file, const char *func, int line, const char *var)
Unlock an object.
int ast_devstate_prov_del(const char *label)
Remove device state provider.
ast_channel_state
ast_channel states
int ack_call
TRUE if agent needs to ack a call to accept it.
static void agent_alert(struct ast_bridge_channel *bridge_channel, const void *payload, size_t payload_size)
int ast_bridge_destroy(struct ast_bridge *bridge, int cause)
Destroy a bridge.
ast_bridge_dissolving_fn dissolving
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
#define ast_cli_register_multiple(e, len)
Register multiple commands.
enum aco_process_status aco_process_config(struct aco_info *info, int reload)
Process a config info via the options registered with an aco_info.
static struct aco_type item
#define ao2_global_obj_ref(holder)
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
int ast_devstate_prov_add(const char *label, ast_devstate_prov_cb_type callback)
Add device state provider.
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
#define AST_DECLARE_STRING_FIELDS(field_list)
Declare the fields needed in a structure.
static char * agent_handle_show_all(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
int ast_bridge_channel_write_callback(struct ast_bridge_channel *bridge_channel, enum ast_bridge_channel_custom_callback_option flags, ast_bridge_custom_callback_fn callback, const void *payload, size_t payload_size)
Write a bridge action custom callback frame into the bridge.
#define ao2_alloc_options(data_size, destructor_fn, options)
void astman_send_ack(struct mansession *s, const struct message *m, char *msg)
Send ack in manager transaction.
#define ast_mutex_lock(a)
#define ast_copy_flags(dest, src, flagz)
#define ast_str_alloca(init_len)
int64_t ast_tvdiff_ms(struct timeval end, struct timeval start)
Computes the difference (in milliseconds) between two struct timeval instances.
#define ast_strdup(str)
A wrapper for strdup()
void ast_party_connected_line_free(struct ast_party_connected_line *doomed)
Destroy the connected line information contents.
int ast_channel_add_bridge_role(struct ast_channel *chan, const char *role_name)
Adds a bridge role to a channel.
static int agent_pvt_sort_cmp(const void *obj_left, const void *obj_right, int flags)
static ast_mutex_t agent_holding_lock
void ast_bridge_channel_feature_digit(struct ast_bridge_channel *bridge_channel, int digit)
Add a DTMF digit to the collected digits to match against DTMF features.
The representation of a single configuration file to be processed.
void ast_cli(int fd, const char *fmt,...)
int ast_bridge_channel_establish_roles(struct ast_bridge_channel *bridge_channel)
Clone the roles from a bridge_channel's attached ast_channel onto the bridge_channel's role list...
int ast_unregister_application(const char *app)
Unregister an application.
#define ACO_TYPES(...)
A helper macro to ensure that aco_info types always have a sentinel.
int ast_bridge_set_after_callback(struct ast_channel *chan, ast_bridge_after_cb callback, ast_bridge_after_cb_failed failed, void *data)
Setup an after bridge callback for when the channel leaves the bridging system.
#define ast_verb(level,...)
struct ast_channel_snapshot * ast_channel_snapshot_create(struct ast_channel *chan)
Generate a snapshot of the channel state. This is an ao2 object, so ao2_cleanup() to deallocate...
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.
const char * pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name)
Return a pointer to the value of the corresponding channel variable.
struct ast_bridge * bridge
Bridge this channel is participating in.
const char * astman_get_header(const struct message *m, char *var)
Get header from mananger transaction.
#define ast_strlen_zero(foo)
struct ast_bridge_methods ast_bridge_base_v_table
Bridge base class virtual method table.
struct ast_format * ast_channel_readformat(struct ast_channel *chan)
const ast_string_field dtmf_accept
DTMF string for an agent to accept a call. * *.
struct ast_bridge * caller_bridge
static char * agent_handle_show_online(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
#define AST_APP_OPTIONS(holder, options...)
Declares an array of options for an application.
ast_bridge_after_cb_reason
int ast_channel_set_bridge_role_option(struct ast_channel *channel, const char *role_name, const char *option, const char *value)
Set a role option on a channel.
static int agent_function_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
int ast_str_set(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Set a dynamic string using variable arguments.
enum ast_device_state devstate
static void agent_login_channel_config(struct agent_pvt *agent, struct ast_channel *chan)
static int caller_joined_bridge(struct ast_bridge_channel *bridge_channel, void *hook_pvt)
#define agent_lock(agent)
Lock the agent.
#define ast_debug(level,...)
Log a DEBUG message.
static int send_colp_to_agent(struct ast_bridge_channel *bridge_channel, struct ast_party_connected_line *connected)
#define FLDSET(type,...)
Convert a struct and list of fields to an argument list of field offsets.
#define ast_bridge_channel_lock(bridge_channel)
Lock the bridge_channel.
int ast_devstate_changed(enum ast_device_state state, enum ast_devstate_cache cachable, const char *fmt,...)
Tells Asterisk the State for Device is changed.
int aco_info_init(struct aco_info *info)
Initialize an aco_info structure.
General Asterisk PBX channel definitions.
static int agent_request_exec(struct ast_channel *chan, const char *data)
Dialplan AgentRequest application to locate an agent to talk with.
void astman_send_list_complete_end(struct mansession *s)
End the list complete event.
static void agents_post_apply_config(void)
static void clear_agent_status(struct ast_bridge_channel *bridge_channel, const void *payload, size_t payload_size)
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
Type for default option handler for unsigned integers.
#define ast_string_field_init(x, size)
Initialize a field pool and fields.
struct ast_party_connected_line * ast_channel_connected(struct ast_channel *chan)
static int agent_mark(void *obj, void *arg, int flags)
Data structure associated with a custom dialplan function.
static void agent_show_requested(struct ast_cli_args *a, int online_only)
#define AST_CAUSE_NORMAL_CLEARING
static int agent_pvt_cmp(void *obj, void *arg, int flags)
#define AST_STRING_FIELD(name)
Declare a string field.
const ast_string_field username
#define ao2_ref(o, delta)
static char * agent_handle_logoff_cmd(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
int ast_softhangup(struct ast_channel *chan, int reason)
Softly hangup up a channel.
In case you didn't read that giant block of text above the mansession_session struct, the struct mansession is named this solely to keep the API the same in Asterisk. This structure really represents data that is different from Manager action to Manager action. The mansession_session pointer contained within points to session-specific data.
static void _agent_lock(struct agent_pvt *agent, const char *file, const char *function, int line, const char *var)
#define ast_strdupa(s)
duplicate a string in memory from the stack
static struct ast_channel * agent_lock_logged(struct agent_pvt *agent)
static int bridge_agent_hold_heartbeat(struct ast_bridge_channel *bridge_channel, void *hook_pvt)
int ast_bridge_interval_hook(struct ast_bridge_features *features, enum ast_bridge_hook_timer_option flags, unsigned int interval, ast_bridge_hook_callback callback, void *hook_pvt, ast_bridge_hook_pvt_destructor destructor, enum ast_bridge_hook_remove_flags remove_flags)
Attach an interval hook to a bridge features structure.
unsigned int auto_logoff
Number of seconds for agent to ack a call before being logged off.
aco_type_item_alloc item_alloc
struct stasis_message_type * ast_channel_agent_login_type(void)
Message type for agent login on a channel.
struct ast_bridge * bridge_alloc(size_t size, const struct ast_bridge_methods *v_table)
struct stasis_message_type * ast_channel_agent_logoff_type(void)
Message type for agent logoff on a channel.
static struct aco_type general_type
struct ast_str * ast_manager_build_channel_state_string(const struct ast_channel_snapshot *snapshot)
Generate the AMI message body from a channel snapshot.
int ast_app_parse_options(const struct ast_app_option *options, struct ast_flags *flags, char **args, char *optstr)
Parses a string containing application options and sets flags/arguments.
static void agent_logout(struct agent_pvt *agent)
Core PBX routines and definitions.
int ast_check_hangup(struct ast_channel *chan)
Check to see if a channel is needing hang up.
struct ast_bridge * bridge_base_init(struct ast_bridge *self, uint32_t capabilities, unsigned int flags, const char *creator, const char *name, const char *id)
Initialize the base class of the bridge.
Their was an error and no changes were applied.
const char * ast_devstate_str(enum ast_device_state devstate) attribute_pure
Convert device state to text string that is easier to parse.
#define ast_bridge_channel_unlock(bridge_channel)
Unlock the bridge_channel.
int ast_manager_unregister(const char *action)
Unregister a registered manager command.
Configuration option-handling.
Structure that contains information about a bridge.
unsigned int wrapup_time
Time after a call in ms before the agent can get a new call.
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true". This function checks to see whether a string passed to it is an indication of an "true" value. It checks to see if the string is "yes", "true", "y", "t", "on" or "1".
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
static void bridge_agent_hold_pull(struct ast_bridge *self, struct ast_bridge_channel *bridge_channel)
Structure representing an agent.
void aco_info_destroy(struct aco_info *info)
Destroy an initialized aco_info struct.
static int unload_module(void)
#define ao2_global_obj_release(holder)
Type for default option handler for bools (ast_true/ast_false)
#define AST_NONSTANDARD_APP_ARGS(args, parse, sep)
Performs the 'nonstandard' argument separation process for an application.
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
struct timeval last_disconnect
#define ao2_callback_data(container, flags, cb_fn, arg, data)
static void caller_abort_agent(struct agent_pvt *agent)
static int complete_agent_logoff_search(void *obj, void *arg, void *data, int flags)
Connected Line/Party information.
#define ao2_iterator_next(iter)
static int action_agents(struct mansession *s, const struct message *m)
#define ao2_alloc(data_size, destructor_fn)
static void agents_cfg_destructor(void *vdoomed)
void ast_bridge_channel_leave_bridge(struct ast_bridge_channel *bridge_channel, enum bridge_channel_state new_state, int cause)
Set bridge channel state to leave bridge (if not leaving already).
static void agent_cfg_destructor(void *vdoomed)
static int bridge_agent_hold_deferred_create(void)
int ast_bridge_channel_queue_callback(struct ast_bridge_channel *bridge_channel, enum ast_bridge_channel_custom_callback_option flags, ast_bridge_custom_callback_fn callback, const void *payload, size_t payload_size)
Queue a bridge action custom callback frame onto the bridge channel.
const ast_string_field moh
static void destroy_config(void)
static int agent_sweep(void *obj, void *arg, int flags)
Bridge virtual methods table definition.
#define ast_channel_unlock(chan)
#define ast_bridge_unlock(bridge)
Unlock the bridge.
static AO2_GLOBAL_OBJ_STATIC(cfg_handle)
static const char * agent_type_blacklist[]
static void parse(struct mgcp_request *req)
static char * complete_agent(const char *word, int state)
int ast_stream_and_wait(struct ast_channel *chan, const char *file, const char *digits)
stream file until digit If the file name is non-empty, try to play it.
static int agent_login_exec(struct ast_channel *chan, const char *data)
Dialplan AgentLogin application to log in an agent.
static void bridge_init_agent_hold(void)
static void * agent_cfg_alloc(const char *name)
#define STRFLDSET(type,...)
Convert a struct and a list of stringfield fields to an argument list of field offsets.
Module has failed to load, may be in an inconsistent state.
unsigned int dead
TRUE if the agent is no longer configured and is being destroyed.
#define ao2_find(container, arg, flags)
static int agent_logoff_request(const char *agent_id, int soft)
static int bridge_agent_hold_ack(struct ast_bridge_channel *bridge_channel, void *hook_pvt)
Basic bridge subclass API.
unsigned int override_wrapup_time
Structure used to handle boolean flags.
int ast_bridge_dtmf_hook(struct ast_bridge_features *features, const char *dtmf, ast_bridge_hook_callback callback, void *hook_pvt, ast_bridge_hook_pvt_destructor destructor, enum ast_bridge_hook_remove_flags remove_flags)
Attach a DTMF hook to a bridge features structure.
#define ast_clear_flag(p, flag)
int ast_bridge_join(struct ast_bridge *bridge, struct ast_channel *chan, struct ast_channel *swap, struct ast_bridge_features *features, struct ast_bridge_tech_optimizations *tech_args, enum ast_bridge_join_flags flags)
Join a channel to a bridge (blocking)
struct ast_bridge_channel * ast_channel_get_bridge_channel(struct ast_channel *chan)
Get a reference to the channel's bridge pointer.
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS|AST_MODFLAG_LOAD_ORDER, "HTTP Phone Provisioning",.support_level=AST_MODULE_SUPPORT_EXTENDED,.load=load_module,.unload=unload_module,.reload=reload,.load_pri=AST_MODPRI_CHANNEL_DEPEND,.requires="http",)
Indicate what information in ast_party_connected_line should be set.
int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value)
Add a variable to the channel variable stack, removing the most recently set value for the same name...
static char * complete_agent_logoff(const char *word, int state)
static void agent_connect_caller(struct ast_bridge_channel *bridge_channel, struct agent_pvt *agent)
static corosync_cfg_handle_t cfg_handle
static const struct ast_app_option agent_login_opts[128]
static void bridge_agent_hold_dissolving(struct ast_bridge *self)
The bridge is being dissolved.
#define ao2_global_obj_replace_unref(holder, obj)
struct ast_set_party_id id
int ast_channel_softhangup_internal_flag(struct ast_channel *chan)
CONFIG_INFO_STANDARD(cfg_info, cfg_handle, agents_cfg_alloc,.files=ACO_FILES(&agents_conf),.post_apply_config=agents_post_apply_config,)
struct ast_bridge * ast_bridge_basic_new(void)
Create a new basic class bridge.
static const char app_agent_request[]
struct ast_channel * chan
Replace objects with duplicate keys in container.
Structure that contains information regarding a channel in a bridge.
void ast_party_connected_line_copy(struct ast_party_connected_line *dest, const struct ast_party_connected_line *src)
Copy the source connected line information to the destination connected line.
int ast_bridge_move(struct ast_bridge *dst_bridge, struct ast_bridge *src_bridge, struct ast_channel *chan, struct ast_channel *swap, int attempt_recovery)
Move a channel from one bridge to another.
static void agents_sweep(void)
After Bridge Execution API.
#define ast_channel_ref(c)
Increase channel reference count.
static void send_agent_logoff(struct ast_channel *chan, const char *agent, long logintime)
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
Standard Command Line Interface.
void ast_bridge_channel_lock_bridge(struct ast_bridge_channel *bridge_channel)
Lock the bridge associated with the bridge channel.
Type information about a category-level configurable object.
static const char app_agent_login[]
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
void ast_connected_line_copy_from_caller(struct ast_party_connected_line *dest, const struct ast_party_caller *src)
Copy the caller information to the connected line information.
const char * ast_channel_name(const struct ast_channel *chan)
unsigned int override_auto_logoff
#define LOGIN_WAIT_TIMEOUT_TIME
int ast_answer(struct ast_channel *chan)
Answer a channel.
#define AST_FEATURE_MAX_LEN
Internal Asterisk hangup causes.
static int complete_agent_search(void *obj, void *arg, void *data, int flags)
static struct ast_custom_function agent_function
Abstract JSON element (object, array, string, int, ...).
Type for default option handler for stringfields.
static void * agent_cfg_find(struct ao2_container *agents, const char *username)
static int action_agent_logoff(struct mansession *s, const struct message *m)
ast_bridge_pull_channel_fn pull
#define ao2_container_alloc_rbtree(ao2_options, container_options, sort_fn, cmp_fn)
int ast_bridge_channel_queue_control_data(struct ast_bridge_channel *bridge_channel, enum ast_control_frame_type control, const void *data, size_t datalen)
Queue a control frame onto the bridge channel with data.
ast_bridge_push_channel_fn push
Reject objects with duplicate keys in container.
static void * agents_cfg_alloc(void)
#define AST_CLI_YESNO(x)
Return Yes or No depending on the argument.
void ast_channel_publish_blob(struct ast_channel *chan, struct stasis_message_type *type, struct ast_json *blob)
Publish a channel blob message.
struct ast_flags * ast_channel_flags(struct ast_channel *chan)
#define AST_APP_OPTION(option, flagno)
Declares an application option that does not accept an argument.
static struct ast_bridge * bridge_agent_hold_new(void)
static struct ast_bridge_channel * agent_bridge_channel_get_lock(struct agent_pvt *agent)
static struct agent_pvt * agent_pvt_new(struct agent_cfg *cfg)
static void agents_mark(void)
#define ast_manager_register_xml(action, authority, func)
Register a manager callback using XML documentation to describe the manager.
static char * agent_handle_show_specific(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
#define ASTERISK_GPL_KEY
The text the key() function should return.
void astman_send_error(struct mansession *s, const struct message *m, char *error)
Send error in manager transaction.
Asterisk module definitions.
struct ast_format * ast_channel_writeformat(struct ast_channel *chan)
static struct ast_bridge_methods bridge_agent_hold_v_table
enum ast_bridge_features_monitor start_stop
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
#define ast_string_field_free_memory(x)
free all memory - to be called before destroying the object
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
struct ast_party_connected_line waiting_colp
static int caller_safety_timeout(struct ast_bridge_channel *bridge_channel, void *hook_pvt)
#define ao2_global_obj_replace(holder, obj)
struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags) attribute_warn_unused_result
Create an iterator for a container.
#define ast_custom_function_register(acf)
Register a custom function.
unsigned int override_ack_call
#define AST_MUTEX_DEFINE_STATIC(mutex)
int ast_stopstream(struct ast_channel *c)
Stops a stream.
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
static int bridge_agent_hold_push(struct ast_bridge *self, struct ast_bridge_channel *bridge_channel, struct ast_bridge_channel *swap)
static enum ast_device_state agent_pvt_devstate_get(const char *agent_id)
static struct aco_type * agent_types[]
static void agent_devstate_changed(const char *agent_id)
#define ast_mutex_unlock(a)
#define AST_APP_ARG(name)
Define an application argument.
static int send_alert_to_agent(struct ast_bridge_channel *bridge_channel, const char *agent_id)
static struct ao2_container * agents
static void agent_after_bridge_cb(struct ast_channel *chan, void *data)
#define ast_string_field_set(x, field, data)
Set a field to a simple string value.
void astman_send_listack(struct mansession *s, const struct message *m, char *msg, char *listflag)
Send ack in manager transaction to begin a list.
#define ao2_link(container, obj)