(closes issue #5866)
Reported by: tyler
Do not force channel format changes when a generator is present. The generator may have changed the formats itself and changing them back would cause issues.
Russell Bryant [Sat, 21 Jul 2007 02:01:46 +0000 (02:01 +0000)]
Backport a fix for a memory leak that was fixed in trunk in reivision 76221
by rizzo. The memory used for the localaddr list was not freed during a
configuration reload.
(closes issue #10247)
Reported by: fkasumovic
Patches:
chan_sip.patch uploaded by fkasumovic (license #101)
Drop any peer realm authentication entries when reloading so multiple entries do not get added to the peer.
Russell Bryant [Thu, 19 Jul 2007 15:49:42 +0000 (15:49 +0000)]
When processing full frames, take sequence number wraparound into account when
deciding whether or not we need to request retransmissions by sending a VNAK.
This code could cause VNAKs to be sent erroneously in some cases, and to not
be sent in other cases when it should have been.
(closes issue #10237, reported and patched by mihai)
Russell Bryant [Wed, 18 Jul 2007 21:09:13 +0000 (21:09 +0000)]
When traversing the queue of frames for possible retransmission after
receiving a VNAK, handle sequence number wraparound so that all frames that
should be retransmitted actually do get retransmitted.
(issue #10227, reported and patched by mihai)
Russell Bryant [Tue, 17 Jul 2007 20:45:27 +0000 (20:45 +0000)]
Ensure that when encoding the contents of an ast_frame into an iax_frame, that
the size of the destination buffer is known in the iax_frame so that code
won't write past the end of the allocated buffer when sending outgoing frames.
(ASA-2007-014)
Russell Bryant [Tue, 17 Jul 2007 20:41:41 +0000 (20:41 +0000)]
After parsing information elements in IAX frames, set the data length to zero,
so that code later on does not think it has data to copy.
(ASA-2007-015)
Mark Michelson [Fri, 13 Jul 2007 20:10:39 +0000 (20:10 +0000)]
Fixed an issue where chanspy flags were uninitialized if no options were passed.
What triggered this investigation was an IRC chat where some people's quiet flags were
set while others' weren't even though none of them had specified the q option.
Russell Bryant [Fri, 13 Jul 2007 20:07:21 +0000 (20:07 +0000)]
Ensure that adding a user to the list of users of a specific music on hold
class is not done at the same time as any of the other operations on this list
to prevent list corruption. Using the global moh_data lock for this is not
ideal, but it is what is used to protect these lists everywhere else in the
module, and I am only changing what is necessary to fix the bug.
When using a TDM400P (and probably other analog cards) there was a chance that
you could hang up and pick the phone back up where it has been long enough to
be not considered a flash hook, but too soon such that the device reports that
it is busy and the person on the phone will only hear silence. This patch
makes chan_zap more tolerant of this and gives the device a couple of seconds
to succeed so the person on the phone happily gets their dialtone.
Russell Bryant [Wed, 11 Jul 2007 22:53:26 +0000 (22:53 +0000)]
The function make_trunk() can fail and return -1 instead of a valid new call
number. Fix the uses of this function to handle this instead of treating it
as the new call number. This would cause a deadlock and memory corruption.
(possible cause of issue #9614 and others, patch by me)
Russell Bryant [Wed, 11 Jul 2007 18:33:23 +0000 (18:33 +0000)]
Make sure that the ESCAPE immediately follows the condition that uses LIKE.
This fixes realtime extensions with ODBC.
(closes issue #10175, reported by stuarth, patch by me)
Jason Parker [Tue, 10 Jul 2007 19:57:20 +0000 (19:57 +0000)]
Fix an issue where it was possible to have a service level of over 100%
Between the time recalc_holdtime and update_queue was called, it was possible that the call could have been hungup.
Move both additions to the same place, so this won't happen.
Issue 10158, initial patch by makoto, modified by me.
Russell Bryant [Mon, 9 Jul 2007 21:00:17 +0000 (21:00 +0000)]
When the specified class isn't found, properly fall back to the channel's music
class or the default.
(issue #10123, reported by blitzrage, patches from juggie, qwell, and me)
Jason Parker [Mon, 9 Jul 2007 20:18:15 +0000 (20:18 +0000)]
Several chan_zap options were not working on reload because they were arbitrarily
disallowed when reloading some/most PRI options (such as signalling) was disallowed.
Options such as polarityonanswerdelay and answeronpolarityswitch can safely be changed on a reload.
This corrects that behavior.
Russell Bryant [Fri, 6 Jul 2007 23:01:22 +0000 (23:01 +0000)]
If a sip_pvt struct has already registered an extension state callback,
remove the old one before adding a new one. If this isn't done, Asterisk
will crash. (issue #10120)
Copy language information to the dialog structure when calling a peer for situations where a PBX may be started on the dialed channel. (issue #10121 reported by clegall_proformatique)
Reset ServicelevelPerf variable back to 0 if we are unable to calculate it each time... otherwise we will get previous values. (issue #10117 reported by noriyuki)
Russell Bryant [Sun, 1 Jul 2007 23:51:34 +0000 (23:51 +0000)]
When appending lines to call files to keep track of retries, write a leading
newline just in case the original call file did not have a newline at the end.
This fix is in response to a problem I saw reported on the asterisk-users
mailing list.
Russell Bryant [Fri, 29 Jun 2007 16:30:56 +0000 (16:30 +0000)]
Backport changes that make chan_iax2 not start the PBX on an incoming channel
until the three-way call setup is completed. These changes are already in 1.4
and trunk.
check if the bchannel stack id is already used, if so don't use it a second time. Also added a release_chan lock, so that the same chan_list object cannot be freed twice. chan_misdn does not crash anymore on heavy load with these changes.
Brett Bryant [Wed, 27 Jun 2007 23:22:13 +0000 (23:22 +0000)]
Reinstating patch. This actually fixes the problem, however I was running a development branch without it and mistakenly thought it wasn't fixed.
Fixes issue #10010, and #9654: 100% CPU usage caused by an asterisk console losing it's controlling terminal.
Russell Bryant [Wed, 27 Jun 2007 21:06:45 +0000 (21:06 +0000)]
Fix a minor issue with parsing the priority number. You could have as much
whitespace as you want around a numeric priority, but you couldn't have any
whitespace around a special priority like "n" or "hint".
(issue #10039, reported by mitheloc, fixed by me)
Joshua Colp [Wed, 27 Jun 2007 20:23:24 +0000 (20:23 +0000)]
I may possibly get shot for doing this... but... defer CDR processing until after the channel has been dealt with. This should eliminate all of the issues with channels going funky (SIP/PRI) when you are posting CDRs to a database that is either slow or unavailable and do not want to enable batching.
simplified generation for dummy bchannels, also we mark them as dummies, so they are not used later as real-bchannels, optimized the RESTART mechanisms, we block a channel now on cause:44, and send out a RESTART automatically, then on reception of RESTART_ACKNOWLEDGE we unblock the channel again.
for inbound TE calls, we setup the bchannel when we get the CONNECT_ACKNOWLEDGE, to make sure mISDN has everything ready. removed some #if 0 areas which weren't used anymore.
Brett Bryant [Fri, 22 Jun 2007 14:39:34 +0000 (14:39 +0000)]
Fixed infinite loop when controlling terminal was lost
and return value of input function wasn't checked for
errors. This would cause 100% cpu to be taken up.
(closes issue #9654, issue #10010)
Reported by: mnicholson, and eserra
Steve Murphy [Thu, 21 Jun 2007 22:29:50 +0000 (22:29 +0000)]
This little fix is in response to bug 10016, but may not cure it. The code is wrong, clearly. In a situation where you set the CDR's amaflags, and then ForkCDR, and then set the new CDR's amaflags to some other value, you will see that all CDRs have had their amaflags changed. This is not good. So I fixed it.
Steve Murphy [Thu, 21 Jun 2007 19:13:17 +0000 (19:13 +0000)]
it was pointed out that the cdr_custom config load could get a lock, and under certain circumstances, would never release it. I also noted that the situation where more than one mapping spec was warned about, but did not ignore further mappings as it had promised. I think I have fixed both situations.
Russell Bryant [Wed, 20 Jun 2007 18:45:38 +0000 (18:45 +0000)]
Fix a problem where an established call would not be properly disconnected
when a PRI disconnect is received depending on which cause code was received.
(issue #9588, original patch by softins, updated patch from jtexter3, and some
additional feedback from mhardeman)
on receiption of cause:44 we mark the channel as in use and inform the user about the situation, we need to test the RESTART stuff then. Also shuffled the empty_chan_in_stack function after the bchannel cleaning functions, to avoid race conditions.
Steve Murphy [Tue, 19 Jun 2007 18:07:59 +0000 (18:07 +0000)]
This fixes 9246, where channel variables are not available in the 'h' exten, on a 'ZOMBIE' channel. The fix is to consolidate the channel variables during a masquerade, and then copy the merged variables back onto the clone, so the zombie has the same vars that the 'original' has.
Russell Bryant [Tue, 19 Jun 2007 16:45:37 +0000 (16:45 +0000)]
Backport fix for crashes related to subscriptions from 1.4 ...
Fix a crash that could occur when handing device state changes.
When the state of a device changes, the device state thread tells the extension
state handling code that it changed. Then, the extension state code calls the
callback in chan_sip so that it can update subscriptions to that extension.
A pointer to a sip_pvt structure is passed to this function as the call which
needs a NOTIFY sent. However, there was no locking done to ensure that the pvt
struct didn't disappear during this process.
(issue #9946, reported by tdonahue, patch by me, patch updated to trunk to use
the sip_pvt lock wrappers by eliel)
Joshua Colp [Tue, 19 Jun 2007 12:57:55 +0000 (12:57 +0000)]
Add parked call extension AFTER the parking slot has been announced, otherwise two threads will try to handle the same channel and it will go kaboom. (issue #9191 reported by japple)
Joshua Colp [Mon, 18 Jun 2007 18:13:03 +0000 (18:13 +0000)]
Set the peer name on the dialog to the one configured in sip.conf and NOT the username to be used for authentication attempts. (issue #9967 reported by achauvin)
Russell Bryant [Thu, 14 Jun 2007 20:56:19 +0000 (20:56 +0000)]
Backport rev 69010 from the 1.4 branch ...
In ast_channel_make_compatible(), just return if the channels' read and write
formats already match up. There are code paths that call this function on a
pair of channels multiple times. This made calls fail that were using g729
in some cases. The reason is that codec_g729a will unregister itself from the
list of available translators will all licenses are in use. So, the first
time the function got called, the right translation path was allocated.
However, the second time it got called, the code would not find a translation
path to/from g729 and make the call fail, even if the channel actually already
had a g729 translation path allocated.