Fix WaitExten(x,m(musicclass)) string termination.

The AST_CONTROL_HOLD MOH class from the WaitExten application can now be
queued onto a channel, passed over local channels with the /m option, and
passed over IAX channels.
........

Merged revisions 367469 from http://svn.asterisk.org/svn/asterisk/branches/1.8
Fix crash in ConfBridge when user announcement is played for more than 2 users

A patch introduced in r354938 made it so that ConfBridge would not attempt to
play sound files if those files did not exist.  Unfortunately, ConfBridge uses
the same underlying function, play_sound_helper, to playback both sound files
and numbers to callers.  When a number is being played back, the name of the
sound file is expected to be NULL.  This NULL value was passed into a function
that tested for the existance of a sound file and is not tolerant to NULL
file names, causing a crash.

This patch fixes the behavior, such that if a sound file does not exist we
do not attempt to play it, but we only attempt that check if the a sound file
was specified in the first place.  If a sound file was not specified, we use
the 'play number' logic in the helper function.

(closes issue ASTERISK-19899)
Reported by: Florian Gilcher
Tested by: Florian Gilcher
patches:
  asterisk-19899.diff uploaded by mjordan (license 6283)
Fix Dial I option ignored if dial forked and one fork redirects.

The Dial and Queue I option is intended to block connected line updates
and redirecting updates.  However, it is a feature that when a call is
locally redirected, the I option is disabled if the redirected call runs
as a local channel so the administrator can have an opportunity to setup
new connected line information.  Unfortunately, the Dial and Queue I
option is disabled for *all* forked calls if one of those calls is
redirected.

* Make the Dial and Queue I option apply to each outgoing call leg
independently.  Now if one outgoing call leg is locally redirected, the
other outgoing calls are not affected.

* Made Dial not pass any redirecting updates when forking calls.
Redirecting updates do not make sense for this scenario.

* Made Queue not pass any redirecting updates when using the ringall
strategy.  Redirecting updates do not make sense for this scenario.

* Fixed deadlock potential with chan_local when Dial and Queue send
redirecting updates for a local redirect.

* Converted the Queue stillgoing flag to a boolean bitfield.

(closes issue ASTERISK-19511)
Reported by: rmudgett
Tested by: rmudgett

Review: https://reviewboard.asterisk.org/r/1920/
........

Merged revisions 367678 from http://svn.asterisk.org/svn/asterisk/branches/1.8
Fix pvt_sip for inbound call to use peer's allowtransfer setting

The pvt_sip allowtransfer was not being set to that of the peer's setting.
Therefore, the global allowtransfer setting was being used instead which would
lead to calls not being transfered if the global setting was set to 'no' despite
the setting on the peer being 'yes' and vice versa, calls would be allowed to
transfer even if the peer's setting was 'no' but the global setting was 'yes'.

(Closes issue ASTERISK-19856)
Reported by: Jacek
Tested by: Michael L. Young, Jacek 
Patches:
issue-asterisk-19856-branch10-v3.diff uploaded by 
                                                 Michael L. Young (license 5026)

Review: https://reviewboard.asterisk.org/r/1923/
........

Merged revisions 367730 from http://svn.asterisk.org/svn/asterisk/branches/1.8
AST-2012-007: Fix IAX receiving HOLD without suggested MOH class crash.

* Made schedule_delivery() set the received frame f->data.ptr to NULL if 
the datalen is zero.  

* Fix queue_signalling() memcpy() size error.

* Made queue_signalling() not use C++ keyword variable names.

