Allow AMI action callback to be reentrant.

Fix AMI module reload deadlock regression from ASTERISK-18479 when it
tried to fix the race between calling an AMI action callback and
unregistering that action.  Refixes ASTERISK-13784 broken by
ASTERISK-17785 change.

Locking the ao2 object guaranteed that there were no active callbacks that
mattered when ast_manager_unregister() was called.  Unfortunately, this
causes the deadlock situation.  The patch stops locking the ao2 object to
allow multiple threads to invoke the callback re-entrantly.  There is no
way to guarantee a module unload will not crash because of an active
callback.  The code attempts to minimize the chance with the registered
flag and the maximum 5 second delay before ast_manager_unregister()
returns.

The trunk version of the patch changes the API to fix the race condition
correctly to prevent the module code from unloading from memory while an
action callback is active.

* Don't hold the lock while calling the AMI action callback.

(closes issue ASTERISK-19487)
Reported by: Philippe Lindheimer

Review: https://reviewboard.asterisk.org/r/1818/
Review: https://reviewboard.asterisk.org/r/1820/


git-svn-id: file:///sync/mirror/asterisk/branches/1.8@359979 eedb1c7a-6a47-11e1-93ee-a9c596eb3dd7
Prevent Echo() from relaying control, null, and modem frames

Echo()'s description states that it echoes audio, video, and DTMF except for #
while it actually echoes any frame that it receives other than DTMF #.  This
was causing frame storms in the test suite in some circumstances where Echo()
was attached to both ends of a pair of local channels and control frames
were being periodically generated.  Echo()'s behavior and description have
been modifed so that it only echoes media and non-# DTMF frames.


git-svn-id: file:///sync/mirror/asterisk/branches/1.8@360033 eedb1c7a-6a47-11e1-93ee-a9c596eb3dd7
Ensure Asterisk sends a BYE when pending on the final response to a re-INVITE

When Asterisk detects a hangup and cannot send a BYE due to a pending
INVITE, it sets the pendingbye flag and waits for the final response to that
INVITE.  When the response is received, it transmits the BYE.  If, however,
that INVITE request is a pending re-INVITE, it needs to first send a CANCEL
request to terminate the pending re-INVITE.  In that circumstance, Asterisk
was, in some scenarios, clearing the pendingbye flag after processing the
CANCEL request and not checking for a pending BYE when receiving the final
487 response to the INVITE.

This patch ensures that if the pendingbye flag is set, it is honored
regardless of the nature of the INVITE request currently in flight.

(closes issue ASTERISK-19365)
Reported by: Thomas Arimont
Tested by: Thomas Arimont
Patches:
  bugASTERISK-19365_2012_03_08.patch uploaded by mjordan (license 6283)

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



git-svn-id: file:///sync/mirror/asterisk/branches/1.8@360086 eedb1c7a-6a47-11e1-93ee-a9c596eb3dd7
Also detect gmime 2.6

Also detect gmime version 2.6 (Michael Biebl)

