72#include <netinet/in.h>
1699#define DEFAULT_RETRY 5
1700#define DEFAULT_TIMEOUT 15
1702#define MAX_PERIODIC_ANNOUNCEMENTS 10
1707#define DEFAULT_MIN_ANNOUNCE_FREQUENCY 15
1709#define MAX_QUEUE_BUCKETS 53
1712#define RES_EXISTS (-1)
1713#define RES_OUTOFMEMORY (-2)
1714#define RES_NOSUCHQUEUE (-3)
1715#define RES_NOT_DYNAMIC (-4)
1716#define RES_NOT_CALLER (-5)
1733static const char *
const pm_family =
"Queue/PersistentMembers";
1789static const struct {
1924#define ANNOUNCEHOLDTIME_ALWAYS 1
1925#define ANNOUNCEHOLDTIME_ONCE 2
1926#define QUEUE_EVENT_VARIABLES 3
1940#define ANNOUNCEPOSITION_YES 1
1941#define ANNOUNCEPOSITION_NO 2
1942#define ANNOUNCEPOSITION_MORE_THAN 3
1943#define ANNOUNCEPOSITION_LIMIT 4
1945#define FORCELONGESTWAITINGCALLER_NO 0
1946#define FORCELONGESTWAITINGCALLER_YES 1
1947#define FORCELONGESTWAITINGCALLER_PRIO 2
2165 struct member *mem = obj;
2166 int *decrement_followers_after = arg;
2168 if (mem->
queuepos > *decrement_followers_after) {
2184 struct member *mem = obj;
2206 if (pos < queue->
rrpos) {
2213#define queue_ref(q) ao2_bump(q)
2214#define queue_unref(q) ({ ao2_cleanup(q); NULL; })
2215#define queue_t_ref(q, tag) ao2_t_bump(q, tag)
2216#define queue_t_unref(q, tag) ({ ao2_t_cleanup(q, tag); NULL; })
2217#define queues_t_link(c, q, tag) ao2_t_link(c, q, tag)
2218#define queues_t_unlink(c, q, tag) ao2_t_unlink(c, q, tag)
2223 char interfacevar[256]=
"";
2234 snprintf(interfacevar,
sizeof(interfacevar),
2235 "QUEUENAME=%s,QUEUEMAX=%d,QUEUESTRATEGY=%s,QUEUECALLS=%d,QUEUEHOLDTIME=%d,QUEUETALKTIME=%d,QUEUECOMPLETED=%d,QUEUEABANDONED=%d,QUEUESRVLEVEL=%d,QUEUESRVLEVELPERF=%2.1f",
2269 new->pos = ++(*pos);
2281 if (!channel_string || !event_string) {
2323 if (!event_string) {
2393 if (!caller_event_string) {
2402 if (!agent_event_string) {
2409 if (!event_string) {
2480 if (caller_snapshot) {
2483 ast_debug(1,
"Empty caller_snapshot; sending incomplete event\n");
2486 if (agent_snapshot) {
2511 if (!caller_snapshot || !agent_snapshot) {
2516 agent_snapshot,
type, blob);
2534 if (!blob || !
type) {
2555 return ast_json_pack(
"{s: s, s: s, s: s, s: s, s: s, s: i, s: i, s: i, s: i, s: i, s: i, s: i, s: i, s: s, s: i, s: i}",
2560 "Membership", (mem->
dynamic ?
"dynamic" : (mem->
realtime ?
"realtime" :
"static")),
2562 "CallsTaken", mem->
calls,
2589 if (raise_penalty != INT_MAX && penalty < raise_penalty) {
2591 if (raise_respect_min && penalty < min_penalty) {
2595 penalty = raise_penalty;
2598 if ((max_penalty != INT_MAX && penalty > max_penalty) || (min_penalty != INT_MAX && penalty < min_penalty)) {
2600 ast_debug(4,
"%s is unavailable because his penalty is not between %d and %d\n",
member->
membername, min_penalty, max_penalty);
2645 ast_debug(4,
"%s is unavailable because it has only been %d seconds since his last call (wrapup time is %d)\n",
2663 return get_member_status(q, max_penalty, min_penalty, raise_penalty, conditions, 1, raise_respect_min);
2677#define MAX_CALL_ATTEMPT_BUCKETS 353
2681 const struct member *object;
2701 const struct member *object_left = obj;
2702 const struct member *object_right = arg;
2703 const char *right_key = arg;
2711 cmp = strcasecmp(object_left->
interface, right_key);
2810 char interface[80], *slash_pos;
2820 if (dev_state->
eid) {
2833 if (!found_member) {
2836 if ((slash_pos = strchr(interface,
'/'))) {
2837 if (!strncasecmp(interface,
"Local/", 6) && (slash_pos = strchr(slash_pos + 1,
'/'))) {
2842 if (!strcasecmp(interface, dev_state->
device)) {
2852 if (avail && found_member) {
2876 ast_debug(1,
"Device '%s' changed to state '%u' (%s)\n",
2881 ast_debug(3,
"Device '%s' changed to state '%u' (%s) but we don't care because they're not a member of any queue.\n",
2956 if (!strcasecmp(child, includename)) {
2974 int state = info->exten_state;
3005 ast_debug(3,
"Extension '%s@%s' changed to state '%d' (%s) but we don't care because they're not a member of any queue.\n",
3020 struct member *mem = obj;
3057 char *exten =
strsep(&context,
"@") + 5;
3077 }
else if (
c > 96) {
3085 const struct member *mem = obj;
3087 const char *chname = strchr(interface,
'/');
3093 for (i = 0; i < 5 && chname[i]; i++) {
3101 struct member *mem1 = obj1;
3102 struct member *mem2 = obj2;
3248 char *timestr, *maxstr, *minstr, *raisestr, *contentdup;
3251 int penaltychangetime, inserted = 0;
3259 if (!(maxstr = strchr(contentdup,
','))) {
3260 ast_log(
LOG_WARNING,
"Improperly formatted penaltychange rule at line %d. Ignoring.\n", linenum);
3266 if ((minstr = strchr(maxstr,
','))) {
3268 if ((raisestr = strchr(minstr,
','))) {
3275 timestr = contentdup;
3276 if ((penaltychangetime = atoi(timestr)) < 0) {
3277 ast_log(
LOG_WARNING,
"Improper time parameter specified for penaltychange rule at line %d. Ignoring.\n", linenum);
3282 rule->time = penaltychangetime;
3286 if (*maxstr ==
'+' || *maxstr ==
'-' || *maxstr ==
'\0') {
3287 rule->max_relative = 1;
3290 rule->max_value = atoi(maxstr);
3293 if (*minstr ==
'+' || *minstr ==
'-') {
3294 rule->min_relative = 1;
3296 rule->min_value = atoi(minstr);
3298 rule->min_relative = 1;
3302 rule->raise_respect_min = 0;
3303 if (*raisestr ==
'r') {
3304 rule->raise_respect_min = 1;
3307 if (*raisestr ==
'+' || *raisestr ==
'-') {
3308 rule->raise_relative = 1;
3310 rule->raise_value = atoi(raisestr);
3312 rule->raise_relative = 1;
3317 if (strcasecmp(rl_iter->
name, list_name)) {
3322 if (
rule->time < rule_iter->time) {
3360 char *rulecat =
NULL;
3371 const char *timestr, *maxstr, *minstr, *raisestr, *rule_name;
3372 int penaltychangetime, rule_exists = 0, inserted = 0;
3373 int max_penalty = 0, min_penalty = 0, raise_penalty = 0;
3383 if (!(strcasecmp(rl_iter->
name, rule_name))) {
3390 if (!(new_rl =
ast_calloc(1,
sizeof(*new_rl)))) {
3398 if (!(timestr) || sscanf(timestr,
"%30d", &penaltychangetime) != 1) {
3399 ast_log(
LOG_NOTICE,
"Failed to parse time (%s) for one of the %s rules, skipping it\n",
3403 if (!(new_penalty_rule =
ast_calloc(1,
sizeof(*new_penalty_rule)))) {
3408 ast_strlen_zero(maxstr) || sscanf(maxstr,
"%30d", &max_penalty) != 1) {
3412 if (*maxstr ==
'+' || *maxstr ==
'-') {
3417 ast_strlen_zero(minstr) || sscanf(minstr,
"%30d", &min_penalty) != 1) {
3421 if (*minstr ==
'+' || *minstr ==
'-') {
3430 if (*raisestr ==
'r') {
3436 if (*raisestr ==
'+' || *raisestr ==
'-') {
3439 if (sscanf(raisestr,
"%30d", &raise_penalty) != 1) {
3444 new_penalty_rule->
time = penaltychangetime;
3446 new_penalty_rule->
max_value = max_penalty;
3448 new_penalty_rule->
min_value = min_penalty;
3452 if (new_penalty_rule->
time < pr_iter->
time) {
3470 char *option =
NULL;
3471 while ((option =
strsep(&value_copy,
","))) {
3472 if (!strcasecmp(option,
"paused")) {
3474 }
else if (!strcasecmp(option,
"penalty")) {
3476 }
else if (!strcasecmp(option,
"inuse")) {
3478 }
else if (!strcasecmp(option,
"ringing")) {
3480 }
else if (!strcasecmp(option,
"invalid")) {
3482 }
else if (!strcasecmp(option,
"wrapup")) {
3484 }
else if (!strcasecmp(option,
"unavailable")) {
3486 }
else if (!strcasecmp(option,
"unknown")) {
3488 }
else if (!strcasecmp(option,
"loose")) {
3490 }
else if (!strcasecmp(option,
"strict")) {
3492 }
else if ((
ast_false(option) && joinempty) || (
ast_true(option) && !joinempty)) {
3494 }
else if ((
ast_false(option) && !joinempty) || (
ast_true(option) && joinempty)) {
3497 ast_log(
LOG_WARNING,
"Unknown option %s for '%s'\n", option, joinempty ?
"joinempty" :
"leavewhenempty");
3512 if (!strcasecmp(param,
"musicclass") ||
3513 !strcasecmp(param,
"music") || !strcasecmp(param,
"musiconhold")) {
3515 }
else if (!strcasecmp(param,
"announce")) {
3517 }
else if (!strcasecmp(param,
"context")) {
3519 }
else if (!strcasecmp(param,
"timeout")) {
3524 }
else if (!strcasecmp(param,
"ringinuse")) {
3526 }
else if (!strcasecmp(param,
"setinterfacevar")) {
3528 }
else if (!strcasecmp(param,
"setqueuevar")) {
3530 }
else if (!strcasecmp(param,
"setqueueentryvar")) {
3532 }
else if (!strcasecmp(param,
"monitor-format")) {
3534 }
else if (!strcasecmp(param,
"membergosub")) {
3536 }
else if (!strcasecmp(param,
"queue-youarenext")) {
3538 }
else if (!strcasecmp(param,
"queue-thereare")) {
3540 }
else if (!strcasecmp(param,
"queue-callswaiting")) {
3542 }
else if (!strcasecmp(param,
"queue-quantity1")) {
3544 }
else if (!strcasecmp(param,
"queue-quantity2")) {
3546 }
else if (!strcasecmp(param,
"queue-holdtime")) {
3548 }
else if (!strcasecmp(param,
"queue-minutes")) {
3550 }
else if (!strcasecmp(param,
"queue-minute")) {
3552 }
else if (!strcasecmp(param,
"queue-seconds")) {
3554 }
else if (!strcasecmp(param,
"queue-thankyou")) {
3556 }
else if (!strcasecmp(param,
"queue-callerannounce")) {
3558 }
else if (!strcasecmp(param,
"queue-reporthold")) {
3560 }
else if (!strcasecmp(param,
"announce-frequency")) {
3562 }
else if (!strcasecmp(param,
"announce-to-first-user")) {
3564 }
else if (!strcasecmp(param,
"min-announce-frequency")) {
3567 }
else if (!strcasecmp(param,
"announce-round-seconds")) {
3574 "using 0 instead for queue '%s' at line %d of queues.conf\n",
3575 val, param, q->
name, linenum);
3578 "using 0 instead for queue '%s'\n",
val, param, q->
name);
3582 }
else if (!strcasecmp(param,
"announce-holdtime")) {
3583 if (!strcasecmp(
val,
"once")) {
3590 }
else if (!strcasecmp(param,
"announce-position")) {
3591 if (!strcasecmp(
val,
"limit")) {
3593 }
else if (!strcasecmp(
val,
"more")) {
3600 }
else if (!strcasecmp(param,
"announce-position-only-up")) {
3602 }
else if (!strcasecmp(param,
"announce-position-limit")) {
3604 }
else if (!strcasecmp(param,
"periodic-announce")) {
3605 if (strchr(
val,
',')) {
3624 }
else if (!strcasecmp(param,
"periodic-announce-startdelay")) {
3626 }
else if (!strcasecmp(param,
"periodic-announce-frequency")) {
3628 }
else if (!strcasecmp(param,
"relative-periodic-announce")) {
3630 }
else if (!strcasecmp(param,
"random-periodic-announce")) {
3632 }
else if (!strcasecmp(param,
"retry")) {
3634 if (q->
retry <= 0) {
3637 }
else if (!strcasecmp(param,
"wrapuptime")) {
3639 }
else if (!strcasecmp(param,
"penaltymemberslimit")) {
3643 }
else if (!strcasecmp(param,
"autofill")) {
3645 }
else if (!strcasecmp(param,
"autopause")) {
3647 }
else if (!strcasecmp(param,
"autopausedelay")) {
3649 }
else if (!strcasecmp(param,
"autopausebusy")) {
3651 }
else if (!strcasecmp(param,
"autopauseunavail")) {
3653 }
else if (!strcasecmp(param,
"maxlen")) {
3658 }
else if (!strcasecmp(param,
"servicelevel")) {
3660 }
else if (!strcasecmp(param,
"strategy")) {
3669 ast_log(
LOG_WARNING,
"'%s' isn't a valid strategy for queue '%s', using ringall instead\n",
3677 ast_log(
LOG_WARNING,
"Changing to the linear strategy currently requires asterisk to be restarted.\n");
3681 }
else if (!strcasecmp(param,
"joinempty")) {
3683 }
else if (!strcasecmp(param,
"leavewhenempty")) {
3685 }
else if (!strcasecmp(param,
"reportholdtime")) {
3687 }
else if (!strcasecmp(param,
"memberdelay")) {
3689 }
else if (!strcasecmp(param,
"weight")) {
3691 }
else if (!strcasecmp(param,
"timeoutrestart")) {
3693 }
else if (!strcasecmp(param,
"defaultrule")) {
3695 }
else if (!strcasecmp(param,
"timeoutpriority")) {
3696 if (!strcasecmp(
val,
"conf")) {
3701 }
else if (!strcasecmp(param,
"log-restricted-caller-id")) {
3703 }
else if (failunknown) {
3705 ast_log(
LOG_WARNING,
"Unknown keyword in queue '%s': %s at line %d of queues.conf\n",
3706 q->
name, param, linenum);
3714#define QUEUE_PAUSED_DEVSTATE AST_DEVICE_INUSE
3715#define QUEUE_UNPAUSED_DEVSTATE AST_DEVICE_NOT_INUSE
3716#define QUEUE_UNKNOWN_PAUSED_DEVSTATE AST_DEVICE_NOT_INUSE
3766 const char *config_val;
3778 S_OR(membername,
"NULL"));
3784 S_OR(membername,
"NULL"));
3789 penalty = atoi(penalty_str);
3792 }
else if (penalty < 0) {
3798 paused = atoi(paused_str);
3804 if (wrapuptime_str) {
3805 wrapuptime = atoi(wrapuptime_str);
3806 if (wrapuptime < 0) {
3854 if ((m =
create_queue_member(interface, membername, penalty, paused, state_interface, ringinuse, wrapuptime))) {
3937 char *category =
NULL;
3938 const char *tmp_name;
3955 }
else if (!member_config) {
3966 ast_debug(1,
"Queue %s not found in realtime.\n", queuename);
3989 for (tmpvar = queue_vars; tmpvar; tmpvar = tmpvar->
next) {
3990 if (!strcasecmp(tmpvar->
name,
"strategy")) {
3993 ast_log(
LOG_WARNING,
"'%s' isn't a valid strategy for queue '%s', using ringall instead\n",
4008 memset(tmpbuf, 0,
sizeof(tmpbuf));
4009 for (v = queue_vars; v; v = v->
next) {
4011 if (strchr(v->
name,
'_')) {
4015 while ((tmp = strchr(tmp,
'_'))) {
4080 int prev_weight = 0;
4098 if (!member_config) {
4099 ast_debug(1,
"No queue_members defined in config extconfig.conf\n");
4104 prev_weight = q->
weight ? 1 : 0;
4114 if (!q->
weight && prev_weight) {
4117 if (q->
weight && !prev_weight) {
4137 char *category =
NULL;
4182 char *category =
NULL;
4198 ast_debug(3,
"Queue %s has no realtime members defined. No need for update\n", q->
name);
4282 if (!
inserted && (
qe->prio >= cur->
prio) && position && (position <=
pos + 1)) {
4286 if (position <
pos) {
4287 ast_log(
LOG_NOTICE,
"Asked to be inserted at position %d but forced into position %d due to higher priority callers\n", position,
pos);
4302 if (q->
count == 1) {
4310 "Position",
qe->pos,
4355 if (digitlen <
sizeof(
qe->digits) - 2) {
4357 qe->digits[digitlen + 1] =
'\0';
4359 qe->digits[0] =
'\0';
4371 qe->digits[0] =
'\0';
4377 qe->valid_digits = 1;
4393 if ((
now -
qe->last_pos) <
qe->parent->minannouncefrequency) {
4398 if ((
qe->last_pos_said ==
qe->pos) && ((
now -
qe->last_pos) <
qe->parent->announcefrequency)) {
4403 if (
qe->parent->announceposition_only_up &&
qe->last_pos_said > 0 &&
qe->last_pos_said <=
qe->pos) {
4416 qe->pos <=
qe->parent->announcepositionlimit)) {
4447 if (
qe->parent->roundingseconds) {
4499 if (
qe->parent->announceposition) {
4500 ast_verb(3,
"Told %s in %s their queue position (which was %d)\n",
4514 qe->last_pos_said =
qe->pos;
4536 if ((
qe->parent->callscompleted +
qe->parent->callsabandoned) == 0) {
4560 queue_t_ref(q,
"Copy queue pointer from queue entry");
4575 "Position", qe->
pos,
4590 snprintf(posstr,
sizeof(posstr),
"%d", qe->
pos);
4640 if (cur->
chan && cur->
chan != exception) {
4655 if (exception || cancel_answered_elsewhere) {
4758 int is_longest_waiting = 1;
4764 if (q == caller->
parent) {
4786 if (
ch->prio > caller->
prio) {
4787 ast_debug(1,
"Queue %s has a call at position %i that's higher priority (%d vs %d)\n",
4791 }
else if (
ch->start < caller->
start) {
4792 ast_debug(1,
"Queue %s has a call at position %i that's been waiting longer (%li vs %li)\n",
4851 ast_debug(1,
"%s paused, can't receive call\n",
call->interface);
4856 ast_debug(1,
"%s not available, can't receive call\n",
call->interface);
4866 ast_debug(1,
"Wrapuptime not yet expired on queue %s for %s\n",
4873 ast_debug(1,
"Priority queue delaying call to %s:%s\n",
4879 ast_debug(1,
"Another caller was waiting longer; delaying call to %s:%s\n",
4896 ast_debug(1,
"%s has another call trying, can't receive call\n",
4917 ast_debug(1,
"%s actually not available, can't receive call\n",
4958 if ((location = strchr(tech,
'/'))) {
5077 for (cur =
outgoing; cur; cur = cur->q_next) {
5078 if (cur->stillgoing &&
5115 ast_debug(1,
"Nobody left to try ringing in queue\n");
5140 ast_debug(1,
"Queue timed out while ringing members.\n");
5226 ast_verb(3,
"Playing periodic announcement\n");
5269 int callabandonedinsl = 0;
5280 "Position", qe->
pos,
5281 "OriginalPosition", qe->
opos,
5282 "HoldTime", (
int)(time(
NULL) - qe->
start));
5287 if (callabandonedinsl) {
5302 ast_verb(3,
"Nobody picked up in %d ms\n", rnatime);
5313 "MemberName", membername,
5314 "RingTime", rnatime);
5323 time_t idletime = time(&idletime)-mem->
lastcall;
5335 ast_verb(3,
"Auto-Pausing Queue Member %s in queue %s since they failed to answer.\n",
5344 ast_verb(3,
"Auto-Pausing Queue Member %s in all queues since they failed to answer on queue %s.\n",
5379#define AST_MAX_WATCHERS 256
5398 int numbusies = prebusies;
5407 char membername[80] =
"";
5411 struct timeval start_time_tv =
ast_tvnow();
5412 int canceled_by_caller = 0;
5418 starttime = (long) time(
NULL);
5421 int numlines, retry, pos = 1;
5426 for (retry = 0; retry < 2; retry++) {
5433 watchers[pos++] = o->
chan;
5447 if (pos > 1 || !stillgoing ||
5457 if (numlines == (numbusies + numnochan)) {
5458 ast_debug(1,
"Everyone is busy at this time\n");
5460 ast_debug(3,
"No one is answering queue '%s' (%d numlines / %d busies / %d failed channels)\n", queue, numlines, numbusies, numnochan);
5483 ast_verb(3,
"%s answered %s\n", ochan_name, inchan_name);
5501 size_t encoded_size;
5510 }
else if (o->
chan && (o->
chan == winner)) {
5534 if ((stuff = strchr(tmpchan,
'/'))) {
5538 const char *forward_context;
5546 if (!strcasecmp(
tech,
"Local")) {
5555 ast_verb(3,
"Now forwarding %s to '%s/%s' (thanks to %s)\n", inchan_name,
tech, stuff, ochan_name);
5560 "Forwarding failed to create channel to dial '%s/%s'\n",
5665 ast_verb(3,
"%s answered %s\n", ochan_name, inchan_name);
5685 size_t encoded_size;
5696 ast_verb(3,
"%s is busy\n", ochan_name);
5698 endtime = (long) time(
NULL);
5699 endtime -= starttime;
5709 starttime = (long) time(
NULL);
5715 ast_verb(3,
"%s is circuit-busy\n", ochan_name);
5717 endtime = (long) time(
NULL);
5718 endtime -= starttime;
5727 starttime = (long) time(
NULL);
5733 ast_verb(3,
"%s is ringing\n", ochan_name);
5748 ast_verb(3,
"Connected line update to %s prevented.\n", inchan_name);
5754 ast_verb(3,
"%s connected line has changed. Saving it until answer for %s\n", ochan_name, inchan_name);
5793 ast_verb(3,
"Redirecting update to %s prevented\n",
5797 ast_verb(3,
"%s redirecting info has changed, passing it to %s\n",
5798 ochan_name, inchan_name);
5813 endtime = (long) time(
NULL) - starttime;
5815 rna(endtime * 1000, qe, o->
chan, on, membername, 1);
5823 starttime = (long) time(
NULL);
5842 canceled_by_caller = 1;
5847 canceled_by_caller = 1;
5853 canceled_by_caller = 1;
5856 if (canceled_by_caller) {
5944 ch =
qe->parent->head;
5946 ast_debug(1,
"There %s %d available %s.\n",
avl != 1 ?
"are" :
"is",
avl,
avl != 1 ?
"members" :
"member");
5960 if (
ch &&
idx <
avl && (
qe->parent->autofill ||
qe->pos == 1)) {
5969 if (
avl == 0 &&
qe->pos == 1) {
5989 if (
qe->pr->max_relative) {
6003 ast_debug(3,
"Setting max penalty to %d for caller %s since %d seconds have elapsed\n",
6011 if (
qe->pr->min_relative) {
6029 ast_debug(3,
"Setting min penalty to %d for caller %s since %d seconds have elapsed\n",
6037 if (
qe->pr->raise_relative) {
6055 ast_debug(3,
"Setting raised penalty to %d for caller %s since %d seconds have elapsed\n",
6091 if (
qe->expire && (time(
NULL) >=
qe->expire)) {
6096 if (
qe->parent->leavewhenempty) {
6110 if (
qe->parent->announcefrequency &&
6116 if (
qe->expire && (time(
NULL) >=
qe->expire)) {
6122 if (
qe->parent->periodicannouncefrequency &&
6127 while (
qe->pr && ((time(
NULL) -
qe->start) >=
qe->pr->time)) {
6132 if (
qe->expire && (time(
NULL) >=
qe->expire)) {
6147 if (
qe->expire && (time(
NULL) >=
qe->expire)) {
6210 if (callcompletedinsl) {
6218 q->
talktime = (((oldtalktime << 2) - oldtalktime) + newtalktime) >> 2;
6245 (qe->
min_penalty != INT_MAX && penalty < qe->min_penalty)) {
6249 ast_debug(1,
"Disregarding penalty, %d members and %d in penaltymemberslimit.\n",
6256 tmp->
metric = penalty * 1000000 * usepenalty;
6259 if (pos < qe->linpos) {
6260 tmp->
metric = 1000 + pos;
6268 tmp->
metric += penalty * 1000000 * usepenalty;
6273 if (pos < q->rrpos) {
6274 tmp->
metric = 1000 + pos;
6276 if (pos > q->
rrpos) {
6282 tmp->
metric += penalty * 1000000 * usepenalty;
6286 tmp->
metric += penalty * 1000000 * usepenalty;
6293 tmp->
metric += penalty * 1000000 * usepenalty;
6301 tmp->
metric += penalty * 1000000 * usepenalty;
6321 const char *reason =
NULL;
6332 reason =
"transfer";
6336 blob =
ast_json_pack(
"{s: s, s: s, s: s, s: I, s: I, s: s}",
6342 "Reason", reason ?:
"");
6345 queue_agent_complete_type(), blob);
6468 queue_data->
dying = 1;
6503 queue_data->
member = mem;
6523 if (!transfer_str) {
6571 if (queue_data->
dying) {
6582 ast_debug(3,
"Detected entry of caller channel %s into bridge %s\n",
6613 if (queue_data->
dying) {
6634 "BLINDTRANSFER",
"%s|%s|%ld|%ld|%d",
6671 if (queue_data->
dying) {
6742 if (!local_one || !local_two || !source) {
6743 ast_debug(1,
"Local optimization begin missing channel snapshots:%s%s%s\n",
6744 !local_one ?
" local_one," :
"",
6745 !local_two ?
" local_two," :
"",
6746 !source ?
" source," :
"");
6750 if (queue_data->
dying) {
6767 ast_log(
LOG_ERROR,
"Unable to track local channel optimization for channel %s. Expect further errors\n", local_one->
base->
name);
6772 optimization->
id =
id;
6801 if (queue_data->
dying) {
6818 ast_log(
LOG_WARNING,
"Told of a local optimization end when we had no previous begin\n");
6822 if (
id != optimization->
id) {
6823 ast_log(
LOG_WARNING,
"Local optimization end event ID does not match begin (%u != %u)\n",
6824 id, optimization->
id);
6829 ast_debug(3,
"Local optimization: Changing queue caller uniqueid from %s to %s\n",
6833 ast_debug(3,
"Local optimization: Changing queue member uniqueid from %s to %s\n",
6865 if (queue_data->
dying) {
6895 ast_debug(3,
"Detected hangup of queue %s channel %s\n", reason ==
CALLER ?
"caller" :
"member",
6899 reason ==
CALLER ?
"COMPLETECALLER" :
"COMPLETEAGENT",
"%ld|%ld|%d",
6915 const char *new_channel_id;
6921 if (queue_data->
dying) {
6927 ast_debug(1,
"Replacing caller channel %s with %s due to masquerade\n", queue_data->
caller_uniqueid, new_channel_id);
6930 ast_debug(1,
"Replacing member channel %s with %s due to masquerade\n", queue_data->
member_uniqueid, new_channel_id);
6970 time_t holdstart, time_t starttime,
int callcompletedinsl)
7031 char full_var_name[128];
7033 snprintf(
buf,
sizeof(
buf),
"%" PRId64, duration / 1000);
7036 snprintf(full_var_name,
sizeof(full_var_name),
"%s_MS", var_base);
7037 snprintf(
buf,
sizeof(
buf),
"%" PRId64, duration);
7045 qeb->
chan = originator;
7053 int64_t answered_time_ms;
7100 char *output,
size_t size)
7102 const char *m = input;
7106 for (p = escaped; p < escaped + size - 1; p++, m++) {
7109 if (*(m + 1) ==
'{') {
7123 if (p == escaped + size) {
7124 escaped[size - 1] =
'\0';
7132 char escaped_filename[256];
7133 char file_with_ext[
sizeof(escaped_filename) +
sizeof(qe->
parent->
monfmt)];
7134 char mixmonargs[1512];
7135 char escaped_monitor_exec[1024];
7136 const char *monitor_options;
7137 const char *monitor_exec;
7139 escaped_monitor_exec[0] =
'\0';
7154 monitor_options =
"";
7162 snprintf(file_with_ext,
sizeof(file_with_ext),
"%s.%s", escaped_filename, qe->
parent->
monfmt);
7165 snprintf(mixmonargs,
sizeof(mixmonargs),
"b%s,%s", monitor_options, escaped_monitor_exec);
7167 snprintf(mixmonargs,
sizeof(mixmonargs),
"b%s", monitor_options);
7170 ast_debug(1,
"Arguments being passed to MixMonitor: %s,%s\n", file_with_ext, mixmonargs);
7210 char queuename[256]=
"";
7215 int res = 0, bridge = 0;
7218 char *announce =
NULL;
7220 time_t now = time(
NULL);
7222 char nondataquality = 1;
7223 char *agiexec =
NULL;
7224 char *gosubexec =
NULL;
7225 const char *monitorfilename;
7226 int forwardsallowed = 1;
7227 int block_connected_line = 0;
7230 int callcompletedinsl;
7233 memset(&bridge_config, 0,
sizeof(bridge_config));
7282 forwardsallowed = 0;
7285 block_connected_line = 1;
7305 ast_debug(1,
"%s is trying to call a queue member.\n",
7312 announce = announceoverride;
7355 to = (qe->
expire - now) * 1000;
7432 if (!res2 && announce) {
7443 long holdtime, holdtimesecs;
7446 holdtime = labs((now - qe->
start) / 60);
7447 holdtimesecs = labs((now - qe->
start) % 60);
7454 if (holdtimesecs > 1) {
7524 ast_str_set(&interfacevar, 0,
"MEMBERINTERFACE=%s,MEMBERNAME=%s,MEMBERCALLS=%d,MEMBERLASTCALL=%ld,MEMBERPENALTY=%d,MEMBERDYNAMIC=%d,MEMBERREALTIME=%d",
7533 ast_str_set(&interfacevar, 0,
"QEHOLDTIME=%ld,QEORIGINALPOS=%d",
7574 char *gosub_args =
NULL;
7575 char *gosub_argstart;
7577 ast_debug(1,
"app_queue: gosub=%s.\n", gosubexec);
7579 gosub_argstart = strchr(gosubexec,
',');
7580 if (gosub_argstart) {
7581 const char *what_is_s =
"s";
7582 *gosub_argstart = 0;
7585 what_is_s =
"~~s~~";
7587 if (
ast_asprintf(&gosub_args,
"%s,%s,1(%s)", gosubexec, what_is_s, gosub_argstart + 1) < 0) {
7590 *gosub_argstart =
',';
7592 const char *what_is_s =
"s";
7595 what_is_s =
"~~s~~";
7597 if (
ast_asprintf(&gosub_args,
"%s,%s,1", gosubexec, what_is_s) < 0) {
7605 ast_log(
LOG_ERROR,
"Could not Allocate string for Gosub arguments -- Gosub Call Aborted!\n");
7610 ast_debug(1,
"app_queue: agi=%s.\n", agi);
7616 ast_log(
LOG_WARNING,
"Asked to execute an AGI on this channel, but could not find application (agi)!\n");
7622 (
long)(orig - to > 0 ? (orig - to) / 1000 : 0));
7631 "RingTime", (
ast_json_int_t)(orig - to > 0 ? (orig - to) / 1000 : 0));
7664 res = bridge ? bridge : 1;
7696 if (!strcasecmp(interface, mem->
interface)) {
7715 struct member *cur_member;
7773 struct member *mem, tmpmem;
7787 queue_t_unref(q,
"Interface wasn't dynamic, expiring temporary reference");
7824 struct member *new_member, *old_member;
7890 ast_debug(1,
"%s Caller new priority %d in queue %s\n",
7907 }
else if (immediate) {
7967 ast_debug(1,
"Ignoring duplicate withdraw request of caller %s from queue %s\n", caller,
queuename);
8015 if (mem->
paused == paused) {
8016 ast_debug(1,
"%spausing already-%spaused queue member %s:%s\n",
8017 (paused ?
"" :
"un"), (paused ?
"" :
"un"), q->
name, mem->
interface);
8028 ast_log(
LOG_WARNING,
"Failed update of realtime queue member %s:%s %spause and reason '%s'\n",
8061 "Queue:%s_avail", q->
name);
8064 "Queue:%s_avail", q->
name);
8085static int set_member_paused(
const char *queuename,
const char *interface,
const char *reason,
int paused)
8114 (
paused ?
"PAUSEALL" :
"UNPAUSEALL"),
"%s",
S_OR(reason,
""));
8148 int foundinterface = 0;
8156 sprintf(rtpenalty,
"%i",
penalty);
8168 return foundinterface;
8197 int foundinterface = 0;
8207 return foundinterface;
8235 int foundinterface = 0, foundqueue = 0;
8253 char *category =
NULL;
8287 if (foundinterface) {
8289 }
else if (!foundqueue) {
8304 int foundqueue = 0, penalty;
8336 const char *queue_name;
8345 char *wrapuptime_tok;
8355 for (entry = db_tree; entry; entry = entry->
next) {
8373 ast_log(
LOG_WARNING,
"Error loading persistent queue: '%s': it does not exist\n", queue_name);
8383 cur_ptr = queue_data;
8398 ast_log(
LOG_WARNING,
"Error parsing persistent member string for '%s' (penalty)\n", queue_name);
8401 penalty = strtol(penalty_tok,
NULL, 10);
8402 if (
errno == ERANGE) {
8408 ast_log(
LOG_WARNING,
"Error parsing persistent member string for '%s' (paused)\n", queue_name);
8411 paused = strtol(paused_tok,
NULL, 10);
8412 if ((
errno == ERANGE) || paused < 0 || paused > 1) {
8418 wrapuptime = strtol(wrapuptime_tok,
NULL, 10);
8419 if (
errno == ERANGE) {
8420 ast_log(
LOG_WARNING,
"Error converting wrapuptime: %s: Out of range.\n", wrapuptime_tok);
8425 ast_debug(1,
"Reload Members: Queue: %s Member: %s Name: %s Penalty: %d Paused: %d ReasonPause: %s Wrapuptime: %d\n",
8426 queue_name, interface, membername, penalty, paused, reason_paused, wrapuptime);
8428 if (
add_to_queue(queue_name, interface, membername, penalty, paused, 0, state_interface, reason_paused, wrapuptime) ==
RES_OUTOFMEMORY) {
8429 ast_log(
LOG_ERROR,
"Out of Memory when reloading persistent queue member\n");
8455 ast_log(
LOG_WARNING,
"PauseQueueMember requires an argument ([queuename],interface[,options][,reason])\n");
8464 ast_log(
LOG_WARNING,
"Missing interface argument to PauseQueueMember ([queuename],interface[,options[,reason]])\n");
8491 ast_log(
LOG_WARNING,
"UnpauseQueueMember requires an argument ([queuename],interface[,options[,reason]])\n");
8500 ast_log(
LOG_WARNING,
"Missing interface argument to UnpauseQueueMember ([queuename],interface[,options[,reason]])\n");
8519 char *parse, *temppos =
NULL;
8529 ast_log(
LOG_WARNING,
"RemoveQueueMember requires an argument (queuename[,interface])\n");
8539 temppos = strrchr(
args.interface,
'-');
8563 ast_debug(1,
"Unable to remove interface '%s' from queue '%s': Not there\n",
args.interface,
args.queuename);
8573 ast_log(
LOG_WARNING,
"Unable to remove interface from queue '%s': '%s' is not a dynamic member\n",
args.queuename,
args.interface);
8590 char *parse, *tmp, *temppos =
NULL, *reason =
NULL;
8606 ast_log(
LOG_WARNING,
"AddQueueMember requires an argument (queuename[,interface[,penalty[,options[,membername[,stateinterface][,wrapuptime]]]]])\n");
8627 temppos = strrchr(
args.interface,
'-');
8634 if ((sscanf(
args.penalty,
"%30d", &penalty) != 1) || penalty < 0) {
8641 tmp =
args.wrapuptime;
8643 wrapuptime = atoi(tmp);
8644 if (wrapuptime < 0) {
8694 ast_log(
LOG_WARNING,
"QueueLog requires arguments (queuename,uniqueid,membername,event[,additionalinfo]\n");
8704 ast_log(
LOG_WARNING,
"QueueLog requires arguments (queuename,uniqueid,membername,event[,additionalinfo])\n");
8709 "%s",
args.params ?
args.params :
"");
8722 if (!strcasecmp(rl_iter->
name, tmp)) {
8730 ast_log(
LOG_ERROR,
"Memory allocation error when copying penalty rules! Aborting!\n");
8762 const char *user_priority;
8763 const char *max_penalty_str;
8764 const char *min_penalty_str;
8765 const char *raise_penalty_str;
8768 int max_penalty, min_penalty, raise_penalty;
8774 int makeannouncement = 0;
8802 ast_log(
LOG_WARNING,
"Queue requires an argument: queuename[,options[,URL[,announceoverride[,timeout[,agi[,gosub[,rule[,position]]]]]]]]\n");
8818 ast_debug(1,
"queue: %s, options: %s, url: %s, announce: %s, timeout: %s, agi: %s, gosub: %s, rule: %s, position: %s\n",
8848 if (user_priority) {
8849 if (sscanf(user_priority,
"%30d", &prio) == 1) {
8857 ast_debug(3,
"NO QUEUE_PRIO variable found. Using default.\n");
8864 if (sscanf(max_penalty_str,
"%30d", &max_penalty) == 1) {
8869 max_penalty = INT_MAX;
8872 max_penalty = INT_MAX;
8876 if (sscanf(min_penalty_str,
"%30d", &min_penalty) == 1) {
8881 min_penalty = INT_MAX;
8884 min_penalty = INT_MAX;
8888 if (*raise_penalty_str ==
'r') {
8890 raise_penalty_str++;
8894 if (sscanf(raise_penalty_str,
"%30d", &raise_penalty) == 1) {
8899 raise_penalty = INT_MAX;
8902 raise_penalty = INT_MAX;
8918 if (
args.position) {
8919 position = atoi(
args.position);
8921 ast_log(
LOG_WARNING,
"Invalid position '%s' given for call to queue '%s'. Assuming no preference for position\n",
args.position,
args.queuename);
8926 ast_debug(1,
"queue: %s, expires: %ld, priority: %d\n",
8954 char *escaped_cidname =
NULL;
8959 if (strchr(escaped_cidname,
'|')) {
8960 for (
char *p = escaped_cidname; *p; p++) {
8972 S_OR(escaped_cidname,
""));
9040 if (makeannouncement) {
9097 ast_verb(3,
"Exiting on time-out cycle\n");
9165 }
else if (res < 0) {
9175 }
else if (qcontinue) {
9229 char interfacevar[256] =
"";
9247 snprintf(interfacevar,
sizeof(interfacevar),
9248 "QUEUEMAX=%d,QUEUESTRATEGY=%s,QUEUECALLS=%d,QUEUEHOLDTIME=%d,QUEUETALKTIME=%d,QUEUECOMPLETED=%d,QUEUEABANDONED=%d,QUEUESRVLEVEL=%d,QUEUESRVLEVELPERF=%2.1f",
9260 snprintf(
buf,
len,
"%d", res);
9282 queue_t_unref(q,
"Done with temporary reference in QUEUE_EXISTS()");
9293 ast_log(
LOG_ERROR,
"QUEUE_MEMBER: Missing required interface argument.\n");
9328 "Missing required argument. %s(<queuename>,<option>[,<interface>])\n",
9337 "Missing required argument. %s(<queuename>,<option>[,<interface>])\n",
9344 if (!strcasecmp(
args.option,
"logged")) {
9354 }
else if (!strcasecmp(
args.option,
"free")) {
9364 }
else if (!strcasecmp(
args.option,
"ready")) {
9377 }
else if (!strcasecmp(
args.option,
"count")) {
9379 }
else if (!strcasecmp(
args.option,
"penalty")) {
9385 }
else if (!strcasecmp(
args.option,
"paused")) {
9391 }
else if ((!strcasecmp(
args.option,
"ignorebusy")
9392 || !strcasecmp(
args.option,
"ringinuse"))) {
9402 queue_t_unref(q,
"Done with temporary reference in QUEUE_MEMBER()");
9425 "Missing required argument. %s([<queuename>],<option>,<interface>)\n",
9435 "Missing required argument. %s([<queuename>],<option>,<interface>)\n",
9445 memvalue = atoi(
value);
9446 if (!strcasecmp(
args.option,
"penalty")) {
9451 }
else if (!strcasecmp(
args.option,
"paused")) {
9452 memvalue = (memvalue <= 0) ? 0 : 1;
9457 }
else if (!strcasecmp(
args.option,
"ignorebusy")
9458 || !strcasecmp(
args.option,
"ringinuse")) {
9459 memvalue = (memvalue <= 0) ? 0 : 1;
9487 ast_log(
LOG_ERROR,
"Missing argument. QUEUE_GET_CHANNEL(<queuename>,<position>)\n");
9502 if (sscanf(
args.position,
"%30d", &position) != 1) {
9507 ast_log (
LOG_ERROR,
"<position> parameter must be an integer greater than zero.\n");
9521 if (q->
count >= position) {
9525 if (
qe->pos == position) {
9532 queue_t_unref(q,
"Done with reference in QUEUE_GET_CHANNEL()");
9562 ast_log(
LOG_ERROR,
"QUEUE_WAITING_COUNT requires an argument: queuename\n");
9570 queue_t_unref(q,
"Done with reference in QUEUE_WAITING_COUNT()");
9582 snprintf(
buf,
len,
"%d", count);
9602 int buflen = 0, count = 0;
9610 strncat(
buf + buflen,
",",
len - buflen - 1);
9616 if (buflen >=
len - 2) {
9647 ast_log(
LOG_ERROR,
"Missing argument. QUEUE_MEMBER_PENALTY(<queuename>,<interface>)\n");
9653 if (
args.argc < 2) {
9654 ast_log(
LOG_ERROR,
"Missing argument. QUEUE_MEMBER_PENALTY(<queuename>,<interface>)\n");
9661 snprintf (
buf,
len,
"%d", penalty);
9677 ast_log(
LOG_ERROR,
"Missing argument. QUEUE_MEMBER_PENALTY(<queuename>,<interface>)\n");
9683 if (
args.argc < 2) {
9684 ast_log(
LOG_ERROR,
"Missing argument. QUEUE_MEMBER_PENALTY(<queuename>,<interface>)\n");
9688 penalty = atoi(
value);
9705 .
name =
"QUEUE_EXISTS",
9710 .
name =
"QUEUE_VARIABLES",
9715 .
name =
"QUEUE_MEMBER",
9721 .
name =
"QUEUE_GET_CHANNEL",
9726 .
name =
"QUEUE_WAITING_COUNT",
9731 .
name =
"QUEUE_MEMBER_LIST",
9736 .
name =
"QUEUE_MEMBER_PENALTY",
9750 const char *general_val =
NULL;
9767 char *rulecat =
NULL;
9772 ast_log(
LOG_NOTICE,
"No queuerules.conf file found, queues will not follow penalty rules\n");
9775 ast_log(
LOG_NOTICE,
"queuerules.conf has not changed since it was last loaded. Not taking any action.\n");
9778 ast_log(
LOG_ERROR,
"Config file queuerules.conf is in an invalid format. Aborting.\n");
9790 if (!strcasecmp(rulecat,
"general")) {
9794 if (!(new_rl =
ast_calloc(1,
sizeof(*new_rl)))) {
9802 if(!strcasecmp(rulevar->
name,
"penaltychange"))
9836 const char *general_val =
NULL;
9844 if (!strcasecmp(general_val,
"mixmonitor"))
9857 if (!strcasecmp(general_val,
"prio")) {
9859 }
else if (
ast_true(general_val)) {
9884 char *membername, *interface, *state_interface, *tmp;
9886 struct member *cur, *newm;
9912 interface = args.interface;
9916 penalty = atoi(tmp);
9925 membername =
args.membername;
9928 membername = interface;
9932 state_interface =
args.state_interface;
9935 state_interface = interface;
9939 tmp =
args.ringinuse;
9946 ast_log(
LOG_ERROR,
"Member %s has an invalid ringinuse value. Using %s ringinuse value.\n",
9947 membername, q->
name);
9955 tmp =
args.wrapuptime;
9957 wrapuptime = atoi(tmp);
9958 if (wrapuptime < 0) {
9973 ast_log(
LOG_ERROR,
"Member %s has an invalid paused value.\n", membername);
9988 if ((newm =
create_queue_member(interface, membername, penalty, paused, state_interface, ringinuse, wrapuptime))) {
10054 const char *tmpvar;
10057 int prev_weight = 0;
10062 if (queue_reload) {
10080 prev_weight = q->
weight ? 1 : 0;
10097 if (queue_reload) {
10101 ast_log(
LOG_WARNING,
"'%s' isn't a valid strategy for queue '%s', using ringall instead\n",
10110 if (member_reload) {
10117 if (queue_reload && strcasecmp(
var->name,
"member")) {
10124 if (member_reload && !strcasecmp(
var->name,
"member")) {
10130 if (member_reload) {
10146 if (!q->
weight && prev_weight) {
10148 }
else if (q->
weight && !prev_weight) {
10153 if (member_reload) {
10171 char *queuename = arg;
10181 char *queuename = arg;
10210 ast_log(
LOG_NOTICE,
"No call queueing config file (queues.conf), so no call queues\n");
10215 ast_log(
LOG_ERROR,
"Config file queues.conf is in an invalid format. Aborting.\n");
10229 if (!strcasecmp(cat,
"general") && queue_reload) {
10238 if (queue_reload) {
10322 time_t now = time(
NULL);
10339 ast_str_append(&
out, 0,
") in '%s' strategy (%ds holdtime, %ds talktime), W:%d, C:%d, A:%d, SL:%2.1f%%, SL2:%2.1f%% within %ds",
10409 (
long) (
now -
qe->start) % 60,
qe->prio);
10433 if (argc != 2 && argc != 3) {
10456 char *category =
NULL;
10476 if (!sorted_queues) {
10500 if (!realtime_queue) {
10505 queue_t_unref(realtime_queue,
"Queue is already in memory");
10537 int list_len, word_len = strlen(
word);
10538 const char *find, *end_find, *end_list;
10541 while(isspace(*
list)) {
10545 while((find = strstr(
list,
word))) {
10547 if (find !=
list && *(find - 1) !=
' ') {
10550 while(!isspace(*
list) && *
list !=
'\0') {
10554 while(isspace(*
list)) {
10561 list_len = strlen(
list);
10562 end_find = find + word_len;
10563 end_list =
list + list_len;
10564 if (end_find == end_list || *end_find !=
' ') {
10567 while(!isspace(*
list) && *
list !=
'\0') {
10571 while(isspace(*
list)) {
10600 int wordlen = strlen(
word);
10602 const char *word_list =
NULL;
10606 if (word_list_offset && strlen(line) >= word_list_offset) {
10607 word_list = line + word_list_offset;
10612 if (!strncasecmp(
word, q->
name, wordlen) && ++which >
state
10613 && (!word_list_offset || !word_list || !
word_in_list(word_list, q->
name))) {
10625 if (!ret && which ==
state && !wordlen && !strncmp(
"queue show", line, 10)) {
10646 "Usage: queue show\n"
10647 " Provides summary information on a specified queue.\n";
10697 int qchancount = 0;
10698 int qlongestholdtime = 0;
10699 int qsummaries = 0;
10717 snprintf(idText,
sizeof(idText),
"ActionID: %s\r\n",
id);
10729 qlongestholdtime = 0;
10743 for (qe = q->
head; qe; qe = qe->
next) {
10744 if ((now - qe->
start) > qlongestholdtime) {
10745 qlongestholdtime = now - qe->
start;
10752 "Available: %d\r\n"
10756 "LongestHoldTime: %d\r\n"
10759 q->
name, qmemcount, qmemavail, qchancount, q->
holdtime, q->
talktime, qlongestholdtime, idText);
10799 snprintf(idText,
sizeof(idText),
"ActionID: %s\r\n",
id);
10818 "Completed: %d\r\n"
10819 "Abandoned: %d\r\n"
10820 "ServiceLevel: %d\r\n"
10821 "ServicelevelPerf: %2.1f\r\n"
10822 "ServicelevelPerf2: %2.1f\r\n"
10838 "StateInterface: %s\r\n"
10839 "Membership: %s\r\n"
10841 "CallsTaken: %d\r\n"
10843 "LastPause: %d\r\n"
10844 "LoginTime: %d\r\n"
10848 "PausedReason: %s\r\n"
10849 "Wrapuptime: %d\r\n"
10863 for (qe = q->
head; qe; qe = qe->
next) {
10869 "CallerIDNum: %s\r\n"
10870 "CallerIDName: %s\r\n"
10871 "ConnectedLineNum: %s\r\n"
10872 "ConnectedLineName: %s\r\n"
10882 (
long) (now - qe->
start), qe->
prio, idText);
10899 const char *queuename, *interface, *penalty_s, *paused_s, *reason, *membername, *state_interface, *wrapuptime_s;
10900 int paused, penalty, wrapuptime = 0;
10923 }
else if (sscanf(penalty_s,
"%30d", &penalty) != 1 || penalty < 0) {
10929 }
else if (sscanf(wrapuptime_s,
"%30d", &wrapuptime) != 1 || wrapuptime < 0) {
10942 ast_queue_log(queuename,
"MANAGER", interface,
"ADDMEMBER",
"%s", paused ?
"PAUSED" :
"");
10944 ast_queue_log(queuename,
"MANAGER", membername,
"ADDMEMBER",
"%s", paused ?
"PAUSED" :
"");
10964 const char *queuename, *interface;
10982 ast_queue_log(queuename,
"MANAGER", interface,
"REMOVEMEMBER",
"%s",
"");
10992 astman_send_error(s, m,
"Unable to remove interface from queue: No such queue");
11011 const char *queuename, *interface, *paused_s, *reason;
11029 astman_send_ack(s, m, paused ?
"Interface paused successfully" :
"Interface unpaused successfully");
11036 const char *queuename, *
event, *
message, *interface, *uniqueid;
11058 const char *queuename =
NULL;
11059 int header_found = 0;
11075 if (!header_found) {
11089 const char *queuename =
NULL;
11118 sprintf(num,
"%d",
state);
11135 const char *queuename, *interface, *ringinuse_s;
11154 astman_send_error(s, m,
"'RingInUse' parameter must be a truth value (yes/no, on/off, 0/1, etc)");
11169 const char *queuename, *interface, *penalty_s;
11182 penalty = atoi(penalty_s);
11195 const char *queuename, *caller, *priority_s, *immediate_s;
11216 }
else if (sscanf(priority_s,
"%30d", &
priority) != 1) {
11222 immediate =
ast_true(immediate_s);
11230 astman_send_error(s, m,
"Unable to change priority caller on queue: No such queue");
11233 astman_send_error(s, m,
"Unable to change priority caller on queue: No such caller");
11242 const char *queuename, *caller, *withdraw_info;
11263 astman_send_error(s, m,
"Unable to request withdraw from queue: No such queue");
11266 astman_send_error(s, m,
"Unable to request withdraw from queue: No such caller");
11269 astman_send_error(s, m,
"Unable to request withdraw from queue: Already requested");
11279 const char *queuename, *interface, *membername =
NULL, *state_interface =
NULL, *reason =
NULL;
11280 int penalty, paused = 0;
11284 e->
command =
"queue add member";
11286 "Usage: queue add member <dial string> to <queue> [penalty <penalty> [as <membername> [state_interface <interface> [paused <reason>]]]]\n"
11287 " Add a dial string (Such as a channel,e.g. SIP/6001) to a queue with optionally: a penalty, membername and a state_interface\n";
11293 if ((
a->argc != 6) && (
a->argc != 8) && (
a->argc != 10) && (
a->argc != 12) && (
a->argc != 14)) {
11295 }
else if (strcmp(
a->argv[4],
"to")) {
11297 }
else if ((
a->argc >= 8) && strcmp(
a->argv[6],
"penalty")) {
11299 }
else if ((
a->argc >= 10) && strcmp(
a->argv[8],
"as")) {
11301 }
else if ((
a->argc == 12) && strcmp(
a->argv[10],
"state_interface")) {
11303 }
else if ((
a->argc == 14) && strcmp(
a->argv[12],
"paused")) {
11307 queuename =
a->argv[5];
11308 interface =
a->argv[3];
11309 if (
a->argc >= 8) {
11310 if (sscanf(
a->argv[7],
"%30d", &penalty) == 1) {
11312 ast_cli(
a->fd,
"Penalty must be >= 0\n");
11316 ast_cli(
a->fd,
"Penalty must be an integer >= 0\n");
11323 if (
a->argc >= 10) {
11324 membername =
a->argv[9];
11327 if (
a->argc >= 12) {
11328 state_interface =
a->argv[11];
11331 if (
a->argc >= 14) {
11333 reason =
a->argv[13];
11339 ast_queue_log(queuename,
"CLI", interface,
"ADDMEMBER",
"%s", paused ?
"PAUSED" :
"");
11341 ast_queue_log(queuename,
"CLI", membername,
"ADDMEMBER",
"%s", paused ?
"PAUSED" :
"");
11343 ast_cli(
a->fd,
"Added interface '%s' to queue '%s'\n", interface, queuename);
11346 ast_cli(
a->fd,
"Unable to add interface '%s' to queue '%s': Already there\n", interface, queuename);
11349 ast_cli(
a->fd,
"Unable to add interface to queue '%s': No such queue\n", queuename);
11352 ast_cli(
a->fd,
"Out of memory\n");
11355 ast_cli(
a->fd,
"Member not dynamic\n");
11369 int wordlen = strlen(
word);
11372 if (pos > 5 || pos < 3) {
11395 queue_t_unref(q,
"Done with iterator, returning interface name");
11412 const char *queuename, *interface;
11418 e->
command =
"queue remove member";
11420 "Usage: queue remove member <channel> from <queue>\n"
11421 " Remove a specific channel from a queue.\n";
11427 if (
a->argc != 6) {
11429 }
else if (strcmp(
a->argv[4],
"from")) {
11433 queuename =
a->argv[5];
11434 interface =
a->argv[3];
11443 ast_queue_log(queuename,
"CLI", interface,
"REMOVEMEMBER",
"%s",
"");
11447 ast_cli(
a->fd,
"Removed interface %s from queue '%s'\n", interface, queuename);
11451 ast_cli(
a->fd,
"Unable to remove interface '%s' from queue '%s': Not there\n", interface, queuename);
11454 ast_cli(
a->fd,
"Unable to remove interface from queue '%s': No such queue\n", queuename);
11457 ast_cli(
a->fd,
"Out of memory\n");
11460 ast_cli(
a->fd,
"Unable to remove interface '%s' from queue '%s': Member is not dynamic\n", interface, queuename);
11475 const char *queuename, *caller;
11481 e->
command =
"queue priority caller";
11483 "Usage: queue priority caller <channel> on <queue> to <priority> [immediate]\n"
11484 " Change the priority of a channel on a queue, optionally applying the change in relation to existing callers.\n";
11492 }
else if (strcmp(
a->argv[4],
"on")) {
11494 }
else if (strcmp(
a->argv[6],
"to")) {
11496 }
else if (sscanf(
a->argv[7],
"%30d", &
priority) != 1) {
11499 }
else if (
a->argc == 9) {
11500 if (strcmp(
a->argv[8],
"immediate")) {
11506 caller =
a->argv[3];
11507 queuename =
a->argv[5];
11514 ast_cli(
a->fd,
"Unable change priority caller %s on queue '%s': No such queue\n", caller, queuename);
11517 ast_cli(
a->fd,
"Unable to change priority caller '%s' on queue '%s': Not there\n", caller, queuename);
11548 const char *queuename, *interface, *reason;
11553 e->
command =
"queue {pause|unpause} member";
11555 "Usage: queue {pause|unpause} member <member> [queue <queue> [reason <reason>]]\n"
11556 " Pause or unpause a queue member. Not specifying a particular queue\n"
11557 " will pause or unpause a member across all queues to which the member\n"
11564 if (
a->argc < 4 ||
a->argc == 5 ||
a->argc == 7 ||
a->argc > 8) {
11566 }
else if (
a->argc >= 5 && strcmp(
a->argv[4],
"queue")) {
11568 }
else if (
a->argc == 8 && strcmp(
a->argv[6],
"reason")) {
11573 interface =
a->argv[3];
11574 queuename =
a->argc >= 6 ?
a->argv[5] :
NULL;
11575 reason =
a->argc == 8 ?
a->argv[7] :
NULL;
11576 paused = !strcasecmp(
a->argv[1],
"pause");
11579 ast_cli(
a->fd,
"%spaused interface '%s'", paused ?
"" :
"un", interface);
11581 ast_cli(
a->fd,
" in queue '%s'", queuename);
11584 ast_cli(
a->fd,
" for reason '%s'", reason);
11589 ast_cli(
a->fd,
"Unable to %spause interface '%s'", paused ?
"" :
"un", interface);
11591 ast_cli(
a->fd,
" in queue '%s'", queuename);
11594 ast_cli(
a->fd,
" for reason '%s'", reason);
11626 const char *queuename =
NULL, *interface;
11631 e->
command =
"queue set ringinuse";
11633 "Usage: queue set ringinuse <yes/no> on <interface> [in <queue>]\n"
11634 " Set a member's ringinuse in the queue specified. If no queue is specified\n"
11635 " then that interface's penalty is set in all queues to which that interface is a member.\n";
11643 if (
a->argc != 6 &&
a->argc != 8) {
11648 if (strcmp(
a->argv[4],
"on") || (
a->argc > 6 && strcmp(
a->argv[6],
"in"))) {
11653 if (
a->argc == 8) {
11654 queuename =
a->argv[7];
11658 interface =
a->argv[5];
11671 ast_cli(
a->fd,
"Set ringinuse on interface '%s' from queue '%s'\n", interface, queuename);
11674 ast_cli(
a->fd,
"Failed to set ringinuse on interface '%s' from queue '%s'\n", interface, queuename);
11683 const char *queuename =
NULL, *interface;
11688 e->
command =
"queue set penalty";
11690 "Usage: queue set penalty <penalty> on <interface> [in <queue>]\n"
11691 " Set a member's penalty in the queue specified. If no queue is specified\n"
11692 " then that interface's penalty is set in all queues to which that interface is a member\n";
11698 if (
a->argc != 6 &&
a->argc != 8) {
11700 }
else if (strcmp(
a->argv[4],
"on") || (
a->argc > 6 && strcmp(
a->argv[6],
"in"))) {
11704 if (
a->argc == 8) {
11705 queuename =
a->argv[7];
11707 interface =
a->argv[5];
11708 penalty = atoi(
a->argv[3]);
11712 ast_cli(
a->fd,
"Set penalty on interface '%s' from queue '%s'\n", interface, queuename);
11715 ast_cli(
a->fd,
"Failed to set penalty on interface '%s' from queue '%s'\n", interface, queuename);
11726 int wordlen = strlen(
word);
11734 if (!strncasecmp(
word, rl_iter->
name, wordlen) && ++which >
state) {
11751 e->
command =
"queue show rules";
11753 "Usage: queue show rules [rulename]\n"
11754 " Show the list of rules associated with rulename. If no\n"
11755 " rulename is specified, list all rules defined in queuerules.conf\n";
11761 if (
a->argc != 3 &&
a->argc != 4) {
11765 rule =
a->argc == 4 ?
a->argv[3] :
"";
11771 ast_cli(
a->fd,
"\tAfter %d seconds, adjust QUEUE_MAX_PENALTY %s %d, adjust QUEUE_MIN_PENALTY %s %d and adjust QUEUE_RAISE_PENALTY %s %d\n", pr_iter->
time, pr_iter->
max_relative ?
"by" :
"to", pr_iter->
max_value, pr_iter->
min_relative ?
"by" :
"to", pr_iter->
min_value, pr_iter->
raise_relative ?
"by" :
"to", pr_iter->
raise_value);
11786 e->
command =
"queue reset stats";
11788 "Usage: queue reset stats [<queuenames>]\n"
11790 "Issuing this command will reset statistics for\n"
11791 "<queuenames>, or for all queues if no queue is\n"
11806 if (
a->argc == 3) {
11811 for (i = 3; i <
a->argc; ++i) {
11825 e->
command =
"queue reload {parameters|members|rules|all}";
11827 "Usage: queue reload {parameters|members|rules|all} [<queuenames>]\n"
11828 "Reload queues. If <queuenames> are specified, only reload information pertaining\n"
11829 "to <queuenames>. One of 'parameters,' 'members,' 'rules,' or 'all' must be\n"
11830 "specified in order to know what information to reload. Below is an explanation\n"
11831 "of each of these qualifiers.\n"
11833 "\t'members' - reload queue members from queues.conf\n"
11834 "\t'parameters' - reload all queue options except for queue members\n"
11835 "\t'rules' - reload the queuerules.conf file\n"
11836 "\t'all' - reload queue rules, parameters, and members\n"
11838 "Note: the 'rules' qualifier here cannot actually be applied to a specific queue.\n"
11839 "Use of the 'rules' qualifier causes queuerules.conf to be reloaded. Even if only\n"
11840 "one queue is specified when using this command, reloading queue rules may cause\n"
11841 "other queues to be affected\n";
11846 const char *command_end =
a->line + strlen(
"queue reload ");
11847 command_end = strchr(command_end,
' ');
11848 if (!command_end) {
11849 command_end =
a->line + strlen(
a->line);
11860 if (!strcasecmp(
a->argv[2],
"rules")) {
11862 }
else if (!strcasecmp(
a->argv[2],
"members")) {
11864 }
else if (!strcasecmp(
a->argv[2],
"parameters")) {
11866 }
else if (!strcasecmp(
a->argv[2],
"all")) {
11870 if (
a->argc == 3) {
11875 for (i = 3; i <
a->argc; ++i) {
11891 int newtalktime = 0;
11902 ast_log(
LOG_WARNING,
"QueueUpdate requires arguments (queuename,uniqueid,agent,status,talktime,params[totaltime,callednumber])\n");
11911 ast_log(
LOG_WARNING,
"Missing argument to QueueUpdate (queuename,uniqueid,agent,status,talktime,params[totaltime|callednumber])\n");
11916 newtalktime = atoi(
args.talktime);
11930 if (!strcasecmp(
args.status,
"ANSWER")) {
11932 q->
talktime = (((oldtalktime << 2) - oldtalktime) + newtalktime) >> 2;
11938 if (newtalktime <= q->servicelevel) {
12080 ast_realtime_require_field(
"queue_members",
"paused",
RQ_INTEGER1, 1,
"uniqueid",
RQ_UINTEGER2, 5,
"reason_paused",
RQ_CHAR, 80,
SENTINEL);
12089 if (!member_config) {
12092 const char *config_val;
12095 ast_log(
LOG_NOTICE,
"ringinuse field entries found in queue_members table. Using 'ringinuse'\n");
12098 ast_log(
LOG_NOTICE,
"ignorebusy field found in queue_members table with no ringinuse field. Using 'ignorebusy'\n");
12101 ast_log(
LOG_NOTICE,
"No entries were found for ringinuse/ignorebusy in queue_members table. Using 'ringinuse'\n");
void ast_cli_unregister_multiple(void)
Generic Advice of Charge encode and decode routines.
void * ast_aoc_destroy_encoded(struct ast_aoc_encoded *encoded)
free an ast_aoc_encoded object
enum ast_aoc_type ast_aoc_get_msg_type(struct ast_aoc_decoded *decoded)
get the message type, AOC-D, AOC-E, or AOC Request
struct ast_aoc_decoded * ast_aoc_decode(struct ast_aoc_encoded *encoded, size_t size, struct ast_channel *chan)
decodes an encoded aoc payload.
void * ast_aoc_destroy_decoded(struct ast_aoc_decoded *decoded)
free an ast_aoc_decoded object
struct ast_aoc_encoded * ast_aoc_encode(struct ast_aoc_decoded *decoded, size_t *out_size, struct ast_channel *chan)
encodes a decoded aoc structure so it can be passed on the wire
static struct ast_custom_function queuevar_function
static void handle_bridge_enter(void *userdata, struct stasis_subscription *sub, struct stasis_message *msg)
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 member_remove_from_queue(struct call_queue *queue, struct member *mem)
static int is_longest_waiting_caller(struct queue_ent *caller, struct member *member)
static void load_realtime_queues(const char *queuename)
static struct member * interface_exists(struct call_queue *q, const char *interface)
static int is_our_turn(struct queue_ent *qe)
Check if we should start attempting to call queue members.
static void record_abandoned(struct queue_ent *qe)
Record that a caller gave up on waiting in queue.
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.
static char * queue_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static int get_wrapuptime(struct call_queue *q, struct member *member)
Return wrapuptime.
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.
static int context_included(const char *parent, const char *child)
Returns if one context includes another context.
static void set_queue_variables(struct call_queue *q, struct ast_channel *chan)
Set variables of queue.
static int manager_queue_reset(struct mansession *s, const struct message *m)
static struct ast_manager_event_blob * queue_member_ringinuse_to_ami(struct stasis_message *message)
static struct ast_manager_event_blob * queue_member_penalty_to_ami(struct stasis_message *message)
static int setup_stasis_subs(struct queue_ent *qe, struct ast_channel *peer, struct member *mem, time_t holdstart, time_t starttime, int callcompletedinsl)
#define ANNOUNCEPOSITION_MORE_THAN
static int pending_members_cmp(void *obj, void *arg, int flags)
static void queue_reset_global_params(void)
static int log_caller_id_name
queues.conf [general] option
static char * complete_queue_rule_show(const char *line, const char *word, int pos, int state)
static void dump_queue_members(struct call_queue *pm_queue)
Dump all members in a specific queue to the database.
#define QUEUE_UNPAUSED_DEVSTATE
static struct ast_custom_function queuemembercount_function
static struct ast_custom_function queuewaitingcount_function
static int play_file(struct ast_channel *chan, const char *filename)
static int queue_persistent_members
queues.conf [general] option
static int montype_default
queues.conf [general] option
static int mark_member_dead(void *obj, void *arg, int flags)
static struct ast_custom_function queuememberlist_function
static struct ast_manager_event_blob * queue_channel_to_ami(const char *type, struct stasis_message *message)
static void set_queue_member_ringinuse(struct call_queue *q, struct member *mem, int ringinuse)
static char * realtime_ringinuse_field
name of the ringinuse field in the realtime database
static void queue_bridge_cb(void *userdata, struct stasis_subscription *sub, struct stasis_message *msg)
static int remove_from_queue(const char *queuename, const char *interface)
Remove member from queue.
static int manager_add_queue_member(struct mansession *s, const struct message *m)
#define MAX_PERIODIC_ANNOUNCEMENTS
static void parse_empty_options(const char *value, enum empty_conditions *empty, int joinempty)
static int aqm_exec(struct ast_channel *chan, const char *data)
AddQueueMember application.
static void set_queue_result(struct ast_channel *chan, enum queue_result res)
sets the QUEUESTATUS channel variable
static struct ast_manager_event_blob * queue_member_pause_to_ami(struct stasis_message *message)
static void leave_queue(struct queue_ent *qe)
Caller leaving queue.
#define MAX_QUEUE_BUCKETS
static int reload_handler(int reload, struct ast_flags *mask, const char *queuename)
The command center for all reload operations.
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_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 char * complete_queue_pause_member(const char *line, const char *word, int pos, int state)
static void do_hang(struct callattempt *o)
common hangup actions
static int set_member_value(const char *queuename, const char *interface, int property, int value)
static void reload_single_member(const char *memberdata, struct call_queue *q)
reload information pertaining to a single member
static struct ast_manager_event_blob * queue_agent_ringnoanswer_to_ami(struct stasis_message *message)
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 reload_queues(int reload, struct ast_flags *mask, const char *queuename)
reload the queues.conf file
static int say_periodic_announcement(struct queue_ent *qe, int ringing)
Playback announcement to queued members if period has elapsed.
static void reload_single_queue(struct ast_config *cfg, struct ast_flags *mask, const char *queuename)
Reload information pertaining to a particular queue.
static void setup_mixmonitor(struct queue_ent *qe, const char *filename)
static struct ast_manager_event_blob * queue_member_removed_to_ami(struct stasis_message *message)
static int upqm_exec(struct ast_channel *chan, const char *data)
UnpauseQueueMember application.
static void clear_queue(struct call_queue *q)
static void handle_attended_transfer(void *userdata, struct stasis_subscription *sub, struct stasis_message *msg)
Handle an attended transfer event.
static void recalc_holdtime(struct queue_ent *qe, int newholdtime)
static int compare_weight(struct call_queue *rq, struct member *member)
static char * handle_queue_pause_member(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static int set_member_ringinuse_help_members(struct call_queue *q, const char *interface, int ringinuse)
static void queue_agent_cb(void *userdata, struct stasis_subscription *sub, struct stasis_message *msg)
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 void queue_set_global_params(struct ast_config *cfg)
static void reload_queue_members(void)
Reload dynamic queue members persisted into the astdb.
static int rqm_exec(struct ast_channel *chan, const char *data)
RemoveQueueMember application.
static int valid_exit(struct queue_ent *qe, char digit)
Check for valid exit from queue via goto.
static int is_member_available(struct call_queue *q, struct member *mem)
#define QUEUE_PAUSED_DEVSTATE
#define ANNOUNCEPOSITION_NO
static char * handle_queue_set_member_penalty(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static void handle_masquerade(void *userdata, struct stasis_subscription *sub, struct stasis_message *msg)
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.
static void print_queue(struct mansession *s, int fd, struct call_queue *q)
Print a single queue to AMI or the CLI.
#define MAX_CALL_ATTEMPT_BUCKETS
static void copy_rules(struct queue_ent *qe, const char *rulename)
Copy rule from global list into specified queue.
static int manager_queue_rule_show(struct mansession *s, const struct message *m)
static const struct strategy strategies[]
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.
static int set_member_paused(const char *queuename, const char *interface, const char *reason, int paused)
static int change_priority_caller_on_queue(const char *queuename, const char *caller, int priority, int immediate)
Change priority caller into a queue.
static struct ao2_container * queues
static int negative_penalty_invalid
queues.conf [general] option
static int load_realtime_rules(void)
Load queue rules from realtime.
static void queue_rules_reset_global_params(void)
static int update_queue(struct call_queue *q, struct member *member, int callcompletedinsl, time_t starttime)
update the queue status
#define FORCELONGESTWAITINGCALLER_PRIO
static void escape_and_substitute(struct ast_channel *chan, const char *input, char *output, size_t size)
static int member_hash_fn(const void *obj, const int flags)
static int member_cmp_fn(void *obj1, void *obj2, int flags)
#define queues_t_unlink(c, q, tag)
#define DEFAULT_MIN_ANNOUNCE_FREQUENCY
The minimum number of seconds between position announcements.
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 queue_stasis_data_destructor(void *obj)
static struct ast_manager_event_blob * queue_member_added_to_ami(struct stasis_message *message)
static struct ast_manager_event_blob * queue_agent_dump_to_ami(struct stasis_message *message)
static int extensionstate2devicestate(int state)
Helper function which converts from extension state to device state values.
#define queues_t_link(c, q, tag)
static int extension_state_cb(const char *context, const char *exten, struct ast_state_cb_info *info, void *data)
static int manager_queue_reload(struct mansession *s, const struct message *m)
static int get_member_penalty(char *queuename, char *interface)
Gets members penalty.
static int realtime_rules
queuerules.conf [general] option
static void handle_local_optimization_begin(void *userdata, struct stasis_subscription *sub, struct stasis_message *msg)
static int pqm_exec(struct ast_channel *chan, const char *data)
PauseQueueMember application.
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.
static int get_member_status(struct call_queue *q, int max_penalty, int min_penalty, int raise_penalty, enum empty_conditions conditions, int devstate, int raise_respect_min)
Check if members are available.
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.
static char * handle_queue_reset(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static int qupd_exec(struct ast_channel *chan, const char *data)
Update Queue with data of an outgoing call.
static char * complete_queue_show(const char *line, const char *word, int pos, int state)
#define FORCELONGESTWAITINGCALLER_YES
#define FORCELONGESTWAITINGCALLER_NO
static char * handle_queue_set_member_ringinuse(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
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.
static int reload_queue_rules(int reload)
Reload the rules defined in queuerules.conf.
static char * complete_queue_add_member(const char *line, const char *word, int pos, int state)
static char * handle_queue_change_priority_caller(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 int manager_queue_member_ringinuse(struct mansession *s, const struct message *m)
static char * complete_queue_set_member_value(const char *line, const char *word, int pos, int state)
static int can_ring_entry(struct queue_ent *qe, struct callattempt *call)
static const char * int2strat(int strategy)
static void free_members(struct call_queue *q, int all)
Iterate through queue's member list and delete them.
static int publish_queue_member_pause(struct call_queue *q, struct member *member)
static void callattempt_free(struct callattempt *doomed)
static int store_next_lin(struct queue_ent *qe, struct callattempt *outgoing)
Search for best metric and add to Linear queue.
#define queue_t_unref(q, tag)
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.
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.
#define ANNOUNCEHOLDTIME_ALWAYS
static const struct ast_app_option queue_exec_options[128]
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 int shared_lastcall
queues.conf [general] option
static int manager_queue_member_penalty(struct mansession *s, const struct message *m)
#define queue_t_ref(q, tag)
static char * __queues_show(struct mansession *s, int fd, int argc, const char *const *argv)
Show queue(s) status and statistics.
static void queue_set_param(struct call_queue *q, const char *param, const char *val, int linenum, int failunknown)
Configure a queue parameter.
static void set_duration_var(struct ast_channel *chan, const char *var_base, int64_t duration)
#define ANNOUNCEPOSITION_LIMIT
static int clear_stats(const char *queuename)
Facilitates resetting statistics for a queue.
static struct ast_custom_function queuememberpenalty_function
static void set_queue_member_pause(struct call_queue *q, struct member *mem, const char *reason, int paused)
static int queue_cmp_cb(void *obj, void *arg, int flags)
static int manager_request_withdraw_caller_from_queue(struct mansession *s, const struct message *m)
static int log_unpause_on_reason_change
queues.conf [general] option
static int set_member_value_help_members(struct call_queue *q, const char *interface, int property, int value)
static int queue_hash_cb(const void *obj, const int flags)
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.
static const char *const pm_family
Persistent Members astdb family.
static int log_membername_as_agent
queues.conf [general] option
static void update_qe_rule(struct queue_ent *qe)
update rules for queues
static void update_connected_line_from_peer(struct ast_channel *chan, struct ast_channel *peer, int is_caller)
static struct ast_manager_event_blob * queue_agent_called_to_ami(struct stasis_message *message)
static int queue_exec(struct ast_channel *chan, const char *data)
The starting point for all queue calls.
static int join_queue(char *queuename, struct queue_ent *qe, enum queue_result *reason, int position)
static char * handle_queue_remove_member(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
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 const struct ast_app_option aqm_opts[128]
static void destroy_queue_member_cb(void *obj)
static void init_queue(struct call_queue *q)
Initialize Queue default values.
static struct ao2_container * pending_members
static struct ast_manager_event_blob * queue_multi_channel_to_ami(const char *type, struct stasis_message *message)
static struct member * find_member_by_queuename_and_interface(const char *queuename, const char *interface)
Find a member by looking up queuename and interface.
static int force_longest_waiting_caller
queues.conf [general] option
static struct ast_manager_event_blob * queue_member_status_to_ami(struct stasis_message *message)
static int kill_dead_members(void *obj, void *arg, int flags)
static void remove_stasis_subscriptions(struct queue_stasis_data *queue_data)
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 pending_members_hash(const void *obj, const int flags)
static int autofill_default
queues.conf [general] option
static int manager_pause_queue_member(struct mansession *s, const struct message *m)
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'.
#define ANNOUNCEHOLDTIME_ONCE
static struct ast_manager_event_blob * queue_caller_join_to_ami(struct stasis_message *message)
static int queue_delme_members_decrement_followers(void *obj, void *arg, int flag)
static int insert_penaltychange(const char *list_name, const char *content, const int linenum)
Change queue penalty by adding rule.
static char * handle_queue_reload(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static int num_available_members(struct call_queue *q)
Get the number of members available to accept a call.
static int ql_exec(struct ast_channel *chan, const char *data)
QueueLog application.
static int manager_remove_queue_member(struct mansession *s, const struct message *m)
static int update_realtime_member_field(struct member *mem, const char *queue_name, const char *field, const char *value)
static int store_next_rr(struct queue_ent *qe, struct callattempt *outgoing)
Search for best metric and add to Round Robbin queue.
static struct stasis_message_router * agent_router
static void queue_member_follower_removal(struct call_queue *queue, struct member *mem)
static struct member * get_interface_helper(struct call_queue *q, const char *interface)
static int mark_unfound(void *obj, void *arg, int flags)
@ QUEUE_RELOAD_PARAMETERS
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 int load_module(void)
Load the module.
static void member_add_to_queue(struct call_queue *queue, struct member *mem)
static int ring_entry(struct queue_ent *qe, struct callattempt *tmp, int *busies)
Part 2 of ring_one.
static void pending_members_remove(struct member *mem)
static void end_bridge_callback(void *data)
static struct stasis_subscription * device_state_sub
Subscription to device state change messages.
static int manager_queues_summary(struct mansession *s, const struct message *m)
Summary of queue info via the AMI.
static struct call_queue * alloc_queue(const char *queuename)
static struct callattempt * find_best(struct callattempt *outgoing)
find the entry with the best metric, or NULL
static int get_queue_member_status(struct member *cur)
Return the current state of a member.
static int unload_module(void)
#define QUEUE_UNKNOWN_PAUSED_DEVSTATE
static void publish_dial_end_event(struct ast_channel *in, struct callattempt *outgoing, struct ast_channel *exception, const char *status)
static int manager_queues_status(struct mansession *s, const struct message *m)
Queue status info via AMI.
static void handle_local_optimization_end(void *userdata, struct stasis_subscription *sub, struct stasis_message *msg)
static int say_position(struct queue_ent *qe, int ringing)
static int realtime_reason_paused
does realtime backend support reason_paused
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 update_realtime_members(struct call_queue *q)
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 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 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.
static struct ast_manager_event_blob * queue_agent_connect_to_ami(struct stasis_message *message)
static void end_bridge_callback_data_fixup(struct ast_bridge_config *bconfig, struct ast_channel *originator, struct ast_channel *terminator)
@ QUEUE_EMPTY_UNAVAILABLE
static struct ast_json * queue_member_blob_create(struct call_queue *q, struct member *mem)
static void queue_channel_cb(void *userdata, struct stasis_subscription *sub, struct stasis_message *msg)
static int use_weight
Records that one or more queues use weight.
#define ANNOUNCEPOSITION_YES
static int wait_a_bit(struct queue_ent *qe)
static void destroy_queue(void *obj)
Free queue's member list then its string fields.
static int kill_if_unfound(void *obj, void *arg, int flags)
static void handle_hangup(void *userdata, struct stasis_subscription *sub, struct stasis_message *msg)
static void do_print(struct mansession *s, int fd, const char *str)
direct output to manager or cli with proper terminator
static char * complete_queue_remove_member(const char *line, const char *word, int pos, int state)
static char * handle_queue_add_member(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
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 void queue_rules_set_global_params(struct ast_config *cfg)
static int member_status_available(int status)
static int queue_member_decrement_followers(void *obj, void *arg, int flag)
static struct ast_cli_entry cli_queue[]
@ OPT_ARG_MUSICONHOLD_CLASS
static struct call_queue * find_load_queue_rt_friendly(const char *queuename)
static struct ast_custom_function queuegetchannel_function
static struct ast_manager_event_blob * queue_caller_abandon_to_ami(struct stasis_message *message)
static struct stasis_forward * topic_forwarder
static struct ast_custom_function queueexists_function
@ AQM_OPT_ARG_PAUSE_REASON
static int strat2int(const char *strategy)
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 struct ast_manager_event_blob * queue_agent_complete_to_ami(struct stasis_message *message)
static void setup_peer_after_bridge_goto(struct ast_channel *chan, struct ast_channel *peer, struct ast_flags *opts, char *opt_args[])
static int word_in_list(const char *list, const char *word)
Check if a given word is in a space-delimited list.
static void log_attended_transfer(struct queue_stasis_data *queue_data, struct ast_attended_transfer_message *atxfer_msg)
static int ring_one(struct queue_ent *qe, struct callattempt *outgoing, int *busies)
Place a call to a queue member.
@ OPT_IGNORE_CONNECTEDLINE
static const struct @51 queue_results[]
static void handle_blind_transfer(void *userdata, struct stasis_subscription *sub, struct stasis_message *msg)
Handle a blind transfer event.
static const struct autopause autopausesmodes[]
static struct ast_manager_event_blob * queue_member_to_ami(const char *type, struct stasis_message *message)
@ QUEUE_STRATEGY_RRMEMORY
@ QUEUE_STRATEGY_LEASTRECENT
@ QUEUE_STRATEGY_FEWESTCALLS
@ QUEUE_STRATEGY_RRORDERED
static int autopause2int(const char *autopause)
static int manager_change_priority_caller_on_queue(struct mansession *s, const struct message *m)
static int compress_char(const char c)
static void queue_publish_member_blob(struct stasis_message_type *type, struct ast_json *blob)
static int manager_queue_log_custom(struct mansession *s, const struct message *m)
static struct ast_manager_event_blob * queue_caller_leave_to_ami(struct stasis_message *message)
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 set_member_penalty_help_members(struct call_queue *q, const char *interface, int penalty)
Persistent data storage (akin to *doze registry)
int ast_db_put(const char *family, const char *key, const char *value)
Store value addressed by family/key.
int ast_db_get_allocated(const char *family, const char *key, char **out)
Get key value specified by family/key as a heap allocated string.
int ast_db_del(const char *family, const char *key)
Delete entry in astdb.
struct ast_db_entry * ast_db_gettree(const char *family, const char *keytree)
Get a list of values within the astdb tree.
void ast_db_freetree(struct ast_db_entry *entry)
Free structure created by ast_db_gettree()
char * strsep(char **str, const char *delims)
Asterisk main include file. File version handling, generic pbx functions.
#define ast_strdup(str)
A wrapper for strdup()
#define ast_strdupa(s)
duplicate a string in memory from the stack
#define ast_asprintf(ret, fmt,...)
A wrapper for asprintf()
#define ast_calloc(num, len)
A wrapper for calloc()
#define ast_malloc(len)
A wrapper for malloc()
int ao2_container_dup(struct ao2_container *dest, struct ao2_container *src, enum search_flags flags)
Copy all object references in the src container into the dest container.
#define ao2_iterator_next(iter)
#define ao2_link(container, obj)
Add an object to a container.
@ AO2_ALLOC_OPT_LOCK_NOLOCK
@ AO2_ALLOC_OPT_LOCK_MUTEX
#define ao2_t_iterator_next(iter, tag)
#define ao2_t_find(container, arg, flags, tag)
#define ao2_callback(c, flags, cb_fn, arg)
ao2_callback() is a generic function that applies cb_fn() to all objects in a container,...
int ao2_container_count(struct ao2_container *c)
Returns the number of elements in a container.
#define ao2_unlink(container, obj)
Remove an object from a container.
@ AO2_ITERATOR_DONTLOCK
Assume that the ao2_container is already locked.
#define ao2_find(container, arg, flags)
struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags) attribute_warn_unused_result
Create an iterator for a container.
#define AO2_STRING_FIELD_SORT_FN(stype, field)
Creates a sort function for a structure string field.
#define ao2_container_alloc_rbtree(ao2_options, container_options, sort_fn, cmp_fn)
Allocate and initialize a red-black tree container.
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
#define ao2_bump(obj)
Bump refcount on an AO2 object by one, returning the object.
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
#define ao2_t_alloc(data_size, destructor_fn, debug_msg)
@ OBJ_SEARCH_PARTIAL_KEY
The arg parameter is a partial search key similar to OBJ_SEARCH_KEY.
@ OBJ_SEARCH_OBJECT
The arg parameter is an object of the same type.
@ OBJ_NOLOCK
Assume that the ao2_container is already locked.
@ OBJ_SEARCH_MASK
Search option field mask.
@ OBJ_SEARCH_KEY
The arg parameter is a search key, but is not an object.
#define ao2_container_alloc_list(ao2_options, container_options, sort_fn, cmp_fn)
Allocate and initialize a list container.
#define ao2_alloc(data_size, destructor_fn)
#define ao2_container_alloc_hash(ao2_options, container_options, n_buckets, hash_fn, sort_fn, cmp_fn)
Allocate and initialize a hash container with the desired number of buckets.
@ AST_BRIDGE_TRANSFER_SUCCESS
After Bridge Execution API.
void ast_bridge_set_after_go_on(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *parseable_goto)
Set channel to go on in the dialplan after the bridge.
static void ringing(struct ast_channel *chan)
Helper method to send a ringing indication to a channel in a bridge.
Basic bridge subclass API.
#define AST_TRANSFERER_ROLE_NAME
@ AST_BRIDGE_FLAG_SWAP_INHIBIT_FROM
@ AST_BRIDGE_FLAG_MERGE_INHIBIT_TO
@ AST_BRIDGE_FLAG_MERGE_INHIBIT_FROM
int ast_channel_has_role(struct ast_channel *channel, const char *role_name)
Check if a role exists on a channel.
CallerID (and other GR30) management and generation Includes code and algorithms from the Zapata libr...
@ AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER
#define AST_PRES_RESTRICTION
Internal Asterisk hangup causes.
#define AST_CAUSE_ANSWERED_ELSEWHERE
static int available(struct dahdi_pvt **pvt, int is_specific_channel)
static int call(void *data)
General Asterisk PBX channel definitions.
void ast_channel_exten_set(struct ast_channel *chan, const char *value)
int ast_waitfordigit(struct ast_channel *c, int ms)
Waits for a digit.
const char * ast_channel_name(const struct ast_channel *chan)
int ast_autoservice_stop(struct ast_channel *chan)
Stop servicing a channel for us...
void ast_channel_appl_set(struct ast_channel *chan, const char *value)
void ast_party_redirecting_init(struct ast_party_redirecting *init)
Initialize the given redirecting structure.
int ast_call(struct ast_channel *chan, const char *addr, int timeout)
Make a call.
int ast_channel_connected_line_sub(struct ast_channel *autoservice_chan, struct ast_channel *sub_chan, const void *connected_info, int frame)
Run a connected line interception subroutine and update a channel's connected line information.
void ast_party_number_init(struct ast_party_number *init)
Initialize the given number structure.
void ast_hangup(struct ast_channel *chan)
Hang up a channel.
@ AST_CHANNEL_REQUESTOR_BRIDGE_PEER
int ast_party_id_presentation(const struct ast_party_id *id)
Determine the overall presentation value for the given party.
void ast_party_connected_line_free(struct ast_party_connected_line *doomed)
Destroy the connected line information contents.
struct stasis_topic * ast_channel_topic(struct ast_channel *chan)
A topic which publishes the events for a particular channel.
void ast_channel_set_caller_event(struct ast_channel *chan, const struct ast_party_caller *caller, const struct ast_set_party_caller *update)
Set the caller id information in the Asterisk channel and generate an AMI event if the caller id name...
struct ast_channel * ast_waitfor_n(struct ast_channel **chan, int n, int *ms)
Waits for input on a group of channels Wait for input on an array of channels for a given # of millis...
#define ast_channel_lock(chan)
int ast_channel_make_compatible(struct ast_channel *chan, struct ast_channel *peer)
Make the frame formats of two channels compatible.
struct ast_format_cap * ast_channel_nativeformats(const struct ast_channel *chan)
void ast_channel_data_set(struct ast_channel *chan, const char *value)
struct ast_party_redirecting * ast_channel_redirecting(struct ast_channel *chan)
void ast_party_connected_line_copy(struct ast_party_connected_line *dest, const struct ast_party_connected_line *src)
Copy the source connected line information to the destination connected line.
void ast_party_connected_line_set(struct ast_party_connected_line *dest, const struct ast_party_connected_line *src, const struct ast_set_party_connected_line *update)
Set the connected line information based on another connected line source.
int ast_channel_priority(const struct ast_channel *chan)
#define ast_channel_lock_both(chan1, chan2)
Lock two channels.
struct ast_party_connected_line * ast_channel_connected(struct ast_channel *chan)
const char * ast_channel_uniqueid(const struct ast_channel *chan)
int ast_channel_datastore_inherit(struct ast_channel *from, struct ast_channel *to)
Inherit datastores from a parent to a child.
void ast_channel_req_accountcodes(struct ast_channel *chan, const struct ast_channel *requestor, enum ast_channel_requestor_relationship relationship)
Setup new channel accountcodes from the requestor channel after ast_request().
const char * ast_channel_context(const struct ast_channel *chan)
int ast_autoservice_start(struct ast_channel *chan)
Automatically service a channel for us...
struct ast_frame * ast_read(struct ast_channel *chan)
Reads a frame.
void ast_channel_update_connected_line(struct ast_channel *chan, const struct ast_party_connected_line *connected, const struct ast_set_party_connected_line *update)
Indicate that the connected line information has changed.
void ast_party_caller_set_init(struct ast_party_caller *init, const struct ast_party_caller *guide)
Initialize the given caller structure using the given guide for a set update operation.
void ast_set_callerid(struct ast_channel *chan, const char *cid_num, const char *cid_name, const char *cid_ani)
Set caller ID number, name and ANI and generate AMI event.
int ast_channel_redirecting_sub(struct ast_channel *autoservice_chan, struct ast_channel *sub_chan, const void *redirecting_info, int is_frame)
Run a redirecting interception subroutine and update a channel's redirecting information.
void ast_channel_inherit_variables(const struct ast_channel *parent, struct ast_channel *child)
Inherits channel variable from parent to child channel.
struct ast_channel * ast_channel_get_by_name(const char *search)
Find a channel by name or uniqueid.
int ast_connected_line_parse_data(const unsigned char *data, size_t datalen, struct ast_party_connected_line *connected)
Parse connected line indication frame data.
int ast_channel_supports_html(struct ast_channel *channel)
Checks for HTML support on a channel.
int ast_check_hangup(struct ast_channel *chan)
Check to see if a channel is needing hang up.
int ast_channel_hangupcause(const struct ast_channel *chan)
int64_t ast_channel_get_duration_ms(struct ast_channel *chan)
Obtain how long it's been, in milliseconds, since the channel was created.
struct ast_party_dialed * ast_channel_dialed(struct ast_channel *chan)
int ast_indicate_data(struct ast_channel *chan, int condition, const void *data, size_t datalen)
Indicates condition of channel, with payload.
void ast_channel_update_redirecting(struct ast_channel *chan, const struct ast_party_redirecting *redirecting, const struct ast_set_party_redirecting *update)
Indicate that the redirecting id has changed.
struct timeval * ast_channel_whentohangup(struct ast_channel *chan)
void ast_party_number_free(struct ast_party_number *doomed)
Destroy the party number contents.
void ast_party_connected_line_init(struct ast_party_connected_line *init)
Initialize the given connected line structure.
int ast_channel_sendurl(struct ast_channel *channel, const char *url)
Sends a URL on a given link Send URL on link.
const char * ast_channel_language(const struct ast_channel *chan)
void ast_party_redirecting_free(struct ast_party_redirecting *doomed)
Destroy the redirecting information contents.
void ast_connected_line_copy_from_caller(struct ast_party_connected_line *dest, const struct ast_party_caller *src)
Copy the caller information to the connected line information.
void ast_channel_req_accountcodes_precious(struct ast_channel *chan, const struct ast_channel *requestor, enum ast_channel_requestor_relationship relationship)
Setup new channel accountcodes from the requestor channel after ast_request().
const char * ast_channel_call_forward(const struct ast_channel *chan)
int ast_pre_call(struct ast_channel *chan, const char *sub_args)
Execute a Gosub call on the channel before a call is placed.
int ast_channel_setoption(struct ast_channel *channel, int option, void *data, int datalen, int block)
Sets an option on a channel.
struct ast_party_caller * ast_channel_caller(struct ast_channel *chan)
void ast_party_connected_line_set_init(struct ast_party_connected_line *init, const struct ast_party_connected_line *guide)
Initialize the given connected line structure using the given guide for a set update operation.
void ast_channel_hangupcause_set(struct ast_channel *chan, int value)
void ast_autoservice_chan_hangup_peer(struct ast_channel *chan, struct ast_channel *peer)
Put chan into autoservice while hanging up peer.
void ast_channel_adsicpe_set(struct ast_channel *chan, enum ast_channel_adsicpe value)
int ast_indicate(struct ast_channel *chan, int condition)
Indicates condition of channel.
int ast_safe_sleep(struct ast_channel *chan, int ms)
Wait for a specified amount of time, looking for hangups.
struct ast_channel * ast_request(const char *type, struct ast_format_cap *request_cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *addr, int *cause)
Requests a channel.
const char * ast_channel_exten(const struct ast_channel *chan)
#define ast_channel_unlock(chan)
#define AST_MAX_EXTENSION
void ast_party_redirecting_copy(struct ast_party_redirecting *dest, const struct ast_party_redirecting *src)
Copy the source redirecting information to the destination redirecting.
ast_channel_state
ast_channel states
Standard Command Line Interface.
#define AST_CLI_DEFINE(fn, txt,...)
void ast_cli(int fd, const char *fmt,...)
#define ast_cli_register_multiple(e, len)
Register multiple commands.
Local proxy channel special access.
struct stasis_message_type * ast_local_optimization_end_type(void)
Message type for when a local channel optimization completes.
struct stasis_message_type * ast_local_optimization_begin_type(void)
Message type for when a local channel optimization begins.
struct stasis_message_type * ast_device_state_message_type(void)
Get the Stasis message type for device state messages.
int ast_devstate_changed(enum ast_device_state state, enum ast_devstate_cache cachable, const char *fmt,...)
Tells Asterisk the State for Device is changed.
const char * ast_devstate2str(enum ast_device_state devstate) attribute_pure
Convert device state to text string for output.
struct stasis_topic * ast_device_state_topic_all(void)
Get the Stasis topic for device state messages.
ast_device_state
Device States.
const char * ast_hangup_cause_to_dial_status(int hangup_cause)
Convert a hangup cause to a publishable dial status.
Call Parking and Pickup API Includes code and algorithms from the Zapata library.
int ast_bridge_call_with_flags(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, unsigned int flags)
Bridge a call, and add additional flags to the bridge.
Generic File Format Support. Should be included by clients of the file handling routines....
int ast_stopstream(struct ast_channel *c)
Stops a stream.
int ast_streamfile(struct ast_channel *c, const char *filename, const char *preflang)
Streams a file.
int ast_fileexists(const char *filename, const char *fmt, const char *preflang)
Checks for the existence of a given file.
int ast_waitstream(struct ast_channel *c, const char *breakon)
Waits for a stream to stop or digit to be pressed.
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
void astman_send_listack(struct mansession *s, const struct message *m, char *msg, char *listflag)
Send ack in manager transaction to begin a list.
void astman_send_error(struct mansession *s, const struct message *m, char *error)
Send error in manager transaction.
void astman_send_list_complete_start(struct mansession *s, const struct message *m, const char *event_name, int count)
Start the list complete event.
struct stasis_topic * ast_manager_get_topic(void)
Get the Stasis Message Bus API topic for AMI.
void astman_send_ack(struct mansession *s, const struct message *m, char *msg)
Send ack in manager transaction.
struct ast_str * ast_manager_str_from_json_object(struct ast_json *blob, key_exclusion_cb exclusion_cb)
Convert a JSON object into an AMI compatible string.
const char * astman_get_header(const struct message *m, char *var)
Get header from manager transaction.
void astman_send_list_complete_end(struct mansession *s)
End the list complete event.
void astman_append(struct mansession *s, const char *fmt,...)
static struct stasis_topic * manager_topic
A stasis_topic that all topics AMI cares about will be forwarded to.
int ast_manager_unregister(const char *action)
Unregister a registered manager command.
struct stasis_message_type * ast_channel_masquerade_type(void)
Message type for when a channel is being masqueraded.
struct stasis_topic * ast_channel_topic_all(void)
A topic which publishes the events for all channels.
struct ast_multi_channel_blob * ast_multi_channel_blob_create(struct ast_json *blob)
Create a ast_multi_channel_blob suitable for a stasis_message.
struct ast_channel_snapshot * ast_multi_channel_blob_get_channel(struct ast_multi_channel_blob *obj, const char *role)
Retrieve a channel snapshot associated with a specific role from a ast_multi_channel_blob.
struct stasis_message_type * stasis_subscription_change_type(void)
Gets the message type for subscription change notices.
void ast_channel_publish_cached_blob(struct ast_channel *chan, struct stasis_message_type *type, struct ast_json *blob)
Publish a channel blob message using the latest snapshot from the cache.
struct ast_channel_snapshot * ast_channel_snapshot_get_latest(const char *uniqueid)
Obtain the latest ast_channel_snapshot from the Stasis Message Bus API cache. This is an ao2 object,...
struct stasis_message_type * ast_channel_agent_logoff_type(void)
Message type for agent logoff on a channel.
struct ast_channel_snapshot * ast_channel_snapshot_create(struct ast_channel *chan)
Generate a snapshot of the channel state. This is an ao2 object, so ao2_cleanup() to deallocate.
void ast_channel_publish_dial(struct ast_channel *caller, struct ast_channel *peer, const char *dialstring, const char *dialstatus)
Publish in the ast_channel_topic or ast_channel_topic_all topics a stasis message for the channels in...
void ast_channel_stage_snapshot_done(struct ast_channel *chan)
Clear flag to indicate channel snapshot is being staged, and publish snapshot.
void ast_multi_channel_blob_add_channel(struct ast_multi_channel_blob *obj, const char *role, struct ast_channel_snapshot *snapshot)
Add a ast_channel_snapshot to a ast_multi_channel_blob object.
struct stasis_message_type * ast_channel_hangup_request_type(void)
Message type for when a hangup is requested on a channel.
struct stasis_message_type * ast_channel_agent_login_type(void)
Message type for agent login on a channel.
struct ast_json * ast_multi_channel_blob_get_json(struct ast_multi_channel_blob *obj)
Retrieve the JSON blob from a ast_multi_channel_blob. Returned ast_json is still owned by obj.
void ast_channel_stage_snapshot(struct ast_channel *chan)
Set flag to indicate channel snapshot is being staged.
void ast_channel_publish_dial_forward(struct ast_channel *caller, struct ast_channel *peer, struct ast_channel *forwarded, const char *dialstring, const char *dialstatus, const char *forward)
Publish in the ast_channel_topic or ast_channel_topic_all topics a stasis message for the channels in...
Application convenience functions, designed to give consistent look and feel to Asterisk apps.
#define AST_APP_ARG(name)
Define an application argument.
struct stasis_topic * ast_queue_topic(const char *queuename)
Get the Stasis Message Bus API topic for queue messages for a particular queue name.
#define AST_APP_OPTIONS(holder, options...)
Declares an array of options for an application.
#define AST_APP_OPTION_ARG(option, flagno, argno)
Declares an application option that accepts an argument.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
#define AST_APP_OPTION(option, flagno)
Declares an application option that does not accept an argument.
struct stasis_topic * ast_queue_topic_all(void)
Get the Stasis Message Bus API topic for queue messages.
int ast_app_exec_sub(struct ast_channel *autoservice_chan, struct ast_channel *sub_chan, const char *sub_args, int ignore_hangup)
Run a subroutine on a channel, placing an optional second channel into autoservice.
int ast_app_parse_options(const struct ast_app_option *options, struct ast_flags *flags, char **args, char *optstr)
Parses a string containing application options and sets flags/arguments.
Configuration File Parser.
#define ast_config_load(filename, flags)
Load a config file.
char * ast_category_browse(struct ast_config *config, const char *prev_name)
Browse categories.
struct ast_config * ast_config_new(void)
Create a new base configuration structure.
int ast_realtime_require_field(const char *family,...) attribute_sentinel
Inform realtime what fields that may be stored.
struct ast_config * ast_load_realtime_multientry(const char *family,...) attribute_sentinel
Retrieve realtime configuration.
int ast_unload_realtime(const char *family)
Release any resources cached for a realtime family.
#define CONFIG_STATUS_FILEUNCHANGED
#define CONFIG_STATUS_FILEINVALID
int ast_check_realtime(const char *family)
Check if realtime engine is configured for family.
void ast_config_destroy(struct ast_config *cfg)
Destroys a config.
@ CONFIG_FLAG_FILEUNCHANGED
const char * ast_variable_retrieve(struct ast_config *config, const char *category, const char *variable)
int ast_update_realtime(const char *family, const char *keyfield, const char *lookup,...) attribute_sentinel
Update realtime configuration.
struct ast_variable * ast_load_realtime(const char *family,...) attribute_sentinel
void ast_variables_destroy(struct ast_variable *var)
Free variable list.
struct ast_variable * ast_variable_browse(const struct ast_config *config, const char *category_name)
#define AST_OPTION_TONE_VERIFY
@ AST_CONTROL_REDIRECTING
@ AST_CONTROL_CONNECTED_LINE
@ AST_CONTROL_PVT_CAUSE_CODE
#define ast_debug(level,...)
Log a DEBUG message.
void ast_queue_log(const char *queuename, const char *callid, const char *agent, const char *event, const char *fmt,...)
#define ast_verb(level,...)
void ast_json_unref(struct ast_json *value)
Decrease refcount on value. If refcount reaches zero, value is freed.
struct ast_json_payload * ast_json_payload_create(struct ast_json *json)
Create an ao2 object to pass json blobs as data payloads for stasis.
struct ast_json * ast_json_pack(char const *format,...)
Helper for creating complex JSON values.
const char * ast_json_string_get(const struct ast_json *string)
Get the value of a JSON string.
struct ast_json * ast_json_object_get(struct ast_json *object, const char *key)
Get a field from a JSON object.
intmax_t ast_json_integer_get(const struct ast_json *integer)
Get the value from a JSON integer.
AST_JSON_INT_T ast_json_int_t
Primarily used to cast when packing to an "I" type.
A set of macros to manage forward-linked lists.
#define AST_LIST_HEAD_STATIC(name, type)
Defines a structure to be used to hold a list of specified type, statically initialized.
#define AST_LIST_HEAD_NOLOCK(name, type)
Defines a structure to be used to hold a list of specified type (with no lock).
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
#define AST_LIST_TRAVERSE_SAFE_END
Closes a safe loop traversal block.
#define AST_LIST_INSERT_BEFORE_CURRENT(elm, field)
Inserts a list entry before the current entry during a traversal.
#define AST_LIST_LOCK(head)
Locks a list.
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
#define AST_LIST_UNLOCK(head)
Attempts to unlock a list.
#define AST_LIST_FIRST(head)
Returns the first entry contained in a list.
#define AST_LIST_NEXT(elm, field)
Returns the next entry in the list after the given entry.
Asterisk locking-related definitions:
#define SCOPED_AO2LOCK(varname, obj)
scoped lock specialization for ao2 mutexes.
int ast_atomic_fetchadd_int(volatile int *p, int v)
Atomically add v to *p and return the previous value of *p.
The AMI - Asterisk Manager Interface - is a TCP protocol created to manage Asterisk with third-party ...
struct ast_str * ast_manager_build_channel_state_string(const struct ast_channel_snapshot *snapshot)
Generate the AMI message body from a channel snapshot.
#define ast_manager_register_xml(action, authority, func)
Register a manager callback using XML documentation to describe the manager.
struct ast_manager_event_blob * ast_manager_event_blob_create(int event_flags, const char *manager_event, const char *extra_fields_fmt,...)
Construct a ast_manager_event_blob.
struct ast_str * ast_manager_build_channel_state_string_prefix(const struct ast_channel_snapshot *snapshot, const char *prefix)
Generate the AMI message body from a channel snapshot.
int ast_max_forwards_decrement(struct ast_channel *chan)
Decrement the max forwards count for a particular channel.
int ast_max_forwards_get(struct ast_channel *chan)
Get the current max forwards for a particular channel.
loadable MixMonitor functionality
int ast_start_mixmonitor(struct ast_channel *chan, const char *filename, const char *options)
Start a mixmonitor on a channel with the given parameters.
Asterisk module definitions.
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
@ AST_MODPRI_DEVSTATE_CONSUMER
@ AST_MODULE_SUPPORT_CORE
#define ASTERISK_GPL_KEY
The text the key() function should return.
int ast_unregister_application(const char *app)
Unregister an application.
@ AST_MODULE_LOAD_SUCCESS
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
int ast_moh_start(struct ast_channel *chan, const char *mclass, const char *interpclass)
Turn on music on hold on a given channel.
void ast_moh_stop(struct ast_channel *chan)
Turn off music on hold on a given channel.
Core PBX routines and definitions.
const struct ast_include * ast_walk_context_includes(const struct ast_context *con, const struct ast_include *inc)
struct ast_context * ast_context_find(const char *name)
Find a context.
const char * pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name)
Return a pointer to the value of the corresponding channel variable.
int ast_exists_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Determine whether an extension exists.
int pbx_exec(struct ast_channel *c, struct ast_app *app, const char *data)
Execute an application.
int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value)
Add a variable to the channel variable stack, removing the most recently set value for the same name.
const char * ast_get_include_name(const struct ast_include *include)
int pbx_builtin_setvar_multiple(struct ast_channel *chan, const char *data)
Parse and set multiple channel variables, where the pairs are separated by the ',' character,...
@ AST_EXTENSION_NOT_INUSE
@ AST_EXTENSION_UNAVAILABLE
@ AST_EXTENSION_DEACTIVATED
const char * ast_get_context_name(struct ast_context *con)
#define ast_custom_function_register(acf)
Register a custom function.
int ast_goto_if_exists(struct ast_channel *chan, const char *context, const char *exten, int priority)
int ast_canmatch_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Looks for a valid matching extension.
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.
int ast_extension_state_del(int id, ast_state_cb_type change_cb)
Deletes a state change watcher by ID.
int ast_extension_state_add(const char *context, const char *exten, ast_state_cb_type change_cb, void *data)
Add watcher for extension states.
struct ast_app * pbx_findapp(const char *app)
Look up an application.
int ast_extension_state(struct ast_channel *c, const char *context, const char *exten)
Uses hint and devicestate callback to get the state of an extension.
void pbx_substitute_variables_helper(struct ast_channel *c, const char *cp1, char *cp2, int count)
static struct stasis_subscription * sub
Statsd channel stats. Exmaple of how to subscribe to Stasis events.
static void to_ami(struct ast_sip_subscription *sub, struct ast_str **buf)
Say numbers and dates (maybe words one day too)
int ast_say_number(struct ast_channel *chan, int num, const char *ints, const char *lang, const char *options)
says a number
#define STASIS_MESSAGE_TYPE_CLEANUP(name)
Boiler-plate messaging macro for cleaning up message types.
@ STASIS_SUBSCRIPTION_FILTER_SELECTIVE
struct stasis_forward * stasis_forward_cancel(struct stasis_forward *forward)
int stasis_subscription_accept_message_type(struct stasis_subscription *subscription, const struct stasis_message_type *type)
Indicate to a subscription that we are interested in a message type.
#define STASIS_MESSAGE_TYPE_DEFN_LOCAL(name,...)
Boiler-plate messaging macro for defining local message types.
int stasis_subscription_set_filter(struct stasis_subscription *subscription, enum stasis_subscription_message_filter filter)
Set the message type filtering level on a subscription.
#define STASIS_MESSAGE_TYPE_INIT(name)
Boiler-plate messaging macro for initializing message types.
void * stasis_message_data(const struct stasis_message *msg)
Get the data contained in a message.
int stasis_subscription_final_message(struct stasis_subscription *sub, struct stasis_message *msg)
Determine whether a message is the final message to be received on a subscription.
struct stasis_subscription * stasis_unsubscribe_and_join(struct stasis_subscription *subscription)
Cancel a subscription, blocking until the last message is processed.
struct stasis_message * stasis_message_create(struct stasis_message_type *type, void *data)
Create a new message.
struct stasis_forward * stasis_forward_all(struct stasis_topic *from_topic, struct stasis_topic *to_topic)
Create a subscription which forwards all messages from one topic to another.
void stasis_publish(struct stasis_topic *topic, struct stasis_message *message)
Publish a message to a topic's subscribers.
#define stasis_subscribe(topic, callback, data)
struct stasis_message_type * ast_channel_entered_bridge_type(void)
Message type for ast_channel enter bridge blob messages.
struct stasis_message_type * ast_blind_transfer_type(void)
Message type for ast_blind_transfer_message.
struct stasis_message_type * ast_attended_transfer_type(void)
Message type for ast_attended_transfer_message.
struct stasis_topic * ast_bridge_topic_all(void)
A topic which publishes the events for all bridges.
@ AST_ATTENDED_TRANSFER_DEST_FAIL
@ AST_ATTENDED_TRANSFER_DEST_BRIDGE_MERGE
@ AST_ATTENDED_TRANSFER_DEST_LOCAL_APP
@ AST_ATTENDED_TRANSFER_DEST_LINK
@ AST_ATTENDED_TRANSFER_DEST_APP
@ AST_ATTENDED_TRANSFER_DEST_THREEWAY
#define stasis_message_router_create(topic)
Create a new message router object.
void stasis_message_router_unsubscribe(struct stasis_message_router *router)
Unsubscribe the router from the upstream topic.
int stasis_message_router_add(struct stasis_message_router *router, struct stasis_message_type *message_type, stasis_subscription_cb callback, void *data)
Add a route to a message router.
void stasis_message_router_unsubscribe_and_join(struct stasis_message_router *router)
Unsubscribe the router from the upstream topic, blocking until the final message has been processed.
#define stasis_message_router_create_pool(topic)
Create a new message router object.
#define AST_DECLARE_STRING_FIELDS(field_list)
Declare the fields needed in a structure.
#define AST_STRING_FIELD(name)
Declare a string field.
#define ast_string_field_set(x, field, data)
Set a field to a simple string value.
#define ast_string_field_init(x, size)
Initialize a field pool and fields.
#define ast_string_field_free_memory(x)
free all memory - to be called before destroying the object
String manipulation functions.
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
int ast_strings_equal(const char *str1, const char *str2)
Compare strings for equality checking for NULL.
size_t attribute_pure ast_str_strlen(const struct ast_str *buf)
Returns the current length of the string stored within buf.
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one.
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true"....
#define S_COR(a, b, c)
returns the equivalent of logic or for strings, with an additional boolean check: second one if not e...
static force_inline int attribute_pure ast_strlen_zero(const char *s)
int attribute_pure ast_false(const char *val)
Make sure something is false. Determine if a string containing a boolean value is "false"....
#define ast_str_alloca(init_len)
#define ast_str_create(init_len)
Create a malloc'ed dynamic length string.
int ast_str_set(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Set a dynamic string using variable arguments.
static force_inline int attribute_pure ast_str_case_hash(const char *str)
Compute a hash value on a case-insensitive string.
char *attribute_pure ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
char * ast_strip(char *s)
Strip leading/trailing whitespace from a string.
char * ast_strsep(char **s, const char sep, uint32_t flags)
Act like strsep but ignore separators inside quotes.
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
ast_app: A registered application
Message representing attended transfer.
enum ast_attended_transfer_dest_type dest_type
struct ast_channel_snapshot * links[2]
struct ast_bridge_channel_snapshot_pair to_transfer_target
enum ast_transfer_result result
union ast_attended_transfer_message::@305 dest
struct ast_bridge_channel_snapshot_pair to_transferee
char bridge[AST_UUID_STR_LEN]
Message published during a blind transfer.
char exten[AST_MAX_EXTENSION]
struct ast_bridge_snapshot * bridge
enum ast_transfer_result result
char context[AST_MAX_CONTEXT]
Blob of data associated with a bridge.
struct ast_bridge_snapshot * bridge
struct ast_channel_snapshot * channel
struct ast_bridge_snapshot * bridge_snapshot
void * end_bridge_callback_data
struct ast_flags features_callee
struct ast_flags features_caller
void(* end_bridge_callback)(void *)
void(* end_bridge_callback_data_fixup)(struct ast_bridge_config *bconfig, struct ast_channel *originator, struct ast_channel *terminator)
const ast_string_field uniqueid
Blob of data associated with a channel.
struct ast_channel_snapshot * snapshot
const ast_string_field uniqueid
const ast_string_field name
Structure representing a snapshot of channel state.
struct ast_channel_snapshot_base * base
struct ast_channel_snapshot_caller * caller
Structure to describe a channel "technology", ie a channel driver See for examples:
Main Channel structure associated with a channel.
const struct ast_channel_tech * tech
char context[AST_MAX_CONTEXT]
descriptor for a cli entry.
ast_context: An extension context
Data structure associated with a custom dialplan function.
struct ast_db_entry * next
The structure that contains device state.
enum ast_device_state state
const struct ast_eid * eid
The EID of the server where this message originated.
Structure used to handle boolean flags.
Data structure associated with a single frame of data.
struct ast_frame_subclass subclass
enum ast_frame_type frametype
union ast_frame::@239 data
ast_include: include= support in extensions.conf
Abstract JSON element (object, array, string, int, ...).
Struct containing info for an AMI event to send out.
A multi channel blob data structure for multi_channel_blob stasis messages.
Caller Party information.
struct ast_party_id id
Caller party ID.
struct ast_party_id ani
Automatic Number Identification (ANI)
Connected Line/Party information.
int source
Information about the source of an update.
struct ast_party_id id
Connected party ID.
struct ast_party_id ani
Automatic Number Identification (ANI)
char * str
Subscriber phone number (Malloced)
struct ast_party_dialed::@221 number
Dialed/Called number.
int transit_network_select
Transit Network Select.
struct ast_party_name name
Subscriber name.
struct ast_party_number number
Subscriber phone number.
unsigned char valid
TRUE if the name information is valid/present.
char * str
Subscriber name (Malloced)
unsigned char valid
TRUE if the number information is valid/present.
char * str
Subscriber phone number (Malloced)
Redirecting Line information. RDNIS (Redirecting Directory Number Information Service) Where a call d...
struct ast_party_id from
Who is redirecting the call (Sent to the party the call is redirected toward)
Support for dynamic strings.
Structure for variables, used for configurations and for channel variables.
struct ast_variable * next
unsigned int autopauseunavail
const ast_string_field sound_thereare
unsigned int setinterfacevar
struct ast_str * sound_periodicannounce[MAX_PERIODIC_ANNOUNCEMENTS]
const ast_string_field sound_callerannounce
const ast_string_field sound_reporthold
unsigned int announceholdtime
const ast_string_field sound_holdtime
unsigned int reportholdtime
unsigned int setqueueentryvar
const ast_string_field sound_seconds
unsigned int timeoutrestart
struct ao2_container * members
int periodicannouncefrequency
const ast_string_field sound_thanks
unsigned int announceposition_only_up
int announcepositionlimit
unsigned int announce_to_first_user
int randomperiodicannounce
int periodicannouncestartdelay
const ast_string_field defaultrule
int log_restricted_caller_id
const ast_string_field queue_quantity2
const ast_string_field moh
struct call_queue::@54 list
enum empty_conditions leavewhenempty
const ast_string_field context
const ast_string_field sound_calls
const ast_string_field sound_minute
const ast_string_field sound_minutes
unsigned int announceposition
const ast_string_field queue_quantity1
const ast_string_field membergosub
enum empty_conditions joinempty
struct call_queue::@55 rules
const ast_string_field name
const ast_string_field sound_next
unsigned int autopausebusy
const ast_string_field announce
unsigned int relativeperiodicannounce
We define a custom "local user" structure because we use it not only for keeping track of what is in ...
unsigned int dial_callerid_absent
unsigned int block_connected_update
struct ast_aoc_decoded * aoc_s_rate_list
struct ast_party_connected_line connected
struct callattempt * call_next
struct ast_channel * chan
struct callattempt * q_next
unsigned int pending_connected_update
structure to hold extensions
Structure representing relevant data during a local channel optimization.
const char * source_chan_uniqueid
In case you didn't read that giant block of text above the mansession_session struct,...
Channel datastore data for max forwards.
char interface[AST_CHANNEL_NAME]
char state_exten[AST_MAX_EXTENSION]
char state_context[AST_MAX_CONTEXT]
struct call_queue * lastqueue
char state_interface[AST_CHANNEL_NAME]
struct penalty_rule::@53 list
struct ast_channel * chan
struct timeval start_time
char digits[AST_MAX_EXTENSION]
time_t last_periodic_announce_time
struct queue_ent::@52 qe_rules
struct ast_channel * chan
int cancel_answered_elsewhere
char context[AST_MAX_CONTEXT]
int last_periodic_announce_sound
const char * predial_callee
struct call_queue * parent
User data for stasis subscriptions used for queue calls.
const ast_string_field caller_uniqueid
const ast_string_field member_uniqueid
struct local_optimization member_optimize
struct stasis_message_router * channel_router
struct call_queue * queue
const ast_string_field bridge_uniqueid
struct stasis_message_router * bridge_router
struct local_optimization caller_optimize
struct rule_list::@57 list
struct rule_list::@56 rules
An API for managing task processing threads that can be shared across modules.
Handy terminal functions for vt* terms.
const char * ast_term_reset(void)
Returns the terminal reset code.
const char * ast_term_color(int fgcolor, int bgcolor)
Return a color sequence string.
int ast_remaining_ms(struct timeval start, int max_ms)
Calculate remaining milliseconds given a starting timestamp and upper bound.
int64_t ast_tvdiff_ms(struct timeval end, struct timeval start)
Computes the difference (in milliseconds) between two struct timeval instances.
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
Support for translation of data formats. translate.c.
#define ast_test_flag(p, flag)
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
long int ast_random(void)
#define ast_set_flag(p, flag)
void ast_replace_subargument_delimiter(char *s)
Replace '^' in a string with ','.