Fix memory leak in error paths for action_originate().

* Fix memory leak of vars in error paths for action_originate().

* Moved struct fast_originate_helper tech and data members to stringfields.

* Simplified ActionID header handling for fast_originate().

* Added doxygen note to ast_request() and ast_call() and the associated
channel callbacks that the data/addr parameters should be treated as const
char *.

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


git-svn-id: http://svn.asterisk.org/svn/asterisk/branches/1.8@353454 f38db490-d61c-443f-a65b-d21fe96a405b
Allow res_calendar to be unloaded

The calendaring tech modules depend on res_calendar and initially
res_calendar just bumped the use count so that it couldn't be unloaded.
res_calendar can potentially create many threads and I've seen issues
where the Asterisk shutdown has failed where it looked like these
threads could be the culprit.

This patch adds unload support for res_calendar. Unloading res_calendar
will also unload the dependant tech modules as well.

(closes issue ASTERISK-16744)
Review: https://reviewboard.asterisk.org/r/1657/


git-svn-id: http://svn.asterisk.org/svn/asterisk/branches/1.8@353502 f38db490-d61c-443f-a65b-d21fe96a405b
Added clarification for the VERBOSITY setting to etc_default_asterisk

Clarified that using the VERBOSITY setting in etc_default_asterisk is the
same as using the -v command line switch, which causes Asterisk to launch
in console mode.

(closes issue ASTERISK-17030)
Reported by: Jonas



git-svn-id: http://svn.asterisk.org/svn/asterisk/branches/1.8@353550 f38db490-d61c-443f-a65b-d21fe96a405b
Resolve an overlap in the ast_audiohook_flags values.

AST_AUDIOHOOK_TRIGGER_WRITE and AST_AUDIOHOOK_WANTS_DTMF were overlapping which
may have caused unintended side effects.  This patch moves
AST_AUDIOHOOK_TRIGGER_WRITE, and updates AST_AUDIOHOOK_TRIGGER_MODE to reflect
the original intention.

This will affect existing modules that use these flags, so be sure to recompile
as necessary.

(closes issue ASTERISK-19246)
Reported by: feyfre


git-svn-id: http://svn.asterisk.org/svn/asterisk/branches/1.8@353598 f38db490-d61c-443f-a65b-d21fe96a405b
Use ast_sockaddr_stringify_fmt wrappers for various functions in chan_sip

There are a number of cleaner looking wrappers for ast_sockaddr_stringify_fmt
available which are slightly more readable than using a direct call to
ast_sockaddr_stringify_fmt. This patch switches a number of those calls in
chan_sip to use those wrappers and is generally harmless.

(Closes issue ASTERISK-16930)
Reported by: Michael L. Young
Patches:
	chan_sip-broken-registration-1.8.diff uploaded by Michael L. Young (license 5026)



git-svn-id: http://svn.asterisk.org/svn/asterisk/branches/1.8@353720 f38db490-d61c-443f-a65b-d21fe96a405b
Fix sip show peers port output, align columns, and fix ami port output.

A previous patch I committed from ASTERISK-16930 unexpectedly changed some output for
the AMI action "sippeers" which this patch changes back. Also, this aligns the output
for the cli command "sip show peers" and fixes another issue that patch introduced by
using ast_sockaddr_stringify calls multiple times without immediately using the pointer.
I also went ahead and did a little janitorial work to clean up whitespace in
_sip_show_peers.

(issue ASTERISK-16930)
(closes issue ASTERISK-19281)
Reported by: Patrick El Youssef
Patches:
	ASTERISK-19281.diff uploaded by Walter Doekes (license 5674)


git-svn-id: http://svn.asterisk.org/svn/asterisk/branches/1.8@353769 f38db490-d61c-443f-a65b-d21fe96a405b
Fix TLS port binding behavior as well as reload behavior:

* Removes references to tlsbindport from http.conf.sample and manager.conf.sample
* Properly bind to port specified in tlsbindaddr, using the default port if specified.
* On a reload, properly close socket if the service has been disabled.

A note has been added to UPGRADE.txt to indicate how ports must be set for TLS.

(closes issue ASTERISK-16959)
reported by Olaf Holthausen

(closes issue ASTERISK-19201)
reported by Chris Mylonas

(closes issue ASTERISK-19204)
reported by Chris Mylonas

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



git-svn-id: http://svn.asterisk.org/svn/asterisk/branches/1.8@353770 f38db490-d61c-443f-a65b-d21fe96a405b
Backports some documentation for func_curl from 10 to 1.8

For some reason this function was completely undocumented in 1.8. I copied the
10 docs over to 1.8 and removed references to an enumerator that was added in
the Asterisk 10 version of func_curl.  That was the only change I noted.

(closes issue ASTERISK-19186)
Reported by: Olivier Krief


git-svn-id: http://svn.asterisk.org/svn/asterisk/branches/1.8@353818 f38db490-d61c-443f-a65b-d21fe96a405b
Restore the 'w' modifier support for ISDN spans.  Dial(DAHDI/g0/1234w888)

This feature also causes the sending complete ie to be sent for switch
types that do not automatically send the ie.  (EuroISDN/ETSI)

The main difference between dialing Dial(DAHDI/g0/1234w888) and
Dial(DAHDI/g0/1234,,D(888)) is the sending of the sending complete ie.

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


git-svn-id: http://svn.asterisk.org/svn/asterisk/branches/1.8@353867 f38db490-d61c-443f-a65b-d21fe96a405b
Ensure entering T.38 passthrough does not cause an infinite loop

