summaryrefslogtreecommitdiff
path: root/apps/app_queue.c
AgeCommit message (Collapse)Author
2017-12-22Remove as much trailing whitespace as possible.Sean Bright
Change-Id: I873c1c6d00f447269bd841494459efccdd2c19c0
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-11app_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-21app_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-01app_queue: Add priority to AMI QueueStatusNiklas Larsson
Add priority to callers in AMI QueueStatus response ASTERISK-27092 #close Change-Id: I8d1f737a72c7c38f4cfe1a4ee3ecc0a4f85bd199
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-06-29app_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: Fix members showing as being in call when not." into 13Jenkins2
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-17app_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-03-22Merge "Revert "app_queue: Handle the caller being redirected out of a queue ↵zuul
bridge"" into 13
2017-03-22Merge "app_queue: Member stuck as pending after forwarding previous call ↵Joshua Colp
from queue" into 13
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-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
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-08app_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-17Merge "app_queue: Added initialization for "context" parameter" into 13zuul
2016-10-14app_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." into 13zuul
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-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-25app_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
2016-05-31core/dial: New channel variable FORWARDERNAMEAlexei Gradinari
Added a new channel variable FORWARDERNAME which indicates which channel was responsible for a forwarding requests received on dial attempt. Fixed a bug in the app_queue: FORWARD_CONTEXT is not used. ASTERISK-26059 #close Change-Id: I34e93e8c1b5e17776a77b319703c48c8ca48e7b2
2016-04-26app_queue: Fix crash when unloading module.Joshua Colp
When unloading the app_queue module the members in each queue are destroyed and as part of this they are removed from the pending members container. Unfortunately a crash would occur as the container was destroyed before the members were removed. This change tweaks ordering so the container destruction occurs after the members are destroyed. ASTERISK-16115 Change-Id: I48c728668c55aee3d05b751a5d450fb57e87f44b
2016-04-25Merge "app_queue: queue members can receive multiple calls" into 13Joshua Colp
2016-04-25app_queue: queue members can receive multiple callsKevin Harwell
It was possible for a queue member that is a member of at least 2 or more queues to receive mulitiple calls at the same time. This happened because of a race between when a member was being rung and when the device state notified the other queue(s) member object of the state change. This patch makes it so when a queue member is being rung it gets added to a global pool of queue members. If that same member is tried again, e.g. from another queue, and it is found to already exist in the pending member container then it will not ring that member. ASTERISK-16115 #close Change-Id: I546dd474776d158c2b6be44205353dee5bac7e48
2016-04-25Fix case sensitive actions in AMI QueueSummary and QueueStatusDarkS
ASTERISK-25954 #close Reported by: Javier Acosta Change-Id: I00be83d45cc7e8385de2523012bd196aafeeb256
2016-04-18app_queue: Frequent segfaults in function can_ring_entry()ibercom
ASTERISK-25888 #close Change-Id: I007a2f2dd99823e04fb5be3ff01f02b0a2956117
2016-02-17app_queue: fix Calculate talktime when is first call answeredRodrigo Ramírez Norambuena
Fix calculate of average time for talktime is wrong when is completed the first call beacuse the time for talked would be that call. ASTERISK-25800 #close Change-Id: I94f79028935913cd9174b090b52bb300b91b9492
2016-01-05app_queue: Add member flag "in_call" to prevent reading wrong lastcall timeMartin Tomec
Member lastcall time is updated later than member status. There was chance to check wrapuptime for available member with wrong (old) lastcall time. New boolean flag "in_call" is set to true right before connecting call, and reset to false after update of lastcall time. Members with "in_call" set to true are treat as unavailable. ASTERISK-19820 #close Change-Id: I1923230cf9859ee51563a8ed420a0628b4d2e500
2016-01-05app_queue: Added reason pause of memberRodrigo Ramírez Norambuena
In app_queue added value Paused Reason on QueueMemberStatus when a member on queue is paused and the reason was set. ASTERISK-25480 #close Reporte by: Rodrigo Ramírez Norambuena Change-Id: Ia5db503482f50764c15e2020196c785f59d4a68e
2015-12-18app_queue: update RT members when the 1st call joins a queue with no agentsCarlos Oliva
If a call enters on a queue and the members on that queue are updated in realtime (ex: using mysql inserting a new agent) the queue members are never refreshed and the call will stay in the queue until other event occurs. This happens only if this is the first call of the queue and there is no agents servicing. This patch prevent this issue, ensuring realtime members are updated if there is one call in the queue and no available agents ASTERISK-25442 #close Change-Id: If1e036d013a5c1d8b0bf60d71d48fe98694a8682
2015-11-16app_queue: (try_calling): mutex 'qe->chan' freed more times than we've locked!Alec Davis
commit aae45acbd (Mark Michelson 2015-04-15 10:38:02 -0500 6525) refer ASTERISK-24958 above commit removed ast_channel_lock(qe->chan); but failed to remove corresponding ast_channel_unlock(qe->chan); ASTERISK-25561 #close Reported Alec Davis Change-Id: Ie05f4e2d08912606178bf1fded57cc022c7a2e1a
2015-09-25app_queue.c: Force COLP update if outgoing channel name changed.Richard Mudgett
* When a call is answered and the outgoing channel name has changed then force a connected line update because the channel is no longer the same. The channel was masqueraded into by another channel. This is usually because of a call pickup. Note: Forwarded calls are handled in a controlled manner so the original channel name is replaced with the forwarded channel. ASTERISK-25423 #close Reported by: John Hardin Change-Id: Ie275ea9e99c092ad369db23e0feb08c44498c172
2015-09-25app_queue.c: Factor out a connected line update routine.Richard Mudgett
Replace inlined code with update_connected_line_from_peer(). ASTERISK-25423 Reported by: John Hardin Change-Id: I33bbd033596fcb0208d41d8970369b4e87b806f3
2015-09-19Merge "app_queue: AgentComplete event has wrong reason" into 13Matt Jordan
2015-09-17app_queue: AgentComplete event has wrong reasonKevin Harwell
When a queued caller transfers an agent to another extension sometimes the raised AgentComplete event has a reason of "caller" and sometimes "transfer". Since a transfer has taken place this should always be transfer. This occurs because sometimes the stasis hangup event arrives before the transfer event thus writing a different reason out. With this patch, when a hangup event is received during a transfer it will check to see if the channel that is hanging up is part of a transfer. If so it will return and let the subsequently received transfer event handler take care of the cleanup. ASTERISK-25399 #close Change-Id: Ic63c49bd9a5ed463ea7a032fd2ea3d63bc81a50d
2015-09-17app_queue: Crash when transferringKevin Harwell
During some transfer scenarios involving queues Asterisk would sometimes crash when trying to obtain a channel snapshot (could happen on caller or member channels). This occurred because the underlying channel had already disappeared when trying to obtain the latest snapshot. This patch adds a reference to both the member and caller channels that extends to the lifetime of the queue'd call, thus making sure the channels will always exist when retrieving the latest snapshots. ASTERISK-25185 #close Reported by: Etienne Lessard Change-Id: Ic397fa68fb4ff35fbc378e745da9246a7b552128
2015-08-18app_queue.c: Extract some functions for simpler code.Richard Mudgett
* Extract set_queue_member_pause() from set_member_paused() for simpler and more consistent code. * Extract set_queue_member_ringinuse() from set_member_ringinuse_help_members() for simpler code. Change-Id: Iecc1f4119c63347341d7ea6b65f5fc4963706306