asterisk/asterisk.git
6 years agoMove where the sorcery observer is added for qualify to guarantee the sched_qualifies...
Joshua Colp [Tue, 25 Jun 2013 19:10:14 +0000 (19:10 +0000)]
Move where the sorcery observer is added for qualify to guarantee the sched_qualifies container exists.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392864 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoCEL refactoring cleanup
Kinsey Moore [Tue, 25 Jun 2013 13:03:17 +0000 (13:03 +0000)]
CEL refactoring cleanup

This change removes AST_CEL_BRIDGE_UPDATE since it should no longer be
used because masquerade situations are now accounted for in other ways.

This also refactors usage of AST_CEL_FORWARD to be produced by a Dial
message which has been extended with a "forward" field.

(closes issue ASTERISK-21566)
Review: https://reviewboard.asterisk.org/r/2635/

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392829 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoFix memory/ref counting leaks in a variety of locations
Matthew Jordan [Tue, 25 Jun 2013 01:12:58 +0000 (01:12 +0000)]
Fix memory/ref counting leaks in a variety of locations

This patch fixes the following memory leaks:
 * http.c: The structure containing the addresses to bind to was not being
   deallocated when no longer used
 * named_acl.c: The global configuration information was not disposed of
 * config_options.c: An invalid read was occurring for certain option types.
 * res_calendar.c: The loaded calendars on module unload were not being
   properly disposed of.
 * chan_motif.c: The format capabilities needed to be disposed of on module
   unload. In addition, this now specifies the default options for the
   maxpayloads and maxicecandidates in such a way that it doesn't cause the
   invalid read in config_options.c to occur.

(issue ASTERISK-21906)
Reported by: John Hardin
patches:
  http.patch uploaded by jhardin (license 6512)
  named_acl.patch uploaded by jhardin (license 6512)
  config_options.patch uploaded by jhardin (license 6512)
  res_calendar.patch uploaded by jhardin (license 6512)
  chan_motif.patch uploaded by jhardin (license 6512)
........

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392812 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoFix a variety of memory leaks
Matthew Jordan [Mon, 24 Jun 2013 23:56:54 +0000 (23:56 +0000)]
Fix a variety of memory leaks

This patch addresses the following memory/ref counting leaks:

 * main/devicestate.c - unsubscribe and join our devicestate message
   subscription
 * main/cel.c - clean up the datastore and config objects on exist
 * main/parking.c - cleanup memory leak of retriever snapshot on message
   payload destruction
 * res/parking/parking_bridge.c - cleanup memory leak of retrieve snapshot
   on message payload destruction
 * main/presencestate.c - unsubscribe and join the caching topic on exit
 * manager.c - properly unregister the manager action "BlindTransfer"
 * sorcery.c - shutdown the threadpool on exit and dispose of any wizards

