Asterisk - The Open Source Telephony Project
21.4.1
|
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 |
Macros | |
#define | ANNOUNCEHOLDTIME_ALWAYS 1 |
#define | ANNOUNCEHOLDTIME_ONCE 2 |
#define | ANNOUNCEPOSITION_LIMIT 4 |
#define | ANNOUNCEPOSITION_MORE_THAN 3 |
#define | ANNOUNCEPOSITION_NO 2 |
#define | ANNOUNCEPOSITION_YES 1 |
#define | AST_MAX_WATCHERS 256 |
#define | DEFAULT_MIN_ANNOUNCE_FREQUENCY 15 |
The minimum number of seconds between position announcements. More... | |
#define | DEFAULT_RETRY 5 |
#define | DEFAULT_TIMEOUT 15 |
#define | MAX_CALL_ATTEMPT_BUCKETS 353 |
#define | MAX_PERIODIC_ANNOUNCEMENTS 10 |
#define | MAX_QUEUE_BUCKETS 53 |
#define | QUEUE_EVENT_VARIABLES 3 |
#define | QUEUE_PAUSED_DEVSTATE AST_DEVICE_INUSE |
#define | queue_ref(q) ao2_bump(q) |
#define | queue_t_ref(q, tag) ao2_t_bump(q, tag) |
#define | queue_t_unref(q, tag) ({ ao2_t_cleanup(q, tag); NULL; }) |
#define | QUEUE_UNKNOWN_PAUSED_DEVSTATE AST_DEVICE_NOT_INUSE |
#define | QUEUE_UNPAUSED_DEVSTATE AST_DEVICE_NOT_INUSE |
#define | queue_unref(q) ({ ao2_cleanup(q); NULL; }) |
#define | queues_t_link(c, q, tag) ao2_t_link(c, q, tag) |
#define | queues_t_unlink(c, q, tag) ao2_t_unlink(c, q, tag) |
#define | RECHECK 1 |
#define | RES_EXISTS (-1) |
#define | RES_NOSUCHQUEUE (-3) |
#define | RES_NOT_CALLER (-5) |
#define | RES_NOT_DYNAMIC (-4) |
#define | RES_OKAY 0 |
#define | RES_OUTOFMEMORY (-2) |
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. | |
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. | |
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 | |
static void | destroy_queue (void *obj) |
Free queue's member list then its string fields. | |
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 | |
static void | do_hang (struct callattempt *o) |
common hangup actions | |
static void | do_print (struct mansession *s, int fd, const char *str) |
direct output to manager or cli with proper terminator | |
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. | |
static struct callattempt * | find_best (struct callattempt *outgoing) |
find the entry with the best metric, or NULL | |
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. | |
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. | |
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. | |
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'. | |
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. | |
static int | manager_queues_summary (struct mansession *s, const struct message *m) |
Summary of queue info via the AMI. | |
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. | |
static void | print_queue (struct mansession *s, int fd, struct call_queue *q) |
Print a single queue to AMI or the CLI. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
static int | rqm_exec (struct ast_channel *chan, const char *data) |
RemoveQueueMember application. | |
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. | |
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. | |
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 | |
static void | set_queue_variables (struct call_queue *q, struct ast_channel *chan) |
Set variables of queue. | |
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_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_caller_abandon_type,.to_ami=queue_caller_abandon_to_ami,) | |
STASIS_MESSAGE_TYPE_DEFN_LOCAL (queue_member_status_type,.to_ami=queue_member_status_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_removed_type,.to_ami=queue_member_removed_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_ringinuse_type,.to_ami=queue_member_ringinuse_to_ami,) | |
STASIS_MESSAGE_TYPE_DEFN_LOCAL (queue_agent_called_type,.to_ami=queue_agent_called_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_complete_type,.to_ami=queue_agent_complete_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,) | |
static int | store_next_lin (struct queue_ent *qe, struct callattempt *outgoing) |
Search for best metric and add to Linear queue. | |
static int | store_next_rr (struct queue_ent *qe, struct callattempt *outgoing) |
Search for best metric and add to Round Robbin queue. | |
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. | |
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 = "da6642af068ee5e6490c5b1d2cc1d238" , .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 | |
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. | |
static int | force_longest_waiting_caller |
queues.conf [general] option | |
static int | log_membername_as_agent |
queues.conf [general] option | |
static int | montype_default |
queues.conf [general] option | |
static int | negative_penalty_invalid |
queues.conf [general] option | |
static struct ao2_container * | pending_members |
static const char *const | pm_family = "Queue/PersistentMembers" |
Persistent Members astdb family. | |
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 | |
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 | |
static char * | realtime_ringinuse_field |
name of the ringinuse field in the realtime database | |
static int | realtime_rules |
queuerules.conf [general] option | |
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 | |
static const struct strategy | strategies [] |
static struct stasis_forward * | topic_forwarder |
static int | use_weight |
Records that one or more queues use weight. | |
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 Added Priority jumping code for adding and removing queue members by Jonathan Stanton el@b etel. nlaster isk@ doilo okli keica re.c om
Fixed to work with CVS as of 2004-02-25 and released as 1.07a by Matthew Enger m.eng er@x i.com .au
Definition in file app_queue.c.
#define ANNOUNCEPOSITION_LIMIT 4 |
We not announce position more than <limit>
Definition at line 1789 of file app_queue.c.
Referenced by queue_set_param().
#define ANNOUNCEPOSITION_MORE_THAN 3 |
We say "Currently there are more than <limit>"
Definition at line 1788 of file app_queue.c.
Referenced by queue_set_param().
#define ANNOUNCEPOSITION_NO 2 |
We don't announce position
Definition at line 1787 of file app_queue.c.
Referenced by queue_set_param().
#define ANNOUNCEPOSITION_YES 1 |
We announce position
Definition at line 1786 of file app_queue.c.
Referenced by init_queue(), and queue_set_param().
#define DEFAULT_MIN_ANNOUNCE_FREQUENCY 15 |
The minimum number of seconds between position announcements.
Definition at line 1561 of file app_queue.c.
Referenced by init_queue().
#define MAX_PERIODIC_ANNOUNCEMENTS 10 |
The maximum periodic announcements we can have
Definition at line 1556 of file app_queue.c.
Referenced by destroy_queue(), init_queue(), and queue_set_param().
#define RECHECK 1 |
Recheck every second to see we we're at the top yet
Definition at line 1555 of file app_queue.c.
Referenced by wait_our_turn().
#define RES_EXISTS (-1) |
Entry already exists
Definition at line 1566 of file app_queue.c.
Referenced by add_to_queue(), aqm_exec(), remove_from_queue(), request_withdraw_caller_from_queue(), and rqm_exec().
#define RES_NOSUCHQUEUE (-3) |
No such queue
Definition at line 1568 of file app_queue.c.
Referenced by add_to_queue(), aqm_exec(), change_priority_caller_on_queue(), remove_from_queue(), request_withdraw_caller_from_queue(), and rqm_exec().
#define RES_NOT_CALLER (-5) |
Caller not found
Definition at line 1570 of file app_queue.c.
Referenced by change_priority_caller_on_queue(), and request_withdraw_caller_from_queue().
#define RES_NOT_DYNAMIC (-4) |
Member is not dynamic
Definition at line 1569 of file app_queue.c.
Referenced by remove_from_queue(), and rqm_exec().
#define RES_OKAY 0 |
Action completed
Definition at line 1565 of file app_queue.c.
Referenced by add_to_queue(), aqm_exec(), change_priority_caller_on_queue(), remove_from_queue(), request_withdraw_caller_from_queue(), and rqm_exec().
#define RES_OUTOFMEMORY (-2) |
Out of memory
Definition at line 1567 of file app_queue.c.
Referenced by add_to_queue(), aqm_exec(), and reload_queue_members().
anonymous enum |
Definition at line 1446 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_ref, ast_category_browse(), ast_check_realtime(), ast_config_destroy(), ast_load_realtime_multientry(), ast_str_buffer(), ast_str_set(), do_print(), find_load_queue_rt_friendly(), call_queue::name, and print_queue().
|
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_ref, 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(), call_queue::name, member::reason_paused, RES_EXISTS, RES_NOSUCHQUEUE, RES_OKAY, and RES_OUTOFMEMORY.
Referenced by aqm_exec(), and reload_queue_members().
|
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, member::calls, member::lastcall, queue_ent::linpos, queue_ent::linwrapped, queue_ent::max_penalty, call_queue::members, queue_ent::min_penalty, member::penalty, call_queue::penaltymemberslimit, queue_ent::pos, member::queuepos, queue_ent::raise_penalty, and call_queue::rrpos.
|
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 ast_debug, queue_ent::chan, find_load_queue_rt_friendly(), call_queue::head, insert_entry(), queue_ent::next, queue_ent::pos, queue_ent::prio, RES_NOSUCHQUEUE, RES_NOT_CALLER, and RES_OKAY.
|
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(), and call_queue::name.
Referenced by reload_handler().
|
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(), ast_strdup, call_queue::name, and word_in_list().
|
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().
|
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_ref, ast_db_del(), ast_db_put(), ast_str_append(), ast_str_buffer(), ast_str_create, ast_str_strlen(), member::dynamic, member::interface, member::membername, call_queue::members, call_queue::name, member::paused, member::penalty, member::reason_paused, member::state_interface, and member::wrapuptime.
Referenced by add_to_queue(), and remove_from_queue().
|
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_multientry(), ast_variables_destroy(), find_queue_by_name_rt(), OBJ_POINTER, 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(), queue_function_exists(), queue_function_mem_read(), queue_function_qac_dep(), queue_function_queuememberlist(), queue_function_var(), qupd_exec(), reload_queue_members(), and request_withdraw_caller_from_queue().
|
static |
Find a member by looking up queuename and interface.
Definition at line 11927 of file app_queue.c.
References find_load_queue_rt_friendly(), call_queue::members, and OBJ_KEY.
Referenced by 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 ao2_iterator_destroy(), ao2_iterator_init(), ao2_ref, ao2_t_find, ast_category_browse(), ast_copy_string(), ast_debug, member::dead, init_queue(), member::interface, member::membername, call_queue::members, ast_variable::name, call_queue::name, ast_variable::next, OBJ_POINTER, queue_set_param(), member::realtime, rt_handle_member_record(), and ast_variable::value.
Referenced by find_load_queue_rt_friendly().
|
static |
Gets members penalty.
Definition at line 8069 of file app_queue.c.
References ao2_ref, find_load_queue_rt_friendly(), and member::penalty.
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_ref, ast_debug, AST_DEVICE_INUSE, AST_DEVICE_INVALID, AST_DEVICE_RINGING, AST_DEVICE_UNAVAILABLE, AST_DEVICE_UNKNOWN, get_wrapuptime(), member::lastcall, member::membername, call_queue::members, member::paused, member::penalty, queue_ent::raise_penalty, member::state_interface, and member::status.
Referenced by queue_exec(), and wait_our_turn().
|
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 get_member_status(), 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 AST_BRIDGE_TRANSFER_SUCCESS, ast_channel_snapshot_get_latest(), ast_debug, 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, queue_stasis_data::member, queue_stasis_data::member_uniqueid, call_queue::name, queue_stasis_data::queue, RAII_VAR, 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, ast_bridge_snapshot::uniqueid, and update_queue().
|
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 AST_BRIDGE_TRANSFER_SUCCESS, ast_channel_snapshot_get_latest(), ast_debug, ast_blind_transfer_message::bridge, queue_stasis_data::bridge_uniqueid, queue_stasis_data::callcompletedinsl, queue_stasis_data::caller_pos, queue_stasis_data::caller_uniqueid, ast_blind_transfer_message::context, queue_ent::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, queue_stasis_data::queue, RAII_VAR, ast_blind_transfer_message::result, send_agent_complete(), queue_stasis_data::starttime, stasis_message_data(), ast_bridge_snapshot::uniqueid, and update_queue().
|
static |
Initialize Queue default values.
Definition at line 2949 of file app_queue.c.
References call_queue::announce_to_first_user, call_queue::announcefrequency, call_queue::announceposition_only_up, ANNOUNCEPOSITION_YES, call_queue::announcepositionlimit, AO2_ALLOC_OPT_LOCK_MUTEX, ao2_container_alloc_hash, ao2_container_alloc_list, AST_DEVICE_INUSE, AST_DEVSTATE_CACHABLE, ast_devstate_changed(), AST_LIST_REMOVE_HEAD, ast_str_create, ast_str_set(), ast_string_field_set, call_queue::autofill, autofill_default, call_queue::autopause, call_queue::autopausedelay, DEFAULT_MIN_ANNOUNCE_FREQUENCY, call_queue::log_restricted_caller_id, MAX_PERIODIC_ANNOUNCEMENTS, call_queue::maxlen, call_queue::memberdelay, call_queue::members, call_queue::minannouncefrequency, call_queue::monfmt, call_queue::name, call_queue::numperiodicannounce, call_queue::penaltymemberslimit, call_queue::periodicannouncefrequency, call_queue::periodicannouncestartdelay, call_queue::randomperiodicannounce, call_queue::retry, call_queue::roundingseconds, call_queue::rules, call_queue::servicelevel, call_queue::sound_periodicannounce, call_queue::timeout, call_queue::timeoutpriority, call_queue::weight, and call_queue::wrapuptime.
Referenced by find_queue_by_name_rt(), and reload_single_queue().
|
static |
Change queue penalty by adding rule.
Check rule for errors with time or formatting, see if rule is relative to rest of queue, iterate list of rules to find correct insertion point, insert and return.
-1 | on failure |
0 | on success |
Definition at line 3083 of file app_queue.c.
References ast_calloc, AST_LIST_INSERT_BEFORE_CURRENT, AST_LIST_INSERT_TAIL, AST_LIST_TRAVERSE, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, ast_strdupa, penalty_rule::max_relative, penalty_rule::max_value, penalty_rule::min_relative, penalty_rule::min_value, penalty_rule::raise_relative, penalty_rule::raise_value, and penalty_rule::time.
Referenced by reload_queue_rules().
|
static |
Check if we should start attempting to call queue members.
A simple process, really. Count the number of members who are available to take our call and then see if we are in a position in the queue at which a member could accept our call.
[in] | qe | The caller who wants to know if it is his turn |
0 | It is not our turn |
1 | It is our turn |
Definition at line 5745 of file app_queue.c.
References ast_debug, call_queue::autofill, queue_ent::chan, call_queue::head, queue_ent::next, num_available_members(), queue_ent::parent, queue_ent::pending, and queue_ent::pos.
Referenced by queue_exec(), and wait_our_turn().
|
static |
Caller leaving queue.
Search the queue to find the leaving client, if found remove from queue create manager event, move others up the queue.
Definition at line 4372 of file app_queue.c.
References ast_channel_publish_cached_blob(), ast_debug, AST_DEVICE_NOT_INUSE, AST_DEVSTATE_CACHABLE, ast_devstate_changed(), ast_json_pack(), ast_json_unref(), AST_LIST_REMOVE_HEAD, ast_variables_destroy(), queue_ent::chan, call_queue::count, call_queue::head, call_queue::name, queue_ent::next, queue_ent::parent, pbx_builtin_setvar_helper(), queue_ent::pos, queue_ent::pr, queue_ent::qe_rules, and RAII_VAR.
Referenced by queue_exec().
|
static |
Load the module.
Module loading including tests for configuration or dependencies. This function can return AST_MODULE_LOAD_FAILURE, AST_MODULE_LOAD_DECLINE, or AST_MODULE_LOAD_SUCCESS. If a dependency or environment variable fails tests return AST_MODULE_LOAD_FAILURE. If the module can not load the configuration file or other non-critical problem return AST_MODULE_LOAD_DECLINE. On success return AST_MODULE_LOAD_SUCCESS.
Definition at line 11759 of file app_queue.c.
References AO2_ALLOC_OPT_LOCK_MUTEX, ao2_container_alloc_hash, aqm_exec(), ast_channel_agent_login_type(), ast_channel_agent_logoff_type(), ast_channel_topic_all(), ast_cli_register_multiple, ast_config_destroy(), ast_custom_function_register, ast_device_state_message_type(), ast_device_state_topic_all(), ast_load_realtime_multientry(), ast_manager_get_topic(), ast_manager_register_xml, AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, ast_queue_topic_all(), ast_realtime_require_field(), ast_register_application_xml, device_state_cb(), manager_queues_status(), manager_queues_summary(), manager_topic, pqm_exec(), ql_exec(), queue_exec(), qupd_exec(), reload_handler(), reload_queue_members(), rqm_exec(), stasis_forward_all(), stasis_message_router_add(), STASIS_MESSAGE_TYPE_INIT, stasis_subscription_accept_message_type(), STASIS_SUBSCRIPTION_FILTER_SELECTIVE, stasis_subscription_set_filter(), and upqm_exec().
|
static |
Load queue rules from realtime.
Check rule for errors with time or formatting, see if rule is relative to rest of queue, iterate list of rules to find correct insertion point, insert and return.
-1 | on failure |
0 | on success |
Definition at line 3187 of file app_queue.c.
References ast_calloc, ast_category_browse(), ast_check_realtime(), ast_config_destroy(), ast_copy_string(), AST_LIST_INSERT_BEFORE_CURRENT, AST_LIST_INSERT_TAIL, AST_LIST_TRAVERSE, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, ast_load_realtime_multientry(), queue_ent::max_penalty, penalty_rule::max_relative, penalty_rule::max_value, queue_ent::min_penalty, penalty_rule::min_relative, penalty_rule::min_value, queue_ent::raise_penalty, penalty_rule::raise_relative, penalty_rule::raise_value, and penalty_rule::time.
Referenced by reload_queue_rules().
|
static |
Get the number of members available to accept a call.
[in] | q | The queue for which we are counting the number of available members |
Definition at line 4509 of file app_queue.c.
References ao2_iterator_destroy(), ao2_iterator_init(), ao2_ref, call_queue::autofill, and call_queue::members.
Referenced by is_our_turn(), and remove_from_queue().
|
static |
The starting point for all queue calls.
The process involved here is to
Definition at line 8512 of file app_queue.c.
References call_queue::announce_to_first_user, call_queue::announcefrequency, ao2_container_count(), AST_APP_ARG, ast_app_exec_sub(), ast_app_parse_options(), AST_CONTROL_RINGING, ast_copy_string(), ast_debug, AST_DECLARE_APP_ARGS, ast_indicate(), AST_LIST_FIRST, ast_moh_start(), ast_moh_stop(), ast_party_id_presentation(), ast_replace_subargument_delimiter(), AST_STANDARD_APP_ARGS, ast_stopstream(), ast_strdupa, queue_ent::chan, copy_rules(), queue_ent::digits, queue_ent::expire, get_member_status(), queue_ent::handled, is_our_turn(), queue_ent::last_periodic_announce_sound, queue_ent::last_periodic_announce_time, queue_ent::last_pos, queue_ent::last_pos_said, leave_queue(), call_queue::log_restricted_caller_id, queue_ent::max_penalty, call_queue::members, queue_ent::min_penalty, queue_ent::moh, call_queue::name, queue_ent::opos, queue_ent::parent, pbx_builtin_getvar_helper(), pbx_builtin_setvar_helper(), call_queue::periodicannouncefrequency, call_queue::periodicannouncestartdelay, queue_ent::pos, queue_ent::pr, queue_ent::predial_callee, queue_ent::prio, queue_ent::qe_rules, queue_ent::raise_penalty, record_abandoned(), queue_ent::ring_when_ringing, S_COR, S_OR, say_periodic_announcement(), set_queue_result(), set_queue_variables(), queue_ent::start, stop, penalty_rule::time, update_qe_rule(), queue_ent::valid_digits, wait_our_turn(), queue_ent::withdraw, and queue_ent::withdraw_info.
Referenced by load_module().
|
static |
Get number either busy / free / ready or total members of a specific queue.
Get or set member properties penalty / paused / ringinuse
number | of members (busy / free / ready / total) or member info (penalty / paused / ringinuse) |
-1 | on error |
Definition at line 9010 of file app_queue.c.
References ao2_container_count(), ao2_iterator_destroy(), ao2_iterator_init(), ao2_ref, AST_APP_ARG, AST_DECLARE_APP_ARGS, AST_DEVICE_INVALID, AST_DEVICE_NOT_INUSE, AST_DEVICE_UNAVAILABLE, AST_STANDARD_APP_ARGS, find_load_queue_rt_friendly(), get_wrapuptime(), member::lastcall, call_queue::members, member::paused, member::penalty, member::ringinuse, and member::status.
|
static |
Get the total number of members in a specific queue (Deprecated)
number | of members |
-1 | on error |
Definition at line 9175 of file app_queue.c.
References ao2_iterator_destroy(), ao2_iterator_init(), ao2_ref, AST_DEVICE_INVALID, AST_DEVICE_UNAVAILABLE, find_load_queue_rt_friendly(), call_queue::members, and member::status.
|
static |
create interface var with all queue details.
0 | on success |
-1 | on error |
Definition at line 8924 of file app_queue.c.
References call_queue::callsabandoned, call_queue::callscompleted, call_queue::callscompletedinsl, call_queue::count, find_load_queue_rt_friendly(), call_queue::holdtime, call_queue::maxlen, pbx_builtin_setvar_multiple(), call_queue::servicelevel, and call_queue::talktime.
|
static |
Always set the global queue defaults, even if there is no "general" section in queues.conf
Definition at line 9570 of file app_queue.c.
Referenced by reload_queues().
|
static |
Reset the global queue rules parameters even if there is no "general" section of queuerules.conf
Definition at line 9491 of file app_queue.c.
Referenced by reload_queue_rules().
|
static |
Set the global queue rules parameters as defined in the "general" section of queuerules.conf
Definition at line 9497 of file app_queue.c.
References ast_true().
Referenced by reload_queue_rules().
|
static |
Set the global queue parameters as defined in the "general" section of queues.conf
Definition at line 9582 of file app_queue.c.
References ast_true().
Referenced by reload_queues().
|
static |
Configure a queue parameter.
The failunknown flag is set for config files (and static realtime) to show errors for unknown parameters. It is cleared for dynamic realtime to allow extra fields in the tables.
Definition at line 3332 of file app_queue.c.
References call_queue::announce_to_first_user, call_queue::announcefrequency, ANNOUNCEPOSITION_LIMIT, ANNOUNCEPOSITION_MORE_THAN, ANNOUNCEPOSITION_NO, call_queue::announceposition_only_up, ANNOUNCEPOSITION_YES, call_queue::announcepositionlimit, ast_copy_string(), ast_debug, ast_str_create, ast_str_set(), ast_strdupa, ast_string_field_set, ast_true(), call_queue::autofill, call_queue::autopause, call_queue::autopausedelay, call_queue::log_restricted_caller_id, MAX_PERIODIC_ANNOUNCEMENTS, call_queue::maxlen, call_queue::memberdelay, call_queue::minannouncefrequency, call_queue::monfmt, call_queue::name, call_queue::numperiodicannounce, call_queue::penaltymemberslimit, call_queue::periodicannouncefrequency, call_queue::periodicannouncestartdelay, call_queue::randomperiodicannounce, call_queue::retry, call_queue::roundingseconds, call_queue::servicelevel, call_queue::sound_periodicannounce, call_queue::timeout, call_queue::timeoutpriority, call_queue::weight, and call_queue::wrapuptime.
Referenced by find_queue_by_name_rt(), and reload_single_queue().
|
static |
The command center for all reload operations.
Whenever any piece of queue information is to be reloaded, this function is called. It interprets the flags set in the mask parameter and acts based on how they are set.
reload | True if we are reloading information, false if we are loading information for the first time. |
mask | A bitmask which tells the handler what actions to take |
queuename | The name of the queue on which we wish to take action |
0 | All reloads were successful |
non-zero | There was a failure |
Definition at line 10003 of file app_queue.c.
References clear_stats(), reload_queue_rules(), and reload_queues().
Referenced by load_module().
|
static |
Reload the rules defined in queuerules.conf.
reload | If 1, then only process queuerules.conf if the file has changed since the last time we inspected it. |
Definition at line 9511 of file app_queue.c.
References ast_calloc, ast_category_browse(), ast_config_destroy(), ast_config_load, ast_copy_string(), AST_LIST_INSERT_TAIL, AST_LIST_LOCK, AST_LIST_REMOVE_HEAD, AST_LIST_UNLOCK, AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, CONFIG_FLAG_FILEUNCHANGED, insert_penaltychange(), load_realtime_rules(), ast_variable::name, ast_variable::next, queue_rules_reset_global_params(), queue_rules_set_global_params(), realtime_rules, and ast_variable::value.
Referenced by reload_handler().
|
static |
reload the queues.conf file
This function reloads the information in the general section of the queues.conf file and potentially more, depending on the value of mask.
reload | 0 if we are calling this the first time, 1 every other time |
mask | Gives flags telling us what information to actually reload |
queuename | If set to a non-zero string, then only reload information from that particular queue. Otherwise inspect all queues |
-1 | Failure occurred |
0 | All clear! |
Definition at line 9916 of file app_queue.c.
References ao2_callback, ast_category_browse(), ast_config_destroy(), ast_config_load, CONFIG_FLAG_FILEUNCHANGED, OBJ_MULTIPLE, OBJ_NODATA, OBJ_NOLOCK, OBJ_UNLINK, queue_reset_global_params(), queue_set_global_params(), and reload_single_queue().
Referenced by reload_handler().
|
static |
reload information pertaining to a single member
This function is called when a member = line is encountered in queues.conf.
memberdata | The part after member = in the config file |
q | The queue to which this member belongs |
Definition at line 9617 of file app_queue.c.
References ao2_link, ao2_ref, ao2_unlink, AST_APP_ARG, ast_copy_string(), AST_DECLARE_APP_ARGS, ast_false(), AST_STANDARD_APP_ARGS, ast_strdupa, ast_strip(), ast_true(), member::calls, create_queue_member(), member::interface, member::lastcall, call_queue::members, call_queue::name, OBJ_POINTER, member::paused, member::penalty, member::queuepos, member::ringinuse, and member::wrapuptime.
Referenced by reload_single_queue().
|
static |
Reload information pertaining to a particular queue.
Once we have isolated a queue within reload_queues, we call this. This will either reload information for the queue or if we're just reloading member information, we'll just reload that without touching other settings within the queue
cfg | The configuration which we are reading |
mask | Tells us what information we need to reload |
queuename | The name of the queue we are reloading information from |
Definition at line 9759 of file app_queue.c.
References ao2_callback, ao2_iterator_destroy(), AO2_ITERATOR_DONTLOCK, ao2_iterator_init(), ao2_ref, ao2_t_find, ast_atomic_fetchadd_int(), member::dynamic, init_queue(), call_queue::members, ast_variable::name, call_queue::name, ast_variable::next, OBJ_MULTIPLE, OBJ_NODATA, OBJ_POINTER, OBJ_UNLINK, queue_set_param(), reload_single_member(), member::ringinuse, ast_variable::value, and call_queue::weight.
Referenced by reload_queues().
|
static |
Remove member from queue.
RES_NOT_DYNAMIC | when they aren't a RT member |
RES_NOSUCHQUEUE | queue does not exist |
RES_OKAY | removed member from queue |
RES_EXISTS | queue exists but no members |
Definition at line 7540 of file app_queue.c.
References ao2_ref, ao2_t_find, ast_copy_string(), AST_DEVICE_INUSE, AST_DEVSTATE_CACHABLE, ast_devstate_changed(), dump_queue_members(), member::dynamic, member::interface, call_queue::members, call_queue::name, num_available_members(), OBJ_POINTER, member::realtime, RES_EXISTS, RES_NOSUCHQUEUE, RES_NOT_DYNAMIC, RES_OKAY, and member::rt_uniqueid.
Referenced by rqm_exec().
|
static |
Request to withdraw a caller from a queue.
RES_NOSUCHQUEUE | queue does not exist |
RES_OKAY | withdraw request sent |
RES_NOT_CALLER | queue exists but no caller |
RES_EXISTS | a withdraw request was already sent for this caller (channel) and queue |
Definition at line 7722 of file app_queue.c.
References ast_debug, ast_strdup, queue_ent::chan, find_load_queue_rt_friendly(), call_queue::head, queue_ent::next, RES_EXISTS, RES_NOSUCHQUEUE, RES_NOT_CALLER, RES_OKAY, queue_ent::withdraw, and queue_ent::withdraw_info.
|
static |
Part 2 of ring_one.
Does error checking before attempting to request a channel and call a member. This function is only called from ring_one(). Failure can occur if:
1 | on success to reach a free agent |
0 | on failure to get agent. |
Definition at line 4753 of file app_queue.c.
References ast_party_caller::ani, ast_party_connected_line::ani, ao2_bump, ast_call(), ast_channel_datastore_inherit(), ast_channel_inherit_variables(), ast_channel_lock_both, ast_channel_publish_dial(), ast_channel_req_accountcodes_precious(), AST_CHANNEL_REQUESTOR_BRIDGE_PEER, ast_channel_set_caller_event(), ast_connected_line_copy_from_caller(), ast_copy_string(), ast_json_pack(), ast_json_unref(), ast_party_caller_set_init(), ast_party_redirecting_copy(), ast_pre_call(), ast_request(), ast_set_callerid(), ast_strdup, queue_ent::cancel_answered_elsewhere, queue_ent::chan, callattempt::dial_callerid_absent, do_hang(), ast_party_caller::id, ast_party_connected_line::id, callattempt::interface, queue_ent::linpos, member::membername, call_queue::name, ast_party_id::number, ast_party_dialed::number, callattempt::orig_chan_name, queue_ent::parent, pbx_builtin_setvar_helper(), queue_ent::predial_callee, RAII_VAR, call_queue::rrpos, member::status, callattempt::stillgoing, ast_party_dialed::str, ast_party_dialed::transit_network_select, and ast_party_number::valid.
Referenced by ring_one().
|
static |
Place a call to a queue member.
Once metrics have been calculated for each member, this function is used to place a call to the appropriate member (or members). The low-level channel-handling and error detection is handled in ring_entry
1 | if a member was called successfully |
0 | otherwise |
Definition at line 4910 of file app_queue.c.
References ast_autoservice_start(), ast_autoservice_stop(), ast_debug, queue_ent::chan, queue_ent::expire, find_best(), callattempt::interface, queue_ent::parent, queue_ent::predial_callee, ring_entry(), and callattempt::stillgoing.
Referenced by wait_for_answer().
|
static |
Find rt member record to update otherwise create one.
Search for member in queue, if found update penalty/paused state, if no member exists create one flag it as a RT member and add to queue member list.
Definition at line 3578 of file app_queue.c.
References ao2_iterator_destroy(), ao2_iterator_init(), ao2_ref, ast_copy_string(), AST_DEVSTATE_CACHABLE, ast_devstate_changed(), ast_false(), ast_true(), create_queue_member(), member::dead, member::interface, member::lastpause, member::membername, call_queue::members, call_queue::name, member::paused, member::penalty, member::realtime, member::reason_paused, member::ringinuse, member::rt_uniqueid, S_OR, member::state_interface, and member::wrapuptime.
Referenced by find_queue_by_name_rt().
|
static |
update rules for queues
Calculate min/max penalties making sure if relative they stay within bounds. Update queues penalty and set dialplan vars, goto next list entry.
Definition at line 5794 of file app_queue.c.
References ast_debug, AST_LIST_NEXT, queue_ent::chan, queue_ent::max_penalty, penalty_rule::max_relative, penalty_rule::max_value, queue_ent::min_penalty, penalty_rule::min_relative, penalty_rule::min_value, pbx_builtin_setvar_helper(), queue_ent::pr, queue_ent::raise_penalty, penalty_rule::raise_relative, penalty_rule::raise_value, and penalty_rule::time.
Referenced by queue_exec(), and wait_our_turn().
|
static |
update the queue status
0 | always |
Definition at line 5972 of file app_queue.c.
References ao2_iterator_destroy(), ao2_iterator_init(), ao2_ref, member::callcompletedinsl, member::calls, call_queue::callscompleted, call_queue::callscompletedinsl, member::lastcall, member::lastqueue, call_queue::members, OBJ_POINTER, member::starttime, and call_queue::talktime.
Referenced by handle_attended_transfer(), handle_blind_transfer(), and update_status().
|
static |
set a member's status based on device state of that member's state_interface.
Lock interface list find sc, iterate through each queues queue_member list for member to update state inside queues
Definition at line 2575 of file app_queue.c.
References AST_DEVICE_NOT_INUSE, member::callcompletedinsl, member::starttime, member::status, and update_queue().
Referenced by device_state_cb().
|
static |
Check for valid exit from queue via goto.
0 | if failure |
1 | if successful |
Definition at line 4172 of file app_queue.c.
References ast_canmatch_extension(), ast_goto_if_exists(), queue_ent::chan, queue_ent::context, queue_ent::digits, ast_party_caller::id, ast_party_id::number, S_COR, ast_party_number::str, ast_party_number::valid, and queue_ent::valid_digits.
Referenced by say_periodic_announcement(), wait_for_answer(), and wait_our_turn().
|
static |
Wait for a member to answer the call.
[in] | qe | the queue_ent corresponding to the caller in the queue |
[in] | outgoing | the list of callattempts. Relevant ones will have their chan and stillgoing parameters non-zero |
[in] | to | the amount of time (in milliseconds) to wait for a response |
[out] | digit | if a user presses a digit to exit the queue, this is the digit the caller pressed |
[in] | prebusies | number of busy members calculated prior to calling wait_for_answer |
[in] | caller_disconnect | if the 'H' option is used when calling Queue(), this is used to detect if the caller pressed * to disconnect the call |
[in] | forwardsallowed | used to detect if we should allow call forwarding, based on the 'i' option to Queue() |
Definition at line 5205 of file app_queue.c.
References ast_aoc_decode(), ast_aoc_destroy_decoded(), ast_aoc_destroy_encoded(), ast_aoc_encode(), ast_aoc_get_msg_type(), ast_call(), ast_channel_connected_line_sub(), ast_channel_datastore_inherit(), ast_channel_inherit_variables(), ast_channel_lock_both, AST_CHANNEL_NAME, ast_channel_publish_dial(), ast_channel_publish_dial_forward(), ast_channel_redirecting_sub(), ast_channel_req_accountcodes(), AST_CHANNEL_REQUESTOR_BRIDGE_PEER, ast_channel_update_connected_line(), ast_channel_update_redirecting(), ast_connected_line_copy_from_caller(), ast_connected_line_parse_data(), AST_CONTROL_ANSWER, AST_CONTROL_AOC, AST_CONTROL_BUSY, AST_CONTROL_CONGESTION, AST_CONTROL_CONNECTED_LINE, AST_CONTROL_HANGUP, AST_CONTROL_OFFHOOK, AST_CONTROL_PVT_CAUSE_CODE, AST_CONTROL_REDIRECTING, AST_CONTROL_RINGING, ast_copy_string(), ast_debug, AST_FRAME_CONTROL, ast_hangup(), ast_indicate(), ast_indicate_data(), AST_MAX_WATCHERS, ast_moh_stop(), ast_party_connected_line_copy(), ast_party_connected_line_free(), ast_party_connected_line_set(), ast_party_connected_line_set_init(), ast_party_number_free(), ast_party_number_init(), ast_party_redirecting_copy(), ast_party_redirecting_free(), ast_party_redirecting_init(), ast_read(), ast_remaining_ms(), ast_request(), AST_STATE_UP, ast_strdup, ast_strdupa, ast_tvdiff_ms(), ast_tvnow(), ast_waitfor_n(), callattempt::block_connected_update, queue_ent::chan, callattempt::connected, ast_frame::data, ast_frame::datalen, callattempt::dial_callerid_absent, do_hang(), ast_frame::frametype, ast_party_redirecting::from, ast_party_caller::id, ast_frame_subclass::integer, callattempt::interface, member::interface, member::membername, call_queue::name, ast_party_id::number, callattempt::orig_chan_name, queue_ent::parent, pbx_builtin_getvar_helper(), pbx_builtin_setvar_helper(), callattempt::pending_connected_update, ring_one(), queue_ent::ring_when_ringing, rna(), callattempt::stillgoing, ast_party_number::str, ast_frame::subclass, ast_channel::tech, ast_party_dialed::transit_network_select, ast_party_number::valid, and valid_exit().
Referenced by dial_exec_full().
|
static |
The waiting areas for callers who are not actively calling members.
This function is one large loop. This function will return if a caller either exits the queue or it becomes that caller's turn to attempt calling queue members. Inside the loop, we service the caller with periodic announcements, holdtime announcements, etc. as configured in queues.conf
0 | if the caller's turn has arrived |
-1 | if the caller should exit the queue. |
Definition at line 5884 of file app_queue.c.
References call_queue::announcefrequency, ast_waitfordigit(), queue_ent::chan, queue_ent::expire, get_member_status(), queue_ent::handled, is_our_turn(), queue_ent::max_penalty, queue_ent::min_penalty, call_queue::name, queue_ent::opos, queue_ent::parent, call_queue::periodicannouncefrequency, queue_ent::pos, queue_ent::pr, queue_ent::raise_penalty, RECHECK, record_abandoned(), say_periodic_announcement(), queue_ent::start, penalty_rule::time, update_qe_rule(), valid_exit(), and queue_ent::withdraw.
Referenced by queue_exec().
|
static |
Check if a given word is in a space-delimited list.
list | Space delimited list of words |
word | The word used to search the list |
1 | if the word is found |
0 | if the word is not found |
Definition at line 10250 of file app_queue.c.
Referenced by complete_queue().
|
static |
|
static |
Definition at line 9448 of file app_queue.c.
|
static |
Definition at line 9469 of file app_queue.c.
|
static |
Definition at line 9464 of file app_queue.c.
|
static |
Definition at line 9458 of file app_queue.c.
|
static |
Definition at line 9479 of file app_queue.c.
|
static |
Definition at line 9484 of file app_queue.c.
|
static |
Definition at line 9453 of file app_queue.c.
|
static |
Definition at line 9474 of file app_queue.c.