Asterisk - The Open Source Telephony Project GIT-master-0644429
|
True call queues with optional send URL on answer. More...
#include "asterisk.h"
#include <sys/time.h>
#include <signal.h>
#include <netinet/in.h>
#include <ctype.h>
#include "asterisk/lock.h"
#include "asterisk/file.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/app.h"
#include "asterisk/linkedlists.h"
#include "asterisk/module.h"
#include "asterisk/translate.h"
#include "asterisk/say.h"
#include "asterisk/features.h"
#include "asterisk/musiconhold.h"
#include "asterisk/cli.h"
#include "asterisk/manager.h"
#include "asterisk/config.h"
#include "asterisk/utils.h"
#include "asterisk/causes.h"
#include "asterisk/astdb.h"
#include "asterisk/devicestate.h"
#include "asterisk/stringfields.h"
#include "asterisk/astobj2.h"
#include "asterisk/strings.h"
#include "asterisk/taskprocessor.h"
#include "asterisk/aoc.h"
#include "asterisk/callerid.h"
#include "asterisk/term.h"
#include "asterisk/dial.h"
#include "asterisk/stasis_channels.h"
#include "asterisk/stasis_message_router.h"
#include "asterisk/bridge_after.h"
#include "asterisk/stasis_bridges.h"
#include "asterisk/core_local.h"
#include "asterisk/mixmonitor.h"
#include "asterisk/bridge_basic.h"
#include "asterisk/max_forwards.h"
Go to the source code of this file.
Data Structures | |
struct | autopause |
struct | call_queue |
struct | callattempt |
We define a custom "local user" structure because we use it not only for keeping track of what is in use but also for keeping track of who we're dialing. More... | |
struct | local_optimization |
Structure representing relevant data during a local channel optimization. More... | |
struct | member |
struct | penalty_rule |
struct | queue_end_bridge |
struct | queue_ent |
struct | queue_stasis_data |
User data for stasis subscriptions used for queue calls. More... | |
struct | rule_list |
struct | rule_lists |
struct | strategy |
Functions | |
static char * | __queues_show (struct mansession *s, int fd, int argc, const char *const *argv) |
Show queue(s) status and statistics. More... | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static int | add_to_queue (const char *queuename, const char *interface, const char *membername, int penalty, int paused, int dump, const char *state_interface, const char *reason_paused, int wrapuptime) |
Add member to queue. More... | |
static struct call_queue * | alloc_queue (const char *queuename) |
AO2_STRING_FIELD_SORT_FN (call_queue, name) | |
static int | aqm_exec (struct ast_channel *chan, const char *data) |
AddQueueMember application. More... | |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
static int | autopause2int (const char *autopause) |
static int | calc_metric (struct call_queue *q, struct member *mem, int pos, struct queue_ent *qe, struct callattempt *tmp) |
Calculate the metric of each member in the outgoing callattempts. More... | |
static void | callattempt_free (struct callattempt *doomed) |
static int | can_ring_entry (struct queue_ent *qe, struct callattempt *call) |
static int | change_priority_caller_on_queue (const char *queuename, const char *caller, int priority, int immediate) |
Change priority caller into a queue. More... | |
static void | clear_queue (struct call_queue *q) |
static int | clear_stats (const char *queuename) |
Facilitates resetting statistics for a queue. More... | |
static int | compare_weight (struct call_queue *rq, struct member *member) |
static char * | complete_queue (const char *line, const char *word, int pos, int state, ptrdiff_t word_list_offset) |
Check if a given word is in a space-delimited list. More... | |
static char * | complete_queue_add_member (const char *line, const char *word, int pos, int state) |
static char * | complete_queue_pause_member (const char *line, const char *word, int pos, int state) |
static char * | complete_queue_remove_member (const char *line, const char *word, int pos, int state) |
static char * | complete_queue_rule_show (const char *line, const char *word, int pos, int state) |
static char * | complete_queue_set_member_value (const char *line, const char *word, int pos, int state) |
static char * | complete_queue_show (const char *line, const char *word, int pos, int state) |
static int | compress_char (const char c) |
static int | context_included (const char *parent, const char *child) |
Returns if one context includes another context. More... | |
static void | copy_rules (struct queue_ent *qe, const char *rulename) |
Copy rule from global list into specified queue. More... | |
static struct member * | create_queue_member (const char *interface, const char *membername, int penalty, int paused, const char *state_interface, int ringinuse, int wrapuptime) |
allocate space for new queue member and set fields based on parameters passed More... | |
static void | destroy_queue (void *obj) |
Free queue's member list then its string fields. More... | |
static void | destroy_queue_member_cb (void *obj) |
static void | device_state_cb (void *unused, struct stasis_subscription *sub, struct stasis_message *msg) |
set a member's status based on device state of that member's interface More... | |
static void | do_hang (struct callattempt *o) |
common hangup actions More... | |
static void | do_print (struct mansession *s, int fd, const char *str) |
direct output to manager or cli with proper terminator More... | |
static void | dump_queue_members (struct call_queue *pm_queue) |
Dump all members in a specific queue to the database. More... | |
static void | end_bridge_callback (void *data) |
static void | end_bridge_callback_data_fixup (struct ast_bridge_config *bconfig, struct ast_channel *originator, struct ast_channel *terminator) |
static void | escape_and_substitute (struct ast_channel *chan, const char *input, char *output, size_t size) |
static int | extension_state_cb (const char *context, const char *exten, struct ast_state_cb_info *info, void *data) |
static int | extensionstate2devicestate (int state) |
Helper function which converts from extension state to device state values. More... | |
static struct callattempt * | find_best (struct callattempt *outgoing) |
find the entry with the best metric, or NULL More... | |
static struct call_queue * | find_load_queue_rt_friendly (const char *queuename) |
static struct member * | find_member_by_queuename_and_interface (const char *queuename, const char *interface) |
Find a member by looking up queuename and interface. More... | |
static struct call_queue * | find_queue_by_name_rt (const char *queuename, struct ast_variable *queue_vars, struct ast_config *member_config) |
Reload a single queue via realtime. More... | |
static void | free_members (struct call_queue *q, int all) |
Iterate through queue's member list and delete them. More... | |
static struct member * | get_interface_helper (struct call_queue *q, const char *interface) |
static int | get_member_penalty (char *queuename, char *interface) |
Gets members penalty. More... | |
static int | get_member_status (struct call_queue *q, int max_penalty, int min_penalty, int raise_penalty, enum empty_conditions conditions, int devstate) |
Check if members are available. More... | |
static int | get_queue_member_status (struct member *cur) |
Return the current state of a member. More... | |
static int | get_wrapuptime (struct call_queue *q, struct member *member) |
Return wrapuptime. More... | |
static void | handle_attended_transfer (void *userdata, struct stasis_subscription *sub, struct stasis_message *msg) |
Handle an attended transfer event. More... | |
static void | handle_blind_transfer (void *userdata, struct stasis_subscription *sub, struct stasis_message *msg) |
Handle a blind transfer event. More... | |
static void | handle_bridge_enter (void *userdata, struct stasis_subscription *sub, struct stasis_message *msg) |
static void | handle_hangup (void *userdata, struct stasis_subscription *sub, struct stasis_message *msg) |
static void | handle_local_optimization_begin (void *userdata, struct stasis_subscription *sub, struct stasis_message *msg) |
static void | handle_local_optimization_end (void *userdata, struct stasis_subscription *sub, struct stasis_message *msg) |
static void | handle_masquerade (void *userdata, struct stasis_subscription *sub, struct stasis_message *msg) |
static char * | handle_queue_add_member (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_queue_change_priority_caller (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_queue_pause_member (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_queue_reload (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_queue_remove_member (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_queue_reset (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_queue_rule_show (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_queue_set_member_penalty (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_queue_set_member_ringinuse (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static void | hangupcalls (struct queue_ent *qe, struct callattempt *outgoing, struct ast_channel *exception, int cancel_answered_elsewhere) |
Hang up a list of outgoing calls. More... | |
static void | init_queue (struct call_queue *q) |
Initialize Queue default values. More... | |
static void | insert_entry (struct call_queue *q, struct queue_ent *prev, struct queue_ent *new, int *pos) |
Insert the 'new' entry after the 'prev' entry of queue 'q'. More... | |
static int | insert_penaltychange (const char *list_name, const char *content, const int linenum) |
Change queue penalty by adding rule. More... | |
static const char * | int2strat (int strategy) |
static struct member * | interface_exists (struct call_queue *q, const char *interface) |
static int | is_longest_waiting_caller (struct queue_ent *caller, struct member *member) |
static int | is_member_available (struct call_queue *q, struct member *mem) |
static int | is_our_turn (struct queue_ent *qe) |
Check if we should start attempting to call queue members. More... | |
static int | join_queue (char *queuename, struct queue_ent *qe, enum queue_result *reason, int position) |
static int | kill_dead_members (void *obj, void *arg, int flags) |
static int | kill_if_unfound (void *obj, void *arg, int flags) |
static void | leave_queue (struct queue_ent *qe) |
Caller leaving queue. More... | |
static int | load_module (void) |
Load the module. More... | |
static void | load_realtime_queues (const char *queuename) |
static int | load_realtime_rules (void) |
Load queue rules from realtime. More... | |
static void | log_attended_transfer (struct queue_stasis_data *queue_data, struct ast_attended_transfer_message *atxfer_msg) |
static int | manager_add_queue_member (struct mansession *s, const struct message *m) |
static int | manager_change_priority_caller_on_queue (struct mansession *s, const struct message *m) |
static int | manager_pause_queue_member (struct mansession *s, const struct message *m) |
static int | manager_queue_log_custom (struct mansession *s, const struct message *m) |
static int | manager_queue_member_penalty (struct mansession *s, const struct message *m) |
static int | manager_queue_member_ringinuse (struct mansession *s, const struct message *m) |
static int | manager_queue_reload (struct mansession *s, const struct message *m) |
static int | manager_queue_reset (struct mansession *s, const struct message *m) |
static int | manager_queue_rule_show (struct mansession *s, const struct message *m) |
static int | manager_queues_status (struct mansession *s, const struct message *m) |
Queue status info via AMI. More... | |
static int | manager_queues_summary (struct mansession *s, const struct message *m) |
Summary of queue info via the AMI. More... | |
static int | manager_remove_queue_member (struct mansession *s, const struct message *m) |
static int | manager_request_withdraw_caller_from_queue (struct mansession *s, const struct message *m) |
static int | mark_member_dead (void *obj, void *arg, int flags) |
static int | mark_unfound (void *obj, void *arg, int flags) |
static void | member_add_to_queue (struct call_queue *queue, struct member *mem) |
static int | member_cmp_fn (void *obj1, void *obj2, int flags) |
static int | member_hash_fn (const void *obj, const int flags) |
static void | member_remove_from_queue (struct call_queue *queue, struct member *mem) |
static int | member_status_available (int status) |
static int | num_available_members (struct call_queue *q) |
Get the number of members available to accept a call. More... | |
static void | parse_empty_options (const char *value, enum empty_conditions *empty, int joinempty) |
static int | pending_members_cmp (void *obj, void *arg, int flags) |
static int | pending_members_hash (const void *obj, const int flags) |
static void | pending_members_remove (struct member *mem) |
static int | play_file (struct ast_channel *chan, const char *filename) |
static int | pqm_exec (struct ast_channel *chan, const char *data) |
PauseQueueMember application. More... | |
static void | print_queue (struct mansession *s, int fd, struct call_queue *q) |
Print a single queue to AMI or the CLI. More... | |
static void | publish_dial_end_event (struct ast_channel *in, struct callattempt *outgoing, struct ast_channel *exception, const char *status) |
static int | publish_queue_member_pause (struct call_queue *q, struct member *member) |
static int | ql_exec (struct ast_channel *chan, const char *data) |
QueueLog application. More... | |
static struct ast_manager_event_blob * | queue_agent_called_to_ami (struct stasis_message *message) |
static void | queue_agent_cb (void *userdata, struct stasis_subscription *sub, struct stasis_message *msg) |
static struct ast_manager_event_blob * | queue_agent_complete_to_ami (struct stasis_message *message) |
static struct ast_manager_event_blob * | queue_agent_connect_to_ami (struct stasis_message *message) |
static struct ast_manager_event_blob * | queue_agent_dump_to_ami (struct stasis_message *message) |
static struct ast_manager_event_blob * | queue_agent_ringnoanswer_to_ami (struct stasis_message *message) |
static void | queue_bridge_cb (void *userdata, struct stasis_subscription *sub, struct stasis_message *msg) |
static struct ast_manager_event_blob * | queue_caller_abandon_to_ami (struct stasis_message *message) |
static struct ast_manager_event_blob * | queue_caller_join_to_ami (struct stasis_message *message) |
static struct ast_manager_event_blob * | queue_caller_leave_to_ami (struct stasis_message *message) |
static void | queue_channel_cb (void *userdata, struct stasis_subscription *sub, struct stasis_message *msg) |
static struct ast_manager_event_blob * | queue_channel_to_ami (const char *type, struct stasis_message *message) |
static int | queue_cmp_cb (void *obj, void *arg, int flags) |
static int | queue_delme_members_decrement_followers (void *obj, void *arg, int flag) |
static int | queue_exec (struct ast_channel *chan, const char *data) |
The starting point for all queue calls. More... | |
static int | queue_function_exists (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) |
Check if a given queue exists. More... | |
static int | queue_function_mem_read (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) |
Get number either busy / free / ready or total members of a specific queue. More... | |
static int | queue_function_mem_write (struct ast_channel *chan, const char *cmd, char *data, const char *value) |
Dialplan function QUEUE_MEMBER() Sets the members penalty / paused / ringinuse. More... | |
static int | queue_function_memberpenalty_read (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) |
Dialplan function QUEUE_MEMBER_PENALTY() Gets the members penalty. More... | |
static int | queue_function_memberpenalty_write (struct ast_channel *chan, const char *cmd, char *data, const char *value) |
Dialplan function QUEUE_MEMBER_PENALTY() Sets the members penalty. More... | |
static int | queue_function_qac_dep (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) |
Get the total number of members in a specific queue (Deprecated) More... | |
static int | queue_function_queuegetchannel (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) |
Dialplan function QUEUE_GET_CHANNEL() Get caller channel waiting at specified position in the queue. More... | |
static int | queue_function_queuememberlist (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) |
Dialplan function QUEUE_MEMBER_LIST() Get list of members in a specific queue. More... | |
static int | queue_function_queuewaitingcount (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) |
Dialplan function QUEUE_WAITING_COUNT() Get number callers waiting in a specific queue. More... | |
static int | queue_function_var (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) |
create interface var with all queue details. More... | |
static int | queue_hash_cb (const void *obj, const int flags) |
static struct ast_manager_event_blob * | queue_member_added_to_ami (struct stasis_message *message) |
static struct ast_json * | queue_member_blob_create (struct call_queue *q, struct member *mem) |
static int | queue_member_decrement_followers (void *obj, void *arg, int flag) |
static void | queue_member_follower_removal (struct call_queue *queue, struct member *mem) |
static struct ast_manager_event_blob * | queue_member_pause_to_ami (struct stasis_message *message) |
static struct ast_manager_event_blob * | queue_member_penalty_to_ami (struct stasis_message *message) |
static struct ast_manager_event_blob * | queue_member_removed_to_ami (struct stasis_message *message) |
static struct ast_manager_event_blob * | queue_member_ringinuse_to_ami (struct stasis_message *message) |
static struct ast_manager_event_blob * | queue_member_status_to_ami (struct stasis_message *message) |
static struct ast_manager_event_blob * | queue_member_to_ami (const char *type, struct stasis_message *message) |
static struct ast_manager_event_blob * | queue_multi_channel_to_ami (const char *type, struct stasis_message *message) |
static void | queue_publish_member_blob (struct stasis_message_type *type, struct ast_json *blob) |
static void | queue_publish_multi_channel_blob (struct ast_channel *caller, struct ast_channel *agent, struct stasis_message_type *type, struct ast_json *blob) |
static void | queue_publish_multi_channel_snapshot_blob (struct stasis_topic *topic, struct ast_channel_snapshot *caller_snapshot, struct ast_channel_snapshot *agent_snapshot, struct stasis_message_type *type, struct ast_json *blob) |
static void | queue_reset_global_params (void) |
static void | queue_rules_reset_global_params (void) |
static void | queue_rules_set_global_params (struct ast_config *cfg) |
static void | queue_set_global_params (struct ast_config *cfg) |
static void | queue_set_param (struct call_queue *q, const char *param, const char *val, int linenum, int failunknown) |
Configure a queue parameter. More... | |
static char * | queue_show (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static struct queue_stasis_data * | queue_stasis_data_alloc (struct queue_ent *qe, struct ast_channel *peer, struct member *mem, time_t holdstart, time_t starttime, int callcompletedinsl) |
static void | queue_stasis_data_destructor (void *obj) |
static int | qupd_exec (struct ast_channel *chan, const char *data) |
Update Queue with data of an outgoing call. More... | |
static void | recalc_holdtime (struct queue_ent *qe, int newholdtime) |
static void | record_abandoned (struct queue_ent *qe) |
Record that a caller gave up on waiting in queue. More... | |
static int | reload (void) |
static int | reload_handler (int reload, struct ast_flags *mask, const char *queuename) |
The command center for all reload operations. More... | |
static void | reload_queue_members (void) |
Reload dynamic queue members persisted into the astdb. More... | |
static int | reload_queue_rules (int reload) |
Reload the rules defined in queuerules.conf. More... | |
static int | reload_queues (int reload, struct ast_flags *mask, const char *queuename) |
reload the queues.conf file More... | |
static void | reload_single_member (const char *memberdata, struct call_queue *q) |
reload information pertaining to a single member More... | |
static void | reload_single_queue (struct ast_config *cfg, struct ast_flags *mask, const char *queuename) |
Reload information pertaining to a particular queue. More... | |
static int | remove_from_queue (const char *queuename, const char *interface) |
Remove member from queue. More... | |
static void | remove_stasis_subscriptions (struct queue_stasis_data *queue_data) |
static int | request_withdraw_caller_from_queue (const char *queuename, const char *caller, const char *withdraw_info) |
Request to withdraw a caller from a queue. More... | |
static int | ring_entry (struct queue_ent *qe, struct callattempt *tmp, int *busies) |
Part 2 of ring_one. More... | |
static int | ring_one (struct queue_ent *qe, struct callattempt *outgoing, int *busies) |
Place a call to a queue member. More... | |
static void | rna (int rnatime, struct queue_ent *qe, struct ast_channel *peer, char *interface, char *membername, int autopause) |
RNA == Ring No Answer. Common code that is executed when we try a queue member and they don't answer. More... | |
static int | rqm_exec (struct ast_channel *chan, const char *data) |
RemoveQueueMember application. More... | |
static void | rt_handle_member_record (struct call_queue *q, char *category, struct ast_config *member_config) |
Find rt member record to update otherwise create one. More... | |
static int | say_periodic_announcement (struct queue_ent *qe, int ringing) |
Playback announcement to queued members if period has elapsed. More... | |
static int | say_position (struct queue_ent *qe, int ringing) |
static void | send_agent_complete (const char *queuename, struct ast_channel_snapshot *caller, struct ast_channel_snapshot *peer, const struct member *member, time_t holdstart, time_t callstart, enum agent_complete_reason rsn) |
Send out AMI message with member call completion status information. More... | |
static int | set_member_paused (const char *queuename, const char *interface, const char *reason, int paused) |
static int | set_member_penalty_help_members (struct call_queue *q, const char *interface, int penalty) |
static int | set_member_ringinuse_help_members (struct call_queue *q, const char *interface, int ringinuse) |
static int | set_member_value (const char *queuename, const char *interface, int property, int value) |
static int | set_member_value_help_members (struct call_queue *q, const char *interface, int property, int value) |
static void | set_queue_member_pause (struct call_queue *q, struct member *mem, const char *reason, int paused) |
static void | set_queue_member_ringinuse (struct call_queue *q, struct member *mem, int ringinuse) |
static void | set_queue_result (struct ast_channel *chan, enum queue_result res) |
sets the QUEUESTATUS channel variable More... | |
static void | set_queue_variables (struct call_queue *q, struct ast_channel *chan) |
Set variables of queue. More... | |
static void | setup_mixmonitor (struct queue_ent *qe, const char *filename) |
static void | setup_peer_after_bridge_goto (struct ast_channel *chan, struct ast_channel *peer, struct ast_flags *opts, char *opt_args[]) |
static int | setup_stasis_subs (struct queue_ent *qe, struct ast_channel *peer, struct member *mem, time_t holdstart, time_t starttime, int callcompletedinsl) |
STASIS_MESSAGE_TYPE_DEFN_LOCAL (queue_agent_called_type,.to_ami=queue_agent_called_to_ami,) | |
STASIS_MESSAGE_TYPE_DEFN_LOCAL (queue_agent_complete_type,.to_ami=queue_agent_complete_to_ami,) | |
STASIS_MESSAGE_TYPE_DEFN_LOCAL (queue_agent_connect_type,.to_ami=queue_agent_connect_to_ami,) | |
STASIS_MESSAGE_TYPE_DEFN_LOCAL (queue_agent_dump_type,.to_ami=queue_agent_dump_to_ami,) | |
STASIS_MESSAGE_TYPE_DEFN_LOCAL (queue_agent_ringnoanswer_type,.to_ami=queue_agent_ringnoanswer_to_ami,) | |
STASIS_MESSAGE_TYPE_DEFN_LOCAL (queue_caller_abandon_type,.to_ami=queue_caller_abandon_to_ami,) | |
STASIS_MESSAGE_TYPE_DEFN_LOCAL (queue_caller_join_type,.to_ami=queue_caller_join_to_ami,) | |
STASIS_MESSAGE_TYPE_DEFN_LOCAL (queue_caller_leave_type,.to_ami=queue_caller_leave_to_ami,) | |
STASIS_MESSAGE_TYPE_DEFN_LOCAL (queue_member_added_type,.to_ami=queue_member_added_to_ami,) | |
STASIS_MESSAGE_TYPE_DEFN_LOCAL (queue_member_pause_type,.to_ami=queue_member_pause_to_ami,) | |
STASIS_MESSAGE_TYPE_DEFN_LOCAL (queue_member_penalty_type,.to_ami=queue_member_penalty_to_ami,) | |
STASIS_MESSAGE_TYPE_DEFN_LOCAL (queue_member_removed_type,.to_ami=queue_member_removed_to_ami,) | |
STASIS_MESSAGE_TYPE_DEFN_LOCAL (queue_member_ringinuse_type,.to_ami=queue_member_ringinuse_to_ami,) | |
STASIS_MESSAGE_TYPE_DEFN_LOCAL (queue_member_status_type,.to_ami=queue_member_status_to_ami,) | |
static int | store_next_lin (struct queue_ent *qe, struct callattempt *outgoing) |
Search for best metric and add to Linear queue. More... | |
static int | store_next_rr (struct queue_ent *qe, struct callattempt *outgoing) |
Search for best metric and add to Round Robbin queue. More... | |
static int | strat2int (const char *strategy) |
static int | try_calling (struct queue_ent *qe, struct ast_flags opts, char **opt_args, char *announceoverride, const char *url, int *tries, int *noption, const char *agi, const char *gosub, int ringing) |
static int | unload_module (void) |
static void | update_connected_line_from_peer (struct ast_channel *chan, struct ast_channel *peer, int is_caller) |
static void | update_qe_rule (struct queue_ent *qe) |
update rules for queues More... | |
static int | update_queue (struct call_queue *q, struct member *member, int callcompletedinsl, time_t starttime) |
update the queue status More... | |
static int | update_realtime_member_field (struct member *mem, const char *queue_name, const char *field, const char *value) |
static void | update_realtime_members (struct call_queue *q) |
static void | update_status (struct call_queue *q, struct member *m, const int status) |
set a member's status based on device state of that member's state_interface. More... | |
static int | upqm_exec (struct ast_channel *chan, const char *data) |
UnpauseQueueMember application. More... | |
static int | valid_exit (struct queue_ent *qe, char digit) |
Check for valid exit from queue via goto. More... | |
static int | wait_a_bit (struct queue_ent *qe) |
static struct callattempt * | wait_for_answer (struct queue_ent *qe, struct callattempt *outgoing, int *to, char *digit, int prebusies, int caller_disconnect, int forwardsallowed) |
Wait for a member to answer the call. More... | |
static int | wait_our_turn (struct queue_ent *qe, int ringing, enum queue_result *reason) |
The waiting areas for callers who are not actively calling members. More... | |
static int | word_in_list (const char *list, const char *word) |
Check if a given word is in a space-delimited list. More... | |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "True Call Queueing" , .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 = AST_BUILDOPT_SUM, .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .reload = reload, .load_pri = AST_MODPRI_DEVSTATE_CONSUMER, } |
static struct stasis_message_router * | agent_router |
static char * | app = "Queue" |
static char * | app_aqm = "AddQueueMember" |
static char * | app_pqm = "PauseQueueMember" |
static char * | app_ql = "QueueLog" |
static char * | app_qupd = "QueueUpdate" |
static char * | app_rqm = "RemoveQueueMember" |
static char * | app_upqm = "UnpauseQueueMember" |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static int | autofill_default |
queues.conf [general] option More... | |
static const struct autopause | autopausesmodes [] |
static struct ast_cli_entry | cli_queue [] |
static struct stasis_subscription * | device_state_sub |
Subscription to device state change messages. More... | |
static int | force_longest_waiting_caller |
queues.conf [general] option More... | |
static int | log_membername_as_agent |
queues.conf [general] option More... | |
static int | montype_default |
queues.conf [general] option More... | |
static int | negative_penalty_invalid |
queues.conf [general] option More... | |
static struct ao2_container * | pending_members |
static const char *const | pm_family = "Queue/PersistentMembers" |
Persistent Members astdb family. More... | |
static const struct ast_app_option | queue_exec_options [128] = { [ 'b' ] = { .flag = OPT_PREDIAL_CALLEE , .arg_index = OPT_ARG_PREDIAL_CALLEE + 1 }, [ 'B' ] = { .flag = OPT_PREDIAL_CALLER , .arg_index = OPT_ARG_PREDIAL_CALLER + 1 }, [ 'C' ] = { .flag = OPT_MARK_AS_ANSWERED }, [ 'c' ] = { .flag = OPT_GO_ON }, [ 'd' ] = { .flag = OPT_DATA_QUALITY }, [ 'F' ] = { .flag = OPT_CALLEE_GO_ON , .arg_index = OPT_ARG_CALLEE_GO_ON + 1 }, [ 'h' ] = { .flag = OPT_CALLEE_HANGUP }, [ 'H' ] = { .flag = OPT_CALLER_HANGUP }, [ 'i' ] = { .flag = OPT_IGNORE_CALL_FW }, [ 'I' ] = { .flag = OPT_IGNORE_CONNECTEDLINE }, [ 'k' ] = { .flag = OPT_CALLEE_PARK }, [ 'K' ] = { .flag = OPT_CALLER_PARK }, [ 'm' ] = { .flag = OPT_MUSICONHOLD_CLASS , .arg_index = OPT_ARG_MUSICONHOLD_CLASS + 1 }, [ 'n' ] = { .flag = OPT_NO_RETRY }, [ 'r' ] = { .flag = OPT_RINGING }, [ 'R' ] = { .flag = OPT_RING_WHEN_RINGING }, [ 't' ] = { .flag = OPT_CALLEE_TRANSFER }, [ 'T' ] = { .flag = OPT_CALLER_TRANSFER }, [ 'x' ] = { .flag = OPT_CALLEE_AUTOMIXMON }, [ 'X' ] = { .flag = OPT_CALLER_AUTOMIXMON }, [ 'w' ] = { .flag = OPT_CALLEE_AUTOMON }, [ 'W' ] = { .flag = OPT_CALLER_AUTOMON }, } |
static int | queue_persistent_members |
queues.conf [general] option More... | |
struct { | |
enum queue_result id | |
char * text | |
} | queue_results [] |
static struct ast_custom_function | queueexists_function |
static struct ast_custom_function | queuegetchannel_function |
static struct ast_custom_function | queuemembercount_dep |
static struct ast_custom_function | queuemembercount_function |
static struct ast_custom_function | queuememberlist_function |
static struct ast_custom_function | queuememberpenalty_function |
static struct ao2_container * | queues |
static struct ast_custom_function | queuevar_function |
static struct ast_custom_function | queuewaitingcount_function |
static int | realtime_reason_paused |
does realtime backend support reason_paused More... | |
static char * | realtime_ringinuse_field |
name of the ringinuse field in the realtime database More... | |
static int | realtime_rules |
queuerules.conf [general] option More... | |
static struct rule_lists | rule_lists = { .first = NULL, .last = NULL, .lock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} } , } |
static int | shared_lastcall |
queues.conf [general] option More... | |
static const struct strategy | strategies [] |
static struct stasis_forward * | topic_forwarder |
static int | use_weight |
Records that one or more queues use weight. More... | |
True call queues with optional send URL on answer.
Each dynamic agent in each queue is now stored in the astdb. When asterisk is restarted, each agent will be automatically readded into their recorded queues. This feature can be configured with the 'persistent_members=<1|0>' setting in the '[general]' category in queues.conf. The default is on.
Patch Version 1.07 2003-12-24 01
Added servicelevel statistic by Michiel Betel michi.nosp@m.el@b.nosp@m.etel..nosp@m.nl Added Priority jumping code for adding and removing queue members by Jonathan Stanton aster.nosp@m.isk@.nosp@m.doilo.nosp@m.okli.nosp@m.keica.nosp@m.re.c.nosp@m.om
Fixed to work with CVS as of 2004-02-25 and released as 1.07a by Matthew Enger m.eng.nosp@m.er@x.nosp@m.i.com.nosp@m..au
Definition in file app_queue.c.
#define ANNOUNCEHOLDTIME_ALWAYS 1 |
Definition at line 1771 of file app_queue.c.
#define ANNOUNCEHOLDTIME_ONCE 2 |
Definition at line 1772 of file app_queue.c.
#define ANNOUNCEPOSITION_LIMIT 4 |
We not announce position more than <limit>
Definition at line 1789 of file app_queue.c.
#define ANNOUNCEPOSITION_MORE_THAN 3 |
We say "Currently there are more than <limit>"
Definition at line 1788 of file app_queue.c.
#define ANNOUNCEPOSITION_NO 2 |
We don't announce position
Definition at line 1787 of file app_queue.c.
#define ANNOUNCEPOSITION_YES 1 |
We announce position
Definition at line 1786 of file app_queue.c.
#define AST_MAX_WATCHERS 256 |
Definition at line 5191 of file app_queue.c.
#define DEFAULT_MIN_ANNOUNCE_FREQUENCY 15 |
The minimum number of seconds between position announcements.
Definition at line 1561 of file app_queue.c.
#define DEFAULT_RETRY 5 |
Definition at line 1553 of file app_queue.c.
#define DEFAULT_TIMEOUT 15 |
Definition at line 1554 of file app_queue.c.
#define MAX_CALL_ATTEMPT_BUCKETS 353 |
Definition at line 2514 of file app_queue.c.
#define MAX_PERIODIC_ANNOUNCEMENTS 10 |
The maximum periodic announcements we can have
Definition at line 1556 of file app_queue.c.
#define MAX_QUEUE_BUCKETS 53 |
Definition at line 1563 of file app_queue.c.
#define QUEUE_EVENT_VARIABLES 3 |
Definition at line 1773 of file app_queue.c.
#define QUEUE_PAUSED_DEVSTATE AST_DEVICE_INUSE |
Definition at line 3536 of file app_queue.c.
#define queue_ref | ( | q | ) | ao2_bump(q) |
Definition at line 2055 of file app_queue.c.
#define queue_t_ref | ( | q, | |
tag | |||
) | ao2_t_bump(q, tag) |
Definition at line 2057 of file app_queue.c.
#define queue_t_unref | ( | q, | |
tag | |||
) | ({ ao2_t_cleanup(q, tag); NULL; }) |
Definition at line 2058 of file app_queue.c.
#define QUEUE_UNKNOWN_PAUSED_DEVSTATE AST_DEVICE_NOT_INUSE |
Definition at line 3538 of file app_queue.c.
#define QUEUE_UNPAUSED_DEVSTATE AST_DEVICE_NOT_INUSE |
Definition at line 3537 of file app_queue.c.
#define queue_unref | ( | q | ) | ({ ao2_cleanup(q); NULL; }) |
Definition at line 2056 of file app_queue.c.
#define queues_t_link | ( | c, | |
q, | |||
tag | |||
) | ao2_t_link(c, q, tag) |
Definition at line 2059 of file app_queue.c.
#define queues_t_unlink | ( | c, | |
q, | |||
tag | |||
) | ao2_t_unlink(c, q, tag) |
Definition at line 2060 of file app_queue.c.
#define RECHECK 1 |
Recheck every second to see we we're at the top yet
Definition at line 1555 of file app_queue.c.
#define RES_EXISTS (-1) |
Entry already exists
Definition at line 1566 of file app_queue.c.
#define RES_NOSUCHQUEUE (-3) |
No such queue
Definition at line 1568 of file app_queue.c.
#define RES_NOT_CALLER (-5) |
Caller not found
Definition at line 1570 of file app_queue.c.
#define RES_NOT_DYNAMIC (-4) |
Member is not dynamic
Definition at line 1569 of file app_queue.c.
#define RES_OKAY 0 |
Action completed
Definition at line 1565 of file app_queue.c.
#define RES_OUTOFMEMORY (-2) |
Out of memory
Definition at line 1567 of file app_queue.c.
anonymous enum |
Definition at line 1446 of file app_queue.c.
anonymous enum |
Enumerator | |
---|---|
OPT_ARG_CALLEE_GO_ON | |
OPT_ARG_PREDIAL_CALLEE | |
OPT_ARG_PREDIAL_CALLER | |
OPT_ARG_MUSICONHOLD_CLASS | |
OPT_ARG_ARRAY_SIZE |
Definition at line 1471 of file app_queue.c.
anonymous enum |
Definition at line 1505 of file app_queue.c.
anonymous enum |
Enumerator | |
---|---|
QUEUE_AUTOPAUSE_OFF | |
QUEUE_AUTOPAUSE_ON | |
QUEUE_AUTOPAUSE_ALL |
Definition at line 1516 of file app_queue.c.
Enumerator | |
---|---|
CALLER | |
AGENT | |
TRANSFER |
Definition at line 6122 of file app_queue.c.
enum empty_conditions |
Enumerator | |
---|---|
QUEUE_EMPTY_PENALTY | |
QUEUE_EMPTY_PAUSED | |
QUEUE_EMPTY_INUSE | |
QUEUE_EMPTY_RINGING | |
QUEUE_EMPTY_UNAVAILABLE | |
QUEUE_EMPTY_INVALID | |
QUEUE_EMPTY_UNKNOWN | |
QUEUE_EMPTY_WRAPUP |
Definition at line 1754 of file app_queue.c.
enum member_properties |
Enumerator | |
---|---|
MEMBER_PENALTY | |
MEMBER_RINGINUSE |
Definition at line 1765 of file app_queue.c.
enum queue_reload_mask |
Enumerator | |
---|---|
QUEUE_RELOAD_PARAMETERS | |
QUEUE_RELOAD_MEMBER | |
QUEUE_RELOAD_RULES | |
QUEUE_RESET_STATS |
Definition at line 1522 of file app_queue.c.
enum queue_result |
Enumerator | |
---|---|
QUEUE_UNKNOWN | |
QUEUE_TIMEOUT | |
QUEUE_JOINEMPTY | |
QUEUE_LEAVEEMPTY | |
QUEUE_JOINUNAVAIL | |
QUEUE_LEAVEUNAVAIL | |
QUEUE_FULL | |
QUEUE_CONTINUE | |
QUEUE_WITHDRAW |
Definition at line 1625 of file app_queue.c.
Enumerator | |
---|---|
TIMEOUT_PRIORITY_APP | |
TIMEOUT_PRIORITY_CONF |
Definition at line 1652 of file app_queue.c.
|
static |
Show queue(s) status and statistics.
List the queues strategy, calls processed, members logged in, other queue statistics such as avg hold time.
Definition at line 10138 of file app_queue.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_container_alloc_rbtree, ao2_container_dup(), ao2_iterator_destroy(), AO2_ITERATOR_DONTLOCK, ao2_iterator_init(), AO2_ITERATOR_UNLINK, ao2_lock, ao2_ref, ao2_t_iterator_next, ao2_unlock, ast_category_browse(), ast_check_realtime(), ast_config_destroy(), ast_load_realtime_multientry(), ast_log, ast_str_alloca, ast_str_buffer(), ast_str_set(), ast_strlen_zero(), ast_variable_retrieve(), CLI_SHOWUSAGE, CLI_SUCCESS, do_print(), find_load_queue_rt_friendly(), call_queue::found, LOG_WARNING, call_queue::name, NULL, out, print_queue(), queue_t_unref, queue_unref, queues, call_queue::realtime, and SENTINEL.
Referenced by queue_show().
|
static |
Definition at line 11947 of file app_queue.c.
|
static |
Definition at line 11947 of file app_queue.c.
|
static |
Add member to queue.
RES_NOT_DYNAMIC | when they aren't a RT member |
RES_NOSUCHQUEUE | queue does not exist |
RES_OKAY | added member from queue |
RES_EXISTS | queue exists but no members |
RES_OUT_OF_MEMORY | queue exists but not enough memory to create member |
Definition at line 7593 of file app_queue.c.
References ao2_lock, ao2_ref, ao2_unlock, ast_copy_string(), AST_DEVICE_NOT_INUSE, AST_DEVSTATE_CACHABLE, ast_devstate_changed(), create_queue_member(), dump_queue_members(), member::dynamic, find_load_queue_rt_friendly(), member::interface, interface_exists(), is_member_available(), member_add_to_queue(), member::membername, call_queue::name, NULL, member::paused, member::penalty, queue_member_blob_create(), queue_publish_member_blob(), queue_t_unref, member::reason_paused, RES_EXISTS, RES_NOSUCHQUEUE, RES_OKAY, RES_OUTOFMEMORY, call_queue::ringinuse, member::state_interface, and member::wrapuptime.
Referenced by aqm_exec(), handle_queue_add_member(), manager_add_queue_member(), and reload_queue_members().
|
static |
Definition at line 3727 of file app_queue.c.
References ao2_t_alloc, ast_string_field_init, ast_string_field_set, destroy_queue(), name, NULL, and queue_t_unref.
Referenced by find_queue_by_name_rt(), and reload_single_queue().
AO2_STRING_FIELD_SORT_FN | ( | call_queue | , |
name | |||
) |
|
static |
AddQueueMember application.
Definition at line 8354 of file app_queue.c.
References add_to_queue(), args, AST_APP_ARG, ast_channel_name(), ast_channel_uniqueid(), AST_DECLARE_APP_ARGS, ast_log, ast_queue_log(), AST_STANDARD_APP_ARGS, ast_strdupa, ast_strip(), ast_strlen_zero(), member::interface, LOG_ERROR, log_membername_as_agent, LOG_NOTICE, LOG_WARNING, member::membername, NULL, options, pbx_builtin_setvar_helper(), member::penalty, queue_persistent_members, RES_EXISTS, RES_NOSUCHQUEUE, RES_OKAY, RES_OUTOFMEMORY, member::state_interface, tmp(), and member::wrapuptime.
Referenced by load_module().
struct ast_module * AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 11947 of file app_queue.c.
|
static |
Definition at line 1948 of file app_queue.c.
References ARRAY_LEN, ast_strlen_zero(), ast_true(), autopause::autopause, autopausesmodes, name, QUEUE_AUTOPAUSE_OFF, and QUEUE_AUTOPAUSE_ON.
Referenced by queue_set_param().
|
static |
Calculate the metric of each member in the outgoing callattempts.
A numeric metric is given to each member depending on the ring strategy used by the queue. Members with lower metrics will be called before members with higher metrics
-1 | if penalties are exceeded |
0 | otherwise |
Definition at line 6044 of file app_queue.c.
References ao2_container_count(), ast_debug, ast_log, ast_random(), member::calls, member::lastcall, queue_ent::linpos, queue_ent::linwrapped, LOG_WARNING, queue_ent::max_penalty, call_queue::members, queue_ent::min_penalty, NULL, member::penalty, call_queue::penaltymemberslimit, QUEUE_STRATEGY_FEWESTCALLS, QUEUE_STRATEGY_LEASTRECENT, QUEUE_STRATEGY_LINEAR, QUEUE_STRATEGY_RANDOM, QUEUE_STRATEGY_RINGALL, QUEUE_STRATEGY_RRMEMORY, QUEUE_STRATEGY_RRORDERED, QUEUE_STRATEGY_WRANDOM, member::queuepos, queue_ent::raise_penalty, call_queue::rrpos, call_queue::strategy, tmp(), and call_queue::wrapped.
Referenced by try_calling().
|
static |
Definition at line 4447 of file app_queue.c.
References ao2_ref, ast_free, ast_party_connected_line_free(), callattempt::connected, callattempt::member, and callattempt::orig_chan_name.
Referenced by hangupcalls(), and try_calling().
|
static |
Definition at line 4657 of file app_queue.c.
References ao2_find, ao2_link, ao2_lock, ao2_ref, ao2_unlock, ast_debug, call(), compare_weight(), force_longest_waiting_caller, get_queue_member_status(), get_wrapuptime(), is_longest_waiting_caller(), member::lastcall, member::lastqueue, member_status_available(), member::membername, call_queue::name, NULL, OBJ_NOLOCK, OBJ_SEARCH_OBJECT, queue_ent::parent, member::paused, pending_members, pending_members_remove(), member::ringinuse, member::status, use_weight, and member::wrapuptime.
Referenced by ring_entry().
|
static |
Change priority caller into a queue.
RES_NOSUCHQUEUE | queue does not exist |
RES_OKAY | change priority |
RES_NOT_CALLER | queue exists but no caller |
Definition at line 7646 of file app_queue.c.
References ao2_lock, ao2_unlock, ast_channel_name(), ast_debug, current, find_load_queue_rt_friendly(), call_queue::head, insert_entry(), queue_ent::next, NULL, queue_ent::pos, priority, RES_NOSUCHQUEUE, RES_NOT_CALLER, and RES_OKAY.
Referenced by handle_queue_change_priority_caller(), and manager_change_priority_caller_on_queue().
|
static |
Definition at line 3051 of file app_queue.c.
References ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_ref, member::callcompletedinsl, member::calls, call_queue::callsabandoned, call_queue::callsabandonedinsl, call_queue::callscompleted, call_queue::callscompletedinsl, call_queue::holdtime, member::lastcall, call_queue::members, member::starttime, and call_queue::talktime.
Referenced by clear_stats(), and find_queue_by_name_rt().
|
static |
Facilitates resetting statistics for a queue.
This function actually does not reset any statistics, but rather finds a call_queue struct which corresponds to the passed-in queue name and passes that structure to the clear_queue function. If no queuename is passed in, then all queues will have their statistics reset.
queuename | The name of the queue to reset the statistics for. If this is NULL or zero-length, then this means to reset the statistics for all queues |
0 | always |
Definition at line 9973 of file app_queue.c.
References ao2_iterator_destroy(), ao2_iterator_init(), ao2_lock, ao2_t_iterator_next, ao2_unlock, ast_strlen_zero(), clear_queue(), call_queue::name, queue_t_unref, and queues.
Referenced by reload_handler().
|
static |
Definition at line 4542 of file app_queue.c.
References ao2_find, ao2_iterator_destroy(), ao2_iterator_init(), ao2_lock, ao2_ref, ao2_t_iterator_next, ao2_unlock, ast_debug, call_queue::count, member::interface, call_queue::members, call_queue::name, num_available_members(), OBJ_POINTER, queue_t_unref, queues, and call_queue::weight.
Referenced by can_ring_entry().
|
static |
Check if a given word is in a space-delimited list.
line | The line as typed not including the current word being completed |
word | The word currently being completed |
pos | The number of completed words in line |
state | The nth desired completion option |
word_list_offset | Offset into the line where the list of queues begins. If non-zero, queues in the list will not be offered for further completion. |
Definition at line 10309 of file app_queue.c.
References ao2_iterator_destroy(), ao2_iterator_init(), ao2_t_iterator_next, ast_strdup, call_queue::name, NULL, queue_t_unref, queues, and word_in_list().
Referenced by complete_queue_add_member(), complete_queue_pause_member(), complete_queue_remove_member(), complete_queue_set_member_value(), complete_queue_show(), handle_queue_reload(), and handle_queue_reset().
|
static |
Definition at line 10815 of file app_queue.c.
References ast_malloc, ast_strdup, complete_queue(), and NULL.
Referenced by handle_queue_add_member().
|
static |
Definition at line 11233 of file app_queue.c.
References ast_strdup, complete_queue(), and NULL.
Referenced by handle_queue_pause_member().
|
static |
Definition at line 11068 of file app_queue.c.
References ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_lock, ao2_ref, ao2_t_iterator_next, ao2_unlock, ast_strdup, complete_queue(), member::interface, member::membername, call_queue::members, NULL, queue_t_unref, queues, and tmp().
Referenced by handle_queue_remove_member().
|
static |
Definition at line 11428 of file app_queue.c.
References AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_strdup, rule_list::list, rule_list::name, and NULL.
Referenced by handle_queue_rule_show().
|
static |
Definition at line 11307 of file app_queue.c.
References ast_strdup, complete_queue(), and NULL.
Referenced by handle_queue_set_member_penalty(), and handle_queue_set_member_ringinuse().
|
static |
Definition at line 10346 of file app_queue.c.
References complete_queue(), and NULL.
Referenced by queue_show().
|
static |
Definition at line 2910 of file app_queue.c.
References c.
Referenced by member_hash_fn().
|
static |
Returns if one context includes another context.
parent | Parent context to search for child |
child | Context to check for inclusion in parent |
This function recursively checks if the context child is included in the context parent.
1 | if child is included in parent |
0 | if not |
Definition at line 2777 of file app_queue.c.
References ast_context_find(), ast_get_context_name(), ast_get_include_name(), ast_walk_context_includes(), c, context_included(), and NULL.
Referenced by context_included(), and extension_state_cb().
|
static |
Copy rule from global list into specified queue.
Definition at line 8469 of file app_queue.c.
References ast_calloc, AST_LIST_INSERT_TAIL, AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_log, ast_strlen_zero(), call_queue::defaultrule, penalty_rule::list, rule_list::list, LOG_ERROR, penalty_rule::max_relative, penalty_rule::max_value, penalty_rule::min_relative, penalty_rule::min_value, rule_list::name, queue_ent::parent, queue_ent::qe_rules, penalty_rule::raise_relative, penalty_rule::raise_value, rule_list::rules, penalty_rule::time, and tmp().
Referenced by queue_exec().
|
static |
allocate space for new queue member and set fields based on parameters passed
Definition at line 2865 of file app_queue.c.
References ao2_alloc, ast_copy_string(), ast_extension_state_add(), ast_log, ast_strdupa, ast_strlen_zero(), voicemailpwcheck::context, destroy_queue_member_cb(), extension_state_cb(), get_queue_member_status(), member::interface, member::lastpause, LOG_WARNING, member::logintime, member::membername, NULL, member::paused, member::penalty, member::ringinuse, S_OR, member::state_context, member::state_exten, member::state_id, member::state_interface, member::status, strsep(), tmp(), and member::wrapuptime.
Referenced by add_to_queue(), reload_single_member(), and rt_handle_member_record().
|
static |
Free queue's member list then its string fields.
Definition at line 3712 of file app_queue.c.
References ao2_ref, ast_free, ast_string_field_free_memory, free_members(), MAX_PERIODIC_ANNOUNCEMENTS, call_queue::members, and call_queue::sound_periodicannounce.
Referenced by alloc_queue().
|
static |
Definition at line 2855 of file app_queue.c.
References ast_extension_state_del(), extension_state_cb(), and member::state_id.
Referenced by create_queue_member().
|
static |
set a member's status based on device state of that member's interface
Definition at line 2641 of file app_queue.c.
References ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_lock, ao2_ref, ao2_t_iterator_next, ao2_unlock, ast_copy_string(), ast_debug, AST_DEVICE_INUSE, AST_DEVICE_NOT_INUSE, ast_device_state_message_type(), ast_devstate2str(), AST_DEVSTATE_CACHABLE, ast_devstate_changed(), ast_device_state_message::device, ast_device_state_message::eid, call_queue::found, is_member_available(), call_queue::members, call_queue::name, queue_t_unref, queues, stasis_message_data(), stasis_message_type(), ast_device_state_message::state, member::state_interface, and update_status().
Referenced by load_module().
|
static |
common hangup actions
Definition at line 4627 of file app_queue.c.
References ast_hangup(), callattempt::chan, callattempt::member, NULL, pending_members_remove(), and callattempt::stillgoing.
Referenced by ring_entry(), and wait_for_answer().
|
static |
direct output to manager or cli with proper terminator
Definition at line 10020 of file app_queue.c.
References ast_cli(), astman_append(), and str.
Referenced by __queues_show(), and print_queue().
|
static |
Dump all members in a specific queue to the database.
Definition at line 7485 of file app_queue.c.
References ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_ref, ast_db_del(), ast_db_put(), ast_free, ast_log, ast_str_append(), ast_str_buffer(), ast_str_create, ast_str_strlen(), member::dynamic, member::interface, LOG_WARNING, member::membername, call_queue::members, call_queue::name, member::paused, member::penalty, pm_family, member::reason_paused, member::state_interface, value, and member::wrapuptime.
Referenced by add_to_queue(), remove_from_queue(), and set_queue_member_pause().
|
static |
Definition at line 6834 of file app_queue.c.
References ao2_ref, queue_end_bridge::chan, queue_end_bridge::q, queue_t_unref, and set_queue_variables().
Referenced by try_calling().
|
static |
Definition at line 6827 of file app_queue.c.
References ao2_ref, queue_end_bridge::chan, and ast_bridge_config::end_bridge_callback_data.
Referenced by try_calling().
|
static |
Definition at line 6874 of file app_queue.c.
References input(), and pbx_substitute_variables_helper().
Referenced by setup_mixmonitor().
|
static |
Definition at line 2806 of file app_queue.c.
References ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_lock, ao2_ref, ao2_t_iterator_next, ao2_unlock, ast_debug, ast_devstate2str(), AST_HINT_UPDATE_DEVICE, voicemailpwcheck::context, context_included(), extensionstate2devicestate(), call_queue::found, sip_to_pjsip::info(), call_queue::members, queue_t_unref, queues, member::state_context, member::state_exten, and update_status().
Referenced by create_queue_member(), and destroy_queue_member_cb().
|
static |
Helper function which converts from extension state to device state values.
Definition at line 2728 of file app_queue.c.
References AST_DEVICE_BUSY, AST_DEVICE_INUSE, AST_DEVICE_INVALID, AST_DEVICE_NOT_INUSE, AST_DEVICE_ONHOLD, AST_DEVICE_RINGING, AST_DEVICE_RINGINUSE, AST_DEVICE_UNAVAILABLE, AST_EXTENSION_BUSY, AST_EXTENSION_DEACTIVATED, AST_EXTENSION_INUSE, AST_EXTENSION_NOT_INUSE, AST_EXTENSION_ONHOLD, AST_EXTENSION_REMOVED, AST_EXTENSION_RINGING, AST_EXTENSION_UNAVAILABLE, and state.
Referenced by extension_state_cb(), and get_queue_member_status().
|
static |
find the entry with the best metric, or NULL
Definition at line 4885 of file app_queue.c.
References callattempt::metric, and NULL.
Referenced by ring_one(), store_next_lin(), and store_next_rr().
|
static |
note
This will be two separate database transactions, so we might see queue parameters as they were before another process changed the queue and member list as it was after the change. Thus we might see an empty member list when a queue is deleted. In practise, this is unlikely to cause a problem.
Definition at line 3895 of file app_queue.c.
References ao2_t_find, ast_atomic_fetchadd_int(), ast_config_destroy(), ast_config_new(), ast_debug, ast_load_realtime(), ast_load_realtime_multientry(), ast_variables_destroy(), find_queue_by_name_rt(), NULL, OBJ_POINTER, queue_t_unref, queues, call_queue::realtime, SENTINEL, update_realtime_members(), use_weight, and call_queue::weight.
Referenced by __queues_show(), add_to_queue(), change_priority_caller_on_queue(), find_member_by_queuename_and_interface(), get_member_penalty(), join_queue(), load_realtime_queues(), queue_function_exists(), queue_function_mem_read(), queue_function_qac_dep(), queue_function_queuememberlist(), queue_function_var(), qupd_exec(), reload_queue_members(), request_withdraw_caller_from_queue(), and set_member_value().
|
static |
Find a member by looking up queuename and interface.
Definition at line 11927 of file app_queue.c.
References ao2_find, ao2_lock, ao2_unlock, find_load_queue_rt_friendly(), call_queue::members, NULL, OBJ_KEY, and queue_t_unref.
Referenced by handle_queue_remove_member(), manager_remove_queue_member(), and rqm_exec().
|
static |
Reload a single queue via realtime.
Check for statically defined queue first, check if deleted RT queue, check for new RT queue, if queue vars are not defined init them with defaults. reload RT queue vars, set RT queue members dead and reload them, return finished queue.
the | queue, |
NULL | if it doesn't exist. |
Definition at line 3751 of file app_queue.c.
References alloc_queue(), ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_lock, ao2_ref, ao2_t_find, ao2_unlock, ast_category_browse(), ast_copy_string(), ast_debug, ast_log, ast_queue_log(), ast_strlen_zero(), clear_queue(), member::dead, call_queue::dead, init_queue(), member::interface, log_membername_as_agent, LOG_WARNING, member_remove_from_queue(), member::membername, call_queue::members, call_queue::name, ast_variable::name, ast_variable::next, NULL, OBJ_POINTER, queue_set_param(), QUEUE_STRATEGY_RINGALL, queue_t_unref, queues, queues_t_link, queues_t_unlink, member::realtime, call_queue::realtime, rt_handle_member_record(), strat2int(), call_queue::strategy, tmp(), and ast_variable::value.
Referenced by find_load_queue_rt_friendly().
|
static |
Iterate through queue's member list and delete them.
Definition at line 3696 of file app_queue.c.
References ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_ref, member::dynamic, member_remove_from_queue(), and call_queue::members.
Referenced by destroy_queue().
|
static |
Definition at line 8987 of file app_queue.c.
References ast_log, ast_strlen_zero(), member::interface, interface_exists(), LOG_ERROR, call_queue::name, and NULL.
Referenced by queue_function_mem_read().
|
static |
Gets members penalty.
Definition at line 8069 of file app_queue.c.
References ao2_lock, ao2_ref, ao2_unlock, ast_log, find_load_queue_rt_friendly(), member::interface, interface_exists(), LOG_ERROR, member::penalty, queue_t_unref, and RESULT_FAILURE.
Referenced by queue_function_memberpenalty_read().
|
static |
Check if members are available.
This function checks to see if members are available to be called. If any member is available, the function immediately returns 0. If no members are available, then -1 is returned.
Definition at line 2422 of file app_queue.c.
References ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_lock, ao2_ref, ao2_unlock, ast_debug, AST_DEVICE_INUSE, AST_DEVICE_INVALID, AST_DEVICE_RINGING, AST_DEVICE_UNAVAILABLE, AST_DEVICE_UNKNOWN, get_member_status(), get_wrapuptime(), member::lastcall, member::membername, call_queue::members, NULL, member::paused, member::penalty, QUEUE_EMPTY_INUSE, QUEUE_EMPTY_INVALID, QUEUE_EMPTY_PAUSED, QUEUE_EMPTY_PENALTY, QUEUE_EMPTY_RINGING, QUEUE_EMPTY_UNAVAILABLE, QUEUE_EMPTY_UNKNOWN, QUEUE_EMPTY_WRAPUP, member::state_interface, and member::status.
Referenced by get_member_status(), join_queue(), queue_exec(), and wait_our_turn().
|
static |
Return the current state of a member.
Definition at line 2850 of file app_queue.c.
References ast_extension_state(), ast_strlen_zero(), extensionstate2devicestate(), NULL, member::state_context, member::state_exten, and member::state_interface.
Referenced by can_ring_entry(), create_queue_member(), and kill_dead_members().
|
static |
Return wrapuptime.
This function checks if wrapuptime in member is set and return this value. Otherwise return value the wrapuptime in the queue configuration
Definition at line 1991 of file app_queue.c.
References member::wrapuptime, and call_queue::wrapuptime.
Referenced by can_ring_entry(), get_member_status(), is_member_available(), and queue_function_mem_read().
|
static |
Handle an attended transfer event.
This event is important in order to be able to log the end of the call to the queue log and to stasis.
userdata | Data pertaining to the particular call in the queue. |
sub | The stasis subscription on which the message occurred. |
msg | The stasis message for the attended transfer event. |
Definition at line 6468 of file app_queue.c.
References ao2_cleanup, ao2_lock, ao2_unlock, AST_ATTENDED_TRANSFER_DEST_THREEWAY, AST_BRIDGE_TRANSFER_SUCCESS, ast_channel_snapshot_get_latest(), ast_debug, ast_strlen_zero(), ast_bridge_channel_snapshot_pair::bridge_snapshot, queue_stasis_data::bridge_uniqueid, queue_stasis_data::callcompletedinsl, queue_stasis_data::caller_uniqueid, ast_attended_transfer_message::dest_type, queue_stasis_data::dying, queue_stasis_data::holdstart, log_attended_transfer(), queue_stasis_data::member, queue_stasis_data::member_uniqueid, call_queue::name, NULL, queue_stasis_data::queue, RAII_VAR, remove_stasis_subscriptions(), ast_attended_transfer_message::result, send_agent_complete(), queue_stasis_data::starttime, stasis_message_data(), ast_attended_transfer_message::to_transfer_target, ast_attended_transfer_message::to_transferee, TRANSFER, ast_bridge_snapshot::uniqueid, and update_queue().
Referenced by setup_stasis_subs().
|
static |
Handle a blind transfer event.
This event is important in order to be able to log the end of the call to the queue log and to stasis.
userdata | Data pertaining to the particular call in the queue. |
sub | The stasis subscription on which the message occurred. |
msg | The stasis message for the blind transfer event |
Definition at line 6409 of file app_queue.c.
References ao2_cleanup, ao2_lock, ao2_unlock, AST_BRIDGE_TRANSFER_SUCCESS, ast_channel_snapshot_get_latest(), ast_debug, ast_queue_log(), ast_strlen_zero(), ast_blind_transfer_message::bridge, queue_stasis_data::bridge_uniqueid, queue_stasis_data::callcompletedinsl, queue_stasis_data::caller_pos, queue_stasis_data::caller_uniqueid, voicemailpwcheck::context, ast_blind_transfer_message::context, queue_stasis_data::dying, ast_blind_transfer_message::exten, queue_stasis_data::holdstart, queue_stasis_data::member, queue_stasis_data::member_uniqueid, member::membername, call_queue::name, NULL, queue_stasis_data::queue, RAII_VAR, remove_stasis_subscriptions(), ast_blind_transfer_message::result, send_agent_complete(), queue_stasis_data::starttime, stasis_message_data(), TRANSFER, ast_bridge_snapshot::uniqueid, and update_queue().
Referenced by setup_stasis_subs().
|
static |
Definition at line 6376 of file app_queue.c.
References ast_debug, ast_string_field_set, ast_strlen_zero(), ast_channel_snapshot::base, ast_bridge_blob::bridge, queue_stasis_data::bridge_uniqueid, queue_stasis_data::caller_uniqueid, ast_bridge_blob::channel, queue_stasis_data::dying, lock, ast_channel_snapshot_base::name, SCOPED_AO2LOCK, stasis_message_data(), ast_bridge_snapshot::uniqueid, and ast_channel_snapshot_base::uniqueid.
Referenced by setup_stasis_subs().
|
static |
Definition at line 6657 of file app_queue.c.
References AGENT, ao2_cleanup, ao2_lock, ao2_unlock, ast_channel_get_by_name(), ast_channel_has_role(), ast_channel_snapshot_get_latest(), ast_debug, ast_queue_log(), ast_strlen_zero(), AST_TRANSFERER_ROLE_NAME, ast_channel_snapshot::base, queue_stasis_data::callcompletedinsl, CALLER, queue_stasis_data::caller_pos, queue_stasis_data::caller_uniqueid, queue_stasis_data::dying, queue_stasis_data::holdstart, queue_stasis_data::member, queue_stasis_data::member_uniqueid, member::membername, call_queue::name, ast_channel_snapshot_base::name, NULL, pbx_builtin_getvar_helper(), queue_stasis_data::queue, RAII_VAR, remove_stasis_subscriptions(), send_agent_complete(), ast_channel_blob::snapshot, queue_stasis_data::starttime, stasis_message_data(), ast_channel_snapshot_base::uniqueid, and update_queue().
Referenced by setup_stasis_subs().
|
static |
Definition at line 6542 of file app_queue.c.
References ast_assert, ast_json_integer_get(), ast_json_object_get(), ast_log, ast_multi_channel_blob_get_channel(), ast_multi_channel_blob_get_json(), ast_strdup, ast_channel_snapshot::base, queue_stasis_data::caller_optimize, queue_stasis_data::caller_uniqueid, queue_stasis_data::dying, id, local_optimization::id, local_optimization::in_progress, lock, LOG_ERROR, queue_stasis_data::member_optimize, queue_stasis_data::member_uniqueid, ast_channel_snapshot_base::name, NULL, SCOPED_AO2LOCK, local_optimization::source_chan_uniqueid, stasis_message_data(), and ast_channel_snapshot_base::uniqueid.
Referenced by setup_stasis_subs().
|
static |
Definition at line 6593 of file app_queue.c.
References ast_debug, ast_json_integer_get(), ast_json_object_get(), ast_log, ast_multi_channel_blob_get_channel(), ast_multi_channel_blob_get_json(), ast_string_field_set, ast_channel_snapshot::base, queue_stasis_data::caller_optimize, queue_stasis_data::caller_uniqueid, queue_stasis_data::dying, id, local_optimization::id, local_optimization::in_progress, lock, LOG_WARNING, queue_stasis_data::member_optimize, queue_stasis_data::member_uniqueid, SCOPED_AO2LOCK, local_optimization::source_chan_uniqueid, stasis_message_data(), and ast_channel_snapshot_base::uniqueid.
Referenced by setup_stasis_subs().
|
static |
Definition at line 6714 of file app_queue.c.
References ao2_lock, ao2_unlock, ast_debug, ast_json_object_get(), ast_json_string_get(), ast_string_field_set, ast_channel_snapshot::base, ast_channel_blob::blob, queue_stasis_data::caller_uniqueid, queue_stasis_data::dying, queue_stasis_data::member_uniqueid, ast_channel_blob::snapshot, stasis_message_data(), and ast_channel_snapshot_base::uniqueid.
Referenced by setup_stasis_subs().
|
static |
Definition at line 10990 of file app_queue.c.
References a, add_to_queue(), ast_cli(), ast_queue_log(), ast_strlen_zero(), CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, complete_queue_add_member(), log_membername_as_agent, NULL, queue_persistent_members, RES_EXISTS, RES_NOSUCHQUEUE, RES_NOT_DYNAMIC, RES_OKAY, RES_OUTOFMEMORY, and ast_cli_entry::usage.
|
static |
Definition at line 11179 of file app_queue.c.
References a, ast_cli(), ast_log, change_priority_caller_on_queue(), CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, LOG_ERROR, NULL, priority, RES_NOSUCHQUEUE, RES_NOT_CALLER, RES_OKAY, and ast_cli_entry::usage.
|
static |
Definition at line 11252 of file app_queue.c.