Commit Graph

2843 Commits

Author SHA1 Message Date
David M. Lee 9bed50db41 optional_api: Fix linking problems between modules that export global symbols
With the new work in Asterisk 12, there are some uses of the
optional_api that are prone to failure. The details are rather involved,
and captured on [the wiki][1].

This patch addresses the issue by removing almost all of the magic from
the optional API implementation. Instead of relying on weak symbol
resolution, a new optional_api.c module was added to Asterisk core.

For modules providing an optional API, the pointer to the implementation
function is registered with the core. For modules that use an optional
API, a pointer to a stub function, along with a optional_ref function
pointer are registered with the core. The optional_ref function pointers
is set to the implementation function when it's provided, or the stub
function when it's now.

Since the implementation no longer relies on magic, it is now supported
on all platforms. In the spirit of choice, an OPTIONAL_API flag was
added, so we can disable the optional_api if needed (maybe it's buggy on
some bizarre platform I haven't tested on)

The AST_OPTIONAL_API*() macros themselves remained unchanged, so
existing code could remain unchanged. But to help with debugging the
optional_api, the patch limits the #include of optional API's to just
the modules using the API. This also reduces resource waste maintaining
optional_ref pointers that aren't used.

Other changes made as a part of this patch:
 * The stubs for http_websocket that wrap system calls set errno to
   ENOSYS.

 * res_http_websocket now properly increments module use count.

 * In loader.c, the while() wrappers around dlclose() were removed. The
   while(!dlclose()) is actually an anti-pattern, which can lead to
   infinite loops if the module you're attempting to unload exports a
   symbol that was directly linked to.

 * The special handling of nonoptreq on systems without weak symbol
   support was removed, since we no longer rely on weak symbols for
   optional_api.

 [1]: https://wiki.asterisk.org/wiki/x/wACUAQ

(closes issue ASTERISK-22296)
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/2797/
........

Merged revisions 397989 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397990 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-30 13:40:27 +00:00
David M. Lee 7f547872e4 ARI: Implement /recordings/stored API's
his patch implements the ARI API's for stored recordings. While the
original task only specified deleting a recording, it was simple
enough to implement the GET for all recordings, and for an individual
recording.

The recording playback operation was modified to use the same code for
accessing the recording as the REST API, so that they will behave
consistently.

There were several problems with the api-docs that were also fixed,
bringing the ARI spec in line with the implementation. There were some
'wishful thinking' fields on the stored recording model (duration and
timestamp) that were removed, because I ended up not implementing a
metadata file to go along with the recording to store such information.

The GET /recordings/live operation was removed, since it's not really
that useful to get a list of all recordings that are currently going
on in the system. (At least, if we did that, we'd probably want to
also list all of the current playbacks. Which seems weird.)

(closes issue ASTERISK-21582)
Review: https://reviewboard.asterisk.org/r/2693/
........

Merged revisions 397985 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397988 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-30 13:28:50 +00:00
Richard Mudgett b6a080d6a3 Match use of ast_free() with ast_calloc() and add some curly braces.
........

Merged revisions 397856 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397857 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-28 16:07:30 +00:00
Richard Mudgett d647b4ae02 bridging: Fix a livelock with local channel optimization.
Use a better means of waking up the bridge channel thread.
........

Merged revisions 397650 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397651 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-26 16:25:39 +00:00
Matthew Jordan 447848a580 Fix the config_options_test
The config options test requires the entire configuration item to be transparent from
the documentation system. So we let it do that too.

As an aside, please do not use this power for evil. Documentation is your friend, and
you really should document your configurations. Hiding your module's configuration
information from the system attempting to enforce some sanity in the universe is something
only a Bond villain would contemplate.
........

Merged revisions 397628 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397629 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-25 18:00:46 +00:00
Joshua Colp dd33217762 Add the bucket API.
Bucket is a URI based API for the creation, retrieval, updating, and deletion
of "buckets" and files contained within them.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397600 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-23 21:49:47 +00:00
Joshua Colp cd7436a6c0 Fix a bug where the argc value was passed as no_doc when registering custom sorcery types.
This also adds a _nodoc equivalent.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397599 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-23 21:45:48 +00:00
Richard Mudgett 6ebfac8e70 Handle DTMF and hold wrapup when a channel leaves the bridging system.
DTMF start/end and hold/unhold events have state because a DTMF begin
event and hold event must be ended by something.

The following cases need to be handled when a channel is moved around in
the system.

* When a channel leaves a bridge it may owe a DTMF end event to the
bridge.

* When a channel leaves a bridge it may owe an UNHOLD event to the bridge.
(This case is explicitly ignored because things like transfers need
explicit control over this.)

* When a channel leaves the bridging system it may need to simulate a DTMF
end event to the channel.

* When a channel leaves the bridging system it may need to simulate an
UNHOLD event to the channel.

The patch also fixes the following:
* Fixes playing a file and restarting MOH using the latest MOH class used.

(closes issue ASTERISK-22043)
Reported by: Matt Jordan

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397577 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-23 18:33:36 +00:00
Richard Mudgett 46b9e5450f Fix memory corruption when trying to get "core show locks".
Review https://reviewboard.asterisk.org/r/2580/ tried to fix the mismatch
in memory pools but had a math error determining the buffer size and
didn't address other similar memory pool mismatches.

* Effectively reverted the previous patch to go in the same direction as
trunk for the returned memory pool of ast_bt_get_symbols().

* Fixed memory leak in ast_bt_get_symbols() when BETTER_BACKTRACES is
defined.

* Fixed some formatting in ast_bt_get_symbols().

* Fixed sig_pri.c freeing memory allocated by libpri when MALLOC_DEBUG is
enabled.

* Fixed __dump_backtrace() freeing memory from ast_bt_get_symbols() when
MALLOC_DEBUG is enabled.

* Moved __dump_backtrace() because of compile issues with the utils
directory.

(closes issue ASTERISK-22221)
Reported by: Matt Jordan

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397570 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-23 18:07:40 +00:00
David M. Lee 7a581537e8 ARI: Correct error codes for bridge operations
This patch adds error checking to ARI bridge operations, when
adding/removing channels to/from bridges.

In general, the error codes fall out as follows:
 * Bridge not found - 404 Not Found
 * Bridge not in Stasis - 409 Conflict
 * Channel not found - 400 Bad Request
 * Channel not in Stasis - 422 Unprocessable Entity
 * Channel not in this bridge (on remove) - 422 Unprocessable Entity

(closes issue ASTERISK-22036)
Review: https://reviewboard.asterisk.org/r/2769/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397565 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-23 17:19:02 +00:00
Matthew Jordan 4d348e853c Add pass through support for Opus and VP8; Opus format attribute negotiation
This patch adds pass through support for Opus and VP8. That includes:

* Format attribute negotiation for Opus. Note that unlike some other codecs,
  the draft RFC specifies having spaces delimiting the attributes in addition
  to ';', so you have "attra=X; attrb=Y". This broke the attribute parsing in
  chan_sip, so a small tweak was also included in this patch for that.

* A format attribute negotiation module for Opus, res_format_attr_opus

* Fast picture update for VP8. Since VP8 uses a different RTCP packet number
  than FIR, this really is specific to VP8 at this time.

Note that the format attribute negotiation in res_pjsip_sdp_rtp was written
by mjordan. The rest of this patch was written completely by Lorenzo Miniero.

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

(closes issue ASTERISK-21981)
Reported by: Tzafrir Cohen
patches:
  asterisk_opus+vp8_passthrough_20130718.patch uploaded by lminiero (License 6518)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397526 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-23 15:42:27 +00:00
Matthew Jordan e31bd332b8 Update config framework/sorcery with types/options without documentation
There are times when a configuration option should not have documentation.

1. Some options are registered with a particular object merely as a warning to
   users. These options aren't even really 'deprecated' - which has its own
   separate API call - they are actually provided by a different configuration
   file. The options are merely registered so that the user gets a warning that
   a different configuration file provides the item.

2. Some object types - most notably some used by modules that use sorcery - are
   completely internal and should never be shown to the user.

3. Sorcery itself has several 'hidden' fields that should never be shown to a
   user.

This patch updates the configuration framework and sorcery with additional API
calls that allow a module to register types as internal and options as not
requiring documentation. This bypasses the XML documentation checking.

This patch also re-enables the strict XML documentation checking in trunk, as
well as updates some documentation that was missing.

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

(closes issue ASTERISK-22359)
Reported by: Matt Jordan

(closes issue ASTERISK-22112)
Reported by: Rusty Newton



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397524 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-23 15:21:40 +00:00
Jonathan Rose 21e22310c7 ARI: Music on Hold/Background Music for bridges
Adds ARI functions to be able to turn on/off music on hold in a
bridge. It actually functions more as a background music without
further actions on the bridge since if the rest of the channels
in the bridge aren't explicitly muted, they will still be able
to communicate.

(closes issue ASTERISK-21974)
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/2688/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397505 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-23 00:26:19 +00:00
Kinsey Moore 7b032c1adb Add SayAlphaCase and similar functionality for AGI
This adds a new dialplan application, SayAlphaCase, that performs much
the same function as SayAlpha except that it takes additional options
which allow the user to specify whether the case of each letter should
be announced for uppercase, lowercase, or all letters. Similar
functionality has been added to the SAY ALPHA AGI command via an
optional parameter.

Original Patch by: Kevin Scott Adams
Reported by: Kevin Scott Adams
Review: https://reviewboard.asterisk.org/r/2725/
(closes issue ASTERISK-20782)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397493 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-22 22:33:48 +00:00
Richard Mudgett c02c1b6f53 Update MOH start/stop routine doxygen.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397482 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-22 21:29:16 +00:00
Richard Mudgett 477dea4661 Bridge API: Set a cause code on a channel when it is ejected from a bridge.
The cause code needs to be passed from the disconnecting channel to the
bridge peers if the disconnecting channel dissolves the bridge.

* Made the call to an app_agent_pool agent disconnect with the busy cause
code if the agent does not ack the call in time or hangs up before acking
the call.

(closes issue ASTERISK-22042)
Reported by: Matt Jordan

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397472 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-22 21:09:52 +00:00
Mark Michelson 00baddb906 Massively clean up app_queue.
This essentially makes app_queue usable again. From reviewboard:

* Reporting of transfers and call completion is done by creating stasis 
  subscriptions and listening for specific events in order to determine
  when the call is finished (either via a transfer or hangup).
* Dial end messages have been added where they were previously missing.
* Queue stats are properly being updated again once calls have finished.
* AgentComplete stasis messages and AMI events are now occurring again.
* Mixmonitor starting has been factored into its own function and uses the
  Mixmonitor API now instead of using ast_pbx_run()

In addition to the changes in app_queue, there are several supplementary changes as well:

* Queue logging now differentiates between attended and blind transfers. A
  note about this is in the CHANGES file.
* Local channel optimization events now report more information. This
  includes which of the two local channels involved is the destination of
  the optimization, the channel that is replacing the destination local channel,
  and an identifier so that begin and end events can be matched to each other.
  The end events are now sent whether the optimization was successful or not and
  includes an indicator of whether the optimization was successful.
* Changes were made to features and bridging_basic so that additional flags may
  be set on a bridge. This is necessary because the queue requires that its
  bridge only allows move-swap local channel optimizations into the bridge.

(closes issue ASTERISK-21517)
Reported by Matt Jordan

(closes issue ASTERISK-21943)
Reported by Matt Jordan

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397451 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-22 18:52:41 +00:00
Mark Michelson 8049bf94f7 Handle default body types for SIP event packages in res_pjsip_pubsub
Prior to this change, we would reject SUBSCRIBE requests that had no Accept
headers. Now event package handlers that handle the default type for the
event package indicate that they do so. Therefore, if we have a handler that
can handle the default type, we can allow SUBSCRIBEs for the handler's event
package that have no Accept headers.

(closes issue ASTERISK-22067)
reported by Mark Michelson

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397441 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-22 17:42:37 +00:00
Kinsey Moore 20dcc49d2e Make CEL behavior conform to the documentation
This modifies the behavior of the CEL engine to conform to documented
behavior for Asterisk 12 as defined on the wiki
https://wiki.asterisk.org/wiki/display/AST/Asterisk+12+CEL+Specification

The primary changes deal with removal of the peer field from function
calls since it is no longer directly relevant to the bridging system
and removal of the layer of CDR-like business logic that was providing
a partial emulation of Asterisk 11 CEL functionality. With this change,
there is no longer a distinction between "bridges" and "conferences"
and all participation changes are denoted with bridge enter and bridge
exit messages.

This updates the CEL unit tests to handle these changes and simplifies
some of the macros used in the process.

This also fixes a segfault when attempting to ref a configuration that
failed to load.

Review: https://reviewboard.asterisk.org/r/2788/
(issue ASTERISK-21567)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397431 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-22 17:13:16 +00:00
Richard Mudgett b816fe45b6 * Move ast_bridge_channel_setup_features() into bridge_basic.c.
* Made application map hooks be removed on a basic bridge personality
change.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397355 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-21 20:02:24 +00:00
Matthew Jordan 855024107c Set 14400 as the default max bit rate if T38MaxBitRate is not specified
If an endpoint fails to include the T38MaxBitRate attribute during negotiation,
Asterisk will negotiate a bit rate of 2400 instead of the ITU recommended
bit rate of 14400. This patch fixes this by making AST_T38_RATE_14400 the
'default' value of the enum by assigning it a value of 0, such that if an
endpoint fails to include the attribute, the default will be 14400.

Note that Walter Doekes included the nice comment in frame.h about why we are
purposefully assigning AST_T38_RATE_14400 a value of 0.

(closes issue ASTERISK-22275)
Reported by: Andreas Steinmetz
patches:
  fax-fix.patch uploaded by anstein (License 6523)
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397307 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-21 16:31:58 +00:00
Richard Mudgett d213dfa30f Fix several interrelated issues dealing with the holding bridge technology.
* Added an option flags parameter to interval hooks.  Interval hooks now
can specify if the callback will affect the media path or not.

* Added an option flags parameter to the bridge action custom callback.
The action callback now can specify if the callback will affect the media
path or not.

* Made the holding bridge technology reexamine the participant idle mode
option whenever the entertainment is restarted.

* Fixed app_agent_pool waiting agents needlessly starting and stopping MOH
every second by specifying the heartbeat interval hook as not affecting
the media path.

* Fixed app_agent_pool agent alert from restarting the MOH after the alert
beep.  The agent entertainment is now changed from MOH to silence after
the alert beep.

* Fixed holding bridge technology to defer starting the entertainment.  It
was previously a mixture of immediate and deferred.

* Fixed holding bridge technology to immediately stop the entertainment.
It was previously a mixture of immediate and deferred.  If the channel
left the bridging system, any deferred stopping was discarded before
taking effect.

* Miscellaneous holding bridge technology rework coding improvements.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397294 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-21 15:51:19 +00:00
Mark Michelson 5caa938be2 Localize and rename ACL configuration.
This is more-or-less a reversion of previous ACL behavior so that
it is more self-contained. ACL sections are now only parsed if res_pjsip_acl.so
is loaded. Moreover, the configuration section is now "type=acl" instead of
"type=security".

The original reason for having ACLs configured in a "type=security" section
was to lump ACLs and other security-related items into the same section. The
problem is that ACLs really should be in their own sections and there are
no other security-related options implemented anyways.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397193 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-20 21:01:59 +00:00
Kinsey Moore 56aea1c030 Allow res_parking to be unloadable
This change protects accesses of res_parking such that it can unload
safely once transient uses of its registered functions are complete.
The parking API has been restructured such that its consumers do not
have access to the vtable exposed by the parking provider, but instead
route through stubs to prevent consumers from holding on to function
pointers.

This adds calls to all the parking unload functions and moves
application loading and unloading into functions in
parking_applications.c similar to the rest of the parts of res_parking.

Review: https://reviewboard.asterisk.org/r/2763/
(closes issue ASTERISK-22142)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396890 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-17 15:01:54 +00:00
Kinsey Moore d7f1f31270 Refactor CEL to avoid using the event system core
This removes usage of the event system for CEL backend data
distribution and strips unused pieces out of the event system.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396888 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-17 14:46:44 +00:00
Kinsey Moore 59753b1ea1 Strip down the old event system
This removes unused code, event types, IE pltypes, and event IE types
where possible and makes several functions private that were once
public. This includes a renumbering of the remaining event and IE types
which breaks binary compatibility with previous versions. The last
remaining consumers of the old event system (or parts thereof) are
main/security_events.c, res/res_security_log.c, tests/test_cel.c,
tests/test_event.c, main/cel.c, and the CEL backends.

Review: https://reviewboard.asterisk.org/r/2703/
(closes issue ASTERISK-22139)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396887 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-17 14:39:27 +00:00
Richard Mudgett 35b9c6a660 Fix CLI "bridge kick <bridge> <channel>" to check if the bridge needs dissolving.
SIP/foo -- Local;1==Local;2 -- .... -- Local;1==Local;2 -- SIP/bar
Kick a ;1 channel and the chain toward SIP/foo goes away.
Kick a ;2 channel and the chain toward SIP/bar goes away.

This can leave a local channel chain between the kicked ;1 and ;2 channels
that are orphaned until you manually request one of those channels to
hangup or request the bridge to dissolve.

* Added ast_bridge_kick() as a companion to ast_bridge_remove().  The
functional difference is that ast_bridge_kick() may dissolve the bridge as
a result of the channel leaving the bridge.

* Made CLI "bridge kick <bridge> <channel>" use ast_bridge_kick() instead
of ast_bridge_remove() so the bridge can dissolve if needed.

* Renamed bridge_channel_handle_hangup() to ast_bridge_channel_kick() and
made it accessible to other files.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396877 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-16 20:48:13 +00:00
Richard Mudgett 6399836f9b Fix some doxygen bridging file references.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396867 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-16 18:34:31 +00:00
Richard Mudgett 745df0fb81 utils.h: Minor formatting tweaks.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396849 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-16 16:22:26 +00:00
David M. Lee f29d969a79 Stasis: address refcount races; implementation comments
Change r395954 reordered some stasis object destruction, which should
have been fine. Unfortunately, it caused some hard to reproduce issues
related to objects being accessed after they had been destroyed. The
patch in r396329 fixed the destruction order problem; this patch
addresses the underlying issue. A few other stasis-related fixes were
also added.

 * Add ref-bumps around areas where objects may get transitively
   destroyed. (For example, where we lock a topic, unref a subscription,
   which unrefs the topic, which explodes the topic when we try to
   unlock it.)

 * Wrote an extensive doxygen page about Stasis implementation,
   relationships between objects, lifecycles of objects, how the
   refcounting works, etc. Many other comments were added, corrected, or
   cleaned up.

 * Added an assert to the topic dtor to catch extra ref decrements.

 * Fixed type used after destruction errors for graceful shutdown in
   stasis_channels.c.

 * I added two unit tests in an attempt to catch destruction order
   issues. Since the underlying cause is a race condition, though, the
   tests rarely failed even when the code was wrong.

 * Fixed a leak in stasis_cache_pattern.c.

(closes issue ASTERISK-22243)
Review: https://reviewboard.asterisk.org/r/2746/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396842 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-16 16:03:34 +00:00
Walter Doekes c43e19e8e5 Prevent heap alloc functions from running out of stack space.
When asterisk has run out of memory (for whatever reason), the alloc
function logs a message. Logging requires memory. A recipe for
infinite recursion.

Stop the recursion by comparing the function call depth for sane values
before attempting another OOM log message.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396822 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-16 07:18:51 +00:00
Richard Mudgett e35860f954 Changed some BUGBUG tags to associated JIRA issue tags.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396792 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-15 18:20:52 +00:00
Richard Mudgett c3466db29d Resolve some BUGBUG comments.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396783 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-15 17:57:33 +00:00
Richard Mudgett 6d24165dee Remove some dead code dealing with: AST_BRIDGE_REC_CHANNEL_0, AST_BRIDGE_REC_CHANNEL_1, and AST_BRIDGE_IGNORE_SIGS.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396734 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-15 15:12:16 +00:00
Richard Mudgett 5f40a6625d Fix Bridge API DTMF hook matching for begin and end DTMF events.
The Bridge API DTMF hook matching would not deal with DTMF end events
only.  It required a DTMF begin event to start matching the DTMF hooks.
There are many places in Asterisk where code only generates DTMF end
events without the corresponding begin event.  One such place is the AMI
action Atxfer.

* Fixed DTMF hook matching if there is a string of DTMF frames in the read
queue.  We could potentially miss some of them before.

* Fixed AMI Atxfer action documentation.

(closes issue ASTERISK-22037)
Reported by: Matt Jordan

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396732 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-15 14:20:59 +00:00
Kinsey Moore 3f46d461bf Fix deadlocks in chan_sip in REFER and BYE handling
This resolves several deadlocks in chan_sip relating to usage of
ast_channel_bridge_peer and improves accessibility of lock debugging
function calls.

Review: https://reviewboard.asterisk.org/r/2756/
(closes issue ASTERISK-22215)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396723 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-15 12:12:26 +00:00
Richard Mudgett 62c2b80487 Remove unsupported channel technology callbacks.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396713 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-15 00:16:39 +00:00
David M. Lee 987fdfb444 ARI: allow other operations to happen while bridged
This patch changes ARI bridging to allow other channel operations to
happen while the channel is bridged.

ARI channel operations are designed to queue up and execute
sequentially. This meant, though, that while a channel was bridged,
any other channel operations would queue up and execute only after the
channel left the bridge.

This patch changes ARI bridging so that channel commands can execute
while the channel is bridged. For most operations, things simply work
as expected. The one thing that ended up being a bit odd is recording.

The current recording implementation will fail when one attempts to
record a channel that's in a bridge. Note that the bridge itself may
be recording; it's recording a specific channel in the bridge that
fails. While this is an annoying limitation, channel recording is
still very useful for use cases such as voice mail, and bridge
recording makes up much of the difference for other use cases.

(closes issue ASTERISK-22084)
Review: https://reviewboard.asterisk.org/r/2726/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396568 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-13 15:27:32 +00:00
Jonathan Rose 6fe21ef48e bridge_channel: Support the lonely flag and make ARI use it.
The lonely flag is an optional flag for bridge channels that will
make them leave a bridge when a channel leaves if only lonely
channels are in the bridge at that point. This is useful for things
like ending recording and playback channels when they cease to be
interacting with other channels in the bridge.

(closes issue ASTERISK-22117)
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/2721/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396497 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-09 17:22:28 +00:00
Richard Mudgett 3f724fa493 Make bridge snapshots use prefixes.
* Changed ast_manager_build_bridge_state_string() to assume an empty
prefix string just like ast_manager_build_channel_state_string().

* Created ast_manager_build_bridge_state_string_prefix() to work just like
ast_manager_build_channel_state_string_prefix().

* Made BridgeMerge AMI event use To/From prefixes.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396417 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-08 19:16:33 +00:00
Richard Mudgett 73b3c70a5f Remove some resolved or obsolete BUGBUG comments.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396401 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-08 17:51:26 +00:00
Matthew Jordan 33e7b76d1d Hide the Surrogate channels from external consumers; kill Masquerade events
This patch does three things:
1. It provides a Surrogate channel technology with a consolidated
   "implementation detail flag" on the channel technology. This tells
   consumers of Stasis that the creation of this channel is an implementation
   detail in Asterisk and can be ignored (if they so choose). This
   consolidates the conference recorder/announcer flags as well - these flags
   had no additional meaning beyond "ignore this channel please".

2. It modifies allocation of a channel in two ways:
   (a) If a channel technology can be determined from the name, we set it
       directly in the allocation routine. This prevents the initial
       publication of the message from going out with a NULL channel technology
       where possible. This lets Stasis consumers get the right channel
       technology on the first publication.
   (b) It reorganizes allocation to make use of the 'finalized' property on the
       channel. This was already used to know that a channel had completely
       finished its construction in the masquerade routine; now we also use it
       to know whether or not the setting of certain channel properties is
       occurring during or post construction. The various set routines were
       modified accordingly as well.

3. The masquerade event is now dead, Jim. It no longer served any purpose
   whatsoever - if you perform a call pickup you'll get a Pickup event;
   if you perform an attended transfer you will still get those events; if you
   steal a channel to put it elsewhere you'll get the corresponding NewExten or
   BridgeEnter events.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396392 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-08 14:13:05 +00:00
David M. Lee c790848794 ARI: Add recording controls
This patch implements the controls from ARI recordings. The controls
are:

 * DELETE /recordings/live/{recordingName} - stop recording and
   discard it
 * POST /recordings/live/{recordingName}/stop - stop recording
 * POST /recordings/live/{recordingName}/pause - pause recording
 * POST /recordings/live/{recordingName}/unpause - resume recording
 * POST /recordings/live/{recordingName}/mute - mute recording (record
   silence to the file)
 * POST /recordings/live/{recordingName}/unmute - unmute recording.

Since this underlying functionality did not already exist, is was
added to app.c by a set of control frames, similar to how playback
control works. The pause/mute control frames are toggles, even though
the ARI controls are idempotent, to be consistent with the playback
control frames.

(closes issue ASTERISK-22181)
Review: https://reviewboard.asterisk.org/r/2697/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396331 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-06 14:44:45 +00:00
David M. Lee b97d318b7b Tweak caching topics to fix CEL tests
The Stasis changes in r395954 had an unanticipated side effect: messages
published directly to an _all topic does not get forwarded to the
corresponding caching topic.

This patch fixes that by changing how caching topics forward messages,
and how the caching pattern forwards are setup.

For the caching pattern, the all_topic is forwarded to the
all_topic_cached. This forwards messages published directly to the
all_topic to all_topic_cached.

In order to avoid duplicate messages on all_topic_cached, caching topics
were changed to no longer forward uncached messages. Subscribers to an
individual caching topic should only expect to receive cache updates,
and subscription change messages. Since individual caching topics are
new, this shouldn't be a problem.

There are a few minor changes to the pre-cache split behavior.

 * For topics changed to use the caching pattern, the all_topic_cached
   will forward snapshots in addition to cache updates. Since
   subscribers by design ignore unexpected messages, this should be
   fine.

 * Caching topics that don't use the caching pattern no longer forward
   non-cache updates. This makes no difference for the current caching
   topics.

   * mwi_topic_cached, channel_by_name_topic and
     presence_state_topic_cached have no subscribers

   * device_state_topic_cached's only subscriber only processes cache
     udpates

(issue ASTERISK-22243)
Review: https://reviewboard.asterisk.org/r/2738


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396329 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-06 14:28:23 +00:00
Jonathan Rose 3797639e84 bridge features: Dial and Queue add features instead of replace them.
Dial and Queue would previously apply a new set of features whenever
bridging. These options would be based purely on the options supplied
to the dial/queue applications. This patch changes the function those
applications use to bridge calls so that the features will be added
to the set of existing features for each channel rather than having
them override the existing features.

(closes issue ASTERISK-22209)
Reported by: Jonathan Rose
Review: https://reviewboard.asterisk.org/r/2713/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396245 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-05 20:18:54 +00:00
Jonathan Rose e47794ead1 ARI: bridges/{bridgeID}/addChannel: add roles parameter
Roles are now cleared with each entry into a bridge with addChannel.
If the roles parameter is present, the role specified will be applied
to all channels being added with the addChannel command.

(closes issue ASTERISK-21973)
Reported by: Matt Jordan
https://reviewboard.asterisk.org/r/2691/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396182 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-05 16:59:13 +00:00
David M. Lee 357b275239 Fix res_ari_asterisk load issue
The new res_ari_asterisk.so module presents several config options
from asterisk main. Unfortunately, they aren't exported, so the module
won't load on Linux.

This patch renames the variables, adding the ast_ prefix so they will
be exported.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396166 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-05 14:35:00 +00:00
David M. Lee 10c91bc96e Address JSON thread safety issues.
In tracking down some unit tests failures, I ended up reading the fine
print[1] regarding Jansson's thread safety.

In short:
 1. Ref-counting is non-atomic.
 2. json_dumps() and friends are not thread safe.

This patch adds locking where necessary to our ast_json_* wrapper API,
with documentation in json.h describing the thread safety limitations of
the API.

 [1]: http://www.digip.org/jansson/doc/2.4/portability.html#thread-safety

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396119 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-02 14:27:35 +00:00
Mark Michelson 328e99f41d Make a couple of changes to help AMI events to be more clear in what is occurring.
* BridgeEnter now contains the unique ID of the channel that is to be swapped out, if applicable.
* There is a ParkedCallSwap event that is sent when a parked channel has a new channel take its place.

(closes issue ASTERISK-22193)
reported by Mark Michelson

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396107 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-02 14:13:04 +00:00
Kinsey Moore 41d6be2432 Move ast_str_container_alloc and friends
This moves ast_str_container_alloc, ast_str_container_add,
ast_str_container_remove, and related private functions into
strings.c/h since they really don't belong in astobj2.c/h.

As a result of this move, utils also had to be updated.

Review: https://reviewboard.asterisk.org/r/2719/
(closes issue ASTERISK-22041)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396105 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-02 14:08:34 +00:00