Signed-off-by: Tzafrir Cohen (License #5035) <tzafrir.cohen@xorcom.com>

git-svn-id: file:///sync/mirror/asterisk/branches/1.8@360087 eedb1c7a-6a47-11e1-93ee-a9c596eb3dd7
Update install_prereq script to include missing GSM library for debian amd move SQLite3.

(closes issue ASTERISK-19367)
Reported by: Andrew Latham
Patches:
	debian_install_prereq.diff uploaded by Andrew Latham (license 5985)


git-svn-id: file:///sync/mirror/asterisk/branches/1.8@360138 eedb1c7a-6a47-11e1-93ee-a9c596eb3dd7
Add missing initialization of update_redirecting in chan_sip.c

git-svn-id: file:///sync/mirror/asterisk/branches/1.8@360262 eedb1c7a-6a47-11e1-93ee-a9c596eb3dd7
Make number not available presentation also set screening to network provided.

Q.951 indicates that when the presentation indicator is "Number not
available due to interworking" for a number then the screening indicator
field should be "Network provided".

* Made ast_party_id_presentation() return AST_PRES_NUMBER_NOT_AVAILABLE
when the presentation is "Number not available due to interworking".  This
fix makes Asterisk consistent and it also makes it consistent with earlier
branches as far as this presentation value is concerned.

* Made pri_to_ast_presentation() and ast_to_pri_presentation() conversions
handle the "Number not available due to interworking" case better in
sig_pri.c.  This change is possible because the minimum required libpri
version (v1.4.11) has the necessary defines in libpri.h.


git-svn-id: file:///sync/mirror/asterisk/branches/1.8@360309 eedb1c7a-6a47-11e1-93ee-a9c596eb3dd7
expression parser: Fix (theoretical) memory leak.

Fix a memory leak that is very unlikely to actually happen.  If a malloc()
succeeded, but the following strdup() failed, the memory from the original
malloc() would be leaked.


git-svn-id: file:///sync/mirror/asterisk/branches/1.8@360356 eedb1c7a-6a47-11e1-93ee-a9c596eb3dd7
Rebuild parsers.

This is needed to include the last fix to main/ast_expr2.y.  The changes look
much bigger as this regeneration of the code was done with newer versions of
flex and bison.


git-svn-id: file:///sync/mirror/asterisk/branches/1.8@360357 eedb1c7a-6a47-11e1-93ee-a9c596eb3dd7
app_jack: fix datastore memory leak in error handling path.


git-svn-id: file:///sync/mirror/asterisk/branches/1.8@360360 eedb1c7a-6a47-11e1-93ee-a9c596eb3dd7
app_page: Fix a memory leak on every Page().

dial_list is a dynamically allocated array that is allocated at the beginning
of Page() based on how many devices will be dialed.  This was never being freed.


git-svn-id: file:///sync/mirror/asterisk/branches/1.8@360363 eedb1c7a-6a47-11e1-93ee-a9c596eb3dd7
func_curl: Fix leak of an ast_str in error handling code path.


git-svn-id: file:///sync/mirror/asterisk/branches/1.8@360413 eedb1c7a-6a47-11e1-93ee-a9c596eb3dd7
Increase verbosity level for ast_verb messages

While this does not fix the issue of the CLI being flooded by 'doing
dnsmgr_lookup' messages, increasing the verbosity level above 5 should help
minimize it.


git-svn-id: file:///sync/mirror/asterisk/branches/1.8@360471 eedb1c7a-6a47-11e1-93ee-a9c596eb3dd7
Fix Asterisk version typo


git-svn-id: file:///sync/mirror/asterisk/branches/1.8@360473 eedb1c7a-6a47-11e1-93ee-a9c596eb3dd7
Update CHANGES for r360471


git-svn-id: file:///sync/mirror/asterisk/branches/1.8@360474 eedb1c7a-6a47-11e1-93ee-a9c596eb3dd7
Fix BETTER_BACKTRACES library detection for Fedora/RedHat/CentOS

(closes ASTERISK-17842)
Reported by: Bryon Clark
Patches:
	20110512__issue19278.diff.txt uploaded by Tilghman Lesher (license 5003)
	configure_bfd_with_dl_and_iberty.patch uploaded by Bryon Clark (license 6157)


git-svn-id: file:///sync/mirror/asterisk/branches/1.8@360488 eedb1c7a-6a47-11e1-93ee-a9c596eb3dd7
Updates config with bootstrap where I changed configure.ac in r360488

(issue ASTERISK-17842)
Reported by: Bryon Clark


git-svn-id: file:///sync/mirror/asterisk/branches/1.8@360574 eedb1c7a-6a47-11e1-93ee-a9c596eb3dd7
Make a debug message regarding subscription changes more accurate.

I was getting confused during some testing why Asterisk was saying that
a subscription was being added when it was clearly being removed. This
fixes that confusion.



git-svn-id: file:///sync/mirror/asterisk/branches/1.8@360625 eedb1c7a-6a47-11e1-93ee-a9c596eb3dd7
Destroy configs when they are no longer used

https://reviewboard.asterisk.org/r/1834/


git-svn-id: file:///sync/mirror/asterisk/branches/1.8@360712 eedb1c7a-6a47-11e1-93ee-a9c596eb3dd7
Improve accuracy of identifying information sent in dialog-info SIP NOTIFY requests.

This change makes use of connected party information in addition to caller ID in order
to populate local and remote XML elements in the dialog-info NOTIFYs.

(closes issue ASTERISK-16735)
Reported by: Maciej Krajewski
Tested by: Maciej Krajewski
Patches:
    local_remote_hint2.diff uploaded by Mark Michelson (license 5049)



git-svn-id: file:///sync/mirror/asterisk/branches/1.8@360862 eedb1c7a-6a47-11e1-93ee-a9c596eb3dd7