Commit Graph

371 Commits

Author SHA1 Message Date
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
Kevin P. Fleming
43c2cf7938 fix a couple of places where a logical member name (if specified) was not used, but instead the direct interface was listed
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@82590 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-17 16:33:30 +00:00
Mark Michelson
e53d7231dd Crap, I broke the build. Fixed.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@82398 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-14 18:35:48 +00:00
Mark Michelson
c7b6c42ef5 Adding member name field to manager events where they were missing before
(closes issue #10721, reported by snar)



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@82396 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-14 18:28:36 +00:00
Mark Michelson
d6b1a0bfd6 Preemptively fixing a possible segfault. It is possible that queuename is NULL
(meaning pause ALL queues), so use q->name instead.



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@82346 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-13 20:16:37 +00:00
Mark Michelson
1cf6ee98e0 Added logic to handle the unlikely case that someone has two queues with the same name.
Asterisk will log a warning message letting the user know that one was already defined with that
name and is it skipping all further instances. This also will work for realtime queues but in order
for that to happen, the user would have to trigger a perfectly timed reload as a realtime queue is being
looked up, which is highly unlikely (but taken care of nonetheless).



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@82326 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-13 16:25:59 +00:00
Mark Michelson
da18cece2c We should only initialize a realtime queue when it is allocated, not every time we access it. This prevents the members ao2_container
from being reallocated every time the queue is accessed.

I also removed a debug message I had accidentally left in on a previous commit.



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@82274 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-12 14:24:53 +00:00
Russell Bryant
3e11102ef8 Fix incorrect uses of ao2_find(). Every one of these calls was reading bogus
memory ...


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@82267 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-11 22:37:17 +00:00
Russell Bryant
56b7a100bc Fix another missing unref of member objects. This one was pointed out by Marta.
When building the outgoing list in try_calling(), a member reference is stored
in each outgoing entry.  However, when this list got destroyed, the reference
was not released.


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@82263 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-11 20:49:34 +00:00
Mark Michelson
4f36c859ad All instances of ao2_iterators which were just named 'i' have been renamed
to 'mem_iter' so that when refcounted queues are merged into trunk, there will be
little confusion regarding iterator names, especially when a queue and member iterator
are used in the same function.



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@82252 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-11 16:05:56 +00:00
Russell Bryant
808ed0e44e Add a couple more missing unrefs of queue member objects
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@82240 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-11 14:34:12 +00:00
Russell Bryant
aa3a71d3bf Add a missing unref of a queue member in an error handling block
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@82238 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-11 14:21:17 +00:00
Russell Bryant
ffa6e7123b Document why membercount can not simply be replaced by ao2_container_count()
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@82236 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-11 14:09:43 +00:00
Tilghman Lesher
4913548485 Convert struct member to use refcounts (closes issue #10199)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@82155 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-10 18:02:02 +00:00
Jason Parker
d73c04d892 Allow the MEMBERINTERFACE variable to be used as the mixmonitor filename.
This moves the setting of the MEMBERINTERFACE variable to before mixmonitor.

Issue 10671, patch by sim.


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@81923 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-07 19:48:00 +00:00
Mark Michelson
76ffc54255 Fixes an issue where valid DTMF had to be pressed twice to exit a queue if a member's phone
was ringing.

(closes issue #10655, reported by strider2k, patched by me)



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@81713 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-06 16:25:40 +00:00
Mark Michelson
fbbf1e2056 Fixing the build...
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@81525 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-05 15:19:47 +00:00
Mark Michelson
f5cc747662 Reverting behavior of QUEUE_MEMBER_COUNT to only count members who are logged in
and available.

(related to issue #10652, reported by wuwu)



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@81520 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-05 15:03:22 +00:00
Mark Michelson
6ed2b5c1b2 Changed a comment to be more accurate.
(really this is just a test to make sure I can commit properly from home)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@81428 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-01 15:57:31 +00:00
Mark Michelson
687f798f19 Fixed broken behavior of a reload on realtime queues. Prior to this patch, if a reload was issued and
a realtime queue had callers waiting in it, then the queue would be removed from the queue list, but it would
not actually be freed (in fact, a debug message warning about a memory leak would come up). With this patch,
reloads do not touch realtime queues at all.



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@81416 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-31 19:48:55 +00:00
Mark Michelson
0589a7e1d0 Removing an extraneous (and possibly misleading) log message. Firstly, if the announce file isn't found, the
streaming functions will report it. Secondly, not all non-zero returns from play_file mean that the announce file
wasn't found. Positive return values simply mean that a digit was pressed (most likely to skip through the announcement).

(closes issue #10612, reported and patched by dimas)



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@81397 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-30 22:05:56 +00:00
Mark Michelson
4c16fcaa97 Changed some manager event messages to reflect whether a queue member is a realtime member or not
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@81381 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-30 15:35:51 +00:00
Mark Michelson
dbe2d229a5 This patch, in essence, will correctly pause a realtime queue member and reflect those
changes in the realtime engine.

(issue #10424, reported by irroot, patch by me)

This patch creates a new function called update_realtime_member_field, which is a generic
function which will allow any one field of a realtime queue member to be updated. This patch
only uses this function to update the paused status of a queue member, but it lays the foundation
for persisting the state of a realtime member the same way that static members' state is maintained
when using the persistentmembers setting



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@81349 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-29 16:35:29 +00:00
Mark Michelson
872ab1519e Changed some tabs to spaces
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@81346 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-29 16:08:09 +00:00
Mark Michelson
2772c71560 This fix creates a more accurate way of detecting whether realtime members were deleted.
(closes issue 10541, reported by Alric, patched by me)

The REALLY nice things about this patch is that queue members now have a "realtime" field
which will be true if the member is a realtime member. This means we can check this value
prior to certain processing if it should ONLY be done for realtime members.



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@81340 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-29 15:52:42 +00:00
Mark Michelson
214d980f86 Resolve a potential deadlock. In this case, a single queue is locked, then the queue list. In changethread(), the queue list is
locked, and then each individual queue is locked. Under the right circumstances, this could deadlock. As such, I have unlocked
the individual queue before locking the queue list, and then locked the queue back after the queue list is unlocked.



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@81158 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-27 22:40:19 +00:00
Mark Michelson
fe5489eead Found a case where the queue's membercount is off. It does not take into account dynamic members on a reload.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@81010 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-27 14:55:44 +00:00
BJ Weschke
318f0f6e46 A minor correction to the available logic of autofill. If a queue member is paused, they're not really "available" so don't count them as such. Somewhat related to issue #10155
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@80818 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-24 19:52:06 +00:00
Russell Bryant
108326e3d1 Fix the build of app_queue
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@80088 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-20 21:57:08 +00:00
Mark Michelson
6268d2d7ec After a discussion on #asterisk-dev, it was decided that this should be in 1.4 as well.
(issue #10424, reported and patched by irroot)



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@80086 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-20 21:39:17 +00:00
Mark Michelson
d66e174242 Found a pointless ternary if. member->dynamic was set to 1 and has no opportunity to change
between then and this line, so "dynamic" will ALWAYS be output.



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@80049 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-20 16:17:43 +00:00
Mark Michelson
f8c70a5799 Changing a bit of logic so that someone will NEVER exit the queue on timeout unless they have enabled the 'n' option.
This commit relates to issue #10320. Thanks to jfitzgibbon for detailing the idea behind this code change.



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@78575 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-08 14:26:36 +00:00
Mark Michelson
5739eba48e Fixes an issue I introduced to queues wherein a queue with joinempty=yes would kick people out of the queue because of erroneously
thinking the 'n' option was in use.

(closes issue #10320, reported by jfitzgibbon, patched by me, tested by blitzrage and me)

Thank you blitzrage for all the testing you've done lately with queues! It's much appreciated!



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@77854 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-01 14:08:57 +00:00
Mark Michelson
7e6f78d95e If a queue uses dynamic realtime members, then the member list should be updated after each attempt to call the queue.
This fixes an issue where if a caller calls into a queue where no one is logged in, they would wait forever even if a member
logged in at some point.

(closes issue #10346, reported by and tested by blitzrage, patched by me)



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@77852 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-01 13:59:59 +00:00
Mark Michelson
ad4eb1b347 Added a membercount variable to call_queue struct which keeps track of the number of logged in members in a particular queue.
This makes it so that the 'n' option for Queue() can act properly depending on which strategy is used. If the strategy is
roundrobin, rrmemory, or ringall, we want to ring each phone once before moving on in the dialplan. However, if any other strategy is
used, we will only ring one phone since it cannot be guaranteed that a different phone will ring on subsequent attempts to ring a phone.

As a side effect of this, the QUEUE_MEMBER_COUNT dialplan function now just reads the membercount variable instead of traversing through
the member list to figure out how many members there are.

Special thanks to blitzrage for helping to test this out.

(closes issue #10127, reported by bcnit, patched by me, tested by blitzrage)



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@76801 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-07-24 16:26:58 +00:00
Joshua Colp
34b000a0e7 Move makeannouncement variable declaration to proper place.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@76054 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-07-20 16:49:13 +00:00
Mark Michelson
049fb8d98e The diff on this looks pretty big but all I did was remove a pointless if statement (always evaluates true).
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@75978 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-07-19 18:59:30 +00:00