(issue ASTERISK-21906)
Reported by: John Hardin
patches:
  cel.patch uploaded by jhardin (license #6512)
  devicestate.patch uploaded by jhardin (license #6512)
  manager.patch uploaded by jardin (license #6512)
  presencestate.patch uploaded by jhardin (license #6512)
  retriever-channel-snapshot.patch uploaded by jhardin (license #6512)
  sorcery.patch uploaded by jhardin (license #6512)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392797 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoFew more menuselect fixes missed in r392777
David M. Lee [Mon, 24 Jun 2013 22:05:28 +0000 (22:05 +0000)]
Few more menuselect fixes missed in r392777

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392779 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoFixed templates so that the changes from r392777 won't be overwritten the next
David M. Lee [Mon, 24 Jun 2013 21:48:39 +0000 (21:48 +0000)]
Fixed templates so that the changes from r392777 won't be overwritten the next
time we run the generators.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392778 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoFix menuselect display for stasis modules.
Richard Mudgett [Mon, 24 Jun 2013 21:40:52 +0000 (21:40 +0000)]
Fix menuselect display for stasis modules.

The menuselect parser is very simple.  It looks for AST_MODULE_INFO and
uses any quoted string on that line as the module summary display.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392777 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoRemove stray properties from merge.
Mark Michelson [Mon, 24 Jun 2013 19:28:51 +0000 (19:28 +0000)]
Remove stray properties from merge.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392747 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoAdd documentation for features configuration.
Mark Michelson [Mon, 24 Jun 2013 18:33:13 +0000 (18:33 +0000)]
Add documentation for features configuration.

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

(closes issue ASTERISK-21542)
Reported by Matt Jordan

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392729 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoIndex installed sounds and implement ARI sounds queries
Kinsey Moore [Mon, 24 Jun 2013 13:49:20 +0000 (13:49 +0000)]
Index installed sounds and implement ARI sounds queries

This adds support for stasis/sounds and stasis/sounds/{ID} queries via
the Asterisk RESTful Interface (ARI, formerly Stasis-HTTP).

The following changes have been made to accomplish this:
* A modular indexer was created for local media.
* A new function to get an ast_format associated with a file extension
  was added.
* Modifications were made to the built-in HTTP server so that URI
  decoding could be deferred to the URI handler when necessary.
* The Stasis-HTTP sounds JSON documentation was modified to handle
  cases where multiple languages are installed in different formats.
* Register and Unregister events for formats were added to the system
  topic.

(closes issue ASTERISK-21584)
(closes issue ASTERISK-21585)
Review: https://reviewboard.asterisk.org/r/2507/

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392700 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoProperly pack the parameters into ast_json_pack when sending a send fax message
Matthew Jordan [Sun, 23 Jun 2013 19:19:30 +0000 (19:19 +0000)]
Properly pack the parameters into ast_json_pack when sending a send fax message

This patch properly packs the parameters into the send fax message so that it
actually work.

Missing a ',' between two string fields can be difficult to debug, particularly
when the actual packing succeeds. Interestingly enough, this didn't actually
crash until the JSON blob we deref'd and disposed of. Since that happened in
a different thread, it was pretty tough to track down.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392676 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoAdd some more missing ast_sorcery_generic_alloc conversions.
Joshua Colp [Sun, 23 Jun 2013 18:59:36 +0000 (18:59 +0000)]
Add some more missing ast_sorcery_generic_alloc conversions.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392667 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoAdd missing ast_sorcery_generic_alloc conversions.
Joshua Colp [Sun, 23 Jun 2013 13:24:18 +0000 (13:24 +0000)]
Add missing ast_sorcery_generic_alloc conversions.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392647 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoFix a bug where messages were getting duplicated on AMI.
Joshua Colp [Sun, 23 Jun 2013 00:02:01 +0000 (00:02 +0000)]
Fix a bug where messages were getting duplicated on AMI.

This was caused by forwarding all endpoint messages to manager which includes
channel messages that are related to the endpoint. This change causes only
the PeerStatus messages to be forwarded to manager thus eliminating the
duplicate channel messages.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392627 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoProperly extract channel variables for the SendFAX/ReceiveFAX Stasis messages
Matthew Jordan [Sat, 22 Jun 2013 22:42:34 +0000 (22:42 +0000)]
Properly extract channel variables for the SendFAX/ReceiveFAX Stasis messages

By the time something extracts the pointers from ast_json_pack, the channels
will already be disposed of. This patch properly pulls the information out of
the variables and packs them into the JSON blob.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392607 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoMake sorcery details opaque and add extended fields.
Joshua Colp [Sat, 22 Jun 2013 14:26:25 +0000 (14:26 +0000)]
Make sorcery details opaque and add extended fields.

Sorcery specific object information is now opaque and allocated with the object.
This means that modules do not need to be recompiled if the sorcery specific part
is changed. It also means that sorcery can store additional information on objects
and ensure it is freed or the reference count decreased when the object goes away.

To facilitate the above a generic sorcery allocator function has been added which
also ensures that allocated objects do not have a lock.

Extended fields have been added thanks to all of the above which allows specific fields
to be marked as extended, and thus simply stored as-is within the object. Type safety
is *NOT* enforced on these fields. A consumer of them has to query and ultimately perform
their own safety check. What does this mean? Extra modules can extend already defined
structures without having to modify them.

Tests have also been included to verify extended field functionality.

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392586 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoMerge in current pimp_my_sip work, including:
Joshua Colp [Sat, 22 Jun 2013 14:03:22 +0000 (14:03 +0000)]
Merge in current pimp_my_sip work, including:

1. Security events
2. Websocket support
3. Diversion header + redirecting support
4. An anonymous endpoint identifier
5. Inbound extension state subscription support
6. PIDF notify generation
7. One touch recording support (special thanks Sean Bright!)
8. Blind and attended transfer support
9. Automatic inbound registration expiration
10. SRTP support
11. Media offer control dialplan function
12. Connected line support
13. SendText() support
14. Qualify support
15. Inband DTMF detection
16. Call and pickup groups
17. Messaging support

Thanks everyone!

Side note: I'm reminded of the song "How Far We've Come" by Matchbox Twenty.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392565 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoFix a deadlock and possible crash in res_fax
Matthew Jordan [Sat, 22 Jun 2013 13:58:07 +0000 (13:58 +0000)]
Fix a deadlock and possible crash in res_fax

This patch fixes two bugs.
(1) It unlocks the channel in the framehook handlers before attempting to grab
    the peer from the bridge. The locking order for the bridging framework is
    bridge first, then channel - having the channel locked while attempting to
    obtain the bridge lock causes a locking inversion and a deadlock. This
    patch bumps the channel ref count prior to releasing the lock in the
    framehook to avoid lifetime issues.

    Note that this does expose a subtle problem in framehooks; that is,
    something could modify the framehook list while we are executing, causing
    issues in the framehook list traversal that the callback executes in.
    Fixing this is a much larger problem that is beyond the scope of this
    patch - (a) we already unlock the channel in this particular framehook
    and we haven't run into a problem yet (as modifying the framehook list
    when a channel is about to perform a fax gateway would be a very odd
    operation) and (b) migrating to an ao2 container of framehooks would be
    more invasive at this point. See the referenced ASTERISK issue for more
    information.
(2) Directly packing channel variables into a JSON object turned out to be
    unsafe. A condition existed where the strings in the JSON blob were no
    longer safe to be accessed if the channel object itself was disposed of.

(issue ASTERISK-21951)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392564 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoMigrate PeerStatus events to stasis, add stasis endpoints, and add chan_pjsip device...
Joshua Colp [Sat, 22 Jun 2013 12:40:16 +0000 (12:40 +0000)]
Migrate PeerStatus events to stasis, add stasis endpoints, and add chan_pjsip device state.

(closes issue ASTERISK-21489)
(closes issue ASTERISK-21503)

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392538 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoExtract a useful routine from the softmix bridge technology.
Richard Mudgett [Fri, 21 Jun 2013 22:39:27 +0000 (22:39 +0000)]
Extract a useful routine from the softmix bridge technology.

* Extract a useful routine from the softmix bridge technology for other
technologies.  Make other technologies use it if they can.

* Made native and 1-1 bridges write to all parties if the bridge channel
writing the frame into the bridge is NULL.  Softmix will also do the same
for frame types that make sense.

* Tweak the bridge write routine return value meaning and adjust the
bridge technologies to match.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392514 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoAdd BUGBUG for broken direct media in chan_gulp
Matthew Jordan [Fri, 21 Jun 2013 21:22:07 +0000 (21:22 +0000)]
Add BUGBUG for broken direct media in chan_gulp

(issue ASTERISK-21947)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392489 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoFix typo.
Jason Parker [Fri, 21 Jun 2013 18:54:49 +0000 (18:54 +0000)]
Fix typo.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392464 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoAdd channel optimization interaction with frame hooks BUGBUG comments.
Richard Mudgett [Fri, 21 Jun 2013 18:10:28 +0000 (18:10 +0000)]
Add channel optimization interaction with frame hooks BUGBUG comments.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392437 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoChange chan_unistim to use core transfer API.
Mark Michelson [Fri, 21 Jun 2013 18:05:56 +0000 (18:05 +0000)]
Change chan_unistim to use core transfer API.

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

(closes issue ASTERISK-21527)
Reported by Matt Jordan

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392436 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoChange several bridge functions to return error status.
Richard Mudgett [Fri, 21 Jun 2013 17:48:14 +0000 (17:48 +0000)]
Change several bridge functions to return error status.

The bridge frame queue functions need to return an error status if the
frame failed to be queued because of an error condition.  The main calls
that needed to return the status are:
ast_bridge_channel_queue_action_data() and
ast_bridge_channel_write_action_data().  The other return changes are
ripple effects.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392435 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoUpdate autosupport script
Matthew Jordan [Fri, 21 Jun 2013 14:21:16 +0000 (14:21 +0000)]
Update autosupport script

This patch updates the autosupport script to collect all information available
to the Asterisk CLI command "digium_phones". It also makes minor improvements
in options handling.

(closes issue AST-1163)
Reported by: Trey Blancher
patches:
  390347_autosupport.diff uploaded by tblancher (License 5821)
  390348_autosupport.diff uploaded by tblancher (License 5821)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392409 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoAdd a log message for when an incoming session is rejected due to the extension not...
Joshua Colp [Thu, 20 Jun 2013 21:13:17 +0000 (21:13 +0000)]
Add a log message for when an incoming session is rejected due to the extension not being found.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392364 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoFix potential bridge hook resource leak if the hook install fails.
Richard Mudgett [Thu, 20 Jun 2013 17:21:40 +0000 (17:21 +0000)]
Fix potential bridge hook resource leak if the hook install fails.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392335 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoFix threadpool rapid growth problem.
Mark Michelson [Thu, 20 Jun 2013 16:29:35 +0000 (16:29 +0000)]
Fix threadpool rapid growth problem.

When a threadpool is set to autoincrement its threadcount, an issue
may arise when multiple tasks are queued at once into the threadpool. Since
threads start active, each new task would result in autoincrementing the
thread count. So if all threads were active, and a thread's autoincrement
value were 5, then 3 new tasks would result in 15 threads being created even
though the initial autoincrement was sufficient to handle the number of tasks.

This change introduces three behavior changes:

1) New threads in the threadpool start idle instead of active.
2) When a threadpool autoincrements, one thread is activated after the growth.
3) When a threadpool's size is incremented manually, all added threads are activated.

For a more detailed explanation about the changes, please see the Review Board link
at the bottom of this commit.

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392318 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoFix build problem on OS X Mountain Lion (10.8)
David M. Lee [Wed, 19 Jun 2013 22:52:23 +0000 (22:52 +0000)]
Fix build problem on OS X Mountain Lion (10.8)

For about forever, our build flags for OS X have been slightly off, but
good enough to build and run. Apparently they aren't good enough any more.

Previously, we would compile with macosx-version-min unset and link with
it set. This combination, using GCC 4.8, on Mountain Lion, would create a
bad executable ("Illegal Instruction: 4", or something like that)

This patch consistently sets macosx-version-min for both compiling and
linking, which makes everything happy enough to build and run.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392279 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoPull CEL linkedid manipulation into cel.c
Kinsey Moore [Wed, 19 Jun 2013 12:55:34 +0000 (12:55 +0000)]
Pull CEL linkedid manipulation into cel.c

This finishes moving all CEL linkedid tracking entirely within cel.c
since that is now possible with channel snapshots.

This also removes another CEL linkedid manipulation function from cel.h
that has already been internalized and is neither called nor available
to link against.

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392241 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoHandle variable substitution in dummy variables
Matthew Jordan [Wed, 19 Jun 2013 01:28:40 +0000 (01:28 +0000)]
Handle variable substitution in dummy variables

When func_cdr is used for variable substitution, there is no channel name
and hence no run-time information available for CDR variable substitution.
In that case, the correct thing to do is to use the CDR object on the channel
passed to the function. This patch checks to see if the channel passed in
has a name - if not, it uses ast_cdr_format_var instead of ast_cdr_get_var.

This allows CDR backends to continue to use variable substitution in order to
resolve ast_cdr object properties.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392214 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoFix the test_substitution test
Matthew Jordan [Tue, 18 Jun 2013 22:37:09 +0000 (22:37 +0000)]
Fix the test_substitution test

In r391947, the CDR function was modified such that it will return a
value for the start,answer, and end times if asked. That time will just
be 0 if it hasn't happened yet.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392190 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoBridging: Fix crash on destruction of a partially constructed bridge.
Richard Mudgett [Tue, 18 Jun 2013 19:31:31 +0000 (19:31 +0000)]
Bridging: Fix crash on destruction of a partially constructed bridge.

* Promoted some bridge construction debug messages to warnings.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392166 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoAdd some safety cleanup for a failed push into a bridge.
Richard Mudgett [Tue, 18 Jun 2013 16:09:15 +0000 (16:09 +0000)]
Add some safety cleanup for a failed push into a bridge.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392140 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoRemove stub comment on function that is not a stub.
Richard Mudgett [Tue, 18 Jun 2013 16:05:24 +0000 (16:05 +0000)]
Remove stub comment on function that is not a stub.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392139 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoFix bridge snapshot conversion to JSON
Kinsey Moore [Tue, 18 Jun 2013 14:30:06 +0000 (14:30 +0000)]
Fix bridge snapshot conversion to JSON

This makes ast_bridge_snapshot_to_json conform to the swagger Bridge
model by adding the two fields it required.

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392116 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoFix build warnings related to printf/scanf of tv_usec.
David M. Lee [Mon, 17 Jun 2013 18:58:56 +0000 (18:58 +0000)]
Fix build warnings related to printf/scanf of tv_usec.

The type of tv_usec is suseconds_t. On Linux, this is usually a long int, but
the specification is actually pretty lax on what it might actually be. And,
sadly, there's no printf/scanf width specifier for suseconds_t. So it could
bit an int or a long, but there's not a great way to tell which it is.

This patch fixes scanf by reading into a long temporary variable that's then
stored into the tv_usec. It fixes printf by casting the tv_usec to a long
first.

This patch also adds some missing width specifiers for some debug statements,
which would cause ".000001" to be displayed at ".1".

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392076 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agochan_vpb: Fix compile error and __ast_channel_alloc() prototype const inconsistency.
Richard Mudgett [Mon, 17 Jun 2013 18:37:27 +0000 (18:37 +0000)]
chan_vpb: Fix compile error and __ast_channel_alloc() prototype const inconsistency.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392073 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agochan_misdn: Fix compile error after CDR merge.
Richard Mudgett [Mon, 17 Jun 2013 18:16:23 +0000 (18:16 +0000)]
chan_misdn: Fix compile error after CDR merge.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392053 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoFix a build warning with stasis messages.
Jason Parker [Mon, 17 Jun 2013 16:59:46 +0000 (16:59 +0000)]
Fix a build warning with stasis messages.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392032 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoPrevent sending a NewExten event after a Hangup during a stack restore
Matthew Jordan [Mon, 17 Jun 2013 14:40:23 +0000 (14:40 +0000)]
Prevent sending a NewExten event after a Hangup during a stack restore

When a channel is originated, its application is typically set to AppDial2,
indicating that it was a dialed channel through the Dial API. Asterisk during
an originate will perform a stack execute to direct the outgoing channel to
a particular place in the dialplan or application. When the stack returns, the
previous application (AppDial2) is restored.

Unfortunately, in the case of an originated channel, the stack restore happens
after hangup. A stasis message is sent notifying everyone that the application
was restored, and this causes a NewExten event to go out after the Hangup event,
violating the basic contract consumers have of the channel lifetime. While we
could preclude the message from going out, restoring the channel's state before
it executed the next higher frame in the stack has to occur, and other places
in the code depend on this behavior.

Since we know that channel hung up (it's a ZOMBIE!), this patch simply checks
to see if the channel has been zombified before sending a NewExten event.

Note that this will fix a number of bouncing tests in the Test Suite. Go tests.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392005 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoRestore bad merge on CHANGES
Matthew Jordan [Mon, 17 Jun 2013 14:31:51 +0000 (14:31 +0000)]
Restore bad merge on CHANGES

The patch for CDRs moved around a lot of content in CHANGES to try and
organize the areas that were affected. This missed some changes that went
in with a merge and removed some updates - this patch adds them back in.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392004 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoFix build warning (which is transmogrified into an error) with my compiler due to...
Joshua Colp [Mon, 17 Jun 2013 12:28:34 +0000 (12:28 +0000)]
Fix build warning (which is transmogrified into an error) with my compiler due to uninitialized variable.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391982 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoMake cdr_mysql compile again by not directly setting the run-time CDR object
Matthew Jordan [Mon, 17 Jun 2013 03:31:19 +0000 (03:31 +0000)]
Make cdr_mysql compile again by not directly setting the run-time CDR object

A stray ast_cdr_setvar was missed in cdr_mysql (silly addons). This has now
been refactored to not set the property, as the property would have been set
on a run-time object that was already dispatched to the backend. The module
simply remembers the value it wanted to set and writes it to MySQL later
in the processing.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391964 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoUpdate Asterisk's CDRs for the new bridging framework
Matthew Jordan [Mon, 17 Jun 2013 03:00:38 +0000 (03:00 +0000)]
Update Asterisk's CDRs for the new bridging framework

This patch is the initial push to update Asterisk's CDR engine for the new
bridging framework. This patch guts the existing CDR engine and builds the new
on top of messages coming across Stasis. As changes in channel state and bridge
state are detected, CDRs are built and dispatched accordingly. This
fundamentally changes CDRs in a few ways.
(1) CDRs are now *very* reflective of the actual state of channels and bridges.
    This means CDRs track well with what an actual channel is doing - which
    is useful in transfer scenarios (which were previously difficult to pin
    down). It does, however, mean that CDRs cannot be 'fooled'. Previous
    behavior in Asterisk allowed for CDR applications, channels, and other
    properties to be spoofed in parts of the code - this no longer works.
(2) CDRs have defined behavior in multi-party scenarios. This behavior will not
    be what everyone wants, but it is a defined behavior and as such, it is
    predictable.
(3) The CDR manipulation functions and applications have been overhauled. Major
    changes have been made to ResetCDR and ForkCDR in particular. Many of the
    options for these two applications no longer made any sense with the new
    framework and the (slightly) more immutable nature of CDRs.

There are a plethora of other changes. For a full description of CDR behavior,
see the CDR specification on the Asterisk wiki.

(closes issue ASTERISK-21196)

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391947 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoFix regression in MWI stasis handling.
Mark Michelson [Fri, 14 Jun 2013 23:26:50 +0000 (23:26 +0000)]
Fix regression in MWI stasis handling.

In revision 389733, mwi state allocation was placed into its
own function instead of performing the allocation in-line when
required. The issue was that in ast_publish_mwi_state_full(),
the local variable "uniqueid" was no longer being set, but it was
still being used as the topic for MWI. This meant that all MWI
publications ended up being published to the "" (empty string)
mailbox topic. Thus MWI subscriptions for specific mailboxes were
never notified of mailbox state changes.

This change fixes the issue by removing the local uniqueid variable
from ast_publish_mwi_state_full() and instead referencing the
mwi_state->uniqueid field since it has been properly set.

(closes issue ASTERISK-21913)
Reported by Malcolm Davenport

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391921 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoEnsure that the number of added contacts never goes below 0.
Joshua Colp [Fri, 14 Jun 2013 21:57:31 +0000 (21:57 +0000)]
Ensure that the number of added contacts never goes below 0.

This can happen when a REGISTER request is removing a contact.

(closes issue ASTERISK-21911)
Reported by: mdavenport

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391902 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoRevert parts of r391855 that were not ready to go in to trunk
Kinsey Moore [Fri, 14 Jun 2013 18:50:21 +0000 (18:50 +0000)]
Revert parts of r391855 that were not ready to go in to trunk

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391856 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoFix two more possible crashes in CEL
Kinsey Moore [Fri, 14 Jun 2013 18:46:00 +0000 (18:46 +0000)]
Fix two more possible crashes in CEL

These are locations that should return valid snapshots, but need to be
handled if not.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391855 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoapp_mixmonitor: Fix crashes caused by unloading app_mixmonitor
Jonathan Rose [Fri, 14 Jun 2013 16:32:43 +0000 (16:32 +0000)]
app_mixmonitor: Fix crashes caused by unloading app_mixmonitor

Unloading app_mixmonitor while active mixmonitors were running would
cause a segfault. This patch fixes that by making it impossible to
unload app_mixmonitor while mixmonitors are active.

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

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

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391828 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoFix a crash in CEL bridge snapshot handling
Kinsey Moore [Fri, 14 Jun 2013 16:12:44 +0000 (16:12 +0000)]
Fix a crash in CEL bridge snapshot handling

Properly search for bridge association structures so that they are
found when expected and handle cases where they don't exist.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391777 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoPublish bridge snapshots more often
Kinsey Moore [Fri, 14 Jun 2013 16:08:55 +0000 (16:08 +0000)]
Publish bridge snapshots more often

Bridge snapshot events were missing some important transitions that
were noticed in subsequent snapshots. Snapshots will now be published
on all bridge reconfigurations.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391776 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoMake the utils directory compile... again.
Matthew Jordan [Thu, 13 Jun 2013 21:53:45 +0000 (21:53 +0000)]
Make the utils directory compile... again.

Utils is a source folder that lies,
eventually all developers will cry,
"I know I must maintain it,
But really with this last commit
I can kiss my software ethics good-bye."

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391732 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoapp_confbridge: Fix memory leak on reload.
Richard Mudgett [Thu, 13 Jun 2013 19:04:41 +0000 (19:04 +0000)]
app_confbridge: Fix memory leak on reload.

The config framework options should not be registered multiple times.
Instead the configuration just needs to be reprocessed by the config
framework.
........

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391701 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoJust return outright on a reload since we have already processed configuration.
Mark Michelson [Thu, 13 Jun 2013 18:26:25 +0000 (18:26 +0000)]
Just return outright on a reload since we have already processed configuration.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391699 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoEnsure that Asterisk still starts up when cel.conf is missing
Kinsey Moore [Thu, 13 Jun 2013 18:20:31 +0000 (18:20 +0000)]
Ensure that Asterisk still starts up when cel.conf is missing

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391689 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoFix memory leak in features_config.c
Mark Michelson [Thu, 13 Jun 2013 18:17:13 +0000 (18:17 +0000)]
Fix memory leak in features_config.c

The options should not be registered multiple times. Instead, the configuration just needs
to be reprocessed by the config framework. This also exposed that we were not properly telling
the config framework to treat the configuration processing with the "reload" semantics when
a reload occurred. Both of these errors are fixed now.

Thanks to Richard Mudgett for discovering the leak.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391676 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoBlow away usage of libjansson's foreach macro
Matthew Jordan [Thu, 13 Jun 2013 18:14:38 +0000 (18:14 +0000)]
Blow away usage of libjansson's foreach macro

While very handy, this macro didn't occur until a later version of libjansson.
We'd prefer to be compatible with older versions still - as such, iteration
over key/value pairs in a JSON object have to be done with a little bit more
manual work.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391675 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoRefactor CEL bridge events on top of Stasis-Core
Kinsey Moore [Thu, 13 Jun 2013 13:46:40 +0000 (13:46 +0000)]
Refactor CEL bridge events on top of Stasis-Core

This pulls bridge-related CEL event triggers out of the code in which
they were residing and pulls them into cel.c where they are now
triggered by changes in bridge snapshots. To get access to the
Stasis-Core parking topic in cel.c, the Stasis-Core portions of parking
init have been pulled into core Asterisk init.

This also adds a new CEL event (AST_CEL_BRIDGE_TO_CONF) that indicates
a two-party bridge has transitioned to a multi-party conference. The
reverse cannot occur in CEL terms even though it may occur in actuality
and two party bridges which receive a AST_CEL_BRIDGE_TO_CONF will be
treated as multi-party conferences for the duration of the bridge.

Review: https://reviewboard.asterisk.org/r/2563/
(closes issue ASTERISK-21564)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391643 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoRefactor CEL channel events on top of Stasis-Core
Kinsey Moore [Thu, 13 Jun 2013 13:15:56 +0000 (13:15 +0000)]
Refactor CEL channel events on top of Stasis-Core

This uses the channel state change events from Stasis-Core to determine
when channel-related CEL events should be raised. Those refactored in
this patch are:
* AST_CEL_CHANNEL_START
* AST_CEL_ANSWER
* AST_CEL_APP_START
* AST_CEL_APP_END
* AST_CEL_HANGUP
* AST_CEL_CHANNEL_END

Retirement of Linked IDs is also refactored.

CEL configuration has been refactored to use the config framework.

Note: Some HANGUP events are not generated correctly because the bridge
layer does not propagate hangupcause/hangupsource information yet.

Review: https://reviewboard.asterisk.org/r/2544/
(closes issue ASTERISK-21563)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391622 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoAdd support for requiring that all queued messages on a caching topic have been handl...
Joshua Colp [Thu, 13 Jun 2013 11:02:16 +0000 (11:02 +0000)]
Add support for requiring that all queued messages on a caching topic have been handled before
retrieving from the cache and also change adding channels to an endpoint to be an immediate
operation.

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391596 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoFix segfault for certain invalid WebSocket input.
David M. Lee [Wed, 12 Jun 2013 21:08:40 +0000 (21:08 +0000)]
Fix segfault for certain invalid WebSocket input.

The WebSocket code would allocate, on the stack, a string large enough
to hold a key provided by the client, and the WEBSOCKET_GUID. If the key
is NULL, this causes a segfault. If the key is too large, it could
overflow the stack.

This patch checks the key for NULL and checks the length of the key to
avoid stack smashing nastiness.

(closes issue ASTERISK-21825)
Reported by: Alfred Farrugia
Tested by: Alfred Farrugia, David M. Lee
Patches:
    issueA21825_check_if_key_is_sent.patch uploaded by Walter Doekes (license 5674)
........

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391561 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoFix memory leak while loading modules, adding formats, and destroying endpoints
Matthew Jordan [Wed, 12 Jun 2013 02:29:08 +0000 (02:29 +0000)]
Fix memory leak while loading modules, adding formats, and destroying endpoints

This patch fixes three memory leaks
 * When we load a module with the LOAD_PRIORITY flag, we remove its entry from
   the load order list. Unfortunately, we don't free the memory associated with
   entry in the list. This patch corrects that and properly frees the memory
   for the module in the list.

 * When adding a custom format (such as SILK or CELT), the routine for adding
   the format was leaking a reference. RAII_VAR cleans this up properly.

 * We now de-ref the channel_snapshot appropriately when an endpoint is
   disposed of
........

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

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391521 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoFix memory leaks in stasis_channels and bridge_native_rtp
Matthew Jordan [Wed, 12 Jun 2013 02:13:31 +0000 (02:13 +0000)]
Fix memory leaks in stasis_channels and bridge_native_rtp

This patch fixes two memory leaks:
 * A memory leak in packing channels into a multi-channel blob payload when
   publishing dial messages. The multi-channel blob payload does not steal
   the references - this approach was chosen because it works well with the
   RAII_VAR macro. Unfortunately, this does mean that you actually have to use
   the RAII_VAR macro (or manually deref it yourself)
 * RTP instances returned as a result of one of the glue operations are ref
   counted and have to be de-ref'd appropriately. We now do that, as saying
   that we should do it and then not would be silly.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391479 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoRemove incorrect comment about local channel optimization occurring when performing...
Mark Michelson [Tue, 11 Jun 2013 22:57:09 +0000 (22:57 +0000)]
Remove incorrect comment about local channel optimization occurring when performing an attended transfer on an entire bridge.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391455 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agobridge_native_rtp: Fix native bridge tech being incompatible when it should be.
Jonathan Rose [Tue, 11 Jun 2013 22:21:36 +0000 (22:21 +0000)]
bridge_native_rtp: Fix native bridge tech being incompatible when it should be.

When checking compatability for the native RTP bridge technology there is a
race condition between clearing framehooks that are destroyed when leaving
certain bridges with certain technologies (such as bridge_native_rtp) and
joining bridges with the bridge_native_rtp technology. Yes, that means a
channel in a native RTP bridge could move to another native RTP bridge and
be considered incompatible with the new native RTP bridge causing it to
revert to a simple bridge technology0. This fixes that bug by ignoring
framehooks that have been marked for destruction when checking for
compatibility with the bridge_native_rtp technology.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391453 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agobridge_native_rtp: Fix possible segfaults on leaves/joins
Jonathan Rose [Tue, 11 Jun 2013 19:44:47 +0000 (19:44 +0000)]
bridge_native_rtp: Fix possible segfaults on leaves/joins

native_rtp_bridge_get can return any result from the ast_rtp_glue_result
enumerator and the join/leave functions for bridge_native_rtp seem to assume
that if the result wasn't local that it was remote. Meanwhile forbid can be
returned by that function which can mean certain glue pointers are NULL. Then
when the join/leave functions try to use members of that pointer, boom.
Segfault.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391430 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoAdd vtable and methods for to_json and to_ami for Stasis messages
David M. Lee [Tue, 11 Jun 2013 15:46:35 +0000 (15:46 +0000)]
Add vtable and methods for to_json and to_ami for Stasis messages

When a Stasis message type is defined in a loadable module, handling
those messages for AMI and res_stasis events can be cumbersome.

This patch adds a vtable to stasis_message_type, with to_ami and
to_json virtual functions. These allow messages to be handled
abstractly without putting module-specific code in core.

As an example, the VarSet AMI event was refactored to use the to_ami
virtual function.

(closes issue ASTERISK-21817)
Review: https://reviewboard.asterisk.org/r/2579/

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391403 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoFix issue with no sound in both way in case of previous call to chan_unistim phone...
Igor Goncharovskiy [Tue, 11 Jun 2013 10:24:04 +0000 (10:24 +0000)]
Fix issue with no sound in both way in case of previous call to chan_unistim phone was canceled.

(related to ASTERISK-20183)
........

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391380 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoIAX2: Transfer Reject: Lock bridgecallno before touching it, refactor
Alec L Davis [Tue, 11 Jun 2013 08:13:39 +0000 (08:13 +0000)]
IAX2: Transfer Reject: Lock bridgecallno before touching it, refactor

1). When touching the bridgecallno, we need to lock it.

2). Remove magic number '0' and replace with TRANSFER_NONE.

3). Exit early if no bridgecallno.