After R340970 Asterisk was still polling the RTCP file descriptor after RTCP is
shut down and removed. If the descriptor happened to have data ready when the
removal occured then Asterisk would go into an infinite loop trying to read
data that it can never actually access. This change disables the audio RTCP
file descriptor for the duration of the T.38 transaction.

(closes issue ASTERISK-18951)
Reported-by: Kristijan Vrban


git-svn-id: http://svn.asterisk.org/svn/asterisk/branches/1.8@353915 f38db490-d61c-443f-a65b-d21fe96a405b
Fixes deadlocks occuring in chan_agent due to r335976

Bad locking order was added to chan_agent to prevent segfaults from having no locking
in a patch by irroot. This patch addresses the bad locking order by releasing locks before
getting the right locking order to stop deadlocks from occuring when doing multiple
interactions with agents.

(closes issue ASTERISK-19285)
Reported by: Alex Villacis Lasso
Review: https://reviewboard.asterisk.org/r/1708/


git-svn-id: http://svn.asterisk.org/svn/asterisk/branches/1.8@353999 f38db490-d61c-443f-a65b-d21fe96a405b
Add missing headers to AMI UnParkedCall event to uniquely identify the call.

The AMI UnParkedCall event was missing the Parkinglot and Uniqueid headers
that the AMI ParkedCall event contains.

(closes issue ASTERISK-19240)
Reported by: Michael Yara


git-svn-id: http://svn.asterisk.org/svn/asterisk/branches/1.8@354116 f38db490-d61c-443f-a65b-d21fe96a405b
Improved documentation of CLI "dialplan add extension" command.

* Documented dialplan add extension <exten>,<priority>,<app(<app-data>)>
format.

* Allow acceptance of command without the app-data value.  There are many
applications that do no need any parameters so it is silly to require that
field for all commands.

* Fixed a couple ast_malloc/ast_free mismatches with ast_add_extension2()
calls.

(closes issue ASTERISK-19222)
Reported by: Andrey Solovyev
Tested by: rmudgett


git-svn-id: http://svn.asterisk.org/svn/asterisk/branches/1.8@354216 f38db490-d61c-443f-a65b-d21fe96a405b
Fix column duplication bug in module reload for cdr_pgsql.

Prior to this patch, attempts to reload cdr_pgsql.so would cause the column list to keep
its current data and then add a second copy during the reload. This would cause attempts
to log the CDR to the database to fail. This patch also cleans up some unnecessary null
checks for ast_free and deals with a few potential locking problems.

(closes issue ASTERISK-19216)
Reported by: Jacek Konieczny
Review: https://reviewboard.asterisk.org/r/1711/


git-svn-id: http://svn.asterisk.org/svn/asterisk/branches/1.8@354263 f38db490-d61c-443f-a65b-d21fe96a405b
Fix multiple SIP realtime issues

1. Set lastms to 0 when clearing instead of ""
2. Don't set ipaddr or port to the string "(null)" when they are empty
3. Add missing required fields, set default for lastms to 0, and modify
   the length of the ipaddr field to 45 in the Postgresql realtime.sql
   file.

(closes issue ASTERISK-19172)
Review: https://reviewboard.asterisk.org/r/1703/


git-svn-id: http://svn.asterisk.org/svn/asterisk/branches/1.8@354348 f38db490-d61c-443f-a65b-d21fe96a405b
Remove some unnecessary locking from ast_hangup().

This patch removes some unnecessary locking of the channels container in
ast_hangup().  The reason this came up is that this lock can very quickly block
the entire system.  If any of the channel cleanup code decides to block, it
causes a problem for the whole system.  For example, when audiohooks get
destroyed, if that blocks for a while waiting on the mixmonitor thread to exit
because it's busy blocking on some I/O, it causes a problem for many other
threads in the meantime.

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


git-svn-id: http://svn.asterisk.org/svn/asterisk/branches/1.8@354492 f38db490-d61c-443f-a65b-d21fe96a405b
Fix crash in ParkAndAnnounce.

Well, thats embarrasing.  I forgot to initialize the caller_id storage.

(closes issue ASTERISK-19311)
Reported by: tootai
Tested by: rmudgett


git-svn-id: http://svn.asterisk.org/svn/asterisk/branches/1.8@354495 f38db490-d61c-443f-a65b-d21fe96a405b
Fix SIP INFO DTMF handling for non-numeric codes

In ASTERISK-18924, SIP INFO DTMF handlingw as changed to account for both
lowercase alphatbetic DTMF events, as well as uppercase alphabetic DTMF
events.  When this occurred, the comparison of the character buffer containing
the event code was changed such that the buffer was first compared again '0'
and '9' to determine if it was numeric.  Unfortunately, since the first
character in the buffer will typically be '1' in the case of non-numeric
event codes (10-16), this caused those codes to be converted to a DTMF event
of '1'.  This patch fixes that, and cleans up handling of both
application/dtmf-relay and application/dtmf content types.

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

(closes issue ASTERISK-19290)
Reported by: Ira Emus
Tested by: mjordan



git-svn-id: http://svn.asterisk.org/svn/asterisk/branches/1.8@354542 f38db490-d61c-443f-a65b-d21fe96a405b
Adding reload support to res_fax.so

(closes issue ASTERISK-16712)
reported by Frank DiGennaro

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



git-svn-id: http://svn.asterisk.org/svn/asterisk/branches/1.8@354545 f38db490-d61c-443f-a65b-d21fe96a405b
Clean-up of minor formatting issues in r354542/3/4

rmudgett pointed out some formatting issues in the check-in for
ASTERISK-19290.  This cleans those up.

Review: https://reviewboards.asterisk.org/r/1722/


git-svn-id: http://svn.asterisk.org/svn/asterisk/branches/1.8@354547 f38db490-d61c-443f-a65b-d21fe96a405b