342#define AST_MAX_BUF 256
345#define CALLER_SAFETY_TIMEOUT_TIME (2 * 60 * 1000)
348#define LOGIN_WAIT_TIMEOUT_TIME 5
413 const struct agent_cfg *cfg_left = obj_left;
414 const struct agent_cfg *cfg_right = obj_right;
415 const char *right_key = obj_right;
424 cmp = strcmp(cfg_left->
username, right_key);
427 cmp = strncmp(cfg_left->
username, right_key, strlen(right_key));
469 .category =
"general",
482 .category =
"general",
656#define agent_lock(agent) _agent_lock(agent, __FILE__, __PRETTY_FUNCTION__, __LINE__, #agent)
667#define agent_unlock(agent) _agent_unlock(agent, __FILE__, __PRETTY_FUNCTION__, __LINE__, #agent)
702 if (logged != agent->
logged) {
814 const struct agent_pvt *agent_left = obj_left;
815 const struct agent_pvt *agent_right = obj_right;
816 const char *right_key = obj_right;
825 cmp = strcmp(agent_left->
username, right_key);
828 cmp = strncmp(agent_left->
username, right_key, strlen(right_key));
856 if (agent->
logged == arg) {
919 "Forced logoff of agent %s(%s). Agent no longer configured.\n",
943 if (!agent->logged) {
947 cfg_old = agent->cfg;
960 ast_debug(1,
"Agent %s: Created.\n", agent->username);
980 agent->deferred_logoff = 1;
1025 int record_agent_calls;
1035 if (!caller_bridge) {
1058 if (record_agent_calls) {
1070 ao2_t_ref(caller_bridge, -1,
"Agent successfully in caller_bridge");
1078 switch (agent->
state) {
1094 int probation_timedout = 0;
1095 int ack_timedout = 0;
1096 int wrapup_timedout = 0;
1098 unsigned int wrapup_time;
1099 unsigned int auto_logoff;
1107 switch (agent->
state) {
1109 probation_timedout =
1111 if (probation_timedout) {
1124 auto_logoff *= 1000;
1138 if (wrapup_timedout) {
1152 }
else if (probation_timedout) {
1155 }
else if (ack_timedout) {
1159 }
else if (wrapup_timedout) {
1160 ast_debug(1,
"Agent %s: Wrapup timeout. Ready for new call.\n", agent->
username);
1187 unsigned int wrapup_time;
1190 const char *moh_class;
1213 ? agent->override_ack_call : agent->cfg->ack_call) {
1214 const char *dtmf_accept;
1217 ? agent->override_dtmf_accept : agent->cfg->dtmf_accept;
1269 switch (agent->state) {
1289 time(&agent->probation_start);
1295 time(&agent->probation_start);
1314 ast_debug(1,
"Agent %s: Call abort recovery complete.\n", agent->username);
1319 wrapup_time = agent->cfg->wrapup_time;
1321 wrapup_time = agent->override_wrapup_time;
1332 ast_debug(1,
"Agent %s: Ready for new call.\n", agent->username);
1467 long time_logged_in;
1480 if (caller_bridge) {
1487 ast_verb(2,
"Agent '%s' logged out. Logged in for %ld seconds.\n",
1506 goto agent_run_cleanup;
1519 ast_debug(1,
"Agent %s: Someone destroyed the agent holding bridge.\n",
1531 if (logged != agent->
logged) {
1554 cfg_old = agent->
cfg;
1555 agent->
cfg = cfg_new;
1564 if (caller_bridge) {
1585 if (logged != agent->
logged) {
1591 ast_debug(1,
"Agent %s: Channel %s is no longer the agent.\n",
1607 ast_debug(1,
"Agent %s: New agent channel %s.\n",
1660 if (agent->
logged != logged) {
1667 if (
bc->chan != logged || agent->
logged != logged) {
1690 if (caller_bridge) {
1720 const char *agent_id = payload;
1721 const char *playfile;
1722 const char *dtmf_accept;
1729 ast_debug(1,
"Agent '%s' does not exist. Where did it go?\n", agent_id);
1750 dtmf[0] = *dtmf_accept;
1764 switch (agent->
state) {
1805 unsigned char data[1024];
1809 if (datalen == (
size_t) -1) {
1899 ast_verb(3,
"Agent '%s' does not exist.\n",
args.agent_id);
1927 if (!caller_bridge) {
1933 switch (agent->state) {
1939 ast_verb(3,
"Agent '%s' not logged in.\n", agent->username);
1944 agent->caller_bridge = caller_bridge;
1952 ast_verb(3,
"Agent '%s' is busy.\n", agent->username);
1971 ast_verb(3,
"Agent '%s' not logged in.\n", agent->username);
1984 ast_verb(3,
"Agent '%s': Caller %s failed to join the bridge.\n",
2007 return res ? -1 : 0;
2022 unsigned int override_ack_call = 0;
2023 unsigned int override_auto_logoff = 0;
2024 unsigned int override_wrapup_time = 0;
2025 const char *override_dtmf_accept =
NULL;
2048 if (sscanf(
var,
"%u", &override_auto_logoff) == 1) {
2055 if (sscanf(
var,
"%u", &override_wrapup_time) == 1) {
2126 ast_verb(3,
"Agent '%s' does not exist.\n",
args.agent_id);
2133 if (agent->logged) {
2135 ast_verb(3,
"Agent '%s' already logged in.\n", agent->username);
2141 time(&agent->login_start);
2142 agent->deferred_logoff = 0;
2151 ast_verb(2,
"Agent '%s' logged in (format %s/%s)\n", agent->username,
2182 args.item =
"status";
2192 if (!strcasecmp(
args.item,
"status")) {
2201 }
else if (!strcasecmp(
args.item,
"name")) {
2203 }
else if (!strcasecmp(
args.item,
"mohclass")) {
2205 }
else if (!strcasecmp(
args.item,
"channel")) {
2214 pos = strrchr(
buf,
'-');
2219 }
else if (!strcasecmp(
args.item,
"fullchannel")) {
2307#define FORMAT_HDR "%-8s %-20s %-11s %-30s %s\n"
2308#define FORMAT_ROW "%-8s %-20s %-11s %-30s %s\n"
2313 unsigned int agents_total = 0;
2314 unsigned int agents_logged_in = 0;
2315 unsigned int agents_talking = 0;
2327 const char *talking_with;
2347 if (!online_only || logged) {
2353 ast_cli(
a->fd,
"\nDefined agents: %u, Logged in: %u, Talking: %u\n",
2354 agents_total, agents_logged_in, agents_talking);
2364 e->
command =
"agent show online";
2366 "Usage: agent show online\n"
2367 " Provides summary information for logged in agents.\n";
2386 e->
command =
"agent show all";
2388 "Usage: agent show all\n"
2389 " Provides summary information for all agents.\n";
2414 "Usage: agent show <agent-id>\n"
2415 " Show information about the <agent-id> agent\n";
2430 ast_cli(
a->fd,
"Agent '%s' not found\n",
a->argv[2]);
2443 const char *talking_with;
2469 "Usage: agent logoff <agent-id> [soft]\n"
2470 " Sets an agent as no longer logged in.\n"
2471 " If 'soft' is specified, do not hangup existing calls.\n";
2476 }
else if (
a->pos == 3 &&
a->n == 0
2478 || !strncasecmp(
"soft",
a->word, strlen(
a->word)))) {
2484 if (
a->argc < 3 || 4 <
a->argc) {
2487 if (
a->argc == 4 && strcasecmp(
a->argv[3],
"soft")) {
2492 ast_cli(
a->fd,
"Logging out %s\n",
a->argv[2]);
2515 snprintf(id_text,
sizeof(id_text),
"ActionID: %s\r\n",
id);
2539 const char *talking_to_chan;
2540 struct ast_str *logged_headers;
2543 if (!logged_snapshot
2544 || !(logged_headers =
2665 ast_log(
LOG_ERROR,
"Unable to register application. Not loading module.\n");
static struct ao2_container * agents
static char * agent_handle_logoff_cmd(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static int action_agents(struct mansession *s, const struct message *m)
static void * agent_cfg_alloc(const char *name)
static int bridge_agent_hold_heartbeat(struct ast_bridge_channel *bridge_channel, void *hook_pvt)
static char * complete_agent(const char *word, int state)
#define CALLER_SAFETY_TIMEOUT_TIME
static struct ast_custom_function agent_function
static void _agent_unlock(struct agent_pvt *agent, const char *file, const char *function, int line, const char *var)
static AO2_GLOBAL_OBJ_STATIC(cfg_handle)
static char * agent_handle_show_online(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static int agent_pvt_sort_cmp(const void *obj_left, const void *obj_right, int flags)
static int send_colp_to_agent(struct ast_bridge_channel *bridge_channel, struct ast_party_connected_line *connected)
static int caller_joined_bridge(struct ast_bridge_channel *bridge_channel, void *hook_pvt)
static const char app_agent_login[]
static int agent_request_exec(struct ast_channel *chan, const char *data)
Dialplan AgentRequest application to locate an agent to talk with.
static enum ast_device_state agent_pvt_devstate_get(const char *agent_id)
static void agents_cfg_destructor(void *vdoomed)
static int agent_sweep(void *obj, void *arg, int flags)
static void agent_show_requested(struct ast_cli_args *a, int online_only)
static struct agent_pvt * agent_pvt_new(struct agent_cfg *cfg)
static void destroy_config(void)
static struct aco_type agent_type
static struct ast_bridge_methods bridge_agent_hold_v_table
static int bridge_agent_hold_push(struct ast_bridge *self, struct ast_bridge_channel *bridge_channel, struct ast_bridge_channel *swap)
static char * agent_handle_show_specific(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static int action_agent_logoff(struct mansession *s, const struct message *m)
CONFIG_INFO_STANDARD(cfg_info, cfg_handle, agents_cfg_alloc,.files=ACO_FILES(&agents_conf),.post_apply_config=agents_post_apply_config,)
static void agent_cfg_destructor(void *vdoomed)
static int bridge_agent_hold_deferred_create(void)
static void send_agent_login(struct ast_channel *chan, const char *agent)
static struct aco_type general_type
static struct ast_bridge_channel * agent_bridge_channel_get_lock(struct agent_pvt *agent)
static int send_alert_to_agent(struct ast_bridge_channel *bridge_channel, const char *agent_id)
static void agent_pvt_destructor(void *vdoomed)
static void send_agent_logoff(struct ast_channel *chan, const char *agent, long logintime)
static void bridge_init_agent_hold(void)
static int agent_cfg_sort_cmp(const void *obj_left, const void *obj_right, int flags)
static struct ast_cli_entry cli_agents[]
static const char app_agent_request[]
static void agent_run(struct agent_pvt *agent, struct ast_channel *logged)
static void agent_after_bridge_cb(struct ast_channel *chan, void *data)
static int agent_logoff_request(const char *agent_id, int soft)
static void agent_alert(struct ast_bridge_channel *bridge_channel, const void *payload, size_t payload_size)
static void agent_after_bridge_cb_failed(enum ast_bridge_after_cb_reason reason, void *data)
static int complete_agent_logoff_search(void *obj, void *arg, void *data, int flags)
static char * agent_handle_show_all(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static int caller_safety_timeout(struct ast_bridge_channel *bridge_channel, void *hook_pvt)
static void caller_abort_agent(struct agent_pvt *agent)
#define agent_lock(agent)
Lock the agent.
static void bridge_agent_hold_dissolving(struct ast_bridge *self)
The bridge is being dissolved.
static struct ast_bridge * bridge_agent_hold_new(void)
#define LOGIN_WAIT_TIMEOUT_TIME
static void _agent_lock(struct agent_pvt *agent, const char *file, const char *function, int line, const char *var)
static const struct ast_app_option agent_login_opts[128]
static int load_module(void)
static int complete_agent_search(void *obj, void *arg, void *data, int flags)
static void agents_post_apply_config(void)
static int agent_function_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
static int unload_module(void)
static int agent_pvt_cmp(void *obj, void *arg, int flags)
static struct ast_channel * agent_lock_logged(struct agent_pvt *agent)
static int agent_mark(void *obj, void *arg, int flags)
static void agent_connect_caller(struct ast_bridge_channel *bridge_channel, struct agent_pvt *agent)
static void agents_mark(void)
static struct aco_type * agent_types[]
static ast_mutex_t agent_holding_lock
static void agents_sweep(void)
static char * complete_agent_logoff(const char *word, int state)
static struct aco_file agents_conf
@ AGENT_STATE_CALL_PRESENT
@ AGENT_STATE_PROBATION_WAIT
@ AGENT_STATE_CALL_WAIT_ACK
@ AGENT_STATE_READY_FOR_CALL
@ AGENT_STATE_LOGGING_OUT
@ AGENT_STATE_CALL_WRAPUP
static void bridge_agent_hold_pull(struct ast_bridge *self, struct ast_bridge_channel *bridge_channel)
static int agent_login_exec(struct ast_channel *chan, const char *data)
Dialplan AgentLogin application to log in an agent.
static void agent_login_channel_config(struct agent_pvt *agent, struct ast_channel *chan)
static void * agents_cfg_alloc(void)
static void agent_logout(struct agent_pvt *agent)
#define agent_unlock(agent)
Unlock the agent.
static void agent_devstate_changed(const char *agent_id)
static int load_config(void)
static int bridge_agent_hold_ack(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 void * agent_cfg_find(struct ao2_container *agents, const char *username)
Asterisk main include file. File version handling, generic pbx functions.
#define ast_strdup(str)
A wrapper for strdup()
#define ast_strdupa(s)
duplicate a string in memory from the stack
#define ao2_t_ref(o, delta, tag)
#define ao2_iterator_next(iter)
#define ao2_link(container, obj)
Add an object to a container.
@ AO2_ALLOC_OPT_LOCK_NOLOCK
@ AO2_ALLOC_OPT_LOCK_MUTEX
#define ao2_global_obj_replace_unref(holder, obj)
Replace an ao2 object in the global holder, throwing away any old object.
#define ao2_callback(c, flags, cb_fn, arg)
ao2_callback() is a generic function that applies cb_fn() to all objects in a container,...
#define ao2_callback_data(container, flags, cb_fn, arg, data)
#define ao2_global_obj_ref(holder)
Get a reference to the object stored in the global holder.
#define ao2_find(container, arg, flags)
struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags) attribute_warn_unused_result
Create an iterator for a container.
#define ao2_container_alloc_rbtree(ao2_options, container_options, sort_fn, cmp_fn)
Allocate and initialize a red-black tree container.
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
#define ao2_global_obj_replace(holder, obj)
Replace an ao2 object in the global holder.
#define ao2_alloc_options(data_size, destructor_fn, options)
void __ao2_cleanup(void *obj)
#define ao2_global_obj_release(holder)
Release the ao2 object held in the global holder.
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
#define ao2_alloc(data_size, destructor_fn)
int __ao2_unlock(void *a, const char *file, const char *func, int line, const char *var)
Unlock an object.
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.
@ AO2_CONTAINER_ALLOC_OPT_DUPS_REJECT
Reject objects with duplicate keys in container.
@ AO2_CONTAINER_ALLOC_OPT_DUPS_REPLACE
Replace objects with duplicate keys in container.
#define ast_bridge_unlock(bridge)
Unlock the bridge.
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)
int ast_bridge_destroy(struct ast_bridge *bridge, int cause)
Destroy a bridge.
struct ast_bridge_methods ast_bridge_base_v_table
Bridge base class virtual method table.
@ AST_BRIDGE_CAPABILITY_HOLDING
@ AST_BRIDGE_JOIN_PASS_REFERENCE
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.
After Bridge Execution API.
ast_bridge_after_cb_reason
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.
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.
Basic bridge subclass API.
struct ast_bridge * ast_bridge_basic_new(void)
Create a new basic class bridge.
@ AST_BRIDGE_CHANNEL_CB_OPTION_MEDIA
#define ast_bridge_channel_unlock(bridge_channel)
Unlock the bridge_channel.
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.
void ast_bridge_channel_lock_bridge(struct ast_bridge_channel *bridge_channel)
Lock the bridge associated with the bridge channel.
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.
#define ast_bridge_channel_lock(bridge_channel)
Lock the bridge_channel.
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).
@ BRIDGE_CHANNEL_STATE_END
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.
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).
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.
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.
int ast_bridge_features_init(struct ast_bridge_features *features)
Initialize bridge features structure.
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.
@ AST_BRIDGE_HOOK_REMOVE_ON_PULL
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.
@ AST_BRIDGE_BUILTIN_AUTOMIXMON
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.
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)
Attach a bridge channel join hook to a bridge features structure.
@ AST_BRIDGE_FLAG_SWAP_INHIBIT_FROM
@ AST_BRIDGE_FLAG_TRANSFER_PROHIBITED
@ AST_BRIDGE_FLAG_MERGE_INHIBIT_TO
@ AST_BRIDGE_FLAG_MERGE_INHIBIT_FROM
void ast_bridge_features_cleanup(struct ast_bridge_features *features)
Clean up the contents of a bridge features structure.
struct ast_bridge * bridge_register(struct ast_bridge *bridge)
Register the new bridge with the system.
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.
struct ast_bridge * bridge_alloc(size_t size, const struct ast_bridge_methods *v_table)
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.
void ast_channel_remove_bridge_role(struct ast_channel *chan, const char *role_name)
Removes a bridge role from a channel.
int ast_channel_add_bridge_role(struct ast_channel *chan, const char *role_name)
Adds a bridge role to a channel.
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.
void ast_bridge_channel_clear_roles(struct ast_bridge_channel *bridge_channel)
Clear all roles from a bridge_channel's role list.
Internal Asterisk hangup causes.
#define AST_CAUSE_NORMAL_CLEARING
General Asterisk PBX channel definitions.
const char * ast_channel_name(const struct ast_channel *chan)
void ast_party_connected_line_free(struct ast_party_connected_line *doomed)
Destroy the connected line information contents.
#define ast_channel_lock(chan)
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.
struct ast_flags * ast_channel_flags(struct ast_channel *chan)
#define ast_channel_ref(c)
Increase channel reference count.
struct ast_party_connected_line * ast_channel_connected(struct ast_channel *chan)
int ast_check_hangup_locked(struct ast_channel *chan)
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_check_hangup(struct ast_channel *chan)
Check to see if a channel is needing hang up.
int ast_softhangup(struct ast_channel *chan, int cause)
Softly hangup up a channel.
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.
#define ast_channel_unref(c)
Decrease channel reference count.
struct ast_format * ast_channel_writeformat(struct ast_channel *chan)
@ AST_SOFTHANGUP_ASYNCGOTO
@ AST_SOFTHANGUP_EXPLICIT
void ast_party_connected_line_init(struct ast_party_connected_line *init)
Initialize the given connected line structure.
struct ast_bridge_channel * ast_channel_get_bridge_channel(struct ast_channel *chan)
Get a reference to the channel's bridge pointer.
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.
int ast_channel_softhangup_internal_flag(struct ast_channel *chan)
struct ast_party_caller * ast_channel_caller(struct ast_channel *chan)
void ast_channel_hangupcause_set(struct ast_channel *chan, int value)
int ast_answer(struct ast_channel *chan)
Answer a channel.
int ast_indicate(struct ast_channel *chan, int condition)
Indicates condition of channel.
#define ast_channel_unlock(chan)
struct ast_format * ast_channel_readformat(struct ast_channel *chan)
ast_channel_state
ast_channel states
Standard Command Line Interface.
#define AST_CLI_YESNO(x)
Return Yes or No depending on the argument.
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
#define AST_CLI_DEFINE(fn, txt,...)
void ast_cli(int fd, const char *fmt,...)
#define ast_cli_register_multiple(e, len)
Register multiple commands.
static void update(int code_size, int y, int wi, int fi, int dq, int sr, int dqsez, struct g726_state *state_ptr)
Configuration option-handling.
void aco_info_destroy(struct aco_info *info)
Destroy an initialized aco_info struct.
@ ACO_PROCESS_ERROR
Their was an error and no changes were applied.
#define STRFLDSET(type,...)
Convert a struct and a list of stringfield fields to an argument list of field offsets.
int aco_info_init(struct aco_info *info)
Initialize an aco_info structure.
#define FLDSET(type,...)
Convert a struct and list of fields to an argument list of field offsets.
#define aco_option_register(info, name, matchtype, types, default_val, opt_type, flags,...)
Register a config option.
@ OPT_UINT_T
Type for default option handler for unsigned integers.
@ OPT_BOOL_T
Type for default option handler for bools (ast_true/ast_false)
@ OPT_STRINGFIELD_T
Type for default option handler for stringfields.
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.
#define ACO_TYPES(...)
A helper macro to ensure that aco_info types always have a sentinel.
int ast_devstate_prov_del(const char *label)
Remove device state provider.
const char * ast_devstate_str(enum ast_device_state devstate) attribute_pure
Convert device state to text string that is easier to parse.
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 ast_devstate_prov_add(const char *label, ast_devstate_prov_cb_type callback)
Add device state provider.
ast_device_state
Device States.
int ast_stopstream(struct ast_channel *c)
Stops a stream.
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 len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
void astman_send_listack(struct mansession *s, const struct message *m, char *msg, char *listflag)
Send ack in manager transaction to begin a list.
void astman_send_error(struct mansession *s, const struct message *m, char *error)
Send error in manager transaction.
void astman_send_list_complete_start(struct mansession *s, const struct message *m, const char *event_name, int count)
Start the list complete event.
void astman_send_ack(struct mansession *s, const struct message *m, char *msg)
Send ack in manager transaction.
const char * astman_get_header(const struct message *m, char *var)
Get header from manager transaction.
void astman_send_list_complete_end(struct mansession *s)
End the list complete event.
void astman_append(struct mansession *s, const char *fmt,...)
int ast_manager_unregister(const char *action)
Unregister a registered manager command.
struct stasis_message_type * ast_channel_agent_logoff_type(void)
Message type for agent logoff on a channel.
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.
struct stasis_message_type * ast_channel_agent_login_type(void)
Message type for agent login on a channel.
void ast_channel_publish_blob(struct ast_channel *chan, struct stasis_message_type *type, struct ast_json *blob)
Publish a channel blob message.
Application convenience functions, designed to give consistent look and feel to Asterisk apps.
#define AST_APP_ARG(name)
Define an application argument.
#define AST_APP_OPTIONS(holder, options...)
Declares an array of options for an application.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
#define AST_APP_OPTION(option, flagno)
Declares an application option that does not accept an argument.
#define AST_NONSTANDARD_APP_ARGS(args, parse, sep)
Performs the 'nonstandard' argument separation process for an application.
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.
#define AST_FEATURE_MAX_LEN
@ AST_CONTROL_CONNECTED_LINE
#define ast_debug(level,...)
Log a DEBUG message.
#define ast_verb(level,...)
void ast_json_unref(struct ast_json *value)
Decrease refcount on value. If refcount reaches zero, value is freed.
struct ast_json * ast_json_pack(char const *format,...)
Helper for creating complex JSON values.
AST_JSON_INT_T ast_json_int_t
Primarily used to cast when packing to an "I" type.
#define ast_mutex_unlock(a)
#define ast_mutex_lock(a)
#define AST_MUTEX_DEFINE_STATIC(mutex)
struct ast_str * ast_manager_build_channel_state_string(const struct ast_channel_snapshot *snapshot)
Generate the AMI message body from a channel snapshot.
#define ast_manager_register_xml(action, authority, func)
Register a manager callback using XML documentation to describe the manager.
Asterisk module definitions.
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
@ AST_MODPRI_DEVSTATE_PROVIDER
@ AST_MODULE_SUPPORT_CORE
#define ASTERISK_GPL_KEY
The text the key() function should return.
int ast_unregister_application(const char *app)
Unregister an application.
@ AST_MODULE_LOAD_SUCCESS
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
Core PBX routines and definitions.
const char * pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name)
Return a pointer to the value of the corresponding channel variable.
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.
#define ast_custom_function_register(acf)
Register a custom function.
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.
static corosync_cfg_handle_t cfg_handle
#define AST_DECLARE_STRING_FIELDS(field_list)
Declare the fields needed in a structure.
#define AST_STRING_FIELD(name)
Declare a string field.
#define ast_string_field_set(x, field, data)
Set a field to a simple string value.
#define ast_string_field_init(x, size)
Initialize a field pool and fields.
#define ast_string_field_free_memory(x)
free all memory - to be called before destroying the object
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true"....
static force_inline int attribute_pure ast_strlen_zero(const char *s)
#define ast_str_alloca(init_len)
int ast_str_set(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Set a dynamic string using variable arguments.
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
The representation of a single configuration file to be processed.
Type information about a category-level configurable object.
const ast_string_field username
const ast_string_field moh
const ast_string_field full_name
const ast_string_field dtmf_accept
unsigned int auto_logoff
Number of seconds for agent to ack a call before being logged off.
unsigned int wrapup_time
Time after a call in ms before the agent can get a new call.
int ack_call
TRUE if agent needs to ack a call to accept it.
const ast_string_field beep_sound
Structure representing an agent.
unsigned int override_auto_logoff
enum ast_device_state devstate
unsigned int dead
TRUE if the agent is no longer configured and is being destroyed.
struct ast_party_connected_line waiting_colp
const ast_string_field override_dtmf_accept
struct timeval last_disconnect
const ast_string_field username
struct ast_bridge * caller_bridge
struct ast_channel * logged
unsigned int override_ack_call
unsigned int override_wrapup_time
unsigned int deferred_logoff
struct ao2_container * agents
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
Structure that contains information regarding a channel in a bridge.
struct ast_bridge * bridge
Bridge this channel is participating in.
struct ast_bridge_features * features
struct ast_channel * chan
Structure that contains features information.
Bridge virtual methods table definition.
ast_bridge_dissolving_fn dissolving
ast_bridge_push_channel_fn push
ast_bridge_pull_channel_fn pull
Structure that contains information about a bridge.
Structure representing a snapshot of channel state.
Main Channel structure associated with a channel.
struct ast_bridge_channel * bridge_channel
descriptor for a cli entry.
Data structure associated with a custom dialplan function.
Structure used to handle boolean flags.
Abstract JSON element (object, array, string, int, ...).
Connected Line/Party information.
Indicate what information in ast_party_connected_line should be set.
Support for dynamic strings.
In case you didn't read that giant block of text above the mansession_session struct,...
static struct aco_type item
int64_t ast_tvdiff_ms(struct timeval end, struct timeval start)
Computes the difference (in milliseconds) between two struct timeval instances.
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
#define ast_test_flag(p, flag)
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
#define ast_clear_flag(p, flag)
#define ast_set_flag(p, flag)
#define ast_copy_flags(dest, src, flagz)