4). Reduce indentation.

Reported by: alecdavis
Tested by: alecdavis
alecdavis (license 585)

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

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

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391335 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoMake the reload stasis message bump the ref count of its sub-object
Matthew Jordan [Mon, 10 Jun 2013 22:38:04 +0000 (22:38 +0000)]
Make the reload stasis message bump the ref count of its sub-object

JSON objects are reference stealing. Hence, if you've RAII_VAR'd some
subobject and want to pack it into another JSON object, you have to bump
the reference count. Using the 'O' option during the pack will bump the
reference count for you.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391314 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoChange chan_skinny to use core transfer API.
Damien Wedhorn [Mon, 10 Jun 2013 21:04:43 +0000 (21:04 +0000)]
Change chan_skinny to use core transfer API.

Changes for both attended and blind transfers in chan_skinny to use the new transfer API instead of masquerade.

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391297 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoAdd AGI command arguments to AsyncAGI event
Kinsey Moore [Mon, 10 Jun 2013 16:03:51 +0000 (16:03 +0000)]
Add AGI command arguments to AsyncAGI event

This makes the AGI AsyncAGI event put provided AGI command arguments in
the event's environment.

(closes issue ASTERISK-21304)
Patch-By: Dirk Wendland

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391271 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoTemporary fix for people using sample features.conf from previous Asterisk versions.
Mark Michelson [Mon, 10 Jun 2013 15:32:02 +0000 (15:32 +0000)]
Temporary fix for people using sample features.conf from previous Asterisk versions.

