Commit Graph

407 Commits

Author SHA1 Message Date
Mark Michelson
c6387c3540 When using autofill, members who are in use should be counted towards the
number of available members to call if ringinuse is set to yes.

Thanks to jmls who brought this issue up on IRC



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@105059 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-28 20:11:57 +00:00
Mark Michelson
70b222e46f Clear up confusion when viewing the QUEUE_WAITING_COUNT of a
"dead" realtime queue. Since from the user's perspective, the queue
does exist, we shouldn't tell them we couldn't find the queue. Instead
since it is a dead queue, report a 0 waiting count

This issue was brought up on IRC by jmls



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@103956 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-20 22:32:22 +00:00
Mark Michelson
cb8ffc789e Prevent a potential three-thread deadlock. Also added a comment block
to explicitly state the locking order necessary inside app_queue.

(closes issue #11862)
Reported by: flujan
Patches:
      11862.patch uploaded by putnopvut (license 60)
	  Tested by: flujan



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@103120 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-08 18:48:17 +00:00
Mark Michelson
2e4650c242 Fix a logic error with regards to autofill. Prior to this change, it was possible
for a caller to go out of turn if autofill were enabled and callers ahead in the queue were attempting
to call a member. This change fixes this.



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@101216 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-30 15:23:00 +00:00
Mark Michelson
da3e5f571a Remove a memory leak from updating realtime queues
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@101035 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-29 23:02:03 +00:00
Mark Michelson
ad19e1c4b6 Fixing an erroneous return value returned when attempting to pause or unpause a queue member
fails.

Fixes BE-366, thanks to John Bigelow for writing the patch.



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@100973 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-29 19:39:00 +00:00
Mark Michelson
8e3c058e44 Fixing another compilation error. I'm a bit off today :(
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@98737 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-14 16:35:12 +00:00
Mark Michelson
1a95cfaf45 Oops. Last commit had compilation error.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@98734 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-14 16:30:33 +00:00
Mark Michelson
aa320d23a9 Adding explicit defaults for missing options to init_queue. This is necessary because
if a user either removes or comments one of these options and reloads their queues, the
option will not reset to its default, instead maintaining the value from prior to the 
reload. 

Thanks to John Bigelow for pointing this error out to me.



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@98733 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-14 16:21:28 +00:00
Mark Michelson
2da89b6120 Part 2 of app_queue doxygen improvements. Some smaller functions this time
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@97575 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-09 18:48:15 +00:00
Mark Michelson
34f994f017 use the \retval doxygen command properly
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@97308 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-09 00:17:40 +00:00
Mark Michelson
2a0748b0fe Part 1 of N of adding doxygen comments to app_queue. I picked some of the most common functions
used (which also happen to be some the biggest/ugliest functions too) to document first. I'm pretty
new to doxygen so criticism is welcome.



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@97304 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-08 23:49:11 +00:00
Mark Michelson
fdd5c25103 Some coding guidelines-related cleanup
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@97206 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-08 21:24:48 +00:00
Joshua Colp
be83b74be9 Make app_queue calls work with directed pickup.
(closes issue #11700)
Reported by: jbauer


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@97093 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-08 18:36:40 +00:00
Mark Michelson
068e1d8208 We need to reset the membername to NULL on each iteration of this loop, otherwise the result is that
multiple members can have the same name, since the variable was not reset on each iteration of the loop.



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@96102 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-02 23:46:02 +00:00
Mark Michelson
60c6826c1c A change to improve the accuracy of queue logging in the case where a member does not
answer during the specified timeout period. Prior to this change, there was a small chance
that the member name recorded in this case would be blank. Also prior to this change, if using
the ringall strategy, if no one answered the call during the specified timeout, the member name
listed in the queue log would randomly be one of the members that was rung.

(closes issue #11498, reported and tested by hloubser, patched by me)



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@95890 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-02 17:51:22 +00:00
Mark Michelson
a7dee30a8d I found a bug while browsing the queue code and managed to reproduce it in a small setup.
If a queue uses the ringall strategy, it was possible through unfortunate coincidence for a single member at a given penalty level to
make app_queue think that all members at that penalty level were unavailable and cause the members at the
next penalty level to be rung. With this patch, we will only move to the next penalty level if ALL the members
at a given penalty level are unreachable.



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@95095 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-28 00:16:15 +00:00
Mark Michelson
ad89849308 Removing a debug message I accidentally just committed
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@94464 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-21 16:11:44 +00:00
Mark Michelson
eac09a0cd0 Fixing Portuguese syntax for saying dates and times. Also some coding guidelines cleanup.
(closes issue #11599, reported and patched by caio1982, coding guidelines cleanup by me)



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@94420 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-21 15:45:14 +00:00
Olle Johansson
517dacce70 Issue 11574: Add dependencies on res_monitor and res_features.
I wonder if Asterisk can run at all without res_features. My guess is that 
there's propably a lot of more modules and the core that depends on it.

Reported by: caio1982
(closes issue #11574)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@93182 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-17 07:15:13 +00:00
Mark Michelson
ef5f25b6c1 Removing an unused variable.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@92443 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-12 16:08:55 +00:00
Mark Michelson
c8b5d2ea03 Fixing autofill to be more accurate. Specifically, if calls ahead of the current
caller were ringing members (but not yet bridged) there could be available members
and waiting callers who would not get matched up. The member availability checker
was correctly determining the number of available members in this scenario, but
the queue itself did not parallelly reflect this status on the pending calls. This
commit corrects the issue.

(closes issue #11459, reported by equissoftware, patched by me)



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@92323 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-11 17:42:25 +00:00
Mark Michelson
626053ac64 If there are no members in a queue, then the loop where the datastore for detecting
duplicate dialed numbers will be skipped, meaning the datastore isn't created. This means
that when we try to free it, there's a crash. This stops that crash from occurring.

(closes issue #11499, reported by slavon, patched by eliel)



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@92202 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-10 16:29:44 +00:00
Russell Bryant
d1f1b3c4d6 * Add channel locking around datastore operations that expect the channel
to be locked.
* Document why we don't record Local channels in the dialed interfaces list.
* Handle memory allocation failure.
* Remove the dialed variable, as it wasn't actually needed.
* Tweak some formatting to conform to coding guidelines.


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@91780 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-07 16:25:25 +00:00
Russell Bryant
85e0e1919d Allow dialing local channels from Queue() and Dial() again. There was a slight
flaw in the code to prevent call forwards from looping that caused this problem.
(related to issue #11486)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@91677 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-07 02:38:40 +00:00
Russell Bryant
079b4a2b18 Fix in an issue in the call forwarding handling code that was causing crashes
on every call into a queue.  I'm not entirely sure about the logic in this part
of the code, so I want to look at it some more tomorrow.  However, this makes
it safe and keeps it from crashing.

(closes issue #11486, reported by adamg, patched by me)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@91675 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-07 02:19:45 +00:00
Mark Michelson
7b052b78e1 A big one...
This is the merge of the forward-loop branch. The main change here is that call-forwards can no longer loop.
This is accomplished by creating a datastore on the calling channel which has a linked list of all devices
dialed. If a forward happens, then the local channel which is created inherits the datastore. If, through this
progression of forwards and datastore inheritance, a device is attempted to be dialed a second time, it will simply
be skipped and a warning message will be printed to the CLI. After the dialing has been completed, the datastore
is detached from the channel and destroyed.

This change also introduces some side effects to the code which I shall enumerate here:

1. Datastore inheritance has been backported from trunk into 1.4
2. A large chunk of code has been removed from app_dial. This chunk is the section of code
   which handles the call forward case after the channel has been requested but before it has
   been called. This was removed because call-forwarding still works fine without it, it makes the
   code less error-prone should it need changing, and it made this set of changes much less painful
   to just have the forwarding handled in one place in each module.
3. Two new files, global_datastores.h and .c have been added. These are necessary since the datastore
   which is attached to the channel may be created and attached in either app_dial or app_queue, so they
   need a common place to find the datastore info. This approach was taken in case similar datastores are
   needed in the future, there will be a common place to add them.


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@90735 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-03 23:12:17 +00:00
Russell Bryant
d208d0fc37 The other day when I went through making changes as a result of the ao2_link()
change, I added some code to set pointers to NULL after they were unreferenced.
This pointed out that in this place, the object was unreferenced before the
code was done using it.  So, move the unref down a little bit.
(crash reported by jmls on IRC)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@90470 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-02 18:18:52 +00:00
Russell Bryant
1f8caa100d Change the behavior of ao2_link(). Previously, in inherited a reference.
Now, it automatically increases the reference count to reflect the reference
that is now held by the container.

This was done to be more consistent with ao2_unlink(), which automatically
releases the reference held by the container.  It also makes it so it is
no longer possible for a pointer to be invalid after ao2_link() returns.


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@90348 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-30 19:26:04 +00:00
Mark Michelson
aafa661ed7 This patch handles the case where a queue member with a negative penalty is added
via the manager. If a negative value is submitted for a member penalty, we set it to 0.

(closes issue #11411, reported and patched by Laureano)



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@90163 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-29 19:38:39 +00:00
Joshua Colp
c24b0e152a Fix a few memory leaks.
(closes issue #11405)
Reported by: eliel
Patches:
      load_realtime.patch uploaded by eliel (license 64)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@90101 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-28 22:59:28 +00:00
Russell Bryant
a5c9a71b4e Instead of depending on the return value of ast_true(), explicitly set the
eventwhencalled variable to 1.


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@89844 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-27 23:21:13 +00:00
Mark Michelson
a5db0a6103 Two changes with regards to the 'eventwhencalled' option of queues.conf
1) Due to some signed vs. unsigned silliness, setting 'eventwhencalled' to 
   'vars' or 'yes' did exactly the same thing. Thus the sign change of the
   ast_true call.

2) The vars2manager function overwrote a \n for every channel variable it parsed, resulting
   in bizarre output for the channel variables. This patch remedies this.

(related to issue #11385, however I'm not sure if this will actually be enough to close it)



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@89837 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-27 23:10:05 +00:00
Mark Michelson
ddc5bf5b47 Fix a small error I made in my previous commit
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@89495 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-21 19:27:51 +00:00
Mark Michelson
d105c24a57 Changing an inaccurate debug message to be less inaccurate. Under the circumstances, this
message would always report that there were 0 members available, even though that may not be true.




git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@89493 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-21 19:24:22 +00:00
Mark Michelson
891b3bab2a Make realtime queues accessible from the QUEUE_MEMBER_COUNT function.
(closes issue #11271, reported and patched by atis, with small modifications from me)



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@89323 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-16 15:28:22 +00:00
Tilghman Lesher
45c16cc29b The member refcount must be incremented, to avoid using it after deallocation.
A huge thanks go to lvl- for patiently providing the necessary valgrind output
that was necessary to finding this problem of memory corruption.
Reported by: lvl-
Patch by: tilghman
Closes issue #11174


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@89093 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-07 23:39:37 +00:00
Mark Michelson
c9935ba132 If a non-existent file is specified to be played either as a periodic announcement
or as a hold/position announcement, the caller would be kicked out of the queue.
No longer does this happen.



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@86328 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-10-18 17:38:26 +00:00
Mark Michelson
cb55155ef1 Changing the strategy field of the call_queue struct to be signed instead of unsigned,
since the code attempts to set the strategy to -1 if you specify a bogus strategy.
While this isn't a huge issue in 1.4, it could be a problem for someone who, say, tries
to use the roundrobin strategy in trunk (despite all the deprecation warnings in 1.4).



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@86202 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-10-17 21:39:05 +00:00
Mark Michelson
1ced2ef939 Adding deprecated warning to monitor-join option, since the plan is to
no longer support this in favor of monitor-type = mixmonitor

(related to issue #10885)



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@86028 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-10-16 22:49:10 +00:00
Mark Michelson
eb154e963c Trying to remove a non-dynamic queue member via dynamic means can lead to some
interesting (read nasty) situations. This patch clears up the issue by making
only dynamic queue members removable via dynamic methods.



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@85958 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-10-16 21:14:34 +00:00
Mark Michelson
661aa4ba35 Fixing a double free which happens in the statechange thread.
(closes issue #10987, reported by andrew)



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@85852 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-10-16 15:21:58 +00:00
Russell Bryant
d63883be92 Ensure that no pending state changes are leaked when the device state change
thread gets stopped on module unload.


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@85720 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-10-15 21:10:02 +00:00
Russell Bryant
87dc20fc03 Previously, app_queue created a thread to handle every single device state
change.  I changed this a while ago in trunk for performance reasons.  However,
bug 8407 points out that it is actually a race condition, causing device state
changes to get processed in random order.  So, I backported my changes from
trunk to 1.4.
(closes issue #8407, patch provided by tim_ringenbach, committed patch by me)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@85717 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-10-15 20:59:27 +00:00
Mark Michelson
74cc6754af Don't allocate space for queue members unless it's needed. You end up deleting dynamic members on a reload. Not good.
closes issue (#10879, reported by dazza76, patched by me)



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@84692 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-10-04 21:57:03 +00:00
Joshua Colp
03a7b06959 Create a duplicate of the channel's member name as the tab completion stuff will free it.
(closes issue #10884)
Reported by: adamg


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@84637 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-10-04 14:51:57 +00:00
Joshua Colp
2187f79e54 Protect the CDR record from modification by pbx_exec so that the application data contains the Queue data.
(closes issue #10761)
Reported by: snar
Patches:
      app-queue-mixmonitor.patch uploaded by snar (license 245)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@83074 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-19 13:47:59 +00:00
Joshua Colp
88cfb003df Initialize a variable to NULL to make the world happy.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@82961 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-18 23:41:02 +00:00
Mark Michelson
3d1a567df0 Moving the logic for handling an empty membername to the create_member function so that there is a common place
where this occurs instead of being spread out to several different places.



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@82865 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-18 20:09:02 +00:00
Kevin P. Fleming
a809a030d9 there is no need for conditional logic to select ->interface or ->membername, snince ->membername will always be populated
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@82834 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-18 18:59:52 +00:00