Commit Graph

2805 Commits

Author SHA1 Message Date
David M. Lee 05ec2860df Corrected doc error for Stasis. I guess the mutex isn't necessary.
Thanks, rmudgett!


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@383541 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-03-21 20:09:11 +00:00
Richard Mudgett 14dd9445e9 Fix astobj2 doxygen comment.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@383519 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-03-21 17:41:52 +00:00
Joshua Colp 07d01e1c41 Pass the sorcery instance to wizards for CUD operations as well as retrieve.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@383405 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-03-20 14:52:23 +00:00
Kinsey Moore 99aa02d17f Transition MWI to Stasis-core
Remove MWI's dependency on the event system by moving it to
Stasis-core. This also introduces forwarding topic pools in Stasis-core
which aggregate many dynamically allocated topics into a single primary
topic.

Review: https://reviewboard.asterisk.org/r/2368/
(closes issue ASTERISK-21097)
Patch-by: Kinsey Moore


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@383284 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-03-16 15:45:58 +00:00
David M. Lee 49e3489cac A simplistic router for stasis_message's.
Often times, when subscribing to a topic, one wants to handle
different message types differently. While one could cascade if/else
statements through the subscription handler, it is much cleaner to
specify a different callback for each message type. The
stasis_message_router is here to help!

A stasis_message_router is constructed for a particular stasis_topic,
which is subscribes to. Call stasis_message_router_unsubscribe() to
cancel that subscription.

Once constructed, routes can be added using
stasis_message_router_add() (or stasis_message_router_set_default()
for any messages not handled by other routes). There may be only one
route per stasis_message_type. The route's callback is invoked just as
if it were a callback for a subscription; but it only gets called for
messages of the specified type.

(issue ASTERISK-20887)
Review: https://reviewboard.asterisk.org/r/2390/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@383242 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-03-15 17:35:16 +00:00
Kinsey Moore 8c444f823b Make stasis unsubscription functions return NULL
Unsubscribing things in Asterisk seems to very commonly follow with
NULLing out the variable that was unsubscribed. This change makes that
a bit simpler.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@383168 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-03-15 12:58:23 +00:00
Jason Parker 1cb917096b Switch to using external pjproject libraries.
ICE/STUN/TURN support in res_rtp_asterisk is also now optional.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@382900 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-03-12 19:08:59 +00:00
David M. Lee 91eba7dc13 Stasis documentation updates.
(issue ASTERISK-20887)
(issue ASTERISK-20959)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@382724 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-03-08 16:59:02 +00:00
Kinsey Moore c6b06e40dc Add message dump capability to stasis cache layer
The cache dump mechanism allows the developer to retreive multiple
items of a given type (or of all types) from the cache residing in a
stasis caching topic in addition to the existing single-item cache
retreival mechanism.  This also adds to the caching unit tests to
ensure that the new cache dump mechanism is functioning properly.

Review: https://reviewboard.asterisk.org/r/2367/
(issue ASTERISK-21097)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@382705 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-03-08 16:00:14 +00:00
David M. Lee 4edd8be35c This patch adds a new message bus API to Asterisk.
For the initial use of this bus, I took some work kmoore did creating
channel snapshots. So rather than create AMI events directly in the
channel code, this patch generates Stasis events, which manager.c uses
to then publish the AMI event.

This message bus provides a generic publish/subscribe mechanism within
Asterisk. This message bus is:

 - Loosely coupled; new message types can be added in seperate modules.
 - Easy to use; publishing and subscribing are straightforward
   operations.

In addition to basic publish/subscribe, the patch also provides
mechanisms for message forwarding, and for message caching.

(issue ASTERISK-20887)
(closes issue ASTERISK-20959)
Review: https://reviewboard.asterisk.org/r/2339/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@382685 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-03-08 15:15:13 +00:00
Matthew Jordan 80b8c2349c Add a 'secret' probation strictrtp mode to handle delayed changes in RTP source
Often, Asterisk may realize that a change in the source of an RTP stream is
about to occur and ask that the RTP engine reset it's lock on the current RTP
source. In certain scenarios, it may take awhile for the new remote system to
send RTP packets, while the old remote system may continue providing RTP during
that time period. This causes Asterisk to re-lock onto the old source, thereby
rejecting the new source when the old source stops sending RTP and the new
source begins.

This patch prevents that by having a constant secondary, 'secret' probation
mode enabled when an RTP source has been chosen. RTP packets from other sources
are always considered, but never chosen unless the current RTP source stops
sending RTP.

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

(closes issue AST-1124)
Reported by: John Bigelow
Tested by: John Bigelow

(closes issue AST-1125)
Reported by: John Bigelow
Tested by: John Bigelow
........

Merged revisions 382573 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@382589 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-03-07 15:48:06 +00:00
Richard Mudgett 736f4e9420 Fixup some bridge and format capabilities comments and whitespace.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@382392 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-03-04 21:15:36 +00:00
Joshua Colp a4f45a2c95 Add support for registering a sorcery handler which supports multiple fields using a regex.
Review: https://reviewboard.asterisk.org/r/2332/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@382340 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-03-01 18:01:56 +00:00
Richard Mudgett e2832f18bc threadpool: Whitespace and comment corrections.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@382294 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-02-28 21:29:57 +00:00
Jason Parker 6acc9ceb76 Don't undefine bzero()/bcopy().
This was causing build failures against external libraries that happened to use
them, unless silly hacks were added to the modules that used those headers.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@382292 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-02-28 21:21:50 +00:00
Michael L. Young d1f8e338b0 Add The Status Of A Module To The Output Of "CLI> module show"
When a module's configuration is not loadable, we still load the module but it
is not in a running state.  When trying to troubleshoot, let's say, why
chan_motif is ignoring inbound XMPP traffic, there is no way to indicate that a
loaded module is not currently running.

(closes issue ASTERISK-21108)
Reported by: Rusty Newton
Tested by: Michael L. Young
Patches:
  asterisk-21108_add_status-v2.diff Michael L. Young (license 5026)

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@381749 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-02-19 17:17:10 +00:00
Joshua Colp cce1c9547f Add support for retrieving multiple objects from sorcery using a regex on their id.
Review: https://reviewboard.asterisk.org/r/2329/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@381614 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-02-16 16:24:21 +00:00
Matthew Jordan e123ee2d77 Disable strict XML documentation config checking; fix crash caused by sorcery
This patch does two things:
 1. It disables (temporarily) strict XML documentation checking for module
    configurations. We should re-enable it before making any release from
    trunk.
 2. Pass the module flag AST_MODULE through sorcery. This means several of the
    API calls are now macros and will do this automatically for you. The config
    framework needs the module that objects are registering to so it can
    properly construct the documentation. (This was already a required field,
    but sorcery was getting by without it)




git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@381567 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-02-15 18:44:24 +00:00
Kevin Harwell 71bce17720 Stopped spamming of debug messages during attended transfer.
While autoservice is running and servicing a channel the callid is being stored
and removed in the thread's local storage for each iteration of the thread loop.
If debug was set to a sufficient level the log file would be spammed with callid
thread local storage debug messages.

Added a new function that checks to see if the callid to be stored is different
than what is already contained (if anything).  If it is different then
store/replace and log, otherwise just leave as is.  Also made it so all logging
of debug messages pertaining to the callid thread storage outputs only when
TEST_FRAMEWORK is defined.

(issue ASTERISK-21014)
(closes issue ASTERISK-21014)
Report by: Rusty Newton
Review: https://reviewboard.asterisk.org/r/2324/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@381557 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-02-15 17:38:22 +00:00
Matthew Jordan d04ab3c645 Add CLI configuration documentation
This patch allows a module to define its configuration in XML in source, such
that it can be parsed by the XML documentation engine. Documentation is
generated in a two-pass approach:

1. The documentation is first generated from the XML pulled from the source
2. The documentation is then enhanced by the registration of configuration
   options that use the configuration framework

This patch include configuration documentation for the following modules:
 * chan_motif
 * res_xmpp
 * app_confbridge
 * app_skel
 * udptl

Two new CLI commands have been added:
 * config show help - show configuration help by module, category, and item
 * xmldoc dump - dump the in-memory representation of the XML documentation to
   a new XML file.

Review: https://reviewboard.asterisk.org/r/2278
Review: https://reviewboard.asterisk.org/r/2058

patches:
  on review 2058 uploaded by twilson



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@381527 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-02-15 13:38:12 +00:00
Kinsey Moore 2e1e0735fe Revamp of terminal color codes
The core module related to coloring terminal output was old and needed
some love.  The main thing here was an attempt to get rid of the
obscene number of stack-local buffers that were allocated for no other
reason than to colorize some output.  Instead, this uses a simple trick
to allocate several buffers within threadlocal storage, then
automatically rotates between them, so that you can make multiple calls
to the colorization routine within one function and not need to
allocate multiple buffers.

Review: https://reviewboard.asterisk.org/r/2241/
Patches:
    bug.patch uploaded by Tilghman Lesher


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@381448 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-02-14 18:47:56 +00:00
Sean Bright 064c65d5a2 Update the name of the update_tags utility in the git mirror how-to.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@381398 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-02-14 14:45:09 +00:00
David M. Lee 222e8a3afb Add a serializer interface to the threadpool
This patch adds the ability to create a serializer from a thread pool. A
serializer is a ast_taskprocessor with the same contract as a default
taskprocessor (tasks execute serially) except instead of executing out
of a dedicated thread, execution occurs in a thread from a
ast_threadpool. Think of it as a lightweight thread.

While it guarantees that each task will complete before executing the
next, there is no guarantee as to which thread from the pool individual
tasks will execute. This normally only matters if your code relys on
thread specific information, such as thread locals.

This patch also fixes a bug in how the 'was_empty' parameter is computed
for the push callback, and gets rid of the unused 'shutting_down' field.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@381326 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-02-12 21:45:59 +00:00
Kinsey Moore b6b9dfb09b Fix compilation error with REF_DEBUG
When the red/black tree work was committed, there was an extra ", " in
the REF_DEBUG definition of ao2_container_alloc_rbtree.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@381218 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-02-11 21:10:53 +00:00
Joshua Colp 27882b8599 Add additional functionality to the Sorcery API.
This commit adds native implementation support for copying and diffing objects,
as well as the ability to load or reload on a per-object type level.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@381134 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-02-10 14:58:37 +00:00
Richard Mudgett 5b236ee647 Make ast_do_masquerade() a void function.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@381086 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-02-09 01:31:55 +00:00
Kinsey Moore 67102c3d3f Add aggregate operations for stuctures with string fields
Add struct-level comparison and copying of string fields to reduce the
complexity of whole-struct comparison and copying when using string
fields. The new macros do not take into account non-stringfield data.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@381017 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-02-07 15:16:44 +00:00
Richard Mudgett 683726a5e7 Eliminate an unused lock in ast_bridge_channel.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@380654 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-31 18:14:55 +00:00
Richard Mudgett 3058e2fb2d Make CHECK_BLOCKING() debug message more useful.
Change the displayed pthread value to hex format so it can be easily
matched with CLI core show threads or gdb.
........

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

Merged revisions 380612 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@380613 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-31 00:37:03 +00:00
Matthew Jordan 148b6e7fba Update configure script to be compatible with ptlib 2.10.9
With ptlib 2.10.9, the configure script fails due to grep returning multiple
matches for the pattern it searches for. This patch updates the pattern
matching to return only the actual version for the symbol searched for,
PTLIB_VERSION.

(closes issue ASTERISK-20980)
Reported by: Stefan Reuter
patches:
  ASTERISK-20980-1.patch uploaded by Stefan Reuter (license 5339)
........

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

Merged revisions 380298 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@380299 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-29 02:12:04 +00:00
Joshua Colp 3fa4278a31 Merge the sorcery data access layer API.
Sorcery is a unifying data access layer which provides a pluggable mechanism to allow
object creation, retrieval, updating, and deletion using different backends (or wizards).

This is a fancy way of saying "one interface to rule them all" where them is configuration,
realtime, and anything else that comes along.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@380069 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-25 14:01:04 +00:00
Matthew Jordan 7d9871b394 Add ControlPlayback manager action
This patch adds the capability for asynchronous manipulation of audio being
played back to a channel though a new AMI action "ControlPlayback". The
ControlPlayback action supports a number of operations, the availability of
which depend on the application being used to send audio to the channel.
When the audio playback was initiated using the ControlPlayback application
or CONTROL STREAM FILE AGI command, the audio can be paused, stopped,
restarted, reversed, or skipped forward. When initiated by other mechanisms
(such as the Playback application), the audio can be stopped, reversed, or
skipped forward.

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

(closes issue ASTERISK-20882)
Reported by: mjordan



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@379830 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-22 15:16:20 +00:00
Richard Mudgett c6e6b7f2f1 Made some bridging API calls void. Some bridging comments updated.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@379753 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-21 20:15:57 +00:00
Richard Mudgett 25c9940fc1 Bridge API comment tweaks.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@379703 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-21 17:55:48 +00:00
Walter Doekes e6a3674150 Add builtin roundf() for systems lacking it.
(closes issue ASTERISK-16854)
Review: https://reviewboard.asterisk.org/r/2276
Reported-by: Ovidiu Sas
........

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

Merged revisions 379548 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@379549 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-19 20:54:07 +00:00
Mark Michelson 84c50fde1f Address David's latest feedback on reviewboard:
* Add a max_size option for threadpools. Also added a test for this option.
* Fixed comments to be more accurate and have fewer typos.
* Updated copyright dates on new files.



git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@379375 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-17 16:04:10 +00:00
Mark Michelson a73d6e5b86 Add doxygen to accessors and increase refcount of taskprocessor before returning.
git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@379127 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-15 21:15:04 +00:00
Mark Michelson 967e380ba8 Make the threadpool listener opaque.
git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@379126 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-15 21:09:55 +00:00
Mark Michelson 663479a558 Make ast_taskprocessor_listener opaque.
git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@379125 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-15 20:48:45 +00:00
Mark Michelson 03e89247de Address further review feedback from David Lee.
* Clarify some documentation
* Change copyright date of taskprocessor files
* Address potential issue of creating taskprocessor with listener if
  taskprocessor with that name exists already



git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@379124 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-15 20:15:00 +00:00
Mark Michelson c6bc51ef28 Make the initial size of the threadpool part of the options passed in.
git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@379123 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-15 19:44:25 +00:00
Mark Michelson edc2e4dac0 Remove threadpool listener alloc and destroy callbacks.
This replaces the destroy callback with a shutdown callback
instead.



git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@379122 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-15 19:36:33 +00:00
Mark Michelson 65c7d6e2c3 Remove alloc and destroy callbacks from the taskprocessor.
Now user data is allocated by the creator of the taskprocessor
listener and that user data is passed into ast_taskprocessor_listener_alloc().
Similarly, freeing of the user data is left up to the user himself. He can
free the data when the taskprocessor shuts down, or he can choose to hold
onto it if it makes sense to do so.

This, unsurprisingly, makes threadpool allocation a LOT cleaner now.



git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@379120 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-15 18:40:36 +00:00
Automerge script c80f86f007 Merged revisions 379070 via svnmerge from
file:///srv/subversion/repos/asterisk/trunk

........
  r379070 | dlee | 2013-01-14 15:47:31 -0600 (Mon, 14 Jan 2013) | 1 line
  
  Fixed doc comment for ast_test_validate
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@379081 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-14 22:19:58 +00:00
Automerge script 0d3dfad94f Merged revisions 379021,379023 via svnmerge from
file:///srv/subversion/repos/asterisk/trunk

................
  r379021 | dlee | 2013-01-14 09:29:22 -0600 (Mon, 14 Jan 2013) | 15 lines
  
  Fix XML encoding of 'identity display' in NOTIFY messages, continued.
  
  When r378933 was merged into 1.8, it should have also escaped
  remote_display, since it will have the same XML encoding problem when
  the caller/callee roles are reversed.
  
  (closes issue ABE-2902)
  Reported by: Guenther Kelleter
  ........
  
  Merged revisions 379001 from http://svn.asterisk.org/svn/asterisk/branches/1.8
  ........
  
  Merged revisions 379020 from http://svn.asterisk.org/svn/asterisk/branches/11
................
  r379023 | dlee | 2013-01-14 09:58:01 -0600 (Mon, 14 Jan 2013) | 20 lines
  
  Masquerades are an insane implementation detail within Asterisk. It generates
  a number of useless and confusing events, and manipulates channels in a way
  that semantically doesn't make sense. I've given a fairly thorough review of
  masquerade code and its usage on the wiki at
  https://wiki.asterisk.org/wiki/x/IwBRAQ.
  
  While ultimately it makes the most sense to abandon masquerades altogether,
  it will take some time to completely irradicate. Even then, there may always
  be code that's not worth rewriting to get rid of the masquerade.
  
  This patch does two things to make masquerades slightly less insane:
   * When swapping the names of the original and clone channel, only emit a
     single rename event of original -> original<ZOMBIE>. The original code
     issued three rename events to accomplish the same end.
   * In addition to swapping the names of the channels, also swap their
     uniqueid's. This allows the 'Uniqueid' field to be used as a stable
     identifier for a channel from and external interface, such as AMI.
  
  Review: https://reviewboard.asterisk.org/r/2266/
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@379032 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-14 16:20:46 +00:00
Automerge script f7f7850f7a Merged revisions 378935 via svnmerge from
file:///srv/subversion/repos/asterisk/trunk