People who use the features.conf.sample file from Asterisk 11 and before in trunk were
given a rude awakening when features configuration changes were made. Because it uses the
config framework and the config framework is strict about what is accepted and what isn't,
people that had parking options configured found that Asterisk no longer started. This is
because parking options are currently handled in res_parking.conf instead of features.conf.

This fix seeks to create a temporary band-aid fix for the problem, but having parking options
from the general section be passed to a handler that will simply print that the option is no
longer supported. This will not cause Asterisk to exit.

The fix only applies to options in the general section. There are two main reasons for this:

1) The sample features.conf file only has parking options in the general section. There are no
configured parking lots. Therefore it's not quite as "urgent" to get the parking lot parsing
fixed.

2) The plan is to move parking configuration back from res_parking.conf to features.conf. When
that happens, the parking lots will also be addressed at that time.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391269 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoAdd announce-to-first-user option for app_queue
Matthew Jordan [Mon, 10 Jun 2013 14:36:15 +0000 (14:36 +0000)]
Add announce-to-first-user option for app_queue

In r386792, the ability to play prompts to the first caller in a call queue was
added. While this is arguably a bug fix for those who expect the first caller
to continue receiving prompts while the agent is dialed, it has the side effect
of preventing the first caller from hearing the agent immediately upon
bridging. This may not be a problem for those who really want this option, but
for those who didn't care whether or not the first caller in queue heard their
position, it was an issue.