(closes issue ASTERISK-19597)
Reported by: mgrobecker
Patches:
      jira_asterisk_19597_v1.8.patch (license #5621) patch uploaded by rmudgett
Tested by: rmudgett, Michael L. Young
........

Merged revisions 367781 from http://svn.asterisk.org/svn/asterisk/branches/1.8
AST-2012-008: Fix remote crash vulnerability in chan_skinny

When a skinny session is unregistered, the corresponding device pointer is set
to NULL in the channel private data.  If the client was not in the on-hook state
at the time the connection was closed, the device pointer can later be
dereferened if a message or channel event attempts to use a line's pointer to
said device.

The patches prevent this from occurring by checking the line's pointer in
message handlers and channel callbacks that can fire after an unregistration
attempt.

(closes issue ASTERISK-19905)
Reported by: Christoph Hebeisen
Tested by: mjordan, Damien Wedhorn
Patches:
  AST-2012-008-1.8.diff uploaded by mjordan (license 6283)
  AST-2012-008-10.diff uploaded by mjordan (licesen 6283)
Coverity Report: Fix issues for error type REVERSE_INULL (deprecated modules)

* Fix only issue pointed out by deprecated_REVERSE_INULL.txt for
app_meetme.c in find_user().

* Change use of %i to %d in sscanf() in find_user().  The use of %i gives
unexpected parsing because it can accept hex, octal, and decimal integer
formats.

* Changed other uses of %i in app_meetme() to use %d for consistency.

(issue ASTERISK-19648)
Reported by: Matt Jordan
........

Merged revisions 367906 from http://svn.asterisk.org/svn/asterisk/branches/1.8
Fix deadlock when executing CLI "pri show channels" and  "ss7 show channels" commands.

* Fix sig_pri_lock_owner() to avoid deadlock properly.

* Code pri_grab() better.

* Fix sig_ss7_lock_owner() to avoid deadlock properly.

* Code ss7_grab() better.

(closes issue ASTERISK-19854)
Reported by: Jaxon
Patches:
      jira_asterisk_19854_v1.8.6.patch (license #5621) patch uploaded by rmudgett (Modified to do the same thing to sig_ss7)
Tested by: Jaxon
........

Merged revisions 367976 from http://svn.asterisk.org/svn/asterisk/branches/1.8
Use the DEADLOCK_AVOIDANCE() macro instead.

(issue ASTERISK-19854)
........

Merged revisions 367980 from http://svn.asterisk.org/svn/asterisk/branches/1.8
Coverity Report: Fix issues for error type REVERSE_INULL (core modules)

* Fixes findings: 0-2,5,7-15,24-26,28-31

(issue ASTERISK-19648)
Reported by: Matt Jordan
........

Merged revisions 368039 from http://svn.asterisk.org/svn/asterisk/branches/1.8
Add documentation to function CHANNEL for options echocan_mode and buffers

The ability to set "echocan_mode" and "buffers" through the dialplan was added
to chan_dahdi some time ago.  This patch adds some documentation to
func_channel.

(Closes issue ASTERISK-19911)
Reported by: Dale Noll
Tested by: Michael L. Young
Patches: 
  asterisk-19911-branch18.diff uploaded by Michael L. Young (license 5026)

Review: https://reviewboard.asterisk.org/r/1949/
........

Merged revisions 368092 from http://svn.asterisk.org/svn/asterisk/branches/1.8
Improve SDP parsing warning messages

* 'Unsupported media type' is only reported when that is in fact the case,
   not when a supported media type is included in an 'm' line that has an
   invalid format.

* All warning messages related to parsing 'm' lines now include the 'm' line contents.

* (minor bugfix) newline added to port-number-zero warning messages.

* Warning messages improved to use RFC-specified terminology for various items.

* Warnings for offers that include more than one port for a single media type now
  include the media type.

Review: https://reviewboard.asterisk.org/r/1811/
........

Merged revisions 368218 from http://svn.asterisk.org/svn/asterisk/branches/1.8
Fix deadlock when Gosub used with alternate dialplan switches.

Attempting to remove a channel from autoservice with the channel lock held
will result in deadlock.

* Restructured gosub_exec() to not call ast_parseable_goto() and
ast_exists_extension() with the channel lock held.

(closes issue ASTERISK-19764)
Reported by: rmudgett
Tested by: rmudgett
........

Merged revisions 368308 from http://svn.asterisk.org/svn/asterisk/branches/1.8
Fix potential deadlock between masquerade and chan_local.

* Restructure ast_do_masquerade() to not hold channel locks while it calls
ast_indicate().

* Simplify many calls to ast_do_masquerade() since it will never return a
failure now.  If it does fail internally because a channel driver callback
operation failed, the only thing ast_do_masquerade() can do is generate a
warning message about strange things may happen and press on.

* Fixed the call to ast_bridged_channel() in ast_do_masquerade().  This
change fixes half of the deadlock reported in ASTERISK-19801 between
masquerades and chan_iax.

(closes issue ASTERISK-19537)
Reported by: rmudgett
Tested by: rmudgett

Review: https://reviewboard.asterisk.org/r/1915/
........

Merged revisions 368405 from http://svn.asterisk.org/svn/asterisk/branches/1.8
Document BLINDTRANSFER behavior change.

(issue ASTERISK-19322)

(closes issue ASTERISK-19875)
Reported by: call
........

Merged revisions 368469 from http://svn.asterisk.org/svn/asterisk/branches/1.8
Relay proper SIP responses on calling side.

Revision 351130 broke corect HANGUPCAUSE setting
for the 404 case in chan_sip. Other cases were also
potentially broken. This patch fixes the relaying
of causes to be what they used to be.

(closes issue ASTERISK-19914)
Reported by Pavel Troller
Tested by Walter Doekes (via a reviewboard test to be committed later)
Patches:
	chan_sip.diff uploaded by Pavel Troller (license #6302)
........

Merged revisions 368498 from http://svn.asterisk.org/svn/asterisk/branches/1.8
Ensure that pages and emails are sent using RFC822-compliant date format

When localization was added to app_voicemail, these headers were altered
when they should have remained in en_US format for RFC compliance. This
reverts the changes to those two lines.

(closes issue ASTERISK-19876)
........

Merged revisions 368520 from http://svn.asterisk.org/svn/asterisk/branches/1.8
Resolve some build warnings

My newly upgraded compiler caught these usages of uninitialized values.
They weren't actually used.
........

Merged revisions 368533 from http://svn.asterisk.org/svn/asterisk/branches/1.8
Fix parked call performing a DTMF blind transfer after being retrieved.

When a parked call was retrieved from the parking lot, it could not do a
blind transfer because it caused the involved calls to be hung up
unconditionally.

* Made the ParkedCall application return the ast_bridge_call() return
value.

(closes issue ABE-2862)
Reported by: Vlad Povorozniuc
........

Merged revisions 368567 from http://svn.asterisk.org/svn/asterisk/branches/1.8
Ensure overlapping hold flags do not conflict

When changing between different modes of hold, the flags were not being
cleared out properly causing a failure to change hold states.

(closes issue ASTERISK-19919)
Patch-by: Morten Tryfoss
Reported-by: Morten Tryfoss
........

Merged revisions 368586 from http://svn.asterisk.org/svn/asterisk/branches/1.8