summaryrefslogtreecommitdiff
path: root/apps/app_queue.c
AgeCommit message (Collapse)Author
2017-12-12app_queue: Fix extension state subscriptions removed on dialplan reloadIvan Poddubny
The approach with having a single global subscription to all extension state changes has one issue: dynamically created hints don't have any watchers and are therefore garbage collected on the first dialplan reload. This change creates a state subscription for every queue member with a hint as state_interface, thus increasing the count of watches for hints, so they are not destroyed prematurely anymore. There are 2 side effects: 1. The state change callback in app_queue is not executed when there are no members referring to the extension. 2. The callback is called multiple times for the same hint if it's associated with more than one queue member. Reported by: Steven T. Wheeler ASTERISK-18411 #close Change-Id: I4956af2136ea2a7f110ac9272eae5f6e676d8f89
2017-10-06app_queue.c: clear moh field in init_queueNathan Bruning
ASTERISK-27301 #close Change-Id: Ic31361f34e2de3b6470e68fc37205a7711082eba
2017-09-28app_queue.c: Fix announcements when announce-to-first-user not enabled.Richard Mudgett
The previous patch for ASTERISK-27216 made it so you wouldn't get any position or periodic announcements unless you had announce-to-first-user enabled. The announce-to-first-user feature was added by ASTERISK_21782 as a result of the patch which introduced the redundant announcements that ASTERISK-27216 removes. * By noting that the makeannouncement variable is used to suppresses the first user announcement, we set its initial value to the announce-to-first-user enable setting. ASTERISK-27216 Change-Id: Ieaeb7dbea8ae7073086b775fbafe0625b000b10a
2017-09-25app_queue: Only do announcement logic between ringing cyclesStefanEng86
This patch reverts the change by patch 2263 from old reviewboard. Note that reverting that 2263-patch still preserves the behaviour that the commit log of the 2263-patch claimed to add. The reason for this is: The function wait_for_answer is only called from try_calling which in turn is only called from the main for loop in queue_exec, and earlier in that loop we already check the things that's removed by this patch. There's no need to check those things twice each loop iteration, and I think the proper place to check it is before each ringing cycle. By checking it in wait_for_answer, you allow the issue explained in the jira - that the head caller hears announcements while the agents' sip phones are actively ringing. Reported-by: Stefan Engström Tested-by: Stefan Engström ASTERISK-27216 #close Change-Id: Ic4290dc75256f9743900c6762ee1bb915f672db0
2017-08-24app_queue: Evaluate realtime queues when running dialplan functionsSean Bright
ASTERISK-19103 #close Reported by: Jim Van Meggelen Change-Id: I4bd32a9d1fcebb8ac56bff0e084d4f53e31b692b
2017-08-22app_queue: Fix initial hold time queue statisticSungtae Kim
Fixed to use correct initial value and fixed to use the correct queue info to check the first value. ASTERISK-27204 Change-Id: Ia9e36c828e566e1cc25c66f73307566e4acb8e73
2017-08-01Fix compiler warnings on Fedora 26 / GCC 7.Corey Farrell
GCC 7 has added capability to produce warnings, this fixes most of those warnings. The specific warnings are disabled in a few places: * app_voicemail.c: truncation of paths more than 4096 chars in many places. * chan_mgcp.c: callid truncated to 80 chars. * cdr.c: two userfields are combined to cdr copy, fix would break ABI. * tcptls.c: ignore use of deprecated method SSLv3_client_method(). ASTERISK-27156 #close Change-Id: I65f280e7d3cfad279d16f41823a4d6fddcbc4c88
2017-08-01app_queue: Add announce-position-only-up optionSean Bright
Setting this option will cause the Queue application to only announce the caller's position if it has improved since the last time that we announced it. Change-Id: I173a124121422209485b043e2bf784f54242fce6
2017-07-18Merge "app_queue: Add change priority of call"George Joseph
2017-07-12Merge "manager: Remove AMI "Queues" action."Joshua Colp
2017-07-11manager: Remove AMI "Queues" action.Benjamin Keith Ford
When performing the "Queues" action via AMI, it outputs the same text that the Asterisk CLI outputs when running a "queue show" command, which does not conform with the AMI spec. "QueueStatus" already does what the "Queues" action should do, so instead of correcting the output, the "Queues" action will be removed and "QueueStatus" should be used instead. ASTERISK-27073 #close Reported by: Brian Change-Id: Id11743859758255b69cc3a557750d7a56c6d16f8
2017-07-10Merge "app_queue: Add priority to AMI QueueStatus"George Joseph
2017-07-05core: Remove 'Data Retrieval API'Sean Bright
This API was not actively maintained, was not added to new modules (such as res_pjsip), and there exist better alternatives to acquire the same information, such as the ARI. Change-Id: I4b2185a83aeb74798b4ad43ff8f89f971096aa83
2017-07-04app_queue: Add change priority of callRodrigo Ramírez Norambuena
This patch include a feature to change the priority a caller in a queue by CLI and AMI. Change-Id: I55d520d71cc1cefe9a9b81fefaefc14679e96133
2017-06-29app_queue: Add priority to AMI QueueStatusNiklas Larsson
Add priority to callers in AMI QueueStatus response ASTERISK-27092 #close Change-Id: I8d1f737a72c7c38f4cfe1a4ee3ecc0a4f85bd199
2017-06-27app_queue: Fix returning to dialplan when a queue is emptyIvan Poddubny
The fix for ASTERISK-25665 introduced a regression. The return value of queue_exec used to be 0 in case of leavewhenempty but it was changed to -1 (returned from wait_our_turn and passed transparently by queue_exec), thus leading to hangup instead of returning back to dialplan. This commit resets the value back to 0 in this case, restoring original behavior. ASTERISK-27065 #close Reported by: Marek Cervenka Change-Id: Id9c83b75aeda463250155e88c5004be52bbca5ac
2017-05-24Merge "app_queue: Add QUEUE_RAISE_PENALTY feature"Joshua Colp
2017-05-23app_queue: Fix members showing as being in call when not.Joshua Colp
A change was done which added an 'in_call' flag to queue members that was set to true while talking to an agent. Unfortunately in practice this does not accurately reflect whether they are talking to an agent or not. If a Local channel is involved and a transfer is performed then the app_queue application would incorrectly think the agent was still in a call with the caller. This was done to fix a race condition between an agent becoming available by device state and the checking of the last call information for the wrapup time. There was a small window where the last call information would be the previous value instead of the new one. This change goes about fixing the original issue in a different way by considering the call completed if device state is received which would make the agent available and if they are currently in a call. If this occurs the last call information is updated before the agent becomes available ensuring that old information is not present when checking if the member should be called. This also improves the transfer situation by actually updating and enforcing the wrapup time. ASTERISK-26399 ASTERISK-26400 ASTERISK-26715 ASTERISK-26975 Change-Id: Ife1cb686e3173b3a6d368601adef9aff69d4beea
2017-05-22app_queue: Add QUEUE_RAISE_PENALTY featureSteve Davies
Additional variable to work alongside QUEUE_MAX_PENALTY and QUEUE_MIN_PENALTY, including an extra parameter in queuerules.conf. This value causes lower Agent penalty values to "raise up" so that they can join higher penalty agents and be treated equally after a period of time. ASTERISK-26995 #close Change-Id: If1c6421a983667a5ac4c359f6dac25b212b4c459
2017-05-11app_queue: Fix duplicate queue_log entries for EXITEMPTY and ABANDONIvan Poddubny
There are 2 places in app_queue.c that log EXITEMPTY event: one in wait_our_turn, and another one in queue_exec in the loop trying to call an agent after wait_our_turn. In most cases it leads to logging EXITEMPTY twice. ABANDON is also logged on two places, and in the rare case when an agent and caller hang up simultaneously it's also possible to get duplicates in queue_log. This commit changes wait_our_turn to return -1 ("the caller should exit the queue") instead of 0 ("the caller's turn has arrived") in case of leaving when empty, so queue_exec skips the agent calling loop. Also, leave_queue is now executed only once in this case, because 2nd time is just a noop when the queue entry has already been removed. Also, it sets qe->handled to -1 to indicate that the call was not answered by an agent, but the necessary handling has already been done in order to avoid logging an extra ABANDON entry. ASTERISK-25665 #close Reported by: Ove Aursand Change-Id: I4578dd383bf2ac41589cf167865e8aaebcd4c11e
2017-04-12modules: change module LOAD_FAILUREs to LOAD_DECLINESGeorge Joseph
In all non-pbx modules, AST_MODULE_LOAD_FAILURE has been changed to AST_MODULE_LOAD_DECLINE. This prevents asterisk from exiting if a module can't be loaded. If the user wishes to retain the FAILURE behavior for a specific module, they can use the "require" or "preload-require" keyword in modules.conf. A new API was added to logger: ast_is_logger_initialized(). This allows asterisk.c/check_init() to print to the error log once the logger subsystem is ready instead of just to stdout. If something does fail before the logger is initialized, we now print to stderr instead of stdout. Change-Id: I5f4b50623d9b5a6cb7c5624a8c5c1274c13b2b25
2017-04-05app_queue: Log reason for PAUSEALL/UNPAUSEALLTroy Bowman
We needed the reason for our reporting when agents pause/unpause all of their queues at once. This is a small, simple patch that adds a reason for PAUSEALL and UNPAUSEALL. I have been using it in production for years. ASTERISK-26920 #close Change-Id: Ifb3f0d1a0abd5194253d9794023546e1395baf3d
2017-03-29Merge "channel: Remove old epoll support and fixed max number of file ↵zuul
descriptors."
2017-03-27channel: Remove old epoll support and fixed max number of file descriptors.Joshua Colp
This change removes the old epoll support which has not been used or maintained in quite some time. The fixed number of file descriptors on a channel has also been removed. File descriptors are now contained in a growable vector. This can be used like before by specifying a specific position to store a file descriptor at or using a new API call, ast_channel_fd_add, which adds a file descriptor to the channel and returns its position. Tests have been added which cover the growing behavior of the vector and the new API call. ASTERISK-26885 Change-Id: I1a754b506c009b83dfdeeb08c2d2815db30ef928
2017-03-22Merge "Revert "app_queue: Handle the caller being redirected out of a queue ↵zuul
bridge""
2017-03-22Merge "app_queue: Member stuck as pending after forwarding previous call ↵zuul
from queue"
2017-03-21Revert "app_queue: Handle the caller being redirected out of a queue bridge"Sean Bright
This reverts commit 163e9e53dc7d84dd42721e733b7706c8147bdd27. Change-Id: Ief28479c77a298879dfe2c56be7ee92dc465da4b
2017-03-17app_queue: Member stuck as pending after forwarding previous call from queueRobert Mordec
Queue member will get stuck in pending_members if queue calls a device that is different from the one observed for state changes. This patch removes members from pending_members as a result of channel stasis events such as blind or attended transfers and hangup. ASTERISK-26862 #close Change-Id: I8bf6df487b9bb35726c08049ff25cdad5e357727
2017-03-17app_queue: Fix locking behavior in stasis message handlersSean Bright
The queue_stasis_data structure contains various mutable fields that require appropriate locking. Specifically, the 'dying,' 'member_uniqueid,' and 'caller_uniqueid' fields need to be locked when read from or written to. Change-Id: I246b7dbff8447acc957a1299f6ad0ebd0fd39088
2017-03-15app_queue: Handle the caller being redirected out of a queue bridgeSean Bright
A caller can leave the Queue() application after being bridged with a member in a few ways: * Caller or member hangup * Caller is transferred somewhere else (blind or atx) * Caller is externally redirected elsewhere The first 2 scenarios are currently handled by subscribing to stasis messages, but the 3rd is not explicitly covered. If a caller is redirected away from the Queue() application, the member who was last bridged with that caller will remain in an "In use" state until the caller hangs up. This patch adds handling of the caller leaving the queue via redirection. We monitor the caller-member bridge, and if the caller is the one that leaves, we treat it the same as we would a caller hangup. ASTERISK-26400 #close Reported by: Etienne Lessard Change-Id: Iba160907770de5a6c9efeffc9df5a13e9ea75334
2017-02-21realtime: Fix ast_load_realtime_multientry handlingSean Bright
ast_load_realtime_multientry() returns an ast_config structure whose ast_categorys are keyed with the empty strings. Several modules were giving semantic meaning to the category names causing problems at runtime. * app_directory: Treated the category name as the mailbox name, and would fail to direct calls to the appropriate extension after an entry was chosen. * app_queue: Queues, queue members, and queue rules were all affected and needed to be updated. * pbx_realtime: Pattern matching would never succeed because the extension entered by the user was always compared to the empty string. Change-Id: Ie7e44986344b0b76ea8f6ddb5879f5040c6ca8a7
2017-02-13app_queue: reset abandoned in sl for sl2 calculationsSebastian Gutierrez
ASTERISK-26775 #close Change-Id: I86de4b1a699d6edc77fea9b70d839440e4088284
2017-01-26app_queue: Fix queues randomly disappearing on reloadkkm
With 500+ queues and a reload every minute, a random queue disappears upon reload. The cause is mususe of the 'dead' flag. Namely, all queues were marked dead up front, and then "resurrected" by dropping this flag for those found in the configuration. But a queue marked dead can be removed also when control leaves the app entry point on a PBX thread. With this change, the queue is marked only not found, and at the end of reload only the queues that are still not found are actually marked as dead, so the dead flag is never reset, and set only on positively dead queues. ASTERISK-26755 Change-Id: I3a4537aec9eb8d8aeeaa0193407e3523feb004bf
2017-01-25Merge "app_queue: add RINGCANCELED log event on caller hang up"zuul
2017-01-20app_queue: add RINGCANCELED log event on caller hang upMartin Tomec
QueueLog did not log ringnoanswer when the caller abandoned call before first timeout. It was impossible to get agent membername and ringing duration for this short calls. After some discusions it seems that the best way is to add new event RINGCANCELED, which is generated after caller hangup during ringing. ASTERISK-26665 Change-Id: Ic70f7b0f32fc95c9378e5bcf63865519014805d3
2017-01-17Merge "app_queue: Add QueueUpdate application."Joshua Colp
2017-01-17app_queue: Add QueueUpdate application.Sebastian Gutierrez
Add an application that allows tracking outbound calls using app_queue. ASTERISK-19862 Change-Id: Ia0ab64aed934c25b2a25022adcc7c0624224346e
2017-01-04app_queue: add new Service Level calculationSebastian Gutierrez
Adds a new formula for SL2 and documentation ASTERISK-26559 Change-Id: I0970c620460507cd9d45b0d43600779c8915e770
2016-12-19app_queue: Ensure member is removed from pending when hanging up.Martin Tomec
In some cases member is added to pending_members, and the channel is hung up before any extension state change. So the member would stay in pending_members forever. So when we call do_hang, we should also remove member from pending. ASTERISK-26621 #close Change-Id: Iae476b5c06481db18ebe0fa594b3e80fdc9a7d54
2016-11-09app_queue: new variable set when abandonedSebastian Gutierrez
sets the variable ABANDONED to TRUE if the call was not answered. ASTERISK-26558 Change-Id: I4729af9bff4eba436d8a776afd3374065d0036d3
2016-10-27Remove ASTERISK_REGISTER_FILE.Corey Farrell
ASTERISK_REGISTER_FILE no longer has any purpose so this commit removes all traces of it. Previously exported symbols removed: * __ast_register_file * __ast_unregister_file * ast_complete_source_filename This also removes the mtx_prof static variable that was declared when MTX_PROFILE was enabled. This variable was only used in lock.c so it is now initialized in that file only. ASTERISK-26480 #close Change-Id: I1074af07d71f9e159c48ef36631aa432c86f9966
2016-10-17app_queue: Added initialization for "context" parameterLeandro Dardini
When using Asterisk Realtime Architecture, empty fields are skipped and the default values are used. If the "context" parameter in queue was set and then cleared from the database, the old value remains in memory and it continues to be used. This change initialize the "context" parameter with an empty value, allowing clearing the parameter. ASTERISK-26462 #close Change-Id: I64be73d5044ce38dd02408bd0e53de965ef65905
2016-10-14Merge "Audit ast_json_pack() calls for needed UTF-8 checks."zuul
2016-10-13Audit ast_json_pack() calls for needed UTF-8 checks.Richard Mudgett
Added needed UTF-8 checks before constructing json objects in various files for strings obtained outside the system. In this case string values from a channel driver's peer and not from the user setting channel variables. * aoc.c: Fixed type mismatch in s_to_json() for time and granularity json object construction. ASTERISK-26466 Reported by: Richard Mudgett Change-Id: Iac2d867fa598daba5c5dbc619b5464625a7f2096
2016-10-13app_queue.c: Fix clearing of pause reason string.Richard Mudgett
The pause reason is not always cleared when it should be cleared. * Made set_queue_member_pause() always clear pause reason if not pausing with a reason string. Change-Id: I993dad19626ec017478a230e980989438b778c53
2016-09-30app_queue: Update dynamic members ringinuse on reload.Etienne Lessard
Previously, when reloading the members of a queue, the members added statically (i.e. defined in queues.conf) would see their "ringinuse" value updated but not the members added dynamically. This change makes dynamic members ringuse value to be updated on reload. Note that it's impossible to add a dynamic member with a specific ringinuse value. For both static and dynamic members, the ringinuse value can always be changed later on with command like "queue set ringinuse" or with the AMI action "QueueMemberRingInUse". So it's possible this commit could break a user workflow if he was changing the ringinuse value of dynamic members via such commands and was also relying on the fact that a queue reload would not update the dynamic members ringinuse value. ASTERISK-26330 Change-Id: I3745cc9a06ba7e02c399636f1ee9e58c04081f3f
2016-09-12app_queue: Fix CLI "queue show" and AMI Queues action output truncation.Richard Mudgett
The output of CLI "queue show" and AMI Queues action is truncated and "failed to extend from 240 to 327" messages are generated if the queue member and interface names are lengthy. * Increase the string buffer size from 240 to 512 in order to accommodate for more information fields added to the output since v1.8. ASTERISK-26360 #close Reported by: Richard Mudgett Change-Id: Id99c03cf5362453b80491a4b3b0434cb67aa966d
2016-08-27app_queue: Ensure member is removed from pending when hanging up.Joshua Colp
When dialing channels it is possible that they may not ever leave the not in use state (Local channels in particular) by the time we cancel them. If this occurs but we know they were dialed we explicitly remove them from the pending members container so that subsequent call attempts occur. ASTERISK-26299 #close Change-Id: I6ad0d17c36480c92cebf840626228ce3f7e4bd65
2016-08-11app_queue: Prevent crash when a call is forwarded to an invalid locationMatt Jordan
When a call forward attempt is made from a Queue member, the current code will hang up the forwarding channel in an off-nominal condition prior to raising the Stasis events informing the rest of Asterisk that the call was forwarded. This will result in a slew of dreaded FRACKs, most likely leading to a crash. This patch modifies the code such that we don't hang up the forwarding channel even in an off-nominal condition until we've safely raised the Stasis messages. ASTERISK-25797 #close Change-Id: Ife5abed351691fd79105321636eaa8ea8dcdba38
2016-07-14app_queue: Only remove queue member from pending when state changes.Joshua Colp
It is possible for a not in use state change to occur multiple times causing a queue member to be removed from the pending call container prematurely. The first not in use state change will remove the queue member from the container. At this moment the member may be called and placed in the pending container. After this another not in use state change can be received which will remove it from the container. Despite being called at this point the code will incorrectly see that there are no pending calls to it. This change only removes it from the pending container if the state has actually changed. ASTERISK-26133 #close patches: app_queue.diff submitted by Richard Miller (license 5685) Change-Id: Ie5a7f17a44f98e9159e9b85009ce3f8393aa78c0