This patch disables the ability for the first caller in the queue to hear
prompts and adds a new option, announce-to-first-user, to queues.conf. Those
who the behavior can enable it by setting this value to True.

Note that if we ever implement the ability to have the prompts be stopped
upon bridging, this option can be removed.

(closes issue ASTERISK-21782)
Reported by: Remi Quezada
........

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

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391245 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoStasis-HTTP: Flesh out bridge-related capabilities
Kinsey Moore [Mon, 10 Jun 2013 13:07:11 +0000 (13:07 +0000)]
Stasis-HTTP: Flesh out bridge-related capabilities

This adds support for Stasis applications to receive bridge-related
messages when the application shows interest in a given bridge.

To supplement this work and test it, this also adds support for the
following bridge-related Stasis-HTTP functionality:
* GET stasis/bridges
* GET stasis/bridges/{bridgeId}
* POST stasis/bridges
* DELETE stasis/bridges/{bridgeId}
* POST stasis/bridges/{bridgeId}/addChannel
* POST stasis/bridges/{bridgeId}/removeChannel

Review: https://reviewboard.asterisk.org/r/2572/
(closes issue ASTERISK-21711)
(closes issue ASTERISK-21621)
(closes issue ASTERISK-21622)
(closes issue ASTERISK-21623)
(closes issue ASTERISK-21624)
(closes issue ASTERISK-21625)
(closes issue ASTERISK-21626)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391199 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agochan_iax2: nativebridge refactor, missed unlock bridgecallno
Alec L Davis [Mon, 10 Jun 2013 09:33:56 +0000 (09:33 +0000)]
chan_iax2: nativebridge refactor, missed unlock bridgecallno
........

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

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391154 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agofix bad edit after conflict resolution
Alec L Davis [Mon, 10 Jun 2013 08:38:03 +0000 (08:38 +0000)]
fix bad edit after conflict resolution
........

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

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391112 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoIAX2: refactor nativebridge transfer
Alec L Davis [Mon, 10 Jun 2013 08:30:31 +0000 (08:30 +0000)]
IAX2: refactor nativebridge transfer