................
  r378935 | dlee | 2013-01-12 00:43:37 -0600 (Sat, 12 Jan 2013) | 41 lines
  
  Fix XML encoding of 'identity display' in NOTIFY messages.
  
  XML encoding in chan_sip is accomplished by naively building the XML
  directly from strings. While this usually works, it fails to take into
  account escaping the reserved characters in XML.
  
  This patch adds an 'ast_xml_escape' function, which works similarly to
  'ast_uri_encode'. This is used to properly escape the local_display
  attribute in XML formatted NOTIFY messages.
  
  Several things to note:
   * The Right Thing(TM) to do would probably be to replace the
     ast_build_string stuff with building an ast_xml_doc. That's a much
     bigger change, and out of scope for the original ticket, so I
     refrained myself.
   * It is with great sadness that I wrote my own ast_xml_escape
     function. There's one in libxml2, but it's knee-deep in
     libxml2-ness, and not easily used to one-off escape a
     string.
   * I only escaped the string we know is causing problems
     (local_display). At least some of the other strings are
     URI-encoded, which should be XML safe. Rather than figuring out
     what's safe and escaping what's not, it would be much cleaner to
     simply build an ast_xml_doc for the messages and let the XML
     library do the XML escaping. Like I said, that's out of scope.
  
  (closes issue ABE-2902)
  Reported by: Guenther Kelleter
  Tested by: Guenther Kelleter
  Review: http://reviewboard.digium.internal/r/365/
  
  ........
  
  Merged revision 378919 from https://origsvn.digium.com/svn/asterisk/be/branches/C.3-bier
  ........
  
  Merged revisions 378933 from http://svn.asterisk.org/svn/asterisk/branches/1.8
  ........
  
  Merged revisions 378934 from http://svn.asterisk.org/svn/asterisk/branches/11
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@378946 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-12 07:21:01 +00:00
Automerge script 2c1720b4f7 Merged revisions 378915,378918 via svnmerge from
file:///srv/subversion/repos/asterisk/trunk

................
  r378915 | dlee | 2013-01-11 16:31:42 -0600 (Fri, 11 Jan 2013) | 21 lines
  
  Add JSON API for Asterisk.
  
  This provides a JSON API by pulling in and wrapping the Jansson JSON
  library[1]. The Asterisk API basically mirrors the Jansson
  functionality, with a few minor tweaks.
  
   * Some names have been asteriskified to protect the innocent.
   * Jansson provides both reference-stealing and reference-borrowing
     versions of several API's. The Asterisk API is exclusively
     reference-stealing for operations that put elements into arrays and
     objects.
   * No support for doubles, since we usually don't need that.
   * Coming along for the ride is the ast_test_validate macro, which made
     the unit tests much easier to write.
  
   [1]: http://www.digip.org/jansson/
  
  (issue ASTERISK-20887)
  (closes issue ASTERISK-20888)
  Review: https://reviewboard.asterisk.org/r/2264/
................
  r378918 | file | 2013-01-11 17:05:38 -0600 (Fri, 11 Jan 2013) | 11 lines
  
  Retain XMPP filters across reconnections so external modules continue to function as expected.
  
  Previously if an XMPP client reconnected any filters added by an external module were lost.
  This issue exhibited itself with chan_motif not receiving and reacting to Jingle signaling.
  
  (closes issue ASTERISK-20916)
  Reported by: kuj
  ........
  
  Merged revisions 378917 from http://svn.asterisk.org/svn/asterisk/branches/11
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@378927 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-11 23:20:57 +00:00
Automerge script e844969fba Merged revisions 378840 via svnmerge from
file:///srv/subversion/repos/asterisk/trunk

........
  r378840 | rmudgett | 2013-01-09 16:56:08 -0600 (Wed, 09 Jan 2013) | 2 lines
  
  Trivial misc bridge code changes.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@378851 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-09 23:20:35 +00:00
Automerge script 7a06fdad89 Merged revisions 378823 via svnmerge from
file:///srv/subversion/repos/asterisk/trunk

........
  r378823 | rmudgett | 2013-01-09 16:15:41 -0600 (Wed, 09 Jan 2013) | 2 lines
  
  Tweaked __ast_test_suite_assert_notify() and __ast_test_suite_event_notify() to be void functions.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@378833 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-09 22:20:40 +00:00
Automerge script 613b972cc5 Merged revisions 378783,378789-378790 via svnmerge from
file:///srv/subversion/repos/asterisk/trunk

................
  r378783 | dlee | 2013-01-09 14:30:33 -0600 (Wed, 09 Jan 2013) | 14 lines
  
  Fix end condition in ast_rtp_lookup_mime_multiple2.
  
  The erroneous end condition would never include the AST_RTP_CISCO_DTMF flag
  in the debug output.
  
  (closes issue ASTERISK-20772)
  Reported by: Xavier Hienne
  ........
  
  Merged revisions 378776 from http://svn.asterisk.org/svn/asterisk/branches/1.8
  ........
  
  Merged revisions 378780 from http://svn.asterisk.org/svn/asterisk/branches/11
................
  r378789 | rmudgett | 2013-01-09 14:56:23 -0600 (Wed, 09 Jan 2013) | 4 lines
  
  * Found some more places to use ast_channel_lock_both().
  
  * Minor optimization in ast_rtp_instance_early_bridge().
................
  r378790 | rmudgett | 2013-01-09 15:14:39 -0600 (Wed, 09 Jan 2013) | 4 lines
  
  * Whitespace changes.
  
  * Made ast_test_init() match its prototype.
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@378801 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-09 21:21:11 +00:00
Automerge script 2ba33b4c3a Merged revisions 378735,378748 via svnmerge from
file:///srv/subversion/repos/asterisk/trunk

................
  r378735 | dlee | 2013-01-09 13:38:53 -0600 (Wed, 09 Jan 2013) | 13 lines
  
  Replace errant tabs with spaces in causes.h.
  
  (closes issue ASTERISK-20826)
  Reported by: snuffy
  Patches:
  	notabs.dif uploaded by snuffy (license 5024)
  ........
  
  Merged revisions 378733 from http://svn.asterisk.org/svn/asterisk/branches/1.8
  ........
  
  Merged revisions 378734 from http://svn.asterisk.org/svn/asterisk/branches/11
................
  r378748 | dlee | 2013-01-09 14:12:00 -0600 (Wed, 09 Jan 2013) | 13 lines
  
  Move declaration of ast_regex_string_to_regex_pattern futher down strings.h.
  
  The prior location is before the declaration of struct ast_str, which causes
  compiler warnings.
  
  (closes issue ASTERISK-20852)
  Reported by: Pavel Troller
  Patches:
  	strings.diff uploaded by Pavel Troller (license 6302)
  ........
  
  Merged revisions 378747 from http://svn.asterisk.org/svn/asterisk/branches/11
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@378759 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-09 20:21:33 +00:00
Mark Michelson bdd8da406b Address review board feedback from Matt and Richard
* Remove extraneous whitespace
* Bump up debug levels of messages and add identifying info to messages.
* Account for potential failures of ao2_link()
* Add additional test and some more test data
* Add some comments in places where they could be useful
* Make threadpool listeners and their callbacks optional



git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@378652 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-07 22:16:06 +00:00
Automerge script b375abae50 Merged revisions 378374,378377,378384 via svnmerge from
file:///srv/subversion/repos/asterisk/trunk

