Commit Graph

11957 Commits

Author SHA1 Message Date
Olle Johansson
7efa6b1fe0 Avoid reinvite race situations with two Asterisks trying
to reinvite each other in 1.4 and trunk. 

This patch implements support for the 491 error code that
Asterisk 1.4 generates on situations where we get an 
incoming INVITE and already has one in progress.

Thanks to mavetju for reporting and to Raj Jain for an
excellent explanation of the problem.

Patch by myself. Tested with 8 Asterisk servers connected
to each other in a training network.

Closes issue #10481



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@92158 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-10 14:04:44 +00:00
Jason Parker
16a03298e9 We need to make sure we free the input frame if we return a different frame in ast_dsp_process.
Issue 11273, pointed out by dimas, with a patch by eliel.


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@91890 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-07 23:29:01 +00:00
Kevin P. Fleming
bcedcf5f8a even though Asterisk explicitly requests that endpoints using G.729 do *not* use Annex B (silence detection and comfort noise generation) some do anyway; the transcoder card interface does not currently work properly with CNG frames, so trim off the CNG before sending the data
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@91870 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-07 22:30:59 +00:00
Russell Bryant
b5463cd8d3 Make the lock protecting each thread's list of locks it currently holds
recursive.  I think that this will fix the situation where some people have
said that "core show locks" locks up the CLI.
(related to issue #11080)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@91830 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-07 21:24:33 +00:00
Russell Bryant
7be75dbbc9 Fix another bug in the DEBUG_THREADS code. The ast_mutex_init() function had
the mutex attribute object marked as static.  This means that multiple threads
initializing locks at the same time could step on each other and end up with
improperly initialized locks.
(found when tracking down locking issues related to issue #11080)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@91828 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-07 21:17:24 +00:00
Russell Bryant
168a6bed5a I love fixing lock related errors in the lock debugging code. That's about as
ironic as it gets in Asterisk programming land.  Anyway, I spotted this bug while
trying to track down why systems are locking up and acting weird in issue #11080.
The mutex attribute object was marked as static in this function when it should
not have been.


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@91826 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-07 21:11:08 +00:00
Russell Bryant
3e913c706f * 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.
* Remove the dialed variable as it isn't needed.
* Restructure some code for clarity and coding guidelines stuff


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@91783 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-07 16:38:48 +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
ab117fecaa * Add a bit more of a verbose comment as to why a hangup frame needs to be
queued up if autoservice gets a NULL return from ast_read().
* Make the process of queueing the hangup frame more efficient by putting the
  frame where it is going to end up and avoiding some locking and extra memory
  allocations and freeing.


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@91777 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-07 16:08:35 +00:00
Mark Michelson
9dbdc103b0 Hangups that happen during autoservice were not processed appropriately. This is
because a hangup actually causes a NULL frame to be received, not a hangup frame.
Queueing a hangup if we receive a NULL frame during autoservice corrects this problem

(closes issue #11467, reported  by jmls, patched by me)



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@91737 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-07 15:39:58 +00:00
Russell Bryant
c13539cb13 Don't unlock the dialed_interfaces list until we're done messing with the iterator.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@91693 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-07 02:51:22 +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
Tilghman Lesher
af01697791 At the end of a call, when we're reporting, RTCP may already be partially torn down, so check for NULL dereference
Reported by: blitzrage
Patch by: tilghman
(Closes issue #11450)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@91637 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-07 00:52:17 +00:00
Mark Michelson
ad820243bd IMAP storage did not honor the maxmsg setting in voicemail.conf, and it also had the possibility
of crashing if a user had more than 256 messages in their voicemail. This patch kills two birds with
one stone by adding maxmsg support and also setting a hard limit on the number of messages at 255 so
that the crashes cannot happen.

(closes issue #11101, reported by Skavin, patched by me)



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@91541 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-06 20:25:11 +00:00
Russell Bryant
0522e3d872 Add a new module flag to indicate that a build sum is present. Modules built
against older Asterisk 1.4 headers will now load properly with just a warning
indicating that they are old and may cause problems.
(patch by paravoid)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@91501 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-06 19:11:35 +00:00
Joshua Colp
6af6d06e75 Fix various in the udptl implementation. It could return empty modem frames, have an incorrect sequence number on packets, and display the wrong sequence number in the debug messages.
(closes issue #11228)
Reported by: Cache
Patches:
      udptl-4.patch uploaded by dimas (license 88)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@91450 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-06 16:49:42 +00:00
Joshua Colp
4edfc25a1f Add support for accepting and sending T.38 in the initial INVITE.
(closes issue #9402)
Reported by: thdei


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@91439 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-06 16:14:26 +00:00
Olle Johansson
95dce3bbba Make sure logger is reloaded at general reload in the cli.
(Discovered during Asterisk training in Portugal)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@91366 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-06 12:54:11 +00:00
Mark Michelson
41661777a4 Reverting extra stuff I didn't mean to commit
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@91292 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-05 22:57:13 +00:00
Mark Michelson
a1a592f3f0 The 'G' option for Dial() did not properly handle the case where only a label was
provided. This was due to the fact that the answering channel did not have an extension
set, so ast_parseable_goto would fail. This fix eliminates the call to ast_parseable_goto
on the answering channel since it is a wasteful call. The answering channel and the calling
channel are both directed to the same extension and context, just different priorities, so
we can just copy the values from the calling channel to the answering channel and increment
the answering channel's priority.

(closes issue #11382, reported by jon, patch by me with correction by jon)



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@91273 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-05 22:35:52 +00:00
Tilghman Lesher
7f7029e090 Upgrade to the latest version of extra sounds
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@91237 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-05 21:38:13 +00:00
Russell Bryant
a4137c3fbe Make the lock in the threadstorage debugging code untracked to avoid a deadlock
on thread destruction.

(closes issue #11207)
Reported by: ys
Patches:
      threadstorage.c.diff uploaded by ys (license 281)

Also fixes an open bug report: (closes issue #11446)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@91192 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-05 17:31:42 +00:00
Russell Bryant
82257a7e33 When DEBUG_THREADS is enabled, we only have the details about who is holding
a lock that we are waiting on for a mutex, not rwlocks.  This should fix the
problem where people have reported "core show locks" crashing sometimes.


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@91074 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-05 00:48:47 +00:00
Russell Bryant
eccfefae2c Fix some crashes in chan_iax2 that were reported as happening on Mac systems.
It turns out that the problem was the Mac version of the ast_atomic_fetchadd_int()
function.  The Mac atomic add function returns the _new_ value, while this function
is supposed to return the old value.  So, the crashes happened on unreferencing
objects.  If the reference count was decreased to 1, ao2_ref() thought that it
had been decreased to zero, and called the destructor.  However, there was still
an outstanding reference around.

(closes issue #11176)
(closes issue #11289)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@91070 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-05 00:35:31 +00:00
Russell Bryant
fc232a9a27 Modify file.h to maintain API compatibility with earlier versions. If a recent
compiler is being used, then a warning will show up for any modules still using
the old name "private" instead of "_private".
(patch suggested by paravoid)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@91032 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-04 23:46:40 +00:00
Russell Bryant
644c7a89e7 Make some changes to some additions I made recently for doing channel autoservice
when looking up extensions.  This code was added to handle the case where a
dialplan switch was in use that could block for a long time.  However, the way
that I added it, it did this for all extension lookups.  However, lookups in the
in-memory tree of extensions should _not_ take long enough to matter.  So, move
the autoservice stuff to be only around executing a switch.


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@90967 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-04 19:57:39 +00:00
Jason Parker
5376122015 If we fail to create a channel after allocating a timing fd, we need to make sure to close it.
Issue 11454, patch by eliel.


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@90876 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-04 17:28:08 +00:00
Joshua Colp
335d271dda Fix build issue on the build cluster.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@90798 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-04 05:29:33 +00:00
Tilghman Lesher
b8c8dee621 Solaris requires the inclusion of sys/loadavg.h for getloadavg().
Reported by: snuffy
Patch by: snuffy,tilghman
(Closes issue #11430)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@90753 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-03 23:50:51 +00:00
Tilghman Lesher
2c651fc500 If both dbhost and dbsock were not set, a NULL deref could result
Reported by: xrg
Patch by: tilghman
(Closes issue #11387)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@90736 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-03 23:23:55 +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
Jason Parker
8315785663 Make sure we always close the conference fd if we have an open one.
Issue 11383, reported by markmhy, patch by eliel.


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@90696 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-03 22:06:36 +00:00
Mark Michelson
d2d88e0f3d Changing some bad logic when calculating the interdigit timeout.
(closes issue #11402, reported and patched by eferro)



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@90639 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-03 20:59:51 +00:00
Jason Parker
8579b0ff93 Fix crash in ParkAndAnnounce application.
Issue #11436, reported by lytledd, patch by eliel.


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@90607 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-03 20:51:17 +00:00
Joshua Colp
bae731053f Do not create a smoother for G723.1 frames, they need to be left alone to their native 20/24 byte size.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@90588 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-03 20:05:42 +00:00
Joshua Colp
b18d1bdd1a Preserve the indication currently playing on a channel when a masquerade operation happens. (issue #BE-88)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@90548 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-03 18:40:56 +00:00
Jason Parker
90edaee7dd Only log debug messages if debug is enabled.
Closes issue #11416, patch by casper.


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@90546 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-03 18:20:49 +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
Tilghman Lesher
763b1ccecc Clarify the return value on autoservice. Specifically, if you started
autoservice and autoservice was already on, it would erroneously return an
error.
Reported by: adiemus
Patch by: dimas
(Closes issue #11433)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@90432 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-02 09:34:23 +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
Russell Bryant
82757dfaa1 Add some notes on the behavior of ao2_unlink() after a discussion with Tilghman
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@90310 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-30 18:46:46 +00:00
Joshua Colp
daf94226d5 Fix locking issues under one legged replaces scenarios.
(closes issue #11420)
Reported by: irroot
Patches:
      chan_sip_oneleg.patch uploaded by irroot (license 52)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@90269 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-30 14:43:15 +00:00
Mark Michelson
a53959d666 Clear the DTMF buffer if the call times out.
(closes issue #11418, reported and patched by eferro)



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@90231 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-30 00:16:04 +00:00
Tilghman Lesher
f82f12d6b2 Properly escape cdr->src and cdr->dst and ensure we use thread-safe escaping
(Fixes AST-2007-026)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@90166 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-29 19:48:10 +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
Tilghman Lesher
817da97389 Properly escape input buffers (Fixes AST-2007-025)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@90160 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-29 19:24:11 +00:00
Tilghman Lesher
2c11f7d18e Use of "private" as a field name in a header file messes with C++ projects
Reported by: chewbacca
Patch by: casper
(Closes issue #11401)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@90155 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-29 17:29:59 +00:00
Tilghman Lesher
e356cd95f3 Upgrade the core sounds release version
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@90154 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-29 17:18:09 +00:00
Russell Bryant
c1556baa9f fix some formatting i accidentally changed
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@90147 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-29 00:36:59 +00:00