remove triple checking of iaxs[fr->callno]->transferring

reduce indentation.

Reported by: alecdavis
Tested by: alecdavis
alecdavis (license 585)

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

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

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391102 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoIAX2: fix race condition with nativebridge transfers.
Alec L Davis [Mon, 10 Jun 2013 07:35:06 +0000 (07:35 +0000)]
IAX2: fix race condition with nativebridge transfers.

1). When touching the bridgecallno, we need to lock it.

2). stop_stuff() which calls iax2_destroy_helper()
    Assumes the lock on the pvt is already held, when iax2_destroy_helper() is called.
    Thus we need to lock the bridgecallno pvt before we call stop_stuff(iaxs[fr->callno]->bridgecallno);

3).   When evaluating the state of 'callno->transferring' of the current leg,
    we can't change it to READY unless the bridgecallno is locked.
      Why, if we are interrupted by the other call leg before 'transferring = TRANSFER_RELEASED',
    the interrupt will find that it is READY and that the bridgecallno is also READY so Releases the legs.

(closes issue ASTERISK-21409)

Reported by: alecdavis
Tested by: alecdavis
alecdavis (license 585)

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

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

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391064 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoClean up MWI topic pool before message type destruction
Matthew Jordan [Sun, 9 Jun 2013 21:11:25 +0000 (21:11 +0000)]
Clean up MWI topic pool before message type destruction