................
  r378374 | rmudgett | 2013-01-02 15:23:16 -0600 (Wed, 02 Jan 2013) | 33 lines
  
  Fix AMI redirect action with two channels failing to redirect both channels.
  
  The AMI redirect action can fail to redirect two channels that are bridged
  together.  There is a race between the AMI thread redirecting the two
  channels and the bridge thread noticing that a channel is hungup from the
  redirects.
  
  * Made the bridge wait for both channels to be redirected before exiting.
  
  * Made the AMI redirect check that all required headers are present before
  proceeding with the redirection.
  
  * Made the AMI redirect require that any supplied ExtraChannel exist
  before proceeding.  Previously the code fell back to a single channel
  redirect operation.
  
  (closes issue ASTERISK-18975)
  Reported by: Ben Klang
  
  (closes issue ASTERISK-19948)
  Reported by: Brent Dalgleish
  Patches:
        jira_asterisk_19948_v11.patch (license #5621) patch uploaded by rmudgett
  Tested by: rmudgett, Thomas Sevestre, Deepak Lohani, Kayode
  
  Review: https://reviewboard.asterisk.org/r/2243/
  ........
  
  Merged revisions 378356 from http://svn.asterisk.org/svn/asterisk/branches/1.8
  ........
  
  Merged revisions 378358 from http://svn.asterisk.org/svn/asterisk/branches/11
................
  r378377 | mjordan | 2013-01-02 16:10:32 -0600 (Wed, 02 Jan 2013) | 24 lines
  
  Prevent crashes from occurring when reading from data sources with large values
  
  When reading configuration data from an Asterisk .conf file or when pulling
  data from an Asterisk RealTime backend, Asterisk was copying the data on the
  stack for manipulation. Unfortunately, it is possible to read configuration
  data or realtime data from some data source that provides a large blob of
  characters. This could potentially cause a crash via a stack overflow.
  
  This patch prevents large sets of data from being read from an ARA backend or
  from an Asterisk conf file.
  
  (issue ASTERISK-20658)
  Reported by: wdoekes
  Tested by: wdoekes, mmichelson
  patches:
   * issueA20658_dont_process_overlong_config_lines.patch uploaded by wdoekes (license 5674)
   * issueA20658_func_realtime_limit.patch uploaded by wdoekes (license 5674)
  ........
  
  Merged revisions 378375 from http://svn.asterisk.org/svn/asterisk/branches/1.8
  ........
  
  Merged revisions 378376 from http://svn.asterisk.org/svn/asterisk/branches/11
................
  r378384 | mjordan | 2013-01-02 16:19:32 -0600 (Wed, 02 Jan 2013) | 11 lines
  
  Clean up app_mysql's application entry points to properly parse arguments
  
  When parsing arguments, application entry points should not attempt to
  directly modify the parameters to the function. This patch properly duplicates
  the passed in parameters before attempting to parse them.
  
  (issue ASTERISK-20658)
  Reported by: wdoekes
  patches:
    issueA20658_sanitize_app_mysql.patch uploaded by wdoekes (license 5674)
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@378385 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-02 22:19:49 +00:00
Automerge script 675914bb17 Merged revisions 378322 via svnmerge from
file:///srv/subversion/repos/asterisk/trunk

................
  r378322 | mjordan | 2013-01-02 12:11:59 -0600 (Wed, 02 Jan 2013) | 33 lines
  
  Prevent exhaustion of system resources through exploitation of event cache
  
  Asterisk maintains an internal cache for devices in the event subsystem. The
  device state cache holds the state of each device known to Asterisk, such that
  consumers of device state information can query for the last known state for
  a particular device, even if it is not part of an active call. The concept of
  a device in Asterisk can include entities that do not have a physical
  representation. One way that this occurred was when anonymous calls are allowed
  in Asterisk. A device was automatically created and stored in the cache for
  each anonymous call that occurred; this was possible in the SIP and IAX2
  channel drivers and through channel drivers that utilized the
  res_jabber/res_xmpp resource modules (Gtalk, Jingle, and Motif). These devices
  are never removed from the system, allowing anonymous calls to potentially
  exhaust a system's resources.
  
  This patch changes the event cache subsystem and device state management to
  no longer cache devices that are not associated with a physical entity.
  
  (issue ASTERISK-20175)
  Reported by: Russell Bryant, Leif Madsen, Joshua Colp
  Tested by: kmoore
  patches:
    event-cachability-3.diff uploaded by jcolp (license 5000)
  ........
  
  Merged revisions 378303 from http://svn.asterisk.org/svn/asterisk/branches/1.8
  ........
  
  Merged revisions 378320 from http://svn.asterisk.org/svn/asterisk/branches/10
  ........
  
  Merged revisions 378321 from http://svn.asterisk.org/svn/asterisk/branches/11
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@378329 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-02 18:20:03 +00:00
Automerge script 5af578c022 Merged revisions 378000-378002 via svnmerge from
file:///srv/subversion/repos/asterisk/trunk

................
  r378000 | seanbright | 2012-12-13 15:20:32 -0600 (Thu, 13 Dec 2012) | 8 lines
  
  Make generate_exchange_uuid() always return the passed ast_str pointer.
  
  I changed this code earlier to return NULL if it wasn't able to generate a UUID,
  whereas the earlier code would always return the ast_str that was passed in.
  Switch back to returning the ast_str, only set it to the empty string instead if
  UUID generation fails.  We still do a validity check later which will catch this
  and blow up if necessary.
................
  r378001 | wedhorn | 2012-12-13 15:25:31 -0600 (Thu, 13 Dec 2012) | 9 lines
  
  Minor fixes for chan_skinny
  
  Whitespace, change SUBSTATE_ONHOOK to correct SKINNY_ONHOOK and 
  correct len of 2 strcmp in skinny_setdebug(). (see opticron's review
  on https://reviewboard.asterisk.org/r/2240/)
  ........
  
  Merged revisions 377991 from http://svn.asterisk.org/svn/asterisk/branches/11
................
  r378002 | rmudgett | 2012-12-13 15:28:15 -0600 (Thu, 13 Dec 2012) | 35 lines
  
  confbridge: Fix MOH on simultaneous user entry to a new conference.
  
  When two users entered a new conference simultaneously, one of the callers
  hears MOH.  This happened if two unmarked users entered simultaneously and
  also if a waitmarked and a marked user entered simultaneously.
  
  * Created a confbridge internal MOH API to eliminate the inlined MOH
  handling code.  Note that the conference mixing bridge needs to be locked
  when actually starting/stopping MOH because there is a small window
  between the conference join unsuspend MOH and actually joining the mixing
  bridge.
  
  * Created the concept of suspended MOH so it can be interrupted while
  conference join announcements to the user and DTMF features can operate.
  
  * Suspend any MOH until the user is about to actually join the mixing
  bridge of the conference.  This way any pre-join file playback does not
  need to worry about MOH.
  
  * Made post-join actions only play deferred entry announcement files.
  Changing the user/conference state during that time is not protected or
  controlled by the state machine.
  
  (closes issue ASTERISK-20606)
  Reported by: Eugenia Belova
  Tested by: rmudgett
  
  Review: https://reviewboard.asterisk.org/r/2232/
  ........
  
  Merged revisions 377992 from http://svn.asterisk.org/svn/asterisk/branches/10
  ........
  
  Merged revisions 377993 from http://svn.asterisk.org/svn/asterisk/branches/11
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@378003 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-12-13 22:17:36 +00:00
Automerge script 3f3ab25f91 Merged revisions 377981 via svnmerge from
file:///srv/subversion/repos/asterisk/trunk

........
  r377981 | dlee | 2012-12-13 10:43:40 -0600 (Thu, 13 Dec 2012) | 1 line
  
  Bail configure if it can't find libuuid.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@377982 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-12-13 17:17:34 +00:00
Mark Michelson ece4c95798 Resolve conflict and reset automerge.
git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@377980 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-12-13 16:39:40 +00:00
Mark Michelson f5e9cf5975 Add automerge property back after conflict.
git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@377879 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-12-11 21:52:09 +00:00
Mark Michelson 7995bc63c7 Some general cleanup, plus we now send state changes when threads activate.
This is now ready for review board, imo!



git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@377805 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-12-11 16:53:16 +00:00
Mark Michelson 8760e32ae3 Add auto-increment option and accompanying test.
This allows for the threadpool to automatically grow if tasks
are pushed to it and no idle threads are currently available.



git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@377803 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-12-11 16:34:00 +00:00
Mark Michelson 29fc122783 Some documentation fixes and function call name fixes.
The documentation for taskprocessors was incorrect with
regards to when a listener's alloc callback was called.

I also made the names of queued function calls in the
threadpool more uniform.



git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@377802 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-12-11 04:23:31 +00:00
Mark Michelson 1310e659bd Solve the issue about the "CHANGE THIS" and "XXX CHANGE THIS XXX" taskprocessor names.
Unfortunately, this required a taskprocessor listener change that makes listener allocation
utterly silly. I'm going to change the scheme so that allocation of taskprocessor listeners
is done internally within taskprocessor code. This will make it parallel with threadpool
code, which is a good thing.



git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@377687 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-12-10 20:14:23 +00:00
Mark Michelson 64deed062a Add threadpool options and accompanying test.
The only test added so far is an idle thread timeout
option. This will greatly aid threadpool users who wish
to maintain a threadpool by allowing for idle threads to
die out as necessary.

Test passes.



git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@377580 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-12-10 06:13:09 +00:00
Mark Michelson 4590bfd93d Add new threadpool test and fix some taskprocessor bugs.
The new thread creation test fails because Asterisk locks up
while trying to lock a taskprocessor.

While trying to debug that, I found a race condition during taskprocessor
creation where a default taskprocessor listener could try to operate on
a partially started taskprocessor. This was fixed by adding a new callback
to taskprocessor listeners.

Then while testing that change, I found some bugs in the taskprocessor
tests where I was not properly unlocking when done with a lock. Scoped
locks have spoiled me a bit.

I still have not figured out why the threadpool thread creation test
is locking up.



git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@377368 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-12-07 00:30:35 +00:00
Automerge script 521f9e8dfe Merged revisions 377245-377246 via svnmerge from
file:///srv/subversion/repos/asterisk/trunk

................
  r377245 | rmudgett | 2012-12-04 20:20:57 -0600 (Tue, 04 Dec 2012) | 8 lines
  
  Fix registering core show codecs/codec CLI commands twice.
  ........
  
  Merged revisions 377241 from http://svn.asterisk.org/svn/asterisk/branches/10
  ........
  
  Merged revisions 377244 from http://svn.asterisk.org/svn/asterisk/branches/11
................
  r377246 | rmudgett | 2012-12-04 20:23:10 -0600 (Tue, 04 Dec 2012) | 1 line
  
  Remove init_framer(). It no longer does anything.
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@377251 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-12-05 03:19:08 +00:00
Mark Michelson cc63d2c380 Add better listener support.
Add some parameters to listener callbacks.
Add alloc and destroy callbacks for listeners.
Add public function for allocating a listener.



git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@377226 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-12-04 23:45:39 +00:00
Mark Michelson 2158005bdb Remove zombie state from threadpool altogether.
After giving it some consideration, there's no real
use for zombie threads. Listeners can't really use the
current number of zombie threads as a way of gauging activity,
zombifying threads is just an extra step before they die that
really serves no purpose, and since there's no way to re-animate
zombies, the operation does not need to be around.

I also fixed up some miscellaneous compilation errors that
were lingering from some past revisions.



git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@377211 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-12-04 22:11:31 +00:00
Mark Michelson a37fb2e8c8 Add some doxygen and rearrange code.
git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@377209 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-12-04 21:11:34 +00:00
Automerge script d53adbe449 Merged revisions 377138 via svnmerge from
file:///srv/subversion/repos/asterisk/trunk

................
  r377138 | rmudgett | 2012-12-03 14:46:11 -0600 (Mon, 03 Dec 2012) | 23 lines
  
  Cleanup core main on exit.
  
  * Cleanup time zones on exit.
  
  * Make exit clean/unclean report consistent for AMI and CLI in
  really_quit().
  
  (issue ASTERISK-20649)
  Reported by: Corey Farrell
  Patches:
        core-cleanup-1_8-10.patch (license #5909) patch uploaded by Corey Farrell
        core-cleanup-11-trunk.patch (license #5909) patch uploaded by Corey Farrell
        Modified
  ........
  
  Merged revisions 377135 from http://svn.asterisk.org/svn/asterisk/branches/1.8
  ........
  
  Merged revisions 377136 from http://svn.asterisk.org/svn/asterisk/branches/10
  ........
  
  Merged revisions 377137 from http://svn.asterisk.org/svn/asterisk/branches/11
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@377145 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-12-03 21:19:40 +00:00
Mark Michelson e7ce12839d This now compiles.
That's a milestone, of sorts. Things really need
arranging/documenting, and there's no function to
be able to push tasks to a threadpool.



git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@377036 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-12-03 16:59:26 +00:00
Mark Michelson ddde765c59 Commit some progress towards threadpools.
Does this compile? Not even close.
But I figure I don't want to lose this all in the case
of some catastrophe.



git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@376833 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-29 18:54:51 +00:00
Automerge script 8c84eb128f Merged revisions 376630 via svnmerge from
file:///srv/subversion/repos/asterisk/trunk

................
  r376630 | rmudgett | 2012-11-27 11:54:25 -0600 (Tue, 27 Nov 2012) | 13 lines
  
  Made AST_LIST_REMOVE() simpler and use better names.
  
  * Update doxygen of AST_LIST_REMOVE().
  ........
  
  Merged revisions 376627 from http://svn.asterisk.org/svn/asterisk/branches/1.8
  ........
  
  Merged revisions 376628 from http://svn.asterisk.org/svn/asterisk/branches/10
  ........
  
  Merged revisions 376629 from http://svn.asterisk.org/svn/asterisk/branches/11
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@376637 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-27 18:20:18 +00:00
Automerge script 37ae4ad43f Merged revisions 376589 via svnmerge from
file:///srv/subversion/repos/asterisk/trunk

................
  r376589 | mjordan | 2012-11-22 18:02:23 -0600 (Thu, 22 Nov 2012) | 29 lines
  
  Re-initialize logmsgs mutex upon logger initialization to prevent lock errors
  
  Similar to the patch that moved the fork earlier in the startup sequence to
  prevent mutex errors in the recursive mutex surrounding the read/write thread
  registration lock, this patch re-initializes the logmsgs mutex.  Part of the
  start up sequence before forking the process into the background includes
  reading asterisk.conf; this has to occur prior to the call to daemon in order
  to read startup parameters.  When reading in a conf file, log statements can
  be generated.  Since this can't be avoided, the mutex instead is
  re-initialized to ensure a reset of any thread tracking information.
  
  This patch also includes some additional debugging to catch errors when
  locking or unlocking the recursive mutex that surrounds locks when the
  DEBUG_THREADS build option is enabled.  DO_CRASH or THREAD_CRASH will
  cause an abort() if a mutex error is detected.
  
  (issue ASTERISK-19463)
  Reported by: mjordan
  Tesetd by: mjordan
  ........
  
  Merged revisions 376586 from http://svn.asterisk.org/svn/asterisk/branches/1.8
  ........
  
  Merged revisions 376587 from http://svn.asterisk.org/svn/asterisk/branches/10
  ........
  
  Merged revisions 376588 from http://svn.asterisk.org/svn/asterisk/branches/11
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@376596 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-23 00:20:55 +00:00
Automerge script d16d0200d2 Merged revisions 376575 via svnmerge from
file:///srv/subversion/repos/asterisk/trunk

........
  r376575 | rmudgett | 2012-11-21 12:33:16 -0600 (Wed, 21 Nov 2012) | 20 lines
  
  Add red-black tree container type to astobj2.
  
  * Add red-black tree container type.
  
  * Add CLI command "astobj2 container dump <name>"
  
  * Added ao2_container_dump() so the container could be dumped by other
  modules for debugging purposes.
  
  * Changed ao2_container_stats() so it can be used by other modules like
  ao2_container_check() for debugging purposes.
  
  * Updated the unit tests to check red-black tree containers.
  
  (closes issue ASTERISK-19970)
  Reported by: rmudgett
  Tested by: rmudgett
  
  Review: https://reviewboard.asterisk.org/r/2110/
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@376580 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-21 19:20:22 +00:00
Mark Michelson e2196d7981 Get rid of trailing whitespace.
git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@376500 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-19 22:34:27 +00:00
Mark Michelson f4328e109d Reorganize code and change behavior of ast_taskprocessor_execute() when taskprocessor is shutting down.
Moved code around to be easier to follow.

ast_taskprocessor_execute() will now return 0 if the taskprocessor is being shut down.



git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@376499 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-19 21:31:32 +00:00
Mark Michelson 2b36cbe2d5 Change the write-up on taskprocessors to reflect the new design.
git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@376382 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-16 04:44:12 +00:00
Mark Michelson 12de4198b8 Add a shutdown callback to taskprocessor listeners.
This helps account for the fact that it is unknown just
how many references may exist for a given taskprocessor
listener, so simply unreffing it from the taskprocessor
shutdown function is not enough to convey the gravity
of the situation.

By putting in a shutdown callback, it now becomes clear
to the listener not to try to do any further operations
on the taskprocessor.



git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@376381 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-16 04:33:53 +00:00
Automerge script e8898ec8ba Merged revisions 376341,376344-376345 via svnmerge from
file:///srv/subversion/repos/asterisk/trunk

................
  r376341 | dlee | 2012-11-15 18:08:00 -0600 (Thu, 15 Nov 2012) | 34 lines
  
  Migrate hashtest/hashtest2 to be unit tests.
  
  Both hashtest and hashtest2 are manual testing apps that thrash hash
  tables (hashtab and ao2 containers, respectively), by spinning up
  several threads that randomly insert, delete, lookup and iterate over
  the hash table. If the app doesn't crash, the hash table probably passes
  the test. Those utils are not a part of the typical Asterisk build, so
  they do not usually get compiled. This all makes them less that useful.
  
  This patch removes those manual test programs and replaces them with
  Asterisk unit test modules (test_{hashtab,astobj2}_thrash.so). It also
  attempts to make the tests more deterministic.
  
  * Rather than spinning up some number of threads that operate on the
    hash table randomly, spin up four threads that concurrenly add,
    remove, lookup and iterate over the hash table.
  * Each thread checks the state of the hash table both during and after
    execution, and indicates a test failure if things are not as expected.
  * Each thread times out after 60 seconds to prevent deadlocking the unit
    test run.
  
  (closes issue ASTERISK-20505)
  Reported by: Matt Jordan
  Review: https://reviewboard.asterisk.org/r/2189/
  ........
  
  Merged revisions 376306 from http://svn.asterisk.org/svn/asterisk/branches/1.8
  ........
  
  Merged revisions 376315 from http://svn.asterisk.org/svn/asterisk/branches/10
  ........
  
  Merged revisions 376339 from http://svn.asterisk.org/svn/asterisk/branches/11
................
  r376344 | dlee | 2012-11-15 18:14:00 -0600 (Thu, 15 Nov 2012) | 1 line
  
  Somehow I put in svn-1.6 merge information. Oops.
................
  r376345 | dlee | 2012-11-15 18:15:30 -0600 (Thu, 15 Nov 2012) | 15 lines
  
  Fixed extconf.c breakage introduced in r376306.
  
  To quote wdoekes:
  > Note that I'm not confirming legitimacy of having that file in tree at
  > all. Is anyone using aelparse/conf2ael?
  ........
  
  Merged revisions 376340 from http://svn.asterisk.org/svn/asterisk/branches/1.8
  ........
  
  Merged revisions 376342 from http://svn.asterisk.org/svn/asterisk/branches/10
  ........
  
  Merged revisions 376343 from http://svn.asterisk.org/svn/asterisk/branches/11
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@376352 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-16 00:19:48 +00:00
Mark Michelson a4a48d9274 Add doxygen and constify some things.
git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@376123 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-09 22:49:25 +00:00
Mark Michelson d5716ecae2 Genericize the allocation and destruction of taskprocessor listeners.
The goal of this is to take the responsibility away from individual
listeners to be sure to properly unref the taskprocessor.



git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@376121 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-09 22:28:10 +00:00
Mark Michelson 77725bf293 Move taskprocessors to use a listener model.
Taskprocessors are now divided into two units: the task queue
and their listeners.

When a task is added to the queue, the listener is notified and
can take whatever action is desired. This means that taskprocessors
are no longer confined to having their tasks executed within a 
single thread.

A default taskprocessor listener has been added that mirrors the
old taskprocessor behavior.

I've tested it by running Asterisk and placing calls. It appears
to work as expected. I'm going to do some cleaning up first and
then write some unit tests to be sure everything works as expected.



git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@376118 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-08 23:27:16 +00:00
Automerge script f69513b85b Merged revisions 376049 via svnmerge from
file:///srv/subversion/repos/asterisk/trunk

................
  r376049 | rmudgett | 2012-11-08 11:38:31 -0600 (Thu, 08 Nov 2012) | 41 lines
  
  Add MALLOC_DEBUG enhancements.
  
  * Makes malloc() behave like calloc().  It will return a memory block
  filled with 0x55.  A nonzero value.
  
  * Makes free() fill the released memory block and boundary fence's with
  0xdeaddead.  Any pointer use after free is going to have a pointer
  pointing to 0xdeaddead.  The 0xdeaddead pointer is usually an invalid
  memory address so a crash is expected.
  
  * Puts the freed memory block into a circular array so it is not reused
  immediately.
  
  * When the circular array rotates out a memory block to the heap it checks
  that the memory has not been altered from 0xdeaddead.
  
  * Made the astmm_log message wording better.
  
  * Made crash if the DO_CRASH menuselect option is enabled and something is
  found.
  
  * Fixed a potential alignment issue on 64 bit systems.
  struct ast_region.data[] should now be aligned correctly for all
  platforms.
  
  * Extracted region_check_fences() from __ast_free_region() and
  handle_memory_show().
  
  * Updated handle_memory_show() CLI usage help.
  
  Review: https://reviewboard.asterisk.org/r/2182/
  ........
  
  Merged revisions 376029 from http://svn.asterisk.org/svn/asterisk/branches/1.8
  ........
  
  Merged revisions 376030 from http://svn.asterisk.org/svn/asterisk/branches/10
  ........
  
  Merged revisions 376048 from http://svn.asterisk.org/svn/asterisk/branches/11
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@376054 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-08 18:19:49 +00:00
Mark Michelson f2bb9afe17 Multiple revisions 375993-375994
........
  r375993 | mmichelson | 2012-11-07 11:01:13 -0600 (Wed, 07 Nov 2012) | 30 lines
  
  Fix misuses of timeouts throughout the code.
  
  Prior to this change, a common method for determining if a timeout
  was reached was to call a function such as ast_waitfor_n() and inspect
  the out parameter that told how many milliseconds were left, then use
  that as the input to ast_waitfor_n() on the next go-around.
  
  The problem with this is that in some cases, submillisecond timeouts
  can occur, resulting in the out parameter not decreasing any. When this
  happens thousands of times, the result is that the timeout takes much
  longer than intended to be reached. As an example, I had a situation where
  a 3 second timeout took multiple days to finally end since most wakeups
  from ast_waitfor_n() were under a millisecond.
  
  This patch seeks to fix this pattern throughout the code. Now we log the
  time when an operation began and find the difference in wall clock time
  between now and when the event started. This means that sub-millisecond timeouts
  now cannot play havoc when trying to determine if something has timed out.
  
  Part of this fix also includes changing the function ast_waitfor() so that it
  is possible for it to return less than zero when a negative timeout is given
  to it. This makes it actually possible to detect errors in ast_waitfor() when
  there is no timeout.
  
  (closes issue ASTERISK-20414)
  reported by David M. Lee
  
  Review: https://reviewboard.asterisk.org/r/2135/
........
  r375994 | mmichelson | 2012-11-07 11:08:44 -0600 (Wed, 07 Nov 2012) | 3 lines
  
  Remove some debugging that accidentally made it in the last commit.
........

Merged revisions 375993-375994 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 375995 from http://svn.asterisk.org/svn/asterisk/branches/10
........

Merged revisions 376014 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@376015 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-07 19:15:26 +00:00
Richard Mudgett 6ad0126425 Fix stuck DTMF when bridge is broken.
When a bridge is broken by an AMI Redirect action or the ChannelRedirect
application, an in progress DTMF digit could be stuck sending forever.

* Made simulate a DTMF end event when a bridge is broken and a DTMF digit
was in progress.

(closes issue ASTERISK-20492)
Reported by: Jeremiah Gowdy
Patches:
      bridge_end_dtmf-v3.patch.txt (license #6358) patch uploaded by Jeremiah Gowdy
      Modified to jira_asterisk_20492_v1.8.patch
      jira_asterisk_20492_v1.8.patch (license #5621) patch uploaded by rmudgett
Tested by: rmudgett

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

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

Merged revisions 375965 from http://svn.asterisk.org/svn/asterisk/branches/10
........

Merged revisions 375966 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@375967 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-06 19:05:11 +00:00
Matthew Jordan a0c363e227 Refactor ast_timer_ack to return an error and handle the error in timer users
Currently, if an acknowledgement of a timer fails Asterisk will not realize
that a serious error occurred and will continue attempting to use the timer's
file descriptor.  This can lead to situations where errors stream to the
CLI/log file.  This consumes significant resources, masks the actual problem
that occurred (whatever caused the timer to fail in the first place), and
can leave channels in odd states.

This patch propagates the errors in the timing resource modules up through
the timer core, and makes users of these timers handle acknowledgement
failures.  It also adds some defensive coding around the use of timers
to prevent using bad file descriptors in off nominal code paths.

Note that the patch created by the issue reporter was modified slightly for
this commit and backported to 1.8, as it was originally written for
Asterisk 10.

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

(issue ASTERISK-20032)
Reported by: Jeremiah Gowdy
patches:
  jgowdy-timerfd-6-22-2012.diff uploaded by Jeremiah Gowdy (license 6358)
........

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

Merged revisions 375894 from http://svn.asterisk.org/svn/asterisk/branches/10
........

Merged revisions 375895 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@375896 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-05 23:10:14 +00:00
Richard Mudgett b0c3d288f2 build_tools: Allow Asterisk to report git SHAs in version string.
Make git more attractive for managing work-in-progress.  Especially
convenient when a potential patch set needs to be tested on multiple
platforms since one can use git to keep all the test environments in sync
independent of a subversion server.

Now the Asterisk version will show the exact git SHA5 that was used when
building (still appended by "M" if there are local modifications) from a
git clone of the Asterisk repository so the developer can more easily know
what is actually under test.

You will now get this:

  $ asterisk -V
  Asterisk GIT-1698298

Instead of this:

  $ asterisk -V
  Asterisk UNKNOWN__and_probably_unsupported

This has zero impact for those not using git with the exception of an
extra test in the configure script to gather git's path.  This is
necessary to prevent "sudo make install" from failing since git may not be
in the path in make's shell environment.

(closes issue ASTERISK-20483)
Reported by: Shaun Ruffell
Patches:
      0001-build_tools-Allow-Asterisk-to-report-git-SHAs-in-ver.patch (license #5417) patch uploaded by Shaun Ruffell
      Modified
........

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

Merged revisions 375190 from http://svn.asterisk.org/svn/asterisk/branches/10
........

Merged revisions 375191 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@375192 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-18 20:13:17 +00:00
Andrew Latham 6c20cf2d8a Doxygen Updates - Title update
Update and extend the configuration_file group and enable linking. Commit other cleanups from multi-version Doxygen testing.  Update title that was left behind many years ago.

(issue ASTERISK-20259)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@375182 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-18 14:17:40 +00:00
Mark Michelson e9ab568f88 Fix some potential misuses of ast_str in the code.
Passing an ast_str pointer by value that then calls
ast_str_set(), ast_str_set_va(), ast_str_append(), or
ast_str_append_va() can result in the pointer originally
passed by value being invalidated if the ast_str had
to be reallocated.

This fixes places in the code that do this. Only the
example in ccss.c could result in pointer invalidation
though since the other cases use a stack-allocated ast_str
and cannot be reallocated.

I've also updated the doxygen in strings.h to include
notes about potential misuse of the functions mentioned
previously.

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

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

Merged revisions 375026 from http://svn.asterisk.org/svn/asterisk/branches/10
........

Merged revisions 375027 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@375044 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-15 21:25:29 +00:00
Mark Michelson c7b23cbb0a Do not use a FILE handle when doing SIP TCP reads.
This is used to solve an issue where a poll on a file
descriptor does not necessarily correspond to the readiness
of a FILE handle to be read.

This change makes it so that for TCP connections, we do a
recv() on the file descriptor instead.

Because TCP does not guarantee that an entire message or even
just one single message will arrive during a read, a loop has
been introduced to ensure that we only attempt to handle a
single message at a time. The tcptls_session_instance structure
has also had an overflow buffer added to it so that if more
than one TCP message arrives in one go, there is a place to
throw the excess.

Huge thanks goes out to Walter Doekes for doing extensive review
on this change and finding edge cases where code could fail.

(closes issue ASTERISK-20212)
reported by Phil Ciccone

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

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

Merged revisions 374906 from http://svn.asterisk.org/svn/asterisk/branches/10
........

Merged revisions 374914 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374924 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-12 16:31:01 +00:00
Andrew Latham 7226606f77 Continue to group config files
(issue ASTERISK-20259)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374888 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-11 22:39:02 +00:00
Mark Michelson 825607e09b Don't make chan_sip export global symbols.
During testing, it was discovered that having chan_sip
export global symbols was problematic.

The biggest problem was that load order was affected.
Trying to use realtime could be problematic since in
all likelihood the necessary realtime driver(s) would
not be loaded before chan_sip.

In addition, it was found that it was impossible to
use the Digium Phone Module for Asterisk since it
must be loaded before chan_sip since it must hook
into chan_sip's configuration parsing.

The solution is to use a virtual table in the same
manner that other modules in Asterisk do, like
app_voicemail.

(closes issue ASTERISK-20545)
Reported by: kmoore

........

Merged revisions 374842 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374849 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-11 15:49:02 +00:00
Joshua Colp d78f7f92b2 Add support for applying direct media ACLs between differing channel technologies.
Review: https://reviewboard.asterisk.org/r/2122/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374414 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-04 13:49:45 +00:00
Matthew Jordan a094707d51 Fix a variety of ref counting issues
This patch resolves a number of ref leaks that occur primarily on Asterisk
shutdown.  It adds a variety of shutdown routines to core portions of
Asterisk such that they can reclaim resources allocate duringd initialization.

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

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

Merged revisions 374178 from http://svn.asterisk.org/svn/asterisk/branches/10
........

Merged revisions 374196 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374197 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-02 01:47:16 +00:00
Andrew Latham 4e228fce03 Doxygen Cleanup
Start adding configuration file linking and pages.  Add module loading doxygen block.

Breaking up commits to keep it easy to track

(issue ASTERISK-20259)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374167 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-01 23:39:45 +00:00
Sean Bright b9eeff1521 app_queue: Support persisting and loading of long member lists.
Greenlight in #asterisk brought up that he was receiving an error message "Could
not create persistent member string, out of space" when running app_queue in
Asterisk 10.  dump_queue_members() made an assumption that 8K would be enough to
store the generated string, but with queues that have large member lists this is
not always the case.  This patch removes the limitation and uses ast_str instead
of a fixed sized buffer.

The complicating factor comes from the fact that ast_db_get requires a buffer
and buffer size argument, which doesn't let us pull back more than what we pass
in, so I introduced a new ast_db_get_allocated() which returns an ast_strdup()'d
copy of the value from astdb.

As an aside, I did some testing on the maximum size of data that we can store in
the BDB library we distribute and was able to store a 10MB string and retrieve
it with no problems, so I feel this is a safe patch.

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

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

Merged revisions 374135 from http://svn.asterisk.org/svn/asterisk/branches/10
........

Merged revisions 374150 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374151 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-01 20:36:25 +00:00
Joshua Colp 0fc114dc65 Add support for retrieving engine specific settings using the speech API and from dialplan.
(closes issue ASTERISK-17136)
Reported by: kenner


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374096 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-01 12:29:04 +00:00
Joshua Colp 9f55e5e928 Make res_http_websocket an optional dependency on supported platforms for chan_sip.
(closes issue ASTERISK-20439)
Reported by: sruffell
Patches:
     0001-chan_sip-websocket-support-is-an-optional-API.patch uploaded by sruffell (license 5417)
........

Merged revisions 373914 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@373915 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-09-27 17:12:08 +00:00
Mark Michelson fdfb3ae5fa Allow for redirecting reasons to be set to arbitrary strings.
This allows for the REDIRECTING dialplan function to be
used to set the reason to any string.

The SIP channel driver has been modified to set the redirecting
reason string to the value received in a Diversion header. In
addition, SIP 480 response reason text will set the redirecting
reason as well.

(closes issue AST-942)
reported by Malcolm Davenport

(closes issue AST-943)
reported by Malcolm Davenport

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@373701 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-09-25 19:29:14 +00:00
Andrew Latham fd98835f1f Doxygen Updates Janitor Work
* Whitespace, doc-blocks, spelling, case, missing and incorrect tags.
* Add cleanup to Makefile for the Doxygen configuration update
* Start updating Doxygen configuration for cleaner output
* Enable inclusion of configuration files into documentation
* remove mantisworkflow...
* update documentation README
* Add markup to Tilghman's email and talk with him about updating his email, he knows...
* no code changes on this commit other than the mentioned Makefile change

(issue ASTERISK-20259)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@373384 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-09-22 20:43:30 +00:00
Andrew Latham 6f61cb50c5 Doxygen Updates - janitor work
Doxygen updates including mistakes, misspellings, missing parameters, updates for Doxygen style.  Some missing txt file links are removed but their content or essense will be included in some later updates.  A majority of the txt files were removed in the 1.6 era but never noted. The HR and EXTREF are simple changes that make the documentation more compatable with more versions of Doxygen.

Further updates coming.

(issue ASTERISK-20259)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@373330 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-09-21 17:14:59 +00:00
Joshua Colp e8380afc8a Add support for DTLS-SRTP to res_rtp_asterisk and chan_sip.
As mentioned on the review for this, WebRTC has moved towards choosing
DTLS-SRTP as the mechanism for key exchange for SRTP. This commit adds
support for this but makes it available for normal SIP clients as well.

Testing has been done to ensure that this introduces no regressions with
existing behavior and also that it functions as expected.

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

Merged revisions 373229 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@373234 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-09-20 18:27:28 +00:00
Richard Mudgett da5944fc56 Named call pickup groups. Fixes, missing functionality, and improvements.
* ASTERISK-20383
Missing named call pickup group features:

CHANNEL(callgroup) - Need CHANNEL(namedcallgroup)
CHANNEL(pickupgroup) - Need CHANNEL(namedpickupgroup)
Pickup() - Needs to also select from named pickup groups.

* ASTERISK-20384
Using the pickupexten, the pickup channel selection could fail even though
there was a call it could have picked up.  In a call pickup race when
there are multiple calls to pickup and two extensions try to pickup a
call, it is conceivable that the loser will not pick up any call even
though it could have picked up the next oldest matching call.

Regression because of the named call pickup group feature.

* See ASTERISK-20386 for the implementation improvements.  These are the
changes in channel.c and channel.h.

* Fixed some locking issues in CHANNEL().

(closes issue ASTERISK-20383)
Reported by: rmudgett
(closes issue ASTERISK-20384)
Reported by: rmudgett
(closes issue ASTERISK-20386)
Reported by: rmudgett
Tested by: rmudgett

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

Merged revisions 373220 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@373221 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-09-20 17:22:41 +00:00
David M. Lee f8d815e19f Add -fnested-functions compile flag, if needed.
In order to use nested functions on some versions of GCC (e.g. GCC on OS X),
the -fnested-functions flag must be passed to the compiler. This patch adds
detection logic to ./configure to add the flag if necessary. It also adds
a comment to utils.h as to why the nested function needs a prototype.

(closes issue ASTERISK-20399)
Reported by: David M. Lee
Review: https://reviewboard.asterisk.org/r/2102/
........

Merged revisions 373119 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@373120 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-09-18 15:50:35 +00:00
David M. Lee 192e6a0f7a Fix timeouts for ast_waitfordigit[_full].
ast_waitfordigit_full would simply pass its timeout to ast_waitfor_nandfds,
expecting it to decrement the timeout by however many milliseconds were
waited. This is a problem if it consistently waits less than 1ms. The timeout
will never be decremented, and we wait... FOREVER!

This patch makes ast_waitfordigit_full manage the timeout itself. It maintains
the previously undocumented behavior that negative timeouts wait forever.

(closes issue ASTERISK-20375)
Reported by: Mark Michelson
Tested by: Mark Michelson
Review: https://reviewboard.asterisk.org/r/2109/
........

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

Merged revisions 373025 from http://svn.asterisk.org/svn/asterisk/branches/10
........

Merged revisions 373029 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@373046 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-09-13 20:02:56 +00:00
Richard Mudgett fb1d9a90a4 Enhance astobj2 to support other types of containers.
The new API allows for sorted containers, insertion options, duplicate
handling options, and traversal order options.

* Adds the ability for containers to be sorted when they are created.

* Adds container creation options to handle duplicates when they are
inserted.

* Adds container creation option to insert objects at the beginning or end
of the container traversal order.

* Adds OBJ_PARTIAL_KEY to allow searching with a partial key.  The partial
key works similarly to the OBJ_KEY flag.  (The real search speed
improvement with this flag will come when red-black trees are added.)

* Adds container traversal and iteration order options: Ascending and
Descending.

* Adds an AST_DEVMODE compile feature to check the stats and integrity of
registered containers using the CLI "astobj2 container stats <name>" and
"astobj2 container check <name>".  The channels container is normally
registered since it is one of the most important containers in the system.

* Adds ao2_iterator_restart() to allow iteration to be restarted from the
beginning.

* Changes the generic container object to have a v_method table pointer to
support other types of containers.

* Changes the container nodes holding objects to be ref counted.

The ref counted nodes and v_method table pointer changes pave the way to
allow other types of containers.

* Includes a large astobj2 unit test enhancement that tests the new
features.

(closes issue ASTERISK-19969)
Reported by: rmudgett

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@372997 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-09-12 21:02:29 +00:00
Mark Michelson 8963829390 Fix inability to shutdown gracefully due to an unending channel reference.
message.c makes use of a special message queue channel that exists
in thread storage. This channel never goes away due to the fact that
the taskprocessor used by message.c does not get shut down, meaning
that it never ends the thread that stores the channel.

This patch fixes the problem by shutting down the taskprocessor when
Asterisk is shut down. In addition, the thread storage has a destructor
that will release the channel reference when the taskprocessor is destroyed.

(closes issue AST-937)
Reported by Jason Parker
Patches:
	AST-937.patch uploaded by Mark Michelson (License #5049)
Tested by Jason Parker
........

Merged revisions 372885 from http://svn.asterisk.org/svn/asterisk/branches/10
........

Merged revisions 372888 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@372891 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-09-11 21:17:53 +00:00
Kinsey Moore d96b832787 Deprecate chan_gtalk, chan_jingle, and res_jabber
chan_gtalk, chan_jingle, and res_jabber are now deprecated in favor of
using chan_motif and res_xmpp. They are a feature-equivalent
replacement and are written to be more easily maintainable.

(closes issue ASTERISK-20298)
Review: https://reviewboard.asterisk.org/r/2082/
Reported-by: Leif Madsen
........

Merged revisions 372795 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@372796 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-09-10 19:49:30 +00:00
Mark Michelson be500bbafb Re-fix sending unnegotiated payloads during a P2P RTP bridge.
The previous fix still would look in the static_RTP_PT table, which
is inappropriate since we specifically want to find a codec that has
been negotiated.

(closes issue ASTERISK-20296)
reported by NITESH BANSAL
Patches:
	codec_negotiation.patch Uploaded by NITESH BANSAL (License #6418)
........

Merged revisions 372311 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@372319 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-09-05 16:24:19 +00:00
Matthew Jordan 8018b879a2 Clean up doxygen warnings
This patch fixes numerous doxygen warnings across Asterisk.  It also updates
the makefile to regenerate the doxygen configuration on the local system
before running doxygen to help prevent warnings/errors on the local system.

Much thanks to Andrew for tackling one of the Asterisk janitor projects!

(issue ASTERISK-20259)
Reported by: Andrew Latham
Patches:
  doxygen_partial.diff uploaded by Andrew Latham (license 5985)
  make_progdocs.diff uploaded by Andrew Latham (license 5985)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@371989 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-08-30 14:23:28 +00:00
Richard Mudgett f075e7631f Ensure alignment of in[] field in MD5Context struct.
The struct MD5Context character buffer is cast to an int32_t* without
making sure that said buffer is aligned.

Since the buffer follows two uint32_t's, the chance of 'in' being (32
bits) unaligned is nil in practice.  But adding code to ensure that 'in'
stays aligned costs nothing and removes all doubts about the casts being
safe.

(closes issue ASTERISK-20241)
Reported by: Walter Doekes
Patches:
      tmp.diff (license #5674) patch uploaded by Walter Doekes


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@371952 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-08-29 22:48:08 +00:00
Mark Michelson 89a5ff859d Add scoped locks to Asterisk.
With the SCOPED_LOCK macro, you can create a variable
that locks a specific lock and unlocks the lock when the
variable goes out of scope. This is useful for situations
where many breaks, continues, returns, or other interruptions
would require separate unlock statements. With a scoped lock,
these aren't necessary.

There are specializations for mutexes, read locks, write locks,
ao2 locks, ao2 read locks, ao2 write locks, and channel locks.
Each of these is a SCOPED_LOCK at heart though.

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@371582 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-08-21 19:04:32 +00:00
Richard Mudgett fb6238899b Add private representation of caller, connected and redirecting party ids.
This patch adds the feature "Private representation of caller, connected
and redirecting party ids", as previously discussed with us (DATUS) and
Digium.

1. Feature motivation

Until now it is quite difficult to modify a party number or name which can
only be seen by exactly one particular instantiated technology channel
subscriber.  One example where a modified party number or name on one
channel is spread over several channels are supplementary services like
call transfer or pickup.  To implement these features Asterisk internally
copies caller and connected ids from one channel to another.  Another
example are extension subscriptions.  The monitoring entities (watchers)
are notified of state changes and - if desired - of party numbers or names
which represent the involving call parties.  One major feature where a
private representation of party names is essentially needed, i.e.  where a
party name shall be exclusively signaled to only one particular user, is a
private user-specific name resolution for party numbers.  A lookup in a
private destination-dependent telephone book shall provide party names
which cannot be seen by any other user at any time.

2. Feature Description

This feature comes along with the implementation of additional private
party id elements for caller id, connected id and redirecting ids inside
Asterisk channels.

The private party id elements can be read or set by the user using
Asterisk dialplan functions.

When a technology channel is initiating a call, receives an internal
connected-line update event, or receives an internal redirecting update
event, it merges the corresponding public id with the private id to create
an effective party id.  The effective party id is then used for protocol
signaling.

The channel technologies which initially support the private id
representation with this patch are SIP (chan_sip), mISDN (chan_misdn) and
PRI (chan_dahdi).

Once a private name or number on a channel is set and (implicitly) made
valid, it is generally used for any further protocol signaling until it is
rewritten or invalidated.

To simplify the invalidation of private ids all internally generated
connected/redirecting update events and also all connected/redirecting
update events which are generated by technology channels -- receiving
regarding protocol information - automatically trigger the invalidation of
private ids.

If not using the private party id representation feature at all, i.e.  if
using only the 'regular' caller-id, connected and redirecting related
functions, the current characteristic of Asterisk is not affected by the
new extended functionality.

3. User interface Description

To grant access to the private name and number representation from the
Asterisk dialplan, the CALLERID, CONNECTEDLINE and REDIRECTING dialplan
functions are extended by the following data types.  The formats of these
data types are equal to the corresponding regular 'non-private' already
existing data types:

CALLERID:
priv-all
priv-name priv-name-valid priv-name-charset priv-name-pres
priv-num priv-num-valid priv-num-plan priv-num-pres
priv-subaddr priv-subaddr-valid priv-subaddr-type priv-subaddr-odd
priv-tag

CONNECTEDLINE:
priv-name priv-name-valid priv-name-pres priv-name-charset
priv-num priv-num-valid priv-num-pres priv-num-plan
priv-subaddr priv-subaddr-valid priv-subaddr-type priv-subaddr-odd
priv-tag

REDIRECTING:
priv-orig-name priv-orig-name-valid priv-orig-name-pres priv-orig-name-charset
priv-orig-num priv-orig-num-valid priv-orig-num-pres priv-orig-num-plan
priv-orig-subaddr priv-orig-subaddr-valid priv-orig-subaddr-type priv-orig-subaddr-odd
priv-orig-tag

priv-from-name priv-from-name-valid priv-from-name-pres priv-from-name-charset
priv-from-num priv-from-num-valid priv-from-num-pres priv-from-num-plan
priv-from-subaddr priv-from-subaddr-valid priv-from-subaddr-type priv-from-subaddr-odd
priv-from-tag

priv-to-name priv-to-name-valid priv-to-name-pres priv-to-name-charset
priv-to-num priv-to-num-valid priv-to-num-pres priv-to-num-plan
priv-to-subaddr priv-to-subaddr-valid priv-to-subaddr-type priv-to-subaddr-odd
priv-to-tag

Reported by: Thomas Arimont

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@371120 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-08-10 19:54:55 +00:00
Richard Mudgett 18d5041981 Use better libss7 detection test and move libpri compile test.
........

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

Merged revisions 371013 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@371030 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-08-09 19:22:35 +00:00
Mark Michelson 9ee8b3c0f6 Extend extension state callbacks to have more information.
Quote from review board:

This patch extends the extension state callbacks so that monitoring channels
(as chan_sip) get more information of the devices which are responsible for
an extension state change. The additional information is needed by chan_sip
to present names/numbers of the caller and callee in an early-state SIP
notification. Users of extenstion state callback not interested in the
additional information are not affected by the changes.

Motivation: to present the involved party's name/number in an early-state
nofification (used by the notified device as a pickup offer) one after another
so that a user can see which call he will pick up in an undirected pickup.
Such a pickup offer to a user shall indicate the same call (number/name-A calls
number/name-B) as the call which would be picked up when an undirected pickup
is executed.


Users interested in additional state info must use the new functions
ast_extension_state_add_extended() resp.
ast_extension_state_add_destroy_extended() to register an extended state
callback. When the callback is registered this way, an extra member
device_state_info of struct ast_state_cb_info is passed to the callback in
addition to the aggregated extension state. This container holds an object for
every device of the monitored extension hint consisting of the device name, the
device state and a channel reference to the channel which (presumably) caused
the device state.

The information is used by chan_sip for early-state notifications. When the
state of a device changes and the new state contains AST_EVENT_RINGING, an
early-state notification is sent to the subscribed devices with the
caller/callee names/numbers of the oldest ringing channel of the monitored
extension. The notified user may then invoke a direct pickup, which will pickup
exactly this channel.

Users of the old non-extended callbacks will only be called when the aggregated
state did change (same behavior as before). Users of the extended callback will
also be called when the state is unchanged but does contain AST_EVENT_RINGING.
That could be the case if two channels are ringing at one device and one of
them hangs up, so the aggregated state does not change. This way the monitoring
channel can create a new early-state notification with the now ringing
party-ids.

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

This contribution comes from Guenther Kelleter



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370979 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-08-09 14:52:16 +00:00
Mark Michelson eb9e645a27 Allow support for early media on AMI originates and call files.
This is based on the work done by Olle Johansson on review board.

The idea is that the channel specified in an AMI originate or call
file is typically not connected to the outgoing extension until the
channel has been answered. With this change, an EarlyMedia header can
be specified for AMI originates and an early_media option can
be specified in call files. With this option set, once early media is
received on a channel, it will be connected with the outgoing extension.

(closes issue ASTERISK-18644)
Reported by Olle Johansson

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370951 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-08-08 22:39:40 +00:00
Joshua Colp 8c5333f34e Payload and RTP code are must remain separate since in non-Asterisk format cases they differ.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370860 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-08-07 19:59:51 +00:00
Joshua Colp 15e41c7542 Reduce memory consumption significantly for users of the RTP engine API by storing only the payloads present and in use instead of every possible one.
Review: https://reviewboard.asterisk.org/r/2052/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370832 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-08-07 13:07:58 +00:00
Matthew Jordan 5c4578f4ad Add named callgroups/pickupgroups
This patch adds named calledgroups/pickupgroups to Asterisk.  Named groups are
implemented in parallel to the existing numbered callgroup/pickupgroup
implementation.  However, unlike the existing implementation, which is limited
to a maximum of 64 defined groups, the number of defined groups allowed for
named callgroups/pickupgroups is effectively unlimited.

Named groups are configured with the keywords "namedcallgroup" and
"namedpickupgroup".  This corresponds to the numbered group definitions of
"callgroup" and "pickupgroup".  Note that as the implementation of named groups
coexists with the existing numbered implementation, a defined named group of
"4" does not equate to numbered group 4.

Support for the named groups has been added to the SIP, DAHDI, and mISDN channel
drivers.

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

Uploaded by:
	Guenther Kelleter(license #6372)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370831 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-08-07 12:46:36 +00:00
Richard Mudgett ea0732def2 Make astobj2.h not include linkedlists.h.
Using astobj2 does not require linkedlists.h be included even though
astob2 uses linked lists internally.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370720 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-08-01 18:52:29 +00:00
Kinsey Moore 9b16c8b0f6 Clean up and ensure proper usage of alloca()
This replaces all calls to alloca() with ast_alloca() which calls gcc's
__builtin_alloca() to avoid BSD semantics and removes all NULL checks
on memory allocated via ast_alloca() and ast_strdupa().

(closes issue ASTERISK-20125)
Review: https://reviewboard.asterisk.org/r/2032/
Patch-by: Walter Doekes (wdoekes)
........

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

Merged revisions 370643 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370655 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-07-31 20:21:43 +00:00
Russell Bryant fd11146592 Add a "corosync ping" CLI command.
This patch adds a new CLI command to the res_corosync module.  It is primarily
used as a debugging tool.  It lets you fire off an event which will cause
res_corosync on other nodes in the cluster to place messages into the logger if
everything is working ok.  It verifies that the corosync communication is
working as expected.

I didn't put anything in the CHANGES file for this, because this module is new
in Asterisk 11.  There is already a generic "res_corosync new module" entry in
there so I figure that covers it just fine.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370535 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-07-30 00:14:18 +00:00
Kevin P. Fleming 7d4ccea736 Enable usage of system-provided NetBSD editline library if available.
This patch changes the Asterisk configure script and build system to detect
the presence of the NetBSD editline library (libedit) on the system. If it is
found, it will be used in preference to the version included in the Asterisk
source tree.

(closes issue ASTERISK-18725)
Reported by: Jeffrey C. Ollie
Review: https://reviewboard.asterisk.org/r/1528/
Patches:
  0001-Allow-linking-building-against-an-external-editline.patch uploaded by jcollie (license #5373) (heavily modified by kpfleming)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370481 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-07-25 12:21:54 +00:00
Kevin P. Fleming b5193428a7 Enable usage of system-provided iLBC library.
The WebRTC version of the iLBC codec is now package as a library and is
available on some platforms. This patch allows codec_ilbc to be built against
that library if it is present.

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370407 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-07-23 21:27:56 +00:00
Matthew Jordan b6a0ae0b35 Unit tests for the Jitter Buffer API; remove unnecessary resync
This patch includes the following:
* Unit tests for the abstract Jitter Buffer API.  This includes both fixed
  and adaptive flavors, testing nominal creation, frame input, frame retrieval,
  resyncing; off nominal frame input overflow, out of order, and others.
* Tweaks to the abstract_jb API to remove the unnecessary resync_threshold
  parameter from the create function (resync_threshold is already in the
  struct passed into the create function)
* Ensure the fixed jitter buffer is empty before destroying it, to avoid an
  ASSERT
* Don't "resync" the adaptive jitter buffer.  The mechanism that was being
  used actually causes the jitter buffer to think its being overflowed by going
  around the jitterbuf API and attempting to 'resynch' it improperly.  If a
  resync is needed, the jitter buffer will do it properly by itself.  Note that
  this is only an optimization needed for trunk, as the worst that happens is 
  the loss of three voice packets before the adaptive jitter buffer will resync
  anyway.
  
Review: https://reviewboard.asterisk.org/r/2035


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370387 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-07-23 21:15:26 +00:00
Kinsey Moore cb9756daa2 Add hangupcause translation support
The HANGUPCAUSE hash (trunk only) meant to replace SIP_CAUSE has now
been replaced with the HANGUPCAUSE and HANGUPCAUSE_KEYS dialplan
functions to better facilitate access to the AST_CAUSE translations
for technology-specific cause codes. The HangupCauseClear application
has also been added to remove this data from the channel.

(closes issue SWP-4738)
Review: https://reviewboard.asterisk.org/r/2025/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370316 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-07-20 15:48:55 +00:00
Terry Wilson 2f674bcdd1 Convert app_confbridge to use the config options framework
Review: https://reviewboard.asterisk.org/r/2024/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370303 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-07-19 23:21:40 +00:00
Joshua Colp cbdb2dbb0e Fix a crash occurring as a result of excess stack usage.
This fix involves moving the allocation of some temporary codec structures to the heap and also reduces the number of maximum payloads to something more sane for both regular and low memory builds.

(closes issue ASTERISK-20140)
Reported by: jonnt


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370171 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-07-18 11:38:05 +00:00
Joshua Colp 44345b0973 Fix a crash as a result of propagating MWI or device state over XMPP when the client is disconnected.
The MWI and device state propagation code wrongly assumes that an XMPP client connection will remain established at all times. This fix corrects that by making the lifetime of the subscription the same as the lifetime of the connection itself. As the connection is established and disconnected the subscription itself is created and destroyed.

(closes issue ASTERISK-18078)
Reported by: elguero


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370152 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-07-17 16:32:10 +00:00
Joshua Colp e938737570 Add support for SIP over WebSocket.
This allows SIP traffic to be exchanged over a WebSocket connection which is useful for rtcweb.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370072 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-07-16 12:35:04 +00:00
Joshua Colp acb5f5f824 Reduce memory consumption and add the H.264 and H.263 modules I shamefully neglected to add.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370060 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-07-13 18:41:07 +00:00
Joshua Colp a693fd1d87 Add support for parsing SDP attributes, generating SDP attributes, and passing it through.
This support includes codecs such as H.263, H.264, SILK, and CELT. You are able to set up a call and have attribute information pass. This should help considerably with video calls.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370055 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-07-13 16:49:40 +00:00
Terry Wilson a7dfafdc56 Handle deprecated (aliased) option names with the config options api
Add a simple way to register "deprecated" option names that alias to a
different "current" name.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370043 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-07-12 21:43:09 +00:00
Jonathan Rose 10afdf3a2a Named ACLs: Introduces a system for creating and sharing ACLs
This patch adds Named ACL functionality to Asterisk. This allows system
administrators to define an ACL and refer to it by a unique name. Configurable
items can then refer to that name when specifying access control lists.
It also includes updates to all core supported consumers of ACLs. That includes
manager, chan_sip, and chan_iax2. This feature is based on the deluxepine-trunk
by Olle E. Johansson and provides a subset of the Named ACL functionality
implemented in that branch. For more information on this feature, see acl.conf
and/or the Asterisk wiki.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369959 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-07-11 18:33:36 +00:00
Joshua Colp a3fa37b8cf Add a new unified Jingle, Google Jingle, and Google Talk channel driver written from scratch called chan_motif.
This channel driver is a replacement for both chan_gtalk and chan_jingle but adds additional features not found in either.
These features include full configuration reload, video, full codec support, bidirectional cause code mapping, hold,
unhold, and ringing indication. It is also compliant with the current published Jingle and Google Jingle specifications.
The original Google Talk protocol is also supported for Google Voice interoperability.

You may ask yourself though where the name motif comes from... and I would say to you... music!

motif: a perceivable or salient recurring fragment or succession of notes

Sorta like a jingle!

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369769 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-07-07 17:06:51 +00:00
Richard Mudgett 1906601bf4 Tweak some comments and whitespace in utils.h
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369666 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-07-05 19:22:03 +00:00
Joshua Colp 213bbc169a Add a cleaned up drop-in replacement for res_jabber called res_xmpp. This provides the same externally facing functionality but is implemented differently internally.
This is currently not built by default but this will be changed once chan_jingle2 (insert actual name in your head when reading this after it has been merged)
is in the tree.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369527 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-07-02 14:06:19 +00:00
Joshua Colp 37256ea45d Add support for ICE/STUN/TURN in res_rtp_asterisk and chan_sip.
Review: https://reviewboard.asterisk.org/r/1891/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369517 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-07-01 17:28:57 +00:00
Richard Mudgett ac35b92b62 Hangup handlers - Dialplan subroutines that run when the channel hangs up.
Hangup handlers are an alternative to the h extension.  They can be used
in addition to the h extension.  The idea is to attach a Gosub routine to
a channel that will execute when the call hangs up.  Whereas which h
extension gets executed depends on the location of dialplan execution when
the call hangs up, hangup handlers are attached to the call channel.  You
can attach multiple handlers that will execute in the order of most
recently added first.

(closes issue ASTERISK-19549)
Reported by: Mark Murawski
Tested by: rmudgett

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369493 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-29 17:02:32 +00:00
Terry Wilson 1609fca6bb Add the ability to set flags via the config options api
Allows the setting of flags via the config options api.
For example, code like this:

#define OPT1 1 << 0
#define OPT2 1 << 1
#define OPT3 1 << 2

struct thing {
   unsigned int flags;
};

and a config like this:

[blah]
opt1=yes
opt2=no
opt3=yes

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369454 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-28 01:12:06 +00:00
Jonathan Rose 5eb94d7ebb Unique Call ID logging Phases III and IV
Adds call ID logging changes to specific channel drivers that weren't handled
handled in phase II of Call ID Logging. Also covers logging for threads for
threads created by systems that may be involved with many different calls.
Extra special thanks to Richard for rigorous review of chan_dahdi and its
various signalling modules.

review: https://reviewboard.asterisk.org/r/1927/
review: https://reviewboard.asterisk.org/r/1950/



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369414 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-26 21:45:22 +00:00
Matthew Jordan 82a7409c15 Add AMI event documentation
This patch adds the core changes necessary to support AMI event documentation
in the source files of Asterisk, and adds documentation to those AMI events
defined in the core application modules.  Event documentation is built from
the source by two new python scripts, located in build_tools:
get_documentation.py and post_process_documentation.py.

The get_documentation.py script mirrors the actions of the existing AWK
get_documentation scripts, except that it will scan the entirety of a source
file for Asterisk documentation.  Upon encountering it, if the documentation
happens to be an AMI event, it will attempt to extract information about the
event directly from the manager event macro calls that raise the event.  The
post_process_documentation.py script combines manager event instances that
are the same event but documented in multiple source files.  It generates
the final core-[lang].xml file.

As this process can take longer to complete than a typical 'make all', it
is only performed if a new make target, 'full', is chosen.

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369346 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-25 17:59:34 +00:00
Mark Michelson 453e01725d Multiple revisions 369323-369324
........
  r369323 | mmichelson | 2012-06-25 10:35:43 -0500 (Mon, 25 Jun 2012) | 9 lines
  
  Eliminate embedding of res_adsi.so module.
  
  The way this is done is to stop using the optional API.
  Instead, res_adsi.so, when loaded fills in a table of
  function pointers.
  
  Review: https://reviewboard.asterisk.org/r/1991
........
  r369324 | mmichelson | 2012-06-25 10:50:17 -0500 (Mon, 25 Jun 2012) | 2 lines
  
  Forgot to svn add this file in my last commit.
........

Merged revisions 369323-369324 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 369325 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369326 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-25 15:55:25 +00:00
Michael L. Young c843dddf80 Fix NULL pointer segfault in ast_sockaddr_parse()
While working with ast_parse_arg() to perform a validity check, a segfault
occurred.  The segfault occurred due to passing a NULL pointer to
ast_sockaddr_parse() from ast_parse_arg().  According to the documentation in
config.h, "result pointer to the result.  NULL is valid here, and can be used to
perform only the validity checks."

This patch fixes the segfault by checking for a NULL pointer.  This patch also
adds documentation to netsock2.h about why it is necessary to check for a NULL
pointer.

(Closes issue ASTERISK-20006)
Reported by: Michael L. Young
Tested by: Michael L. Young
Patches:
asterisk-20006-netsock-null-ptr.diff uploaded by Michael L. Young (license 5026)

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

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

Merged revisions 369109 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369110 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-20 02:07:00 +00:00
Kinsey Moore f080be134e Ensure that pvt cause information does not break native bridging
Channel drivers that allow native bridging need to handle
AST_CONTROL_PVT_CAUSE_CODE frames and previously did not handle them
properly, usually breaking out of the native bridge. This change
corrects that behavior and exposes the available cause code information
to the dialplan while native bridges are in place. This required
exposing the HANGUPCAUSE hash setter outside of channel.c, so
additional documentation has been added.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369086 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-19 21:13:41 +00:00
Kinsey Moore bdab2763ac Add HANGUPCAUSE hash support to IAX2
Continuing with the Who Hung Up? project for Asterisk 11, this adds
support to IAX2 for the HANGUPCAUSE hash.

Additionally, this breaks out some functionality in frame.c for getting
information about frame types and subclasses.

Review: https://reviewboard.asterisk.org/r/1941/
(issue SWP-4222)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369007 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-15 16:17:12 +00:00
Richard Mudgett f8746d0009 Allow non-normal execution routines to be able to run on hungup channels.
* Make non-normal dialplan execution routines be able to run on a hung up
channel.  This is preparation work for hangup handler routines.

* Fixed ability to support relative non-normal dialplan execution
routines.  (i.e., The context and exten are optional for the specified
dialplan location.) Predial routines are the only non-normal routines that
it makes sense to optionally omit the context and exten.  Setting a hangup
handler also needs this ability.

* Fix Return application being able to restore a dialplan location
exactly.  Channels without a PBX may not have context or exten set.

* Fixes non-normal execution routines like connected line interception and
predial leaving the dialplan execution stack unbalanced.  Errors like
missing Return statements, popping too many stack frames using StackPop,
or an application returning non-zero could leave the dialplan stack
unbalanced.

* Fixed the AGI gosub application so it cleans up the dialplan execution
stack and handles the autoloop priority increments correctly.

* Eliminated the need for the gosub_virtual_context return location.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368985 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-14 23:22:53 +00:00
Richard Mudgett c5256059b8 Move vm defines to group them better.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368972 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-14 20:49:28 +00:00
Jason Parker 6334142050 Multiple revisions 368963,368965
........
  r368963 | qwell | 2012-06-14 13:47:03 -0500 (Thu, 14 Jun 2012) | 14 lines
  
  Remove global symbol requirement from app_voicemail.
  
  This uses the existing "function installation" stuff that already existed for
  other functions, like getting message counts.
  
  (closes issue AST-807)
  (issue AST-901)
  (issue AST-908)
  
  Review: https://reviewboard.asterisk.org/r/1965/
  ........
  
  Merged revisions 368962 from http://svn.asterisk.org/svn/asterisk/certified/branches/1.8.11
........
  r368965 | qwell | 2012-06-14 14:04:57 -0500 (Thu, 14 Jun 2012) | 11 lines
  
  These functions that were moved need to be static.
  
  Also wrap test functions in a #ifdef.
  
  (issue AST-807)
  (issue AST-901)
  (issue AST-908)
  ........
  
  Merged revisions 368964 from http://svn.asterisk.org/svn/asterisk/certified/branches/1.8.11
........

Merged revisions 368963,368965 from http://svn.asterisk.org/svn/asterisk/branches/10-digiumphones


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368966 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-14 19:40:11 +00:00
Terry Wilson cfa0826c49 Add a post_apply callback to the Config Options API
This adds a callback that only fires when changes have been successfully
applied via the Config Options API.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368921 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-14 13:41:47 +00:00
Terry Wilson 01307e4b7b Add filename alias support to the Config Options API
This adds the ability to handle a single filename alias for a config
file. This is useful if a config filename has changed, but the old
filename should be supported for backwards compatibility.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368920 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-14 13:35:07 +00:00
Richard Mudgett 72eb8eb1e7 Fix deadlock potential with ast_set_hangupsource() calls.
Calling ast_set_hangupsource() with the channel lock held can result in a
deadlock because the function also locks the bridged channel.

(issue ASTERISK-19537)

(closes issue AST-891)
Reported by: Guenther Kelleter
Tested by: Guenther Kelleter

(closes issue ASTERISK-19801)
Reported by: Alec Davis
........

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

Merged revisions 368760 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368772 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-11 17:34:08 +00:00
Richard Mudgett 745484e1b3 Fix error paths in action_hangup() for AMI Hangup action.
* Check allocation function return values for failure.  Crashing is bad.

* Tweak ast_regex_string_to_regex_pattern() parameters for proper ast_str 
usage.  


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368714 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-08 21:08:17 +00:00
Richard Mudgett 8b2412db28 Tweak ast_channel_softhangup_withcause_locked() to take a typed parameter.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368712 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-08 20:49:00 +00:00
Terry Wilson 9f704b5d59 Fix reloading an unchanged file with the Config Options API
Adding multiple file support broke reloading an unchanged file. This
adds an enum for return values for the aco_process_* functions and
ensures that the config is not applied if res is not ACO_PROCESS_OK.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368673 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-07 20:32:07 +00:00
Terry Wilson aeeff8cfa2 Add default handler documentation and standardize acl handler
Added documentation describing what flags and arguments to pass to
aco_option_register for default option types. Also changed the ACL
handler to use the flags parameter to differentiate between "permit"
and "deny" instead of adding an additional vararg parameter.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368663 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-07 15:43:37 +00:00
Kinsey Moore 571445ab9c Convert AST_FLAG_ANSWERED_ELSEWHERE usage to AST_CAUSE_ANSWERED_ELSEWHERE
This was essentially duplicated functionality where normal channels used
AST_CAUSE_ANSWERED_ELSEWHERE while local channels and queues used
AST_FLAG_ANSWERED_ELSEWHERE.  This removes the flag and converts that usage
into AST_CAUSE_ANSWERED_ELSEWHER usage.

Review: https://reviewboard.asterisk.org/r/1944
(closes issue ASTERISK-19865)
Patch-by: Birger Harzenetter


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368519 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-05 14:41:43 +00:00
Mark Michelson 14a985560e Merge changes dealing with support for Digium phones.
Presence support has been added. This is accomplished by
allowing for presence hints in addition to device state
hints. A dialplan function called PRESENCE_STATE has been
added to allow for setting and reading presence. Presence
can be transmitted to Digium phones using custom XML
elements in a PIDF presence document.

Voicemail has new APIs that allow for moving, removing,
forwarding, and playing messages. Messages have had a new
unique message ID added to them so that the APIs will work
reliably. The state of a voicemail mailbox can be obtained
using an API that allows one to get a snapshot of the mailbox.
A voicemail Dialplan App called VoiceMailPlayMsg has been
added to be able to play back a specific message.

Configuration hooks have been added. Configuration hooks
allow for a piece of code to be executed when a specific
configuration file is loaded by a specific module. This is
useful for modules that are dependent on the configuration
of other modules.

chan_sip now has a public method that allows for a custom
SIP INFO request to be sent mid-dialog. Digium phones use
this in order to display progress bars when files are played.

Messaging support has been expanded a bit. The main
visible difference is the addition of an AMI action
MessageSend.

Finally, a ParkingLots manager action has been added in order
to get a list of parking lots.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368435 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-04 20:26:12 +00:00
Joshua Colp 380c7c5c39 Add res_http_websocket module which implements the WebSocket protocol according to RFC 6455.
Review: https://reviewboard.asterisk.org/r/1952/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368359 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-02 21:13:36 +00:00
Terry Wilson d54717c39e Add new config-parsing framework
This framework adds a way to register the various options in a config
file with Asterisk and to handle loading and reloading of that config
in a consistent and atomic manner.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368181 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-01 16:33:25 +00:00
Jonathan Rose bdaecbb66b chan_sip: fix problem directmediapermit/deny uses the wrong address
When remotely bridging calls with directmedia, Asterisk would check
the address of the peers/users holding directmedia ACLs (set via
directmediapermit/directmediadeny) instead of the bridged peer. This
is similar to r366547, but trunk specific and involves changes to
the rtpengine instead of just chan_sip.

(closes issue AST-876)
review: https://reviewboard.asterisk.org/r/1924/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@367640 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-24 18:56:43 +00:00
Terry Wilson c7f2d02ef1 Fix race condition for CEL LINKEDID_END event
This patch fixes to situations that could cause the CEL LINKEDID_END event to
be missed.

1) During a core stop gracefully, modules are unloaded when ast_active_channels
== 0. The LINKDEDID_END event fires during the channel destructor. This means
that occasionally, the cel_* module will be unloaded before the channel is
destroyed. It seemed generally useful to wait until the refcount of all
channels == 0 before unloading, so I added a channel counter and used it in the
shutdown code.

2) During a masquerade, ast_channel_change_linkedid is called. It calls
ast_cel_check_retire_linkedid which unrefs the linkedid in the linkedids
container in cel.c. It didn't ref the new linkedid. Now it does. 

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

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

Merged revisions 367299 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@367309 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-22 17:29:12 +00:00
Mark Michelson 8b1193087e Revert revision 367163.
This should have been committed to my team trunk-digiumphones branch
instead of trunk.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@367183 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-21 20:31:53 +00:00
Mark Michelson e5f1f0496a Add "send to voicemail" Digium phone functionality to Asterisk.
This change accommodates two methods by which calls can be directed to
a user's voicemail.

* Incoming calls can be redirected to any user's voicemail.
* Established calls can be blind transferred to any user's voicemail.

Digium phones indicate the desire to direct a call to voicemail by using
a Diversion header with a reason parameter of "send_to_vm". 

This patch adds the "send_to_vm" reason as a valid redirecting reason. In
addition, chan_sip.c has been modified to update redirecting information
on the transferred channel by reading a Diversion header on a REFER request.

(closes issue AST-871)
Reported by Malcolm Davenport

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@367163 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-21 19:22:25 +00:00
Terry Wilson 45149bfdf8 Minor documentation change
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@367124 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-21 17:39:37 +00:00
Mark Michelson 5c576aa3c2 Fix memory leak of SSL_CTX structures in TLS core.
SSL_CTX structures were allocated but never freed. This was a bigger
issue for clients than servers since new SSL_CTX structures could be
allocated for each connection. Servers, on the other hand, typically
set up a single SSL_CTX for their lifetime.

This is solved in two ways:

1. In __ssl_setup(), if a tcptls_cfg has an ssl_ctx on it, it is
freed so that a new one can take its place.
2. A companion to ast_ssl_setup() called ast_ssl_teardown() has
been added so that servers can properly free their SSL_CTXs.

(issue ASTERISK-19278)
........

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

Merged revisions 367003 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@367010 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-18 17:24:57 +00:00
Jonathan Rose cd37bec058 logger: Adds additional support for call id logging and chan_sip specific stuff
This patch improves the handling of call id logging significantly with regard
to transfers and adding APIs to better handle specific aspects of logging.
Also, changes have been made to chan_sip in order to better handle the creation
of callids and to enable the monitor thread to bind itself to a particular
call id when a dialog is determined to be related to a callid. It then unbinds
itself before returning to normal monitoring.

review: https://reviewboard.asterisk.org/r/1886/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366842 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-17 16:28:20 +00:00
Richard Mudgett 2d175b7e8f Remove missed idx parameter to some ao2 global holder macros.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366700 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-16 18:00:18 +00:00
Richard Mudgett d4fa095a64 Change ao2 global array to ao2 global object holder.
Review: https://reviewboard.asterisk.org/r/1921/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366663 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-16 16:34:42 +00:00
Kinsey Moore b5a6de76fc Commit framework for HANGUPCAUSE (replacement for SIP_CAUSE)
This is the starting point for the Asterisk 11: Who Hung Up work and provides
a framework which will allow channel drivers to report the types of hangup
cause information available in SIP_CAUSE without incurring the overhead of the
MASTER_CHANNEL dialplan function. The initial implementation only includes
cause generation for chan_sip and does not include cause code translation
utilities.

This change deprecates SIP_CAUSE and replaces its method of reporting cause
codes with the new framework. This change also deprecates the 'storesipcause'
option in sip.conf.

Review: https://reviewboard.asterisk.org/r/1822/
(Closes issue SWP-4221)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366408 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-14 19:44:27 +00:00
Richard Mudgett 4ea636c776 Run predial routine on local;2 channel where you would expect.
Before this patch, the predial routine executes on the ;1 channel of a
local channel pair.  Executing predial on the ;1 channel of a local
channel pair is of limited utility.  Any channel variables set by the
predial routine executing on the ;1 channel will not be available when the
local channel executes dialplan on the ;2 channel.

* Create ast_pre_call() and an associated pre_call() technology callback
to handle running the predial routine.  If a channel technology does not
provide the callback, the predial routine is simply run on the channel.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366183 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-10 21:29:41 +00:00
Russell Bryant eebdf35159 res_corosync: Fix build against corosync 2.0.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@364444 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-28 01:20:57 +00:00
Matthew Jordan 50c959580c Prevent overflow in calculation in ast_tvdiff_ms on 32-bit machines
The method ast_tvdiff_ms attempts to calculate the difference, in milliseconds,
between two timeval structs, and return the difference in a 64-bit integer.
Unfortunately, it assumes that the long tv_sec/tv_usec members in the timeval
struct are large enough to hold the calculated values before it returns.  On
64-bit machines, this might be the case, as a long may be 64-bits.  On 32-bit
machines, however, a long may be less (32-bits), in which case, the calculation
can overflow.

This overflow caused significant problems in MixMonitor, which uses the method
to determine if an audio factory, which has not presented audio to an audiohook,
is merely late in providing said audio or will never provide audio.  In an
overflow situation, the audiohook would incorrectly determine that an audio
factory that will never provide audio is merely late instead.  This led to
situations where a MixMonitor never recorded any audio.  Note that this happened
most frequently when that MixMonitor was started by the ConfBridge application
itself, or when the MixMonitor was attached to a Local channel.

(issue ASTERISK-19497)
Reported by: Ben Klang
Tested by: Ben Klang
Patches:
  32-bit-time-overflow-10-2012-04-26.diff (license #6283) by mjordan

(closes issue ASTERISK-19727)
Reported by: Mark Murawski
Tested by: Michael L. Young
Patches:
  32-bit-time-overflow-2012-04-27.diff (license #6283) by mjordan)

(closes issue ASTERISK-19471)
Reported by: feyfre
Tested by: feyfre

(issue ASTERISK-19426)
Reported by: Johan Wilfer

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

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

Merged revisions 364285 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@364287 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-27 19:30:59 +00:00
Olle Johansson 7aa0c3c64b Make it possible to change the minimum DTMF duration in asterisk.conf
Asterisk has a setting for the minimum allowed DTMF. If we get shorter
DTMF tones, these will be changed to the minimum on the outbound call
leg. 

(closes issue ASTERISK-19772)

Review: https://reviewboard.asterisk.org/r/1882/
Reported by: oej
Tested by: oej
Patches by: oej

Thanks to the reviewers.

1.8 branch for this patch: agave-dtmf-duration-asterisk-conf-1.8



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@363558 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-25 09:32:21 +00:00
Richard Mudgett 3a874139d4 Fix connected-line/redirecting interception gosubs executing more than intended.
* Redo ast_app_run_sub()/ast_app_exec_sub() to use a known return point so
execution will stop after the routine returns there.
(s@gosub_virtual_context:1)

* Create ast_app_exec_macro() and ast_app_exec_sub() to run the macro and
gosub application respectively with the parameter string already created.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@362962 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-20 23:29:56 +00:00
Richard Mudgett 73f48997f9 Add original party id and reason support.
ISDN ETSI PTP and Q.SIG (And SS7 in future) have support for reporting who
was the original redirecting party of a call.

* Added support for the original redirecting party and reason to the
REDIRECTING function and the system core as well as to the stubbed
locations in sig_pri.c.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@362779 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-20 00:57:13 +00:00
Michael L. Young abf40d9b28 Add IPv6 address support to security events framework.
The current Security Events Framework API only supports IPv4 when it comes to
generating security events.  This patch does the following:

* Changes the Security Events Framework API to support IPV6 and updates
  the components that use this API.

* Eliminates an error message that was being generated since the current
  implementation was treating an IPv6 socket address as if it was IPv4.

* Some copyright dates were updated on files touched by this patch.

(closes issue ASTERISK-19447) 
Reported by: Michael L. Young 
Tested by: Michael L. Young 
Patches: 
  security_events_ipv6v3.diff uploaded by Michael L. Young (license 5026)

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@362200 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-16 21:20:50 +00:00
Richard Mudgett a35c7ba8e7 Add option to invoke the extensions.conf stdexten using the legacy macro method.
ASTERISK-18809 eliminated the legacy macro invocation of the stdexten in
favor of the Gosub method without a means of backwards compatibility.

(issue ASTERISK-18809)
(closes issue ASTERISK-19457)
Reported by: Matt Jordan
Tested by: rmudgett

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@361998 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-12 16:29:52 +00:00
Mark Murawki 745fcdbffe Fix dev-mode compiler warning about gnu_printf
(related to ASTERISK-19575)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@361039 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-03 20:03:44 +00:00
Mark Murawki e4252eac10 Allow the Hangup manager action to match channels by regex
* Hangup now can take a regular expression as the Channel option.  If you want
  to hangup multiple channels, use /regex/ as the Channel option.  Existing
  behavior to hanging up a single channel is unchanged, but if you pass a regex,
  the manager will send you a list of channels back that were hung up.

(closes issue ASTERISK-19575)
Reported by: Mark Murawski
Tested by: Mark Murawski



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@361038 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-03 19:31:25 +00:00
Richard Mudgett fb796aac06 Misc changes to make astobj2 enhancement diffs easier to follow.
* Rename astobj2 API parameter funcname to func.

* Rename astobj2 API iterator parameter to iter.

* Update some documentation for OBJ_MULTIPLE.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@360827 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-29 21:57:23 +00:00
Jonathan Rose 655a8d4420 Introducing the log message unique call identifiers feature
Log messages will now display a call number that they are tied to (ordered for calls
based on when they started). This feature is made to be minimally invasive without
requiring changes to many of the existing log messages. These IDs  won't show up for
verbose messages on CLI (but they will in log files) This is currently in phase II
of production, see more about this feature on the wiki --
https://wiki.asterisk.org/wiki/display/AST/Unique+Call-ID+Logging

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@360787 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-29 20:01:20 +00:00
Jonathan Rose d501c2ea2d undoing 360785 due to merging mistake
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@360786 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-29 19:59:30 +00:00
Jonathan Rose bf994f0e04 Introducing the log message unique call identifiers feature
Log messages will now display a call number that they are tied to (ordered for calls
based on when they started). This feature is made to be minimally invasive without
requiring changes to many of the existing log messages. These IDs  won't show up for
verbose messages on CLI (but they will in log files) This is currently in phase II
of production, see more about this feature on the wiki --
https://wiki.asterisk.org/wiki/display/AST/Unique+Call-ID+Logging

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@360785 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-29 19:54:35 +00:00
Richard Mudgett 38e892b370 Add global ao2 array container.
Global ao2 objects must always exist after initialization because there is
no access control to obtain another reference to the global object.

It is expected that module configuration could use these new API calls to
replace an active configuration parameter object with an updated
configuration parameter object.

With these new API calls, the global object could be replaced, removed, or
referenced without the risk of someone using a stale global object
pointer.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@360627 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-27 17:13:32 +00:00
Jonathan Rose c6979ff581 Adds F option to Bridge application
Similar to dial and queue F option.

(Closes issue ASTERISK-19282)
Reported by: To
Patches:
	bridge_f-v3.diff uploaded by To (license 6347)
Review: https://reviewboard.asterisk.org/r/1825/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@360227 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-22 21:25:22 +00:00
Sean Bright 3a231e090f chan_iax2: Correct spelling of 'Port' header in IAX2 PeerStatus AMI Events
The PeerStatus event for IAX2 channels currently includes a header named Post
which should have been Port.  Post was removed and the AMI version has been
updated to 1.3.
........

Merged revisions 359982 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@359983 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-20 18:17:16 +00:00
Richard Mudgett 334f13d8b8 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/
........

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

Merged revisions 359980 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@359981 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-20 17:31:28 +00:00
Richard Mudgett dd4a3b1825 Simplify some code in ast_app_run_sub().
* Remove unnnecessary const from const char * const var declaration in the
ast_app_run_macro() and ast_app_run_sub() prototypes.  The second const is
unnecessary.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@359904 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-16 20:37:54 +00:00
Mark Michelson 827f2eae92 Revert the pre-dial addition.
The code may be just fine, but it had not received a "ship it!" on
review board yet.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@359857 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-16 15:38:45 +00:00
Mark Murawki c65b41f57a Add options PreDial options 'b' and 'B' to app_dial
* Added 'b' and 'B' options to Dial.  These options will allow you to run
  last-minute dialplan on the caller and callee channels while the Dial
  application is executing, but before the call is started.  For example you
  can use the 'b' option to run dialplan on the callee channel to get the name
  of the newly created channel right away.

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

(closes issue: ASTERISK-19548)
Reported by: Mark Murawski
Tested by: Mark Murawski, Stefan Schmidt



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@359705 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-15 18:58:25 +00:00
Russell Bryant 28881524dc app.h: Always initialize AST_DECLARE_APP_ARGS().
This patch ensures that the struct defined by AST_DECLARE_APP_ARGS() is always
fully initialized.  I'm not sure if this fixes any real bugs, but it silences
a bunch of warnings from coverity, and is generally a good thing to do anyway.
........

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

Merged revisions 359454 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@359456 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-14 22:41:21 +00:00
Richard Mudgett 9b31bd3cd8 Fix deadlock potential with some ast_indicate/ast_indicate_data calls.
Calling ast_indicate()/ast_indicate_data() with the channel lock held can
result in a deadlock with a local channel because of how local channels
need to avoid deadlock.
........

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

Merged revisions 359453 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@359455 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-14 22:38:29 +00:00
Richard Mudgett a22b6f6e4b Three copies of the file contents in channel_internal.h are a bit excessive.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@359360 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-14 18:12:08 +00:00
Matthew Jordan 6df0ae5c1f Force non-inlining of ao2_iterator_destroy when TEST_FRAMEWORK is enabled
In r357272, astobj2 was changed to automatically enable REF_DEBUG when the
TEST_FRAMEWORK flag was enabled.  Unfortunately, some compilers (gcc 4.5.1
at least) will attempt to inline ao2_iterator_destroy in handle_astobj2_test.
This by itself is not a problem; unfortunately, the compiler believes that
there is a code path wherein an object allocated on the stack will be
free'd.  As warnings are treated as errors, this prevents compilation of
astobj2.

This patch works around that by adding the noinline attribue to
ao2_iterator_destroy, but only if the TEST_FRAMEWORK flag is enabled.
Preventing inlining is only needed for the test method defined in astobj2,
which is also only enabled if TEST_FRAMEWORK is enabled.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@359306 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-14 14:40:44 +00:00
Russell Bryant 00b270833f Fix bogus reads/writes of console log levels in asterisk.c
This patch updates the NUMLOGLEVELS define in logger.h to 32, to match the fact
that logger.c implements 32 log levels (because of the custom log level stuff).
asterisk.c uses this define to size an array of levels per remote console.

This array is modified in ast_console_toggle_loglevel(), which is called by the
"logger set level" CLI command.  While the documentation for the CLI command
doesn't make it terribly obvious, you can use this CLI command to toggle a
custom log level on a remote console, as well.  However, doing so led to an
invalid array index in asterisk.c.

This array is read from any time a log message is written to a console.  So, 
all custom log level messages resulted in a bogus read if a remote console
was connected.
........

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

Merged revisions 359260 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@359261 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-14 10:56:53 +00:00
Russell Bryant 4585000039 Remove chan_usbradio and app_rpt.
These modules are being maintained outside of the tree and have been for a long
time now, so it doesn't make sense to keep them here.

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

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

Merged revisions 359051 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@359052 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-13 23:42:24 +00:00
Terry Wilson 128c9109b0 Add missing channel_internal.h
...again.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@359011 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-13 21:24:13 +00:00
Terry Wilson 699d2bd705 Make hints for invalid SIP devices return Unavail, not idle
This patch drastically simplifies the device state aggegation code.
The old method was not only overly complex, but also made it impossible
to return AST_DEVICE_INVALID from the aggregation code. The unit test
update is as a result of fixing that bug.

The SIP change stems from a bug introduced by removing a DNS lookup
for hostname-based SIP channels.

(closes issue ASTERISK-16702)
Review: https://reviewboard.asterisk.org/r/1808/
........

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

Merged revisions 358944 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@358945 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-13 20:06:57 +00:00
Terry Wilson 786f5898d1 Finalize ast_channel opaquification
Review: https://reviewboard.asterisk.org/r/1786/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@358907 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-13 18:20:34 +00:00
Joshua Colp f5fda0eb74 Transition app_page to using app_confbridge internally for the conference bridge portion of paging. This also adds a new 'announcement' option to ConfBridge user profiles.
Review: https://reviewboard.asterisk.org/r/1754/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@358730 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-10 20:06:46 +00:00
Sean Bright a8116350bc Add some underscores in a few of our llist macros to reduce name collisions.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@358646 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-08 17:00:22 +00:00
Richard Mudgett 38f6e5d1ad Make usage of DECLARE_STRINGFIELD_SETTERS_FOR() not look so odd.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@358263 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-05 21:55:28 +00:00
Kinsey Moore 8d1bde49a9 Fix case-sensitivity for device-specific event subscriptions and CCSS
This change fixes case-sensitivity for device-specific subscriptions such that
the technology identifier is case-insensitive while the remainder of the device
string is still case-sensitive.  This should also preserve the original case of
the device string as passed in to the event system.  CCSS is the only feature
affected as it is the only consumer of device-specific event subscriptions.

The second part of this patch addresses similar case-sensitivity issues within
CCSS itself that prevented it from functioning correctly after the fix to the
events system.

This adds a unit test to verify that the event system works as expected.

(closes issue ASTERISK-19422)
Review: https://reviewboard.asterisk.org/r/1780/
........

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

Merged revisions 357941 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@357942 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-02 21:06:12 +00:00
Terry Wilson 0e5c761c28 Opaquify ast_channel typedefs, fd arrays, and softhangup flag
Review: https://reviewboard.asterisk.org/r/1784/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@357721 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-01 22:09:18 +00:00
Walter Doekes 41f5a1ab35 Update stringfield documentation for removed second va_list in favor of va_copy.
In r320946, the second va_list that was passed to ast_string_field_build_va
and friends, was removed. This patch updates the documentation to reflect that.
........

Merged revisions 357620 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@357621 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-29 20:41:38 +00:00
Terry Wilson a9d607a357 Opaquify ast_channel structs and lists
Review: https://reviewboard.asterisk.org/r/1773/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@357542 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-29 16:52:47 +00:00
Sean Bright 35e2a046fd Documentation update. There is no AST_SOCKADDR_UNSPEC.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@357355 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-28 19:55:32 +00:00
Richard Mudgett 85ea4277f1 Convert struct ast_tcptls_session_instance to finally use the ao2 object lock.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@357317 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-28 18:46:34 +00:00
Richard Mudgett 2e834f7d36 Astobj2 locking enhancement.
Add the ability to specify what kind of locking an ao2 object has when it
is allocated.  The locking could be one of: MUTEX, RWLOCK, or none.

New API:

ao2_t_alloc_options()
ao2_alloc_options()
ao2_t_container_alloc_options()
ao2_container_alloc_options()

ao2_rdlock()
ao2_wrlock()
ao2_tryrdlock()
ao2_trywrlock()

The OBJ_NOLOCK and AO2_ITERATOR_DONTLOCK flags have a slight meaning
change.  They no longer mean that the object is protected by an external
mechanism.  They mean the lock associated with the object has already been
manually obtained by one of the ao2_lock calls.  This change is necessary
for RWLOCK support since they are not reentrant.  Also an operation on an
ao2 container may require promoting a read lock to a write lock by
releasing the already held read lock to re-acquire as a write lock.


Replaced API calls:

ao2_t_link_nolock()
ao2_link_nolock()
ao2_t_unlink_nolock()
ao2_unlink_nolock()

with the respective

ao2_t_link_flags()
ao2_link_flags()
ao2_t_unlink_flags()
ao2_unlink_flags()

API calls to be more flexible and to allow an anticipated enhancement to
control linking duplicate objects into a container.


The changes to format.c and format_cap.c are taking advantange of the new
ao2 locking options to simplify the use of the format capabilities
containers.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@357272 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-28 18:15:34 +00:00
Richard Mudgett 50c8557f03 Add ability to clone ao2 containers.
Occasionally there is a need to put all objects in one container also into
another container.

Some reasons you might need to do this:

1) You need to reconfigure a container.  You would do this by creating a
new container with the new configuration and ao2_container_dup the old
container into it.  Then replace the old container with the new.  Then
destroy the old container.

2) You need the contents of a container to remain stable while operating
on all of the objects.  You would do this by creating a cloned container
of the original with ao2_container_clone.  The cloned container is a
snapshot of the objects at the time of the cloning.  When done, just
destroy the cloned container.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@357145 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-28 00:42:38 +00:00
Jonathan Rose e37631d071 Converts locking for odbc containers from ast_mutex_lock to ao2_locks.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@357051 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-27 19:55:14 +00:00
Kinsey Moore 1fac2fba4b Deprecated macro usage for connected line, redirecting, and CCSS
This commit adds GoSub alternatives to connected line, redirecting, and CCSS
macro hooks so that macro can finally be deprecated.  This also adds
deprecation warnings for those features when used and in documentation.

Review: https://reviewboard.asterisk.org/r/1760/
(closes issue SWP-4256)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@357013 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-27 16:50:19 +00:00
Sean Bright 3cf09f40f7 Convert netsock.h over to use ast_sockaddrs rather than sockaddr_in and update
chan_iax2 to pass in the correct types.

chan_iax2 is the only consumer for the various ast_netsock_* functions in trunk
at this point, so this feels like a safe change to make.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@357005 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-27 16:31:24 +00:00
Sean Bright 6214285950 Make ast_netsock_set_qos() delegate to ast_set_qos().
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@356916 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-27 14:57:23 +00:00
Sean Bright 0cf8b2b136 Correct typo in deprecation comment.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@356883 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-27 14:15:24 +00:00
Sean Bright 51c24c88a1 Prefer ast_set_qos() over ast_netsock_set_qos()
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@356882 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-27 14:13:58 +00:00
Richard Mudgett 0553e61207 astobj2.h comment tweaks.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@356765 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-24 23:40:23 +00:00
Richard Mudgett e43d123f11 astobj2.h documentation updates.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@356734 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-24 20:47:12 +00:00
Richard Mudgett ebe2c33b72 Fix worker thread resource leak in SIP TCP/TLS.
The SIP TCP/TLS worker threads were created joinable but noone could join
them if they died on their own.

* Fix the SIP TCP/TLS worker threads to not be created joinable.

* _sip_tcp_helper_thread() only needs one parameter since the pvt
parameter is only passed in as NULL and never used.

(closes issue ASTERISK-19203)
Reported by: Steve Davies

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

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

Merged revisions 356690 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@356697 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-24 18:33:04 +00:00
Matthew Jordan 670797e5da Allow SRTP policies to be reloaded
Currently, when using res_srtp, once the SRTP policy has been added to the
current session the policy is locked into place.  Any attempt to replace an
existing policy, which would be needed if the remote endpoint negotiated a new
cryptographic key, is instead rejected in res_srtp.  This happens in particular
in transfer scenarios, where the endpoint that Asterisk is communicating with
changes but uses the same RTP session.

This patch modifies res_srtp to allow remote and local policies to be reloaded
in the underlying SRTP library.  From the perspective of users of the SRTP API,
the only change is that the adding of remote and local policies are now added
in a single method call, whereas they previously were added separately.  This
was changed to account for the differences in handling remote and local
policies in libsrtp.

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

(closes issue ASTERISK-19253)
Reported by: Thomas Arimont
Tested by: Thomas Arimont
Patches:
  srtp_renew_keys_2012_02_22.diff uploaded by Matt Jordan (license 6283)
  (with some small modifications for this check-in)
........

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

Merged revisions 356605 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@356606 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-24 15:10:35 +00:00
Terry Wilson ebaf59a656 Opaquification for ast_format structs in struct ast_channel
Review: https://reviewboard.asterisk.org/r/1770/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@356573 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-24 00:32:20 +00:00
Terry Wilson 0cc38858dd Track module use count for res_calendar
If the res_calendar module was followed immediately by one of the
calendar tech modules and "core stop gracefully" was run, Asterisk
would crash.

This patch adds use count tracking for res_calendar so that it is
unloaded after the tech modules when shutting down gracefully. It
is now not possible to unload all the of the calendar modules via
"module unload res_calednar.so", but it is still possible to unload
them all via "module unload -h res_calendar.so".

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

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

Merged revisions 356297 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@356314 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-22 21:22:43 +00:00
Terry Wilson 3a9ac7c10c Rename ast_channel_emulate_dtmf_digit* funcs
The accessors names for the "emulate_dtmf_digit" field on the ast_channel
are misleading. Change them to ast_channel_dtmf_digit_to_emulate*.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@356183 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-22 00:35:54 +00:00
Terry Wilson 57f42bd74f ast_channel opaquification of pointers and integral types
Review: https://reviewboard.asterisk.org/r/1753/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@356042 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-20 23:43:27 +00:00
Richard Mudgett 7093cf278c Fix compile problem when old version of libvorbisfile v1.1.2 is used.
The principle difference between libvorbisfile v1.1.2 and newer (at least
v1.2.0) is the addition of the predefined callbacks OV_CALLBACKS_xxx in
vorbis/vorbisfile.h used for ov_open_callbacks().

* Updated the configure script to detect if libvorbisfile.h declares
OV_CALLBACKS_NOCLOSE.

* Copied the declaration of OV_CALLBACKS_NOCLOSE from v1.2.0 to allow
v1.1.2 to compile.

(closes issue ASTERISK-19370)
Reported by: Jonn Taylor
........

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

Merged revisions 355620 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@355621 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-16 19:51:15 +00:00
Tilghman Lesher a78b0af5ea Re-commit the verbose branch.
This change permits each verbose destination (consoles, logger) to have its
own concept of what the verbosity level is.  The big feature here is that
the logger will now be able to capture a particular verbosity level without
condemning each console to need to suffer that level of verbosity.
Additionally, a stray 'core set verbose' will no longer change what will go
to the log.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@355413 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-14 20:27:16 +00:00
Richard Mudgett 51b32041d5 Fix voicemail problems when using ogg/vorbis.
Ogg/vorbis was fairly useless as a voicemail file format because it did
not implement the seek and tell format callbacks among other problems.

Since we were already using the libvorbis and libvorbisenc libraries we
can use libvorbisfile as it is also part of the vorbis library package.

* Made use the libvorbisfile to handle the ogg/vorbis file stream.  The
format_ogg_vorbis.c is now mostly a wrapper around libvorbisfile.

(closes issue ASTERISK-16926)
Reported by: sque
Patches:
      ogg_vorbis_use_libvorbisfile.patch (license #6108) patch uploaded by sque
........

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

Merged revisions 355375 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@355376 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-14 19:29:24 +00:00
Terry Wilson 34c55e8e7c Opaquify char * and char[] in ast_channel
Review: https://reviewboard.asterisk.org/r/1733/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@354968 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-13 17:27:06 +00:00
Russell Bryant 055a19e128 Replace res_ais with a new module, res_corosync.
This patch removes res_ais and introduces a new module, res_corosync.
The OpenAIS project is deprecated and is now just a wrapper around
Corosync.  This module provides the same functionality using the same
core infrastructure, but without the use of the deprecated components.

Technically res_ais could have been used with an AIS implementation other
than OpenAIS, but that is the only one I know of that was ever used.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@354046 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-05 10:58:37 +00:00
Mark Michelson 0f4489dc0f 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
........

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

Merged revisions 353820 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@353821 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-02 18:55:05 +00:00
Richard Mudgett 23bc964e1c Constify some more channel driver technology callback parameters.
Review: https://reviewboard.asterisk.org/r/1707/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@353685 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-01 19:53:38 +00:00
Richard Mudgett a99b3c817b Fix ExtenSpy and simplify the channel search functions.
When ast_channel name was opaquified, the channel search functions did not
get converted correctly.  As a result ExtenSpy which uses a channel
iterator search by exten@context could never find anything.

* Updated the doxygen documentation for the search functions in channel.h.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@353647 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-01 17:21:40 +00:00
Sean Bright 544333b435 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
........

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

Merged revisions 353599 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@353600 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-01 15:59:54 +00:00
Richard Mudgett 2d7a40de58 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/
........

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

Merged revisions 353463 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@353466 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-31 17:26:09 +00:00
Terry Wilson de57235ac6 Re-link peers by IP when dnsmgr changes the IP
Asterisk's dnsmgr currently takes a pointer to an ast_sockaddr and updates it
anytime an address resolves to something different. There are a couple of
issues with this. First, the ast_sockaddr is usually the address of an
ast_sockaddr inside a refcounted struct and we never bump the refcount of those
structs when using dnsmgr. This makes it possible that a refresh could happen
after the destructor for that object is called (despite ast_dnsmgr_release
being called in that destructor). Second, the module using dnsmgr cannot be
aware of an address changing without polling for it in the code. If an action
needs to be taken on address update (like re-linking a SIP peer in the
peers_by_ip table), then polling for this change negates many of the benefits
of having dnsmgr in the first place.

This patch adds a function to the dnsmgr API that calls an update callback
instead of blindly updating the address itself. It also moves calls to
ast_dnsmgr_release outside of the destructor functions and into cleanup
functions that are called when we no longer need the objects and increments the
refcount of the objects using dnsmgr since those objects are stored on the
ast_dnsmgr_entry struct. A helper function for returning the proper default SIP
port (non-tls vs tls) is also added and used.

This patch also incorporates changes from a patch posted by Timo Teräs to
ASTERISK-19106 for related dnsmgr issues.

(closes issue ASTERISK-19106)

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

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

Merged revisions 353397 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@353418 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-30 23:58:51 +00:00
Kevin P. Fleming 92ef8a6fe1 Address OpenSSL initialization issues when using third-party libraries.
When Asterisk is used with various third-party libraries (CURL, PostgresSQL,
many others) that have the ability themselves to use OpenSSL, it is possible
for conflicts to arise in how the OpenSSL libraries are initialized and
shutdown. This patch addresses these conflicts by 'wrapping' the important
functions from the OpenSSL libraries in a new shared library that is part
of Asterisk itself, and is loaded in such a way as to ensure that *all*
calls to these functions will be dispatched through the Asterisk wrapper
functions, not the native functions.

This new library is optional, but enabled by default. See the CHANGES file
for documentation on how to disable it.

Along the way, this patch also makes a few other minor changes:

* Changes MODULES_DIR to ASTMODDIR throughout the build system, in order to
  more closely match what is used during run-time configuration.

* Corrects some errors in the configure script where AC_CHECK_TOOLS was used
  instead of AC_PATH_PROG.

* Adds a new variable for linker flags in the build system (DYLINK), used for
  producing true shared libraries (as opposed to the dynamically loadable
  modules that the build system produces for 'regular' Asterisk modules).

* Moves the Makefile bits that handle installation and uninstallation of the
  main Asterisk binary into main/Makefile from the top-level Makefile.

* Moves a couple of useful preprocessor macros from optional_api.h to
  asterisk.h.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@353317 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-30 21:21:16 +00:00
Richard Mudgett 27b69e7d29 Audit of ao2_iterator_init() usage for v1.8.
Fixes numerous reference leaks and missing ao2_iterator_destroy() calls as
a result.

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

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

Merged revisions 352956 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@352957 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-27 18:47:16 +00:00
Kevin P. Fleming 9ee8a74461 Remove "asterisk/version.h" in favor of "asterisk/ast_version.h".
A long time ago, in a land far far away, we added "asterisk/ast_version.h",
which provides the ast_get_version() and ast_get_version_num() functions. These
were added so that modules that needed the version information for the Asterisk
instance they were loaded in could actually get it (as opposed the version that
they were compiled against). We changed everything in the tree to use the
new mechanism (although later main/test.c was added using the old method).
However, the old mechanism was never removed, and as a result, new code is
still trying to use it.

This commit removes asterisk/version.h and replaces it with a header that
will generate a compile-time error if you try to use it (the error message
tells you which header you should use instead). It also removes the Makefile
and build_tools bits that generated the file, and it updates main/test.c to
use the 'proper' method of getting the Asterisk version information.

This is an API change and thus is being committed for trunk only, but it's
a fairly minor one and definitely improves the situation for out-of-tree
modules.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@352626 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-25 21:31:28 +00:00
Terry Wilson 99cae5b750 Opaquify channel stringfields
Continue channel opaque-ification by wrapping all of the stringfields.
Eventually, we will restrict what can actually set these variables, but
the purpose for now is to hide the implementation and keep people from
adding code that directly accesses the channel structure. Semantic
changes will follow afterward.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@352348 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-24 20:12:09 +00:00
Jonathan Rose 6fd0ac9dcd Eliminates doubling the :port part of SIP Notify Message-Account headers.
This patch prevents the domain string from getting mangled during the initreqprep
step by moving the initialization to before its immediate use.  It also documents
this pitfall for the ast_sockaddr_stringify functions.

(issue ASTERISK-19057)
Reported by: Yuri
Review: https://reviewboard.asterisk.org/r/1678/
........

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

Merged revisions 351560 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@351561 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-19 21:55:41 +00:00
Kinsey Moore d05a7d45cd Run bootstrap.sh for the for the ASTERISK-18929 fix
configure and autoconfig.h.in were not regenerated when the fix was committed.
........

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

Merged revisions 350737 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@350738 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-13 22:17:13 +00:00
Matthew Jordan a8276fe8ef Fix crash from bridge channel hangup race condition in ConfBridge
This patch addresses two issues in ConfBridge and the channel bridge layer:
1. It fixes a race condition wherein the bridge channel could be hung up
2. It removes the deadlock avoidance from the bridging layer and makes the
   bridge_pvt an ao2 ref counted object

Patch by David Vossel (mjordan was merely the commit monkey)

(issue ASTERISK-18988)
(closes issue ASTERISK-18885)
Reported by: Dmitry Melekhov
Tested by: Matt Jordan
Patches: chan_bridge_cleanup_v.diff uploaded by David Vossel (license 5628)

(closes issue ASTERISK-19100)
Reported by: Matt Jordan
Tested by: Matt Jordan

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

Merged revisions 350550 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@350551 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-13 16:48:06 +00:00
Terry Wilson 04da92c379 Replace direct access to channel name with accessor functions
There are many benefits to making the ast_channel an opaque handle, from
increasing maintainability to presenting ways to kill masquerades. This patch
kicks things off by taking things a field at a time, renaming the field to
'__do_not_use_${fieldname}' and then writing setters/getters and converting the
existing code to using them. When all fields are done, we can move ast_channel
to a C file from channel.h and lop off the '__do_not_use_'.

This patch sets up main/channel_interal_api.c to be the only file that actually
accesses the ast_channel's fields directly. The intent would be for any API
functions in channel.c to use the accessor functions. No more monkeying around
with channel internals. We should use our own APIs.

The interesting changes in this patch are the addition of
channel_internal_api.c, the moving of the AST_DATA stuff from channel.c to
channel_internal_api.c (note: the AST_DATA stuff will have to be reworked to
use accessor functions when ast_channel is really opaque), and some re-working
of the way channel iterators/callbacks are handled so as to avoid creating fake
ast_channels on the stack to pass in matching data by directly accessing fields
(since "name" is a stringfield and the fake channel doesn't init the
stringfields, you can't use the ast_channel_name_set() function). I went with
ast_channel_name(chan) for a getter, and ast_channel_name_set(chan, name) for a
setter.

The majority of the grunt-work for this change was done by writing a semantic
patch using Coccinelle ( http://coccinelle.lip6.fr/ ).

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@350223 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-09 22:15:50 +00:00
Russell Bryant 2b2d34b3c9 Constify tag argument in REF_DEBUG related code.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@349409 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-12-31 15:45:57 +00:00
Kevin P. Fleming fdda494776 Improve T.38 gateway V.21 preamble detection.
This commit removes the V.21 preamble detection code previously added to the
generic DSP implementation in Asterisk, and instead enhances the res_fax module
to be able to utilize V.21 preamble detection functionality made available by
FAX technology modules. This commit also adds such support to res_fax_spandsp,
which uses the Spandsp modem tone detection code to do the V.21 preamble
detection.

There should be no functional change here, other than much more reliable V.21
preamble detection (and thus T.38 gateway initiation).
........

Merged revisions 349248 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@349249 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-12-28 18:59:16 +00:00
Matthew Jordan d9651f2be9 Fix timing source dependency issues with MOH
Prior to this patch, res_musiconhold existed at the same module priority level
as the timing sources that it depends on.  This would cause a problem when
music on hold was reloaded, as the timing source could be changed after
res_musiconhold was processed.  This patch adds a new module priority level,
AST_MODPRI_TIMING, that the various timing modules are now loaded at.  This
now occurs before loading other resource modules, such that the timing source
is guaranteed to be set prior to resolving the timing source dependencies.

(closes issue ASTERISK-17474)
Reporter: Luke H
Tested by: Luke H, Vladimir Mikhelson, zzsurf, Wes Van Tlghem, elguero, Thomas Arimont
Patches:
 asterisk-17474-dahdi_timing-infinite-wait-fix_v3_branch-1.8.diff uploaded by elguero (License #5026)
 asterisk-17474-dahdi_timing-infinite-wait-fix_v3_branch-10.diff uploaded by elguero (License #5026)
 asterisk-17474-dahdi_timing-infinite-wait-fix_v3.diff uploaded by elguero (License #5026)

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

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

Merged revisions 349195 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@349196 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-12-27 20:55:15 +00:00
Richard Mudgett 32e35e5fcd Fix extension state callback references in chan_sip.
Chan_sip gives a dialog reference to the extension state callback and
assumes that when ast_extension_state_del() returns, the callback cannot
happen anymore.  Chan_sip then reduces the dialog reference count
associated with the callback.  Recent changes (ASTERISK-17760) have
resulted in the potential for the callback to happen after
ast_extension_state_del() has returned.  For chan_sip, this could be very
bad because the dialog pointer could have already been destroyed.

* Added ast_extension_state_add_destroy() so chan_sip can account for the
sip_pvt reference given to the extension state callback when the extension
state callback is deleted.

* Fix pbx.c awkward statecbs handling in ast_extension_state_add_destroy()
and handle_statechange() now that the struct ast_state_cb has a destructor
to call.

* Ensure that ast_extension_state_add_destroy() will never return -1 or 0
for a successful registration.

* Fixed pbx.c statecbs_cmp() to compare the correct information.  The
passed in value to compare is a change_cb function pointer not an object
pointer.

* Make pbx.c ast_merge_contexts_and_delete() not perform callbacks with
AST_EXTENSION_REMOVED with locks held.  Chan_sip is notorious for
deadlocking when those locks are held during the callback.

* Removed unused lock declaration for the pbx.c store_hints list.

(closes issue ASTERISK-18844)
Reported by: rmudgett

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

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

Merged revisions 348952 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@348953 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-12-23 02:35:13 +00:00
Terry Wilson b9bf2444e0 Allow packetization vaules > 127
According to the RTP packetization documentation, and the maximum values
listed in AST_FORMAT_LIST, we should support values > that the signed
char array that ast_codec_pref makes available to store the value. All
places in the code treat the framing field as though it were an int
array instaead of a char array anyway, so this just fixes the type of
the array.

(closes issue ASTERISK-18876)
Review: https://reviewboard.asterisk.org/r/1639/
........

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

Merged revisions 348845 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@348847 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-12-22 20:39:48 +00:00
Richard Mudgett b05d4603c4 Fix crash during CDR update.
The ast_cdr_setcid() and ast_cdr_update() were shown in ASTERISK-18836 to
be called by different threads for the same channel.  The channel driver
thread and the PBX thread running dialplan.

* Add lock protection around CDR API calls that access an ast_channel
pointer.

(closes issue ASTERISK-18836)
Reported by: gpluser

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

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

Merged revisions 348363 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@348364 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-12-16 21:10:19 +00:00