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
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
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
codec that we don't know, Asterisk did not remove that codec from the list.
With this patch, we remove the codec from audio and video rtp objects and
deny it ever existed. Thanks to lasse for testing.
(closes issue #11376)
Reported by: lasse
Patches:
bug11376.txt uploaded by oej (license 306)
Tested by: lasse
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@89630 65c4cc65-6c06-0410-ace0-fbb531ad65f3
ast_uri_decode function as opposed to my home-rolled one. Also added
comments.
Thanks to oej for pointing me in the right direction
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@89119 65c4cc65-6c06-0410-ace0-fbb531ad65f3
in extensions.conf AND maintain their escaped characters when forming URI's
(closes issue #10681, reported by cahen, patched by me, code review by file)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@89090 65c4cc65-6c06-0410-ace0-fbb531ad65f3
asterisk channel must be locked, as this data may change at any time.
(I have seen numerous reports of crashes related to the handling of channel
variables. There are a couple of issues on the bug tracker related to it,
but it has also been noted on IRC and mailing lists. So, I am finding and
fixing some places where channel variables are handled improperly.)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@88768 65c4cc65-6c06-0410-ace0-fbb531ad65f3
and ast_string_field_free_all to ast_string_field_reset_all
to avoid misuse (due to too similar names and an error in
documentation). Fix two related memory leaks in app_meetme.
No need to merge to trunk, different fix already applied there.
Not applicable to 1.2
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@88471 65c4cc65-6c06-0410-ace0-fbb531ad65f3
There was a race condition related to the handling of POKEing peers. Essentially,
a reference to a peer is held by the scheduler when there are pending callbacks,
but the reference count didn't reflect it. So, it was possible for a peer to hit
a reference count of zero and have its destructor begin to be called at the same
time that the scheduler thread ran a POKE related callback. If that happened,
a crash would likely occur.
(closes issue #11082, closes issue #11094)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@87686 65c4cc65-6c06-0410-ace0-fbb531ad65f3
sense for it to default to off. The default configuration file has it on, and
proper RFC behavior, as indicated by a comment in the code, is for it to be on.
So, let's have it on by default to make lives easier.
(closes issue #10954, suggested by jtodd)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@85604 65c4cc65-6c06-0410-ace0-fbb531ad65f3
due to various buffer sizes around the code, but I still didn't like seeing a
non length-limited copy of data coming off of the wire into a stack buffer, as
this would be a problem in the future if buffer sizes elsewhere got changed or
size limitations removed ...
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@84370 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Change h323 to only remove the Makefile on a dist-clean, rather than a clean.
This fixes a bug I found with trying to run make after a make clean
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@84291 65c4cc65-6c06-0410-ace0-fbb531ad65f3
session at Astricon. chan_sip did not output any message when a call was
rejected because the extension was not found. This adds a verbose message
(at verbose level 3) to note when this happens.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@83941 65c4cc65-6c06-0410-ace0-fbb531ad65f3
peers. Instead, use an iterator. By using an iterator, the peers container
is not locked while the POKE is being done. It can cause a deadlock if the
peers container is locked because poking a peer will try to lock pvt structs,
while there is a lot of other code that will hold a pvt lock when trying to
go lock the peers container.
(reported to me directly by Loic Didelot. Thank you for the debug info!)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@83175 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Reported by: dimas
Patches:
chan_sip.patch uploaded by dimas (license 88)
Read in subscribecontext option in general to be the default.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@83070 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Reported by: kenw
Patches:
9724.txt uploaded by russell (license 2)
Tested by: kenw, russell
Resolve a deadlock that occurs when doing a SIP transfer to parking.
I come across this type of deadlock fairly often it seems. It is very important
to mind the boundary between the channel driver and the core in respect to the
channel lock and the channel-pvt lock. Channel drivers lock to lock the
pvt and then the channel once it calls into the core, while the core will do
it in the opposite order. The way this is avoided is by having channel drivers
either release their pvt lock while calling into the core, or such as in this
case, unlocking the pvt just long enough to acquire the channel lock.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@81832 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Also changed load_module function to use defines rather than numbers for return values.
Issue 10651, patch by rbraun_proformatique, with additions by me.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@81523 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Reported by: jamesgolovich
Patches:
asterisk-iaxfirmwareleak.diff.txt uploaded by jamesgolovich (license 176)
Fix memory leak when unloading chan_iax2. The firmware files were not being freed.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@81439 65c4cc65-6c06-0410-ace0-fbb531ad65f3
handling blocks in the code for building peers. The peer object destructor
does this and doing it twice will cause a crash.
(closes issue #10625, reported by and patched by pnlarsson)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@81433 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Reported by: casper
Patches:
chan_sip.c.80129.diff uploaded by casper (license 55)
Remove needless check for AUTH_UNKNOWN_DOMAIN. It was impossible for it to ever be that value.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@81395 65c4cc65-6c06-0410-ace0-fbb531ad65f3
not return because it blocks. later chan_misdn would try to queue a frame like
a AST_CONTROL_ANSWER which could result in a deadlock situation. misdn_read
will now not block forever anymore, and we don't queue the ANSWER frame at all
when we already was called with misdn_answer -> answer would be called twice.
Also we don't explicitly send a RELEASE_COMPLETE on receiption of a RELEASE
anymore, because mISDN does that for us, this resulted in a problem on some
switches, which would block our port after some calls for a short while.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@81367 65c4cc65-6c06-0410-ace0-fbb531ad65f3
he doesn't cause a queue's announce file to be interrupted. Also went ahead and did the
same for the '*' key and for ending a call.
(closes issue #10528, reported by deskhack, patched by me)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@81120 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Reported by: jesselang
Patches:
chan_sip-ChannelReload-20080825.patch uploaded by jesselang (license 202)
Remove an extra \r\n to make the ChannelReload event conform with every other event.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@81012 65c4cc65-6c06-0410-ace0-fbb531ad65f3
places that scheduled items to be executed by the scheduler thread did not
signal the scheduler thread to wake up so that it could recalculate the time
until the next action. These changes will make the scheduler thread more
responsive and ensure that actions get executed as close to when intended as
possible instead of it being possible for very long delays.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@80895 65c4cc65-6c06-0410-ace0-fbb531ad65f3
starts, then don't give up on poking peers. Allow the poke to get rescheduled
so that it will work once the dnsmgr is able to resolve the host.
(closes issue #10521, patch by jamesgolovich)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@80849 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Googletalk calls are answered too early, which results in CDRs wrongly
stating that a call was ANSWERED when the calling party cancelled a
call before before being established.
We must not answer the call upon reception of a 'transport-accept' iq
packet, but this packet still needs to be acknowledged, otherwise the
remote peer would close the call (like in #8970).
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@80661 65c4cc65-6c06-0410-ace0-fbb531ad65f3
the peers and users are being stored in a linked list, that they go in the
list in the same order that the older code used. This is necessary to maintain
the behavior of which peers and users get matched when traversing the container.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@80497 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This set of changes fixes problems with the handling of iax2_user and iax2_peer
objects. It was very possible for a thread to still hold a reference to one of
these objects while a reload operation tries to delete them. The fix here is to
ensure that all references to these objects are tracked so that they can't go away
while still in use.
To accomplish this, I used the astobj2 reference counted object model. This
code has been in one of Luigi Rizzo's branches for a long time and was primarily
developed by one of his students, Marta Carbone. I wanted to go ahead and bring
this in to 1.4 because there are other problems similar to the ones fixed by these
changes, so we might as well go ahead and use the new astobj if we're going to go
through all of the work necessary to fix the problems.
As a nice side benefit of these changes, peer and user handling got more efficient.
Using astobj2 lets us not hold the container lock for peers or users nearly as long
while iterating. Also, by changing a define at the top of chan_iax2.c, the objects
will be distributed in a hash table, drastically increasing lookup speed in these
containers, which will have a very big impact on systems that have a large number of
users or peers.
The use of the hash table will be made the default in trunk. It is not the default
in 1.4 because it changes the behavior slightly. Previously, since peers and users
were stored in memory in the same order they were specified in the configuration file,
you could influence peer and user matching order based on the order they are specified
in the configuration. The hash table does not guarantee any order in the container,
so this behavior will be going away. It just means that you have to be a little
more careful ensuring that peers and users are matched explicitly and not forcing
chan_iax2 to have to guess which user is the right one based on secret, host, and
access list settings, instead of simply using the username.
If you have any questions, feel free to ask on the asterisk-dev list.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@80362 65c4cc65-6c06-0410-ace0-fbb531ad65f3
limit on how many history entires will be stored for each SIP dialog. It is
currently set to 50, but can be increased if deemed necessary.
(closes issue #10421, closes issue #10418, patches suggested by jmoldenhauer,
patches updated by me)
(Security implications documented in AST-2007-020)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@80183 65c4cc65-6c06-0410-ace0-fbb531ad65f3
ast_read to return NULL in the case that the channel has been hung up.
(crash reported by anonymouz666 on IRC in #asterisk-dev)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@79912 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Caused by fix for issue 9938.
I basically took the code that existed before 9938 was fixed, and
copied it into a new function - ast_unescape_semicolon
There should be very few places this will be needed (pbx_config
does NOT need this (see issue 9938 for details))
Issue 10430, patch by me, with help/ideas from murf (thanks murf).
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@79904 65c4cc65-6c06-0410-ace0-fbb531ad65f3
to the scheduler to ensure that they don't overwrite the ID of a previously
scheduled item. If there is one, it should be removed.
(closes issue #10391, closes issue #10256, probably others, patch by me)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@79857 65c4cc65-6c06-0410-ace0-fbb531ad65f3
and scheduling multi-threaded. Unfortunately, we have to do some expensive
deadlock avoidance when queueing frames on to the ast_channel owner of the IAX2
pvt struct. This was already handled for regular frames, but ast_queue_hangup
and ast_queue_control were still used directly. Making these changes introduced
even more places where the IAX2 pvt struct can disappear in the context of a
function holding its lock due to calling a function that has to unlock/lock it
to avoid deadlocks. I went through and fixed all of these places to account for
this possibility.
(issue #10362, patch by me)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@79756 65c4cc65-6c06-0410-ace0-fbb531ad65f3
ringinuse=no for the queue.
(closes issue #10215, reported by Doug, repaired by me)
Special thanks to fkasumovic for pointing out the source of the problem and to bweschke for helping to come up with a solution!
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@79748 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Reported by: irroot
Patches:
sip_timeout.patch uploaded by irroot (license 52)
Change hardcoded timer value to defined value. I'm doing this in 1.4 as well so if it needs to be changed in the future this place would not have been forgotten.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@79523 65c4cc65-6c06-0410-ace0-fbb531ad65f3
core issue. You can not call find_callno() while holding a pvt lock as this
function has to lock another (every) other pvt lock. Doing so can lead to a
classic deadlock. So, I am tracking down all of the code paths where this
can happen and fixing them.
The fix I committed earlier today was along the same theme. This patch fixes
some code down the path of authenticate_reply.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@79272 65c4cc65-6c06-0410-ace0-fbb531ad65f3
call find_callno. You can't hold a pvt lock while calling find_callno because
it goes through and locks every single one looking for a match.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@79214 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Reported by: haklin
Don't set the callerid name and number a second time on a newly created channel. ast_channel_alloc itself already sets it and setting it twice would cause a memory leak.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@79174 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Now matches are made on both the IP address and port number, or if the insecure setting is set to "port" then just match on the
IP address.
In order to accomplish this, I also added a new API call, ast_category_root, which returns the first variable of an ast_category struct
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@78103 65c4cc65-6c06-0410-ace0-fbb531ad65f3
will just return immediately. Also, fix some logic so the thread's lock
isn't unlocked twice in the weird case of dynamic threads getting acquired
right after a timeout.
(pointed out by SteveK)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@78028 65c4cc65-6c06-0410-ace0-fbb531ad65f3
during the first time it runs. This shouldn't ever happen, but we should
account for it anyway.
(pointed out by pete, who works with mihai)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@77949 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Also rearrange messages to better fit with what a wireshark trace shows it should be.
Issue 10299, initial patch and solution by sbisker, modified by me to fit with wireshark trace.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@77947 65c4cc65-6c06-0410-ace0-fbb531ad65f3