Topics need to be disposed of prior to the message types that are published
on them. This includes topic pools. This prevents an assertion from being
raised on shutdown.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391040 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoOnly initialize manager_bridging during startup
Matthew Jordan [Sat, 8 Jun 2013 22:18:38 +0000 (22:18 +0000)]
Only initialize manager_bridging during startup

This moves the initialization call behind the protection against
reloads. We don't want to re-add message router routes during
reloads.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391016 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoAdd backtrace generation to MALLOC_DEBUG memory corruption reports
Matthew Jordan [Sat, 8 Jun 2013 22:09:07 +0000 (22:09 +0000)]
Add backtrace generation to MALLOC_DEBUG memory corruption reports

This patch allows astmm to access the backtrace generation code in Asterisk.
When memory is allocated, a backtrace is created and stored with the memory
region that tracks the allocation. If a memory corruption is detected, the
backtrace is printed to the astmm log. The backtrace will make use of the
BETTER_BACKTRACES build option if available.

As a result, this patch moves the backtrace generation code into its own file
and uses the non-wrapped versions of the C library memory allocation routines.
This allows the memory allocation code to safely use the backtrace generation
routines without infinitely recursing.

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391012 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoAdd more support for native bridging.
Richard Mudgett [Sat, 8 Jun 2013 06:31:50 +0000 (06:31 +0000)]
Add more support for native bridging.

* Added a start technology callback that technologies can use to start
bridging operations.  It is expected that native bridges will find this
useful.

* Factored out bridge_channel_complete_join().

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@390991 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoFix a crash when a bridge switches from the softmix bridge technology to another.
Richard Mudgett [Sat, 8 Jun 2013 05:18:22 +0000 (05:18 +0000)]
Fix a crash when a bridge switches from the softmix bridge technology to another.

A three party bridge uses the softmix bridging technology.  This
technology has a dedicated thread used to perform the analog mixing.  When
one of these parties leaves the bridge, the bridge technology is changed
from the softmix technology to a two-party mixing technology.  Changing
technologies is done by removing channels from the old technology and
adding them to the new technology.  Since the remaining channels do not
leave the bridge, the softmix mixing thread could continue to process all
channels in the bridge.  If the bridge code is not able to start
destruction of the softmix technology before the softmix mixing thread
wakes up, a crash happens.

* Added a stop technology callback that technologies can use to request
any helper threads to stop in preparation for being destroyed.

(closes issue AST-1156)
Reported by: John Bigelow

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@390975 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoUpdate some doxygen comments.
Richard Mudgett [Sat, 8 Jun 2013 02:13:58 +0000 (02:13 +0000)]
Update some doxygen comments.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@390957 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoThe bridge uniqueid is available for softmix destructor.
Richard Mudgett [Sat, 8 Jun 2013 02:10:47 +0000 (02:10 +0000)]
The bridge uniqueid is available for softmix destructor.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@390956 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoAdd some bridge identifiers to some softmix messages.
Richard Mudgett [Sat, 8 Jun 2013 01:12:57 +0000 (01:12 +0000)]
Add some bridge identifiers to some softmix messages.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@390940 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agores_parking: Add parking_devicestate.c left out from previous commit
Jonathan Rose [Fri, 7 Jun 2013 20:51:19 +0000 (20:51 +0000)]
res_parking: Add parking_devicestate.c left out from previous commit

(issue ASTERISK-21645)
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/2545/

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@390920 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoMake app_queue AMI events more consistent. Give Join/Leave more useful names.
Jason Parker [Fri, 7 Jun 2013 19:51:19 +0000 (19:51 +0000)]
Make app_queue AMI events more consistent.  Give Join/Leave more useful names.

This also removes the eventwhencalled and eventmemberstatus configuration
options.  These events can just be filtered via manager.conf blacklists.

(closes issue ASTERISK-21469)
Review: https://reviewboard.asterisk.org/r/2586/

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@390901 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoImplement ARI POST to /channels, to originate a call.
Jason Parker [Fri, 7 Jun 2013 18:39:42 +0000 (18:39 +0000)]
Implement ARI POST to /channels, to originate a call.

(closes issue ASTERISK-21617)
Review: https://reviewboard.asterisk.org/r/2597/

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@390885 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoEnsure that all unit tests compile with the cache clear rework in place
Kinsey Moore [Fri, 7 Jun 2013 16:22:24 +0000 (16:22 +0000)]
Ensure that all unit tests compile with the cache clear rework in place

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@390864 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agores_parking: Automatically generate extensions, hints, etc.
Jonathan Rose [Fri, 7 Jun 2013 16:07:18 +0000 (16:07 +0000)]
res_parking: Automatically generate extensions, hints, etc.

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@390849 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoapp_meetme: Refactor manager events to use stasis
Jonathan Rose [Fri, 7 Jun 2013 15:54:26 +0000 (15:54 +0000)]
app_meetme: Refactor manager events to use stasis

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@390848 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoRework stasis cache clear events
Kinsey Moore [Fri, 7 Jun 2013 12:56:56 +0000 (12:56 +0000)]
Rework stasis cache clear events

Stasis cache clear message payloads now consist of a stasis_message
representative of the message to be cleared from the cache. This allows
multiple parallel caches to coexist and be cleared properly by the same
cache clear message even when keyed on different fields.

This change fixes a bug where multiple cache clears could be posted for
channels. The cache clear is now produced in the destructor instead of
ast_hangup.

Additionally, dummy channels are no longer capable of producing channel
snapshots.

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@390830 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoRefactor chan_dahdi/sig_analog/sig_pri and chan_misdn to use the common transfer...
Richard Mudgett [Fri, 7 Jun 2013 01:06:49 +0000 (01:06 +0000)]
Refactor chan_dahdi/sig_analog/sig_pri and chan_misdn to use the common transfer functions.

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

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

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@390804 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoTweak applicationmap and featuregroup config containers.
Richard Mudgett [Fri, 7 Jun 2013 00:33:20 +0000 (00:33 +0000)]
Tweak applicationmap and featuregroup config containers.

* Change applicationmap and featuregroup to replace duplicate config items
rather than reject them.

* Remove some unneeded warning messages when getting the applicationmap
allows duplicates from DYNAMIC_FEATURES.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@390803 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoConditionally reject duplicate entries in applicationmap containers.
Mark Michelson [Thu, 6 Jun 2013 23:32:13 +0000 (23:32 +0000)]
Conditionally reject duplicate entries in applicationmap containers.

When reading from a config file, it's important to reject duplicates. Otherwise,
featuregroups will have ambiguity when pointing to applicationmap items. However,
when constructing the channel's current applicationmap, we don't care about duplicate
names since it's the DTMF that identifies a feature, not the name.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@390787 65c4cc65-6c06-0410-ace0-fbb531ad65f3

6 years agoReimplement bridging and DTMF features related channel variables in the bridging...
Richard Mudgett [Thu, 6 Jun 2013 22:46:54 +0000 (22:46 +0000)]
Reimplement bridging and DTMF features related channel variables in the bridging core.

* The channel variable ATTENDED_TRANSFER_COMPLETE_SOUND is no longer
channel driver specific.  If the channel variable is set on the
transferrer channel, the sound will be played to the target of an attended
transfer.

* The channel variable BRIDGEPEER becomes a comma separated list of peers
in a multi-party bridge.  The BRIDGEPEER value can have a maximum of 10
peers listed.  Any more peers in the bridge will not be included in the
list.  BRIDGEPEER is not valid in holding bridges like parking since those
channels do not talk to each other even though they are in a bridge.

* The channel variable BRIDGEPVTCALLID is only valid for two party bridges
and will contain a value if the BRIDGEPEER's channel driver supports it.

* The channel variable DYNAMIC_PEERNAME is redundant with BRIDGEPEER and
is removed.  The more useful DYNAMIC_WHO_ACTIVATED gives the channel name
that activated the dynamic feature.

* The channel variables DYNAMIC_FEATURENAME and DYNAMIC_WHO_ACTIVATED are
set only on the channel executing the dynamic feature.  Executing a
dynamic feature on the bridge peer in a multi-party bridge will execute it
on all peers of the activating channel.

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

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@390771 65c4cc65-6c06-0410-ace0-fbb531ad65f3