Commit Graph

459 Commits

Author SHA1 Message Date
David M. Lee cf9324b25e Move more channel events to Stasis; move res_json.c to main/json.c.
This patch started out simply as fixing the bouncing tests introduced
in r382685, but required some other changes to give it a decent
implementation.

To fix the bouncing tests, the UserEvent and Newexten AMI events
needed to be refactored to dispatch via Stasis. Dispatching directly
to AMI resulted in those events sometimes getting ahead of the
associated Newchannel events, which would understandably confuse anyone.

I found that instead of creating a zillion different message types and
structures associated with them, it would be preferable to define a
message type that has a channel snapshot and a blob of structured data
with a small bit of additional information. The JSON object model
provides a very nice way of representing structured data, so I went
with that.

 * Move JSON support from res_json.c to main/json.c
   * Made libjansson-dev a required dependency
 * Added an ast_channel_blob message type, which has a channel
   snapshot and JSON blob of data.
 * Changed UserEvent and Newexten events so that they are dispatched
   via ast_channel_blob messages on the channel's topic.
 * Got rid of the ast_channel_varset message; used ast_channel_blob
   instead.
 * Extracted the manager functions converting Stasis channel events to
   AMI events into manager_channel.c.

(issue ASTERISK-21096)
Review: https://reviewboard.asterisk.org/r/2381/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@383579 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-03-22 14:06:46 +00:00
Joshua Colp 07d01e1c41 Pass the sorcery instance to wizards for CUD operations as well as retrieve.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@383405 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-03-20 14:52:23 +00:00
David M. Lee 49e3489cac A simplistic router for stasis_message's.
Often times, when subscribing to a topic, one wants to handle
different message types differently. While one could cascade if/else
statements through the subscription handler, it is much cleaner to
specify a different callback for each message type. The
stasis_message_router is here to help!

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@383242 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-03-15 17:35:16 +00:00
Kinsey Moore ccb5526508 Take advantage of the fact that stasis_unsubscribe now returns NULL
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@383169 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-03-15 13:04:52 +00:00
Kinsey Moore c6b06e40dc Add message dump capability to stasis cache layer
The cache dump mechanism allows the developer to retreive multiple
items of a given type (or of all types) from the cache residing in a
stasis caching topic in addition to the existing single-item cache
retreival mechanism.  This also adds to the caching unit tests to
ensure that the new cache dump mechanism is functioning properly.

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


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

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

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@382685 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-03-08 15:15:13 +00:00
Joshua Colp a4f45a2c95 Add support for registering a sorcery handler which supports multiple fields using a regex.
Review: https://reviewboard.asterisk.org/r/2332/


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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@381614 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-02-16 16:24:21 +00:00
David M. Lee 222e8a3afb Add a serializer interface to the threadpool
This patch adds the ability to create a serializer from a thread pool. A
serializer is a ast_taskprocessor with the same contract as a default
taskprocessor (tasks execute serially) except instead of executing out
of a dedicated thread, execution occurs in a thread from a
ast_threadpool. Think of it as a lightweight thread.

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@381326 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-02-12 21:45:59 +00:00
David M. Lee f2b9c12704 Minor fixes to res_json and test_json.
* Made input checking more consistent with other Asterisk code
* Added validation to ast_json_dump_new_file
* Fixed tests for ownereship semantics

(issue ASTERISK-20887)


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

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


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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@381017 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-02-07 15:16:44 +00:00
Joshua Colp ffaf79b1eb Fix an issue where building with DEBUG_FD_LEAKS enabled would not work due to sorcery using calls called "open" and "close".
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@380407 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-29 20:19:28 +00:00
Joshua Colp 734d864de2 Add a unit test which confirms the apply handler callback is called when it should be.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@380178 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-27 18:40:15 +00:00
Joshua Colp 3fa4278a31 Merge the sorcery data access layer API.
Sorcery is a unifying data access layer which provides a pluggable mechanism to allow
object creation, retrieval, updating, and deletion using different backends (or wizards).

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

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


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



git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@379375 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-17 16:04:10 +00:00
Mark Michelson 967e380ba8 Make the threadpool listener opaque.
git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@379126 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-15 21:09:55 +00:00
Mark Michelson 663479a558 Make ast_taskprocessor_listener opaque.
git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@379125 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-15 20:48:45 +00:00
Mark Michelson c6bc51ef28 Make the initial size of the threadpool part of the options passed in.
git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@379123 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-15 19:44:25 +00:00
Mark Michelson edc2e4dac0 Remove threadpool listener alloc and destroy callbacks.
This replaces the destroy callback with a shutdown callback
instead.



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

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



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

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


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

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


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



git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@378652 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-07 22:16:06 +00:00
Mark Michelson f5e9cf5975 Add automerge property back after conflict.
git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@377879 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-12-11 21:52:09 +00:00
Mark Michelson 8760e32ae3 Add auto-increment option and accompanying test.
This allows for the threadpool to automatically grow if tasks
are pushed to it and no idle threads are currently available.



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



git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@377687 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-12-10 20:14:23 +00:00
Mark Michelson 90d76a5026 Make thread state waiting a little less ugly and not possible to lock up.
git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@377686 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-12-10 19:32:50 +00:00
Mark Michelson 957cb0742b Improve timedwaits in tests to actually behave like they should.
git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@377654 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-12-10 15:55:56 +00:00
Mark Michelson 64deed062a Add threadpool options and accompanying test.
The only test added so far is an idle thread timeout
option. This will greatly aid threadpool users who wish
to maintain a threadpool by allowing for idle threads to
die out as necessary.

Test passes.



git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@377580 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-12-10 06:13:09 +00:00
Mark Michelson 5dd22df050 Improve shutdown procedure.
This helps tests to pass more often than before.
They are far less likely to queue extra processes
into the control taskprocessor since they are prevented
once the threadpool begins to shut down.



git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@377578 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-12-10 05:25:38 +00:00
Mark Michelson b6a73bb451 Add some useful debugging in threadpool test failure conditions.
git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@377475 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-12-09 19:06:35 +00:00
Mark Michelson 293b18ecce Create longer thread destruction test.
This one involves shrinking the threadpool in such
a way that both idle and active threads are affected.

This test made me re-realize why the zombie state exists,
so I re-added it. We don't want to clog up the control
taskprocessor by waiting on active threads to complete
what they are doing. Instead, we mark them as zombies so
that when they are done, they can clean themselves up
properly.

Without the zombie state available, the new test actually
will deadlock.



git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@377474 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-12-09 18:56:25 +00:00
Mark Michelson 4deecdef72 Add a task distribution test.
git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@377418 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-12-08 00:22:33 +00:00
Mark Michelson b353c80dc0 Add threadpool reactivation test.
git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@377400 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-12-07 23:42:42 +00:00
Mark Michelson afdbd80bc3 Add a single-thread multi-task test.
git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@377397 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-12-07 22:35:11 +00:00
Mark Michelson d9f4952b8a Add test where we create a thread and push a task.
Passes!



git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@377380 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-12-07 19:50:38 +00:00
Mark Michelson 2dc89eb485 Add test where we add a task then create a thread for it.
It passes.



git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@377379 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-12-07 19:34:11 +00:00
Mark Michelson f275c11e78 Add threadpool destruction test.
It worked on the first try. Fun time.



git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@377378 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-12-07 19:16:28 +00:00
Mark Michelson ec29862a92 Fix up categories of threadpool tests.
git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@377369 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-12-07 01:03:49 +00:00
Mark Michelson 4590bfd93d Add new threadpool test and fix some taskprocessor bugs.
The new thread creation test fails because Asterisk locks up
while trying to lock a taskprocessor.

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

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

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@377368 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-12-07 00:30:35 +00:00
Mark Michelson c32634e0dd Add initial simple threadpool test.
This one simply pushes a task into the threadpool and ensures
that the listener gets the callbacks expected.

It currently crashes, so I need to figure out what's wrong.



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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@376580 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-21 19:20:22 +00:00
Mark Michelson ff06346ea2 Add doxygen to taskprocessor tests.
git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@376498 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-19 20:35:39 +00:00
Automerge script 558c108b92 Merged revisions 376457 via svnmerge from
file:///srv/subversion/repos/asterisk/trunk

........
  r376457 | mjordan | 2012-11-18 20:14:54 -0600 (Sun, 18 Nov 2012) | 7 lines
  
  Fix uninitialized in this function error
  
  With some versions of gcc, n_buckets will be flagged as being uninitialized
  before use.  While its technically impossible (since the switch statement,
  even without a default, accounts for all possibilities), we'll initialize the
  variable to 0 anyway.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@376462 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-19 02:19:08 +00:00
Mark Michelson 623d741ba1 Restructure taskprocessor load test to test integrity of task execution.
This throws a random number to each task and stores a copy locally. After
all tasks have executed, the data is checked to be sure tasks executed
in the correct order.



git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@376413 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-17 22:27:39 +00:00
Mark Michelson da0e2169de Add a second default taskprocessor test that executes 20000 tasks.
git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@376412 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-17 21:55:42 +00:00
Mark Michelson f209bc6f9d Change the default taskprocessor test so it will never hang forever.
Changes the ast_cond_wait() to an ast_cond_timedwait() so that
if there is an issue, we'll never wait forever for the task to
finish execution.



git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@376411 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-17 21:48:59 +00:00
Mark Michelson ec68a15619 Test that shutdown callback is called when expected.
git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@376383 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-16 05:00:42 +00:00
Mark Michelson 12de4198b8 Add a shutdown callback to taskprocessor listeners.
This helps account for the fact that it is unknown just
how many references may exist for a given taskprocessor
listener, so simply unreffing it from the taskprocessor
shutdown function is not enough to convey the gravity
of the situation.

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



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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@376352 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-16 00:19:48 +00:00
Mark Michelson 426e8d1454 Refine the taskprocessor listener test a bit more.
This makes it easier to follow and tests more thoroughly.



git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@376140 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-12 00:36:16 +00:00
Mark Michelson 7d84963667 Add a test that ensures that taskprocessor listener callbacks
are properly called.

The new test is a bit raw in that it uses magic numbers, but that
can be improved upon easily.



git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@376124 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-09 23:23:32 +00:00
Mark Michelson 6fc8d830f8 Add a basic taskprocessor test.
This just queues a task and ensures that the task
gets executed by the default taskprocessor listener.



git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@376120 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-09 19:42:47 +00:00
Andrew Latham b106b77041 Title update
Update title that was left behind many years ago. Used revision 6596 as my guide for what it should be.

(issue ASTERISK-20259)


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

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

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

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

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

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

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


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

(issue ASTERISK-20259)


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

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

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

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

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

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

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

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

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

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

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

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

(closes issue ASTERISK-19969)
Reported by: rmudgett

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@372997 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-09-12 21:02:29 +00:00
Mark Michelson 96de9ecf30 I forgot to add the unit tests for scoped locks earlier today.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@371633 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-08-23 04:12:32 +00:00
Kinsey Moore 9b16c8b0f6 Clean up and ensure proper usage of alloca()
This replaces all calls to alloca() with ast_alloca() which calls gcc's
__builtin_alloca() to avoid BSD semantics and removes all NULL checks
on memory allocated via ast_alloca() and ast_strdupa().

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370655 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-07-31 20:21:43 +00:00
Russell Bryant ee04ec77b4 Fix ast_event_new unit test.
One of my recent commits broke this test.  The error was:

[test_event.c:event_new_test:214]: Events expected to be identical
have different size: 69 != 59

The difference in size occurred because the first event had
the EID IE added to the event twice.  ast_event_new() now always
adds it automatically.  Previously it only added it if there
were no IEs specified, which was kind of weird.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370541 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-07-30 13:45:42 +00:00
Kevin P. Fleming 39ae307bdb Silence a warning message from older versions of GCC.
Revision 370426 introduced the use of a nested function in tests/test_acl.c,
but the lack of the 'auto' scope specifier on the function and a forward
declaration resulted in compilation errors on the automated test systems.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370453 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-07-24 19:12:09 +00:00
Kevin P. Fleming 0385c0e9cb Allow permit/deny ACL lines to contain multiple items and negated entries.
Rules in ACLs (specified using 'permit' and 'deny') can now contain multiple
items (separated by commas), and items in the rule can be negated by prefixing
them with '!'. This simplifies Asterisk Realtime configurations, since it is no
longer necessray to control the order that the 'permit' and 'deny' columns are
returned from queries.

Review: https://reviewboard.asterisk.org/r/1592/
Initial patch contributed by Tilghman Lesher
Unit tests written by Kevin P. Fleming



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


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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370043 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-07-12 21:43:09 +00:00
Terry Wilson 1609fca6bb Add the ability to set flags via the config options api
Allows the setting of flags via the config options api.
For example, code like this:

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

struct thing {
   unsigned int flags;
};

and a config like this:

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

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


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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368966 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-14 19:40:11 +00:00
Terry Wilson 9f704b5d59 Fix reloading an unchanged file with the Config Options API
Adding multiple file support broke reloading an unchanged file. This
adds an enum for return values for the aco_process_* functions and
ensures that the config is not applied if res is not ACO_PROCESS_OK.

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


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

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


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

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

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

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

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

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



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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368181 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-01 16:33:25 +00:00
Richard Mudgett d4fa095a64 Change ao2 global array to ao2 global object holder.
Review: https://reviewboard.asterisk.org/r/1921/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366663 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-16 16:34:42 +00:00
Richard Mudgett 005cd92e78 Fix type punned compiler warning in test_config.c
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@365479 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-07 18:51:44 +00:00
Michael L. Young fdf3cd0e2e Update security events unit tests
The security events framework API was changed in Asterisk 10 but the unit tests
were not updated at the same time.

This patch does the following:
* Adds two more security events that were added to the API 
* Add challenge, received_challenge and received_hash in the inval_password 
  security event unit test

(Closes issue ASTERISK-19760)
Reported by: Michael L. Young
Tested by: Michael L. Young
Patches:
issue-asterisk-19760-trunk.diff uploaded by Michael L. Young (license 5026)

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@365248 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-03 19:36:33 +00:00
Terry Wilson f7c174ff84 Multiple revisions 364365,364369
........
  r364365 | twilson | 2012-04-27 17:31:01 -0500 (Fri, 27 Apr 2012) | 11 lines
  
  Fix ast_parse_arg numeric type range checking and add tests
  
  ast_parse_arg wasn't checking for strto* parse errors or limiting
  the results by the actual range of the numeric types. This patch fixes
  that and adds unit tests as well.
  
  Review: https://reviewboard.asterisk.org/r/1879/
  ........
  
  Merged revisions 364340 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
  r364369 | twilson | 2012-04-27 17:33:10 -0500 (Fri, 27 Apr 2012) | 2 lines
  
  Add missing test_config.c
........

Merged revisions 364365,364369 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@364397 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-27 22:54:20 +00:00
Michael L. Young a011ae78dc Add leading and trailing backslashes
A couple of unit tests did not have have leading or trailing backslashes when
setting their test category resulting in a warning message being displayed.
Added the backslash where needed.
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@362682 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-19 21:14:35 +00:00
Michael L. Young 33c9161d1e Fix building security events test
The Security Events Framework API changed in trunk to support IPv6.  This broke
the building of the security events test which was based around IPv4.  This
patches fixes the build by changing the test to conform to the new changes.

(related to issue ASTERISK-19447)

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


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

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@360627 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-27 17:13:32 +00:00
Matthew Jordan a699bb72ad Add tests for main/jitterbuf.c
This patch adds unit tests for main/jitterbuf.c.  This includes checking for
the following:
  * Nominal insertion and retrieval of frames
  * Insertion and retrieval of frames where the frames are inserted out of
    order with respect to the previous frame
  * Insertion and retrieval of frames where some number of frames that would
    occur in the expected sequence are instead dropped
  * Insertion and retrieval of frames with an arrival time that does not occur
    at the same rate as the surrounding frames
  * Resynchronization of the jitter buffer when an inserted frame breaks the
    resynchronization threshold
  * Overfilling of the jitter buffer

For each of the tests, both JB_TYPE_VOICE and JB_TYPE_CONTROL permutations
exist.

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

(issue: ASTERISK-18964)
Reported by: Kris Shaw
Tested by: Kris Shaw, Matt Jordan



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

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

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@358945 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-13 20:06:57 +00:00
Tilghman Lesher 9af5c769c3 Enable macros in 1.8 to find the next highest "h" extension in a context, like in 1.4.
This change restores functionality that was present in 1.4, when AEL macros
were implemented with the Macro dialplan application.  Macros are fraught with
functionality issues, because they consume a large portion of the underlying
application stack.  This limits the ability of AEL users to call many layers
of subroutines, an issue which Gosub does not have (originally tested to
100,000 levels deep).  Therefore, starting in 1.6.0, AEL macros were
implemented with Gosub.

However, there were some implicit behaviors of Macro, which were not replicated
at the same time as with the transition to Gosub, one of which is documented in
the related issue.  In particular, the "h" extension is designed to execute not
in the Macro context, but in the topmost calling context.  Due to legacy issues
with a misapplied bugfix many years ago, when a macro exited in 1.4, it looks
in all calling contexts, bubbling up from the deepest level until it finds an
"h" extension.

Since AEL hides the complexity of the underlying dialplan logic from the AEL
programmer, it's reasonable to assume that this behavior should not change in
the transition from Asterisk 1.4 LTS to Asterisk 1.8 LTS, lest we break
working AEL configurations in the transition to Asterisk 1.8 LTS.  This fix
is the result, which implements a search for the "h" extension in all calling
Gosub contexts.

Fixes ASTERISK-19336

Patch: 20120308__ael_bugfix_for_trunk__2.diff (License #5003) by Tilghman Lesher
	(with slight modifications for 1.8)

Tested by: Johan Wilfer

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@358812 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-13 08:06:20 +00:00
Kinsey Moore 8d1bde49a9 Fix case-sensitivity for device-specific event subscriptions and CCSS
This change fixes case-sensitivity for device-specific subscriptions such that
the technology identifier is case-insensitive while the remainder of the device
string is still case-sensitive.  This should also preserve the original case of
the device string as passed in to the event system.  CCSS is the only feature
affected as it is the only consumer of device-specific event subscriptions.

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

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

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@357942 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-02 21:06:12 +00:00
Terry Wilson a9d607a357 Opaquify ast_channel structs and lists
Review: https://reviewboard.asterisk.org/r/1773/


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

Some reasons you might need to do this:

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@357145 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-28 00:42:38 +00:00
Terry Wilson 6dcfd18308 Fix some tests that didn't get opaquification changes
Review: https://reviewboard.asterisk.org/r/1766/


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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@354968 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-13 17:27:06 +00:00
Richard Mudgett f2c2d83c92 Audit of ao2_iterator_init() usage for v10.
Fix double format_cap iterator cleanup.
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@352996 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-27 19:33:49 +00:00
Richard Mudgett ca41b4aba0 Doubly linked lists unit test and update to implementation.
Update the doubly linked list implementation.  Now safe traversing can
insert before and after the current node when traversing in either
direction.

Updated the linked lists unit test test_linkedlist to also test doubly
linked lists.  The old test_dlinkedlist requires a manual check of results
and probably should be removed.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@347110 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-12-06 19:09:56 +00:00
Terry Wilson fa57bbe17c Add a unit test for ast_sockaddr_split_hostport
Review: https://reviewboard.asterisk.org/r/1575/
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@344214 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-11-09 19:31:27 +00:00
Richard Mudgett f7ce570c35 Fix AST_LIST_INSERT_BEFORE_CURRENT() updating the wrong variable.
AST_LIST_INSERT_BEFORE_CURRENT() could not be used twice in an iteration
or before AST_LIST_REMOVE_CURRENT() without corrupting the list.
AST_LIST_INSERT_BEFORE_CURRENT() could also corrupt the list if
AST_LIST_INSERT_BEFORE_CURRENT() or AST_LIST_REMOVE_CURRENT() is used on
the next iteration.

* Fixed cut and paste error using the wrong variable in
AST_LIST_INSERT_BEFORE_CURRENT().

* Added linked list unit tests for AST_LIST_INSERT_BEFORE_CURRENT(),
AST_LIST_APPEND_LIST(), and AST_LIST_INSERT_LIST_AFTER().
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@342663 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-10-29 04:31:51 +00:00
Paul Belanger ca0f2acab7 Set 'core' support level for test_format_api.c
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@341147 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-10-17 16:39:14 +00:00
Paul Belanger dbb8332ff7 Merged revisions 338556 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10

................
  r338556 | pabelanger | 2011-09-29 17:14:34 -0400 (Thu, 29 Sep 2011) | 9 lines
  
  Merged revisions 338555 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.8
  
  ........
    r338555 | pabelanger | 2011-09-29 17:12:21 -0400 (Thu, 29 Sep 2011) | 2 lines
    
    Test modules should depend on the TEST_FRAMEWORK flag
  ........
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@338557 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-09-29 21:16:07 +00:00
Jason Parker 930bd5660a Merged revisions 338552 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10

................
  r338552 | qwell | 2011-09-29 15:54:55 -0500 (Thu, 29 Sep 2011) | 9 lines
  
  Merged revisions 338551 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.8
  
  ........
    r338551 | qwell | 2011-09-29 15:54:13 -0500 (Thu, 29 Sep 2011) | 1 line
    
    Test modules have a support level of core.
  ........
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@338553 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-09-29 20:55:15 +00:00
Jason Parker a6c29b931e Merged revisions 338228 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10

................
  r338228 | qwell | 2011-09-28 15:54:35 -0500 (Wed, 28 Sep 2011) | 9 lines
  
  Merged revisions 338227 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.8
  
  ........
    r338227 | qwell | 2011-09-28 15:52:47 -0500 (Wed, 28 Sep 2011) | 1 line
    
    Add support levels to non-module sections of menuselect (cflags, utils, etc).
  ........
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@338229 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-09-28 20:55:42 +00:00
Richard Mudgett 55b70ae625 Merged revisions 337974 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10

................
  r337974 | rmudgett | 2011-09-26 14:35:23 -0500 (Mon, 26 Sep 2011) | 37 lines
  
  Merged revisions 337973 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.8
  
  ........
    r337973 | rmudgett | 2011-09-26 14:30:39 -0500 (Mon, 26 Sep 2011) | 30 lines
    
    Fix deadlock when using dummy channels.
    
    Dummy channels created by ast_dummy_channel_alloc() should be destoyed by
    ast_channel_unref().  Using ast_channel_release() needlessly grabs the
    channel container lock and can cause a deadlock as a result.
    
    * Analyzed use of ast_dummy_channel_alloc() and made use
    ast_channel_unref() when done with the dummy channel.  (Primary reason for
    the reported deadlock.)
    
    * Made app_dial.c:dial_exec_full() not call ast_call() holding any channel
    locks.  Chan_local could not perform deadlock avoidance correctly.
    (Potential deadlock exposed by this issue.  Secondary reason for the
    reported deadlock since the held lock was part of the deadlock chain.)
    
    * Fixed some uses of ast_dummy_channel_alloc() not checking the returned
    channel pointer for failure.
    
    * Fixed some potential chan=NULL pointer usage in func_odbc.c.  Protected
    by testing the bogus_chan value.
    
    * Fixed needlessly clearing a 1024 char auto array when setting the first
    char to zero is enough in manager.c:action_getvar().
    
    (closes issue ASTERISK-18613)
    Reported by: Thomas Arimont
    Patches:
          jira_asterisk_18613_v1.8.patch (license #5621) patch uploaded by rmudgett
    Tested by: Thomas Arimont
  ........
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@337975 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-09-26 19:40:12 +00:00
Kinsey Moore 486b6042f3 Merged revisions 337062 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10

................
  r337062 | kmoore | 2011-09-20 16:05:01 -0500 (Tue, 20 Sep 2011) | 18 lines
  
  Merged revisions 337061 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.8
  
  ........
    r337061 | kmoore | 2011-09-20 16:04:11 -0500 (Tue, 20 Sep 2011) | 11 lines
    
    Make CANMATCH with the new pattern match engine behave more like the old one
    
    When checking an extension for E_CANMATCH using the new extension matching
    algorithm, an exact match was not returned as a possible match resulting in the
    queue failing to allow a caller to exit on DTMF.  This removes the requirement
    that an extension be longer than acquired digits for an E_CANMATCH operation
    to succeed.
    
    (closes issue ASTERISK-18044)
    Review: https://reviewboard.asterisk.org/r/1367/
  ........
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@337063 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-09-20 21:05:42 +00:00
Paul Belanger 606ca8ee8c Merged revisions 332177 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10

................
  r332177 | pabelanger | 2011-08-16 16:11:49 -0400 (Tue, 16 Aug 2011) | 11 lines
  
  Merged revisions 332176 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.8
  
  ........
    r332176 | pabelanger | 2011-08-16 16:10:13 -0400 (Tue, 16 Aug 2011) | 4 lines
    
    Flag test modules as 'core'
    
    Review: https://reviewboard.asterisk.org/r/1369/
  ........
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@332178 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-08-16 20:15:23 +00:00
Terry Wilson 7b07828f2b Merged revisions 331659 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10

................
  r331659 | twilson | 2011-08-12 11:31:21 -0500 (Fri, 12 Aug 2011) | 11 lines
  
  Merged revisions 331658 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.8
  
  ........
    r331658 | twilson | 2011-08-12 11:30:26 -0500 (Fri, 12 Aug 2011) | 4 lines
    
    Fix netsock2 multiple zero-expansion test
    
    Remove erroneous single bracket.
  ........
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@331660 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-08-12 16:32:24 +00:00
Russell Bryant 6a15e95a32 astobj2: Avoid using temporary objects + ao2_find() with OBJ_POINTER.
There is a fairly common pattern making its way through the code base where we
put a temporary object on the stack so we can call ao2_find() with OBJ_POINTER.
The purpose is so that it can be passed into the object hash function.
However, this really seems like a hack and potentially error prone.  This patch
is a first stab at approach to avoid having to do that.

It adds a new flag, OBJ_KEY, which can be used instead of OBJ_POINTER in these
situations.  Then, the hash function can know whether it was given an object or
some custom data to hash.

The patch also changes some uses of ao2_find() for iax2_user and iax2_peer
objects to reflect how OBJ_KEY would be used.

So long, and thanks for all the fish.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@330273 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-07-29 19:34:36 +00:00
Terry Wilson aada2733d6 Merged revisions 328992 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/2.0

................
  r328992 | twilson | 2011-07-20 15:18:25 -0500 (Wed, 20 Jul 2011) | 12 lines
  
  Merged revisions 328987 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.8
  
  ........
    r328987 | twilson | 2011-07-20 15:16:58 -0500 (Wed, 20 Jul 2011) | 5 lines
    
    We can't guarantee an eth0 is present
    
    FreeBSD test fails on this case presumably because there is no eth0 on the test
    machine. Better to just remove this test for now.
  ........
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@328996 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-07-20 20:19:16 +00:00
Terry Wilson c26bb50cc3 Merged revisions 328717 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.10

................
  r328717 | twilson | 2011-07-18 20:55:32 -0500 (Mon, 18 Jul 2011) | 14 lines
  
  Merged revisions 328716 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.8
  
  ........
    r328716 | twilson | 2011-07-18 20:35:53 -0500 (Mon, 18 Jul 2011) | 7 lines
    
    Make AST_LIST_REMOVE safer
    
    AST_LIST_REMOVE shouldn't modify the element passed in if it isn't found. This
    commit also adds linked list unit tests.
    
    Review: https://reviewboard.asterisk.org/r/1321/
  ........
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@328718 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-07-19 02:00:56 +00:00
Leif Madsen a525edea59 Merged revisions 328247 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.10

................
  r328247 | lmadsen | 2011-07-14 16:25:31 -0400 (Thu, 14 Jul 2011) | 14 lines
  
  Merged revisions 328209 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.8
  
  ........
    r328209 | lmadsen | 2011-07-14 16:13:06 -0400 (Thu, 14 Jul 2011) | 6 lines
    
    Introduce <support_level> tags in MODULEINFO.
    This change introduces MODULEINFO into many modules in Asterisk in order to show
    the community support level for those modules. This is used by changes committed
    to menuselect by Russell Bryant recently (r917 in menuselect). More information about
    the support level types and what they mean is available on the wiki at
    https://wiki.asterisk.org/wiki/display/AST/Asterisk+Module+Support+States
  ........
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@328259 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-07-14 20:28:54 +00:00
Tilghman Lesher 6ec3c929ab Merged revisions 327793 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r327793 | tilghman | 2011-07-12 10:35:46 -0500 (Tue, 12 Jul 2011) | 14 lines
  
  Use 'printf' (POSIX issue 4) instead of 'echo -n', for portability.
  
  The problem with using 'echo -n' is that it is not portable.  While BSD systems
  required that the '-n' option be removed and interpreted, System V required
  that all strings should be echoed with no interpretation of options.  This
  fundamental difference of behavior means that it is never possible to use the
  '-n' flag to echo in tests which are meant to be portable.
  
  In this case, on Mac OS X 10.6, the /bin/sh shell builtin 'echo' uses the
  System V semantics of the command, and thus the SHELL test failed on that
  platform.
  
  http://pubs.opengroup.org/onlinepubs/009695399/utilities/echo.html#tag_04_41_16
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@327794 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-07-12 15:38:47 +00:00
Matthew Nicholson 0852fddf33 use printf instead of echo -n in substitution test
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@327684 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-07-11 20:06:28 +00:00
Matthew Nicholson 7eda60dca1 Merged revisions 327512 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r327512 | mnicholson | 2011-07-11 08:53:59 -0500 (Mon, 11 Jul 2011) | 2 lines
  
  reset our buffer each iteration when doing variable substitution
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@327513 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-07-11 13:55:28 +00:00
Matthew Nicholson 2ac180275d Merged revisions 327106 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r327106 | mnicholson | 2011-07-08 14:52:51 -0500 (Fri, 08 Jul 2011) | 11 lines
  
  Reset our ast_str before passing it on to dialplan function backends.
  
  It is possible for a dialplan backend to not modify the given buffer or ast_str
  and still return success. This causes any previous value stored in the buffer
  to be used as if the new function call provided it. Some functions also append
  to the given buffer assuming it is empty.
  
  The test_substitution unit test has also been modified to detect this problem.
  
  (closes issue ASTERISK-17878)
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@327107 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-07-08 19:54:23 +00:00
Russell Bryant c952e1c0c5 Merged revisions 327046 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r327046 | russell | 2011-07-08 11:00:05 -0500 (Fri, 08 Jul 2011) | 2 lines
  
  Fix an error and add more log message info to help see why this fails on FreeBSD.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@327047 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-07-08 16:00:46 +00:00
Terry Wilson efd040cd11 Replace Berkeley DB with SQLite 3
There were some bugs in the very ancient version of Berkeley DB that Asterisk
used. Instead of spending the time tracking down the bugs in the Berkeley code
we move to the much better documented SQLite 3.

Conversion of the old astdb happens at runtime by running the included
astdb2sqlite3 utility. The ast_db API with SQLite 3 backend should behave
identically to the old Berkeley backend, but in the future we could offer a
much more robust interface.

We do not include the SQLite 3 library in the source tree, but instead rely
upon the distribution-provided libraries. SQLite is so ubiquitous that this
should not place undue burden on administrators.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@326589 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-07-06 20:58:12 +00:00
Terry Wilson d7e2d2248c Merged revisions 324557 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r324557 | twilson | 2011-06-22 22:10:38 -0500 (Wed, 22 Jun 2011) | 5 lines
  
  Remove tests for parsing address with invalid port
  
  getaddrinfo on OS X returns with EAI_NONAME error when passed a port
  greater than 65535. Linux throws no error, so remove the tests for now.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@324558 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-06-23 03:16:44 +00:00
Terry Wilson 385b8c6f8b Merged revisions 324484 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r324484 | twilson | 2011-06-22 13:52:04 -0500 (Wed, 22 Jun 2011) | 20 lines
  
  Stop sending IPv6 link-local scope-ids in SIP messages
  
  The idea behind the patch listed below was used, but in a more targeted manner.
  There are now address stringification functions for addresses that are meant to
  be sent to a remote party. Link-local scope-ids only make sense on the machine
  from which they originate and so are stripped in the new functions.
  
  There is also a host sanitization function added to chan_sip which is used
  for when peer and dialog tohost fields or sip_registry hostnames are used to
  craft a SIP message.
  
  Also added are some basic unit tests for netsock2 address parsing.
  
  (closes issue ASTERISK-17711)
  Reported by: ch_djalel
  Patches:
        asterisk-1.8.3.2-ipv6_ll_scope.patch uploaded by ch_djalel (license 1251)
  
  Review: https://reviewboard.asterisk.org/r/1278/
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@324487 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-06-22 19:12:24 +00:00
Richard Mudgett ab0c2cf441 Merged revisions 323990 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r323990 | rmudgett | 2011-06-16 13:12:32 -0500 (Thu, 16 Jun 2011) | 5 lines
  
  The test_event unit test is occasionally failing.
  
  Wait for the special posted event to process before adding a new
  subscription.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@323991 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-06-16 18:13:01 +00:00
Terry Wilson 9ef6b131d0 Merged revisions 323866 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r323866 | twilson | 2011-06-15 15:03:58 -0500 (Wed, 15 Jun 2011) | 2 lines
  
  Remove now-useless cast of ARRAY_LEN
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@323867 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-06-15 20:04:55 +00:00
Terry Wilson 89b653cb81 Merged revisions 323859 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r323859 | twilson | 2011-06-15 14:45:20 -0500 (Wed, 15 Jun 2011) | 2 lines
  
  Fix more ARRAY_LEN format string issues
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@323860 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-06-15 19:46:46 +00:00
Terry Wilson 17c3802b9f Merged revisions 323672 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r323672 | twilson | 2011-06-15 10:09:51 -0700 (Wed, 15 Jun 2011) | 5 lines
  
  Cast ARRAY_LEN to size_t for ast_logging
  
  32-bit and 64-bit machines return different types for ARRAY_LEN(), so cast
  it before using in a format string.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@323673 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-06-15 17:12:29 +00:00
Richard Mudgett b2d0ea5fea Merged revisions 323669-323670 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r323669 | rmudgett | 2011-06-15 11:43:18 -0500 (Wed, 15 Jun 2011) | 21 lines
  
  [regression] Voicemail MWI is no longer sent.
  
  When leaving a voicemail, the MWI message is never sent.  The same thing
  happens when checking a voicemail and marking it as read.
  
  If you restart Asterisk, everything comes up at that state correctly, but
  changes to the messages in voicemail causes the light to not be set
  appropriately.  Very easy to reproduce.
  
  * Made ast_event_check_subscriber() return TRUE if there are ANY
  subscribers to an event type when there are no restricting ie values
  passed.  This allows an event being queued to be queued.
  
  (closes issue ASTERISK-18002)
  Reported by: lmadsen
  Tested by: lmadsen, irroot
  Patches:
       jira_asterisk_18002_v1.8.patch uploaded by rmudgett (License #5621)
  
  (closes issue ASTERISK-18019)
........
  r323670 | rmudgett | 2011-06-15 11:43:31 -0500 (Wed, 15 Jun 2011) | 7 lines
  
  Add a test to the event unit tests to catch ASTERISK-18002.
  
  The new tests check to see if there are ANY subscribers to the event type
  when ast_event_check_subscriber() is not passed any specific ie values.
  
  (issue ASTERISK-18002)
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@323671 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-06-15 16:49:34 +00:00
Terry Wilson 6017de6292 Merged revisions 322923 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r322923 | twilson | 2011-06-09 19:33:23 -0700 (Thu, 09 Jun 2011) | 2 lines
  
  Add some astdb unit tests
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@322940 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-06-10 03:28:29 +00:00
Richard Mudgett 85aa126b34 Merged revisions 321871 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r321871 | rmudgett | 2011-06-03 15:58:13 -0500 (Fri, 03 Jun 2011) | 27 lines
  
  Event subscription fixes.
  
  Must commit the subscription fixes together with the integration
  subscription tests.  The subscription fixes cause an erroneously passing
  test to fail.  The new subscription tests detect errors without the
  subscription fixes.
  
  * Added missing event_names[] table entry.
  
  * Reworked ast_event_check_subscriber()/match_sub_ie_val_to_event() to
  correctly detect if a subscriber exists for the proposed event.
  
  * Made match_ie_val() and match_sub_ie_val_to_event() check the buffer
  length for RAW payload types.
  
  * Fixed error handling memory leak in ast_event_sub_activate(),
  ast_event_unsubscribe(), and ast_event_queue().
  
  * Made ast_event_new() and ast_event_check_subscriber() better protect
  themselves from an invalid payload type.
  
  * Added container lock protection between removing old cache events and
  adding the new cached event in
  ast_event_queue_and_cache()/event_update_cache().
  
  * Added new event subscription tests.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@321872 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-06-03 21:02:32 +00:00
Russell Bryant 6357719a82 Fix some astobj2 iterator breakage, add another unit test.
Review: https://reviewboard.asterisk.org/r/1254/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@321752 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-06-03 18:25:11 +00:00
Richard Mudgett 9fc0d9be66 Fix compiler warning.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@306326 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-02-04 19:09:00 +00:00
David Vossel c26c190711 Asterisk media architecture conversion - no more format bitfields
This patch is the foundation of an entire new way of looking at media in Asterisk.
The code present in this patch is everything required to complete phase1 of my
Media Architecture proposal.  For more information about this project visit the link below.
https://wiki.asterisk.org/wiki/display/AST/Media+Architecture+Proposal

The primary function of this patch is to convert all the usages of format
bitfields in Asterisk to use the new format and format_cap APIs.  Functionally
no change in behavior should be present in this patch.  Thanks to twilson
and russell for all the time they spent reviewing these changes.

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@306010 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-02-03 16:22:10 +00:00
Matthew Nicholson e706b5706e According to section 19.1.2 of RFC 3261:
For each component, the set of valid BNF expansions defines exactly
  which characters may appear unescaped.  All other characters MUST be
  escaped.

This patch modifies ast_uri_encode() to encode strings in line with this recommendation.  This patch also adds an ast_escape_quoted() function which escapes '"' and '\' characters in quoted strings in accordance with section 25.1 of RFC 3261.  The ast_uri_encode() function has also been modified to take an ast_flags struct describing the set of rules it should use when escaping characters to allow for it to escape SIP URIs in addition to HTTP URIs and other types of URIs or variations of those two URI types in the future.

The ast_uri_decode() function has also been modified to accept an ast_flags struct describing the set of rules to use when decoding to enable decoding '+' as ' ' in legacy http URLs.

The unit tests for these functions have also been updated.

ABE-2705

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@303509 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-01-24 18:59:22 +00:00
Russell Bryant cc0b7e7df5 Some scheduler API cleanup and improvements.
Previously, I had added the ast_sched_thread stuff that was a generic scheduler
thread implementation.  However, if you used it, it required using different
functions for modifying scheduler contents.  This patch reworks how this is
done and just allows you to optionally start a thread on the original scheduler
context structure that has always been there.  This makes it trivial to switch
to the generic scheduler thread implementation without having to touch any of
the other code that adds or removes scheduler entries.

In passing, I made some naming tweaks to add ast_ prefixes where they were not
there before.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@299091 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-12-20 17:15:54 +00:00
Tilghman Lesher f5043262be Merged revisions 295078 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

................
  r295078 | tilghman | 2010-11-15 12:30:13 -0600 (Mon, 15 Nov 2010) | 16 lines
  
  Merged revisions 295062 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.6.2
  
  ................
    r295062 | tilghman | 2010-11-15 12:24:02 -0600 (Mon, 15 Nov 2010) | 9 lines
    
    Merged revisions 295026 via svnmerge from 
    https://origsvn.digium.com/svn/asterisk/branches/1.4
    
    ........
      r295026 | tilghman | 2010-11-15 11:58:37 -0600 (Mon, 15 Nov 2010) | 2 lines
      
      Create test verifying results of expression parser
    ........
  ................
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@295079 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-11-15 19:11:12 +00:00
Mark Michelson 3964b078dd Merged revisions 292741 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r292741 | mmichelson | 2010-10-22 12:09:52 -0500 (Fri, 22 Oct 2010) | 12 lines
  
  Prevent multiple runs of event_sub_test from producing false failure results.
  
  The array of test subscriptions was declared "static," meaning that the
  data.count field would retain its value between runs of the test. After the
  first test run, this would result in false reports of test failures.
  
  I chose to just remove the "static" keyword from the structure since it's not
  a huge deal to construct this structure during each run of the test. Another
  alternative would have been to zero out the data.count fields of each test
  subscription instead.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@292742 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-10-22 17:10:59 +00:00
Tilghman Lesher 6d0e383321 Merged revisions 289543,289581 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r289543 | tilghman | 2010-09-30 12:50:52 -0500 (Thu, 30 Sep 2010) | 2 lines
  
  More Solaris compatibility fixes
........
  r289581 | tilghman | 2010-09-30 15:23:10 -0500 (Thu, 30 Sep 2010) | 2 lines
  
  Solaris fixes.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@289588 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-09-30 20:40:08 +00:00
Tilghman Lesher 7157b48150 Merged revisions 289104 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r289104 | tilghman | 2010-09-28 13:18:43 -0500 (Tue, 28 Sep 2010) | 4 lines
  
  Solaris compatibility fixes
  
  Review: https://reviewboard.asterisk.org/r/942/
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@289112 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-09-28 18:20:20 +00:00
Tilghman Lesher 336d2a1abd Merged revisions 285931 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

................
  r285931 | tilghman | 2010-09-09 20:25:50 -0500 (Thu, 09 Sep 2010) | 21 lines
  
  Merged revisions 285930 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.6.2
  
  ................
    r285930 | tilghman | 2010-09-09 20:16:32 -0500 (Thu, 09 Sep 2010) | 14 lines
    
    Merged revisions 285889 via svnmerge from 
    https://origsvn.digium.com/svn/asterisk/branches/1.4
    
    ........
      r285889 | tilghman | 2010-09-09 19:13:45 -0500 (Thu, 09 Sep 2010) | 7 lines
      
      Fix Mac OS X build.
      
      This also fixes a rather grievous calculation error for the offset of
      ast_fdset, which was masked on Linux and FreeBSD, because these platforms
      check the first 256 FDs regardless of the bitmask setting (due to backwards
      compatibility).
    ........
  ................
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@285932 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-09-10 01:27:44 +00:00
Tilghman Lesher 5eae9f44f7 Merged revisions 284597 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

................
  r284597 | tilghman | 2010-09-02 00:00:34 -0500 (Thu, 02 Sep 2010) | 29 lines
  
  Merged revisions 284593,284595 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.6.2
  
  ................
    r284593 | tilghman | 2010-09-01 17:59:50 -0500 (Wed, 01 Sep 2010) | 18 lines
    
    Merged revisions 284478 via svnmerge from 
    https://origsvn.digium.com/svn/asterisk/branches/1.4
    
    ........
      r284478 | tilghman | 2010-09-01 13:49:11 -0500 (Wed, 01 Sep 2010) | 11 lines
      
      Ensure that all areas that previously used select(2) now use poll(2), with implementations that need poll(2) implemented with select(2) safe against 1024-bit overflows.
      
      This is a followup to the fix for the pthread timer in 1.6.2 and beyond, fixing
      a potential crash bug in all supported releases.
      
      (closes issue #17678)
       Reported by: russell
      Branch: https://origsvn.digium.com/svn/asterisk/team/tilghman/ast_select 
      
      Review: https://reviewboard.asterisk.org/r/824/
    ........
  ................
    r284595 | tilghman | 2010-09-01 22:57:43 -0500 (Wed, 01 Sep 2010) | 2 lines
    
    Failed to rerun bootstrap.sh after last commit
  ................
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@284598 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-09-02 05:02:54 +00:00
Paul Belanger 9bbe763be5 Merged revisions 280446 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r280446 | pabelanger | 2010-07-29 14:37:32 -0400 (Thu, 29 Jul 2010) | 2 lines
  
  Remove res_crypto dependency.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@280447 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-29 18:51:39 +00:00
Paul Belanger ee20d59ec5 Merged revisions 280414 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r280414 | pabelanger | 2010-07-29 12:44:22 -0400 (Thu, 29 Jul 2010) | 2 lines
  
  crypto_loaded_test depends on res_crypto, else test will fail.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@280415 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-29 16:45:34 +00:00
Paul Belanger f1bb6dde75 Merged revisions 279442 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r279442 | pabelanger | 2010-07-25 17:26:42 -0400 (Sun, 25 Jul 2010) | 2 lines
  
  Add trailing backslash to silence warning message. 
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@279443 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-25 21:28:10 +00:00
David Vossel f805d00bbd make func_file unit test's category consistent with other tests
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@278539 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-21 19:16:12 +00:00
Mark Michelson d6cc7dd982 Remove the fe80🔢:1234 test case from test_acl.c
The ACL test was failing on Mac OS X because it would
convert the above invalid link-local address into
fe80::1234 while reporting no error from getaddrinfo().
Linux does not do this.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@277872 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-19 17:10:00 +00:00
Mark Michelson 6fa79e8f77 Make ACLs IPv6-capable.
ACLs can now be configured to match IPv6 networks. This is only
relevant for ACLs in chan_sip for now since other channel drivers
do not support IPv6 addressing. However, once those channel drivers
are outfitted to support IPv6 addressing, the ACLs will already be
ready for IPv6 support.

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@277814 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-19 14:17:16 +00:00
Matthew Nicholson 1fd618de5b updated devicestate test for device state changes
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@277409 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-16 19:32:10 +00:00
Tilghman Lesher e990f89a0e Fix trunk build for Mac OS X 10.6
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@276870 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-16 04:23:02 +00:00
Tilghman Lesher 832d1296c6 Remove the old stub files, preferring the optional_api method.
(closes issue #17475)
 Reported by: tilghman
 
Review: https://reviewboard.asterisk.org/r/695/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@276490 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-14 20:48:59 +00:00
Richard Mudgett ec37ffbdaf ast_callerid restructuring
The purpose of this patch is to eliminate struct ast_callerid since it has
turned into a miscellaneous collection of various party information.

Eliminate struct ast_callerid and replace it with the following struct
organization:

struct ast_party_name {
	char *str;
	int char_set;
	int presentation;
	unsigned char valid;
};
struct ast_party_number {
	char *str;
	int plan;
	int presentation;
	unsigned char valid;
};
struct ast_party_subaddress {
	char *str;
	int type;
	unsigned char odd_even_indicator;
	unsigned char valid;
};
struct ast_party_id {
	struct ast_party_name name;
	struct ast_party_number number;
	struct ast_party_subaddress subaddress;
	char *tag;
};
struct ast_party_dialed {
	struct {
		char *str;
		int plan;
	} number;
	struct ast_party_subaddress subaddress;
	int transit_network_select;
};
struct ast_party_caller {
	struct ast_party_id id;
	char *ani;
	int ani2;
};

The new organization adds some new information as well.

* The party name and number now have their own presentation value that can
be manipulated independently.  ISDN supplies the presentation value for
the name and number at different times with the possibility that they
could be different.

* The party name and number now have a valid flag.  Before this change the
name or number string could be empty if the presentation were restricted.
Most channel drivers assume that the name or number is then simply not
available instead of indicating that the name or number was restricted.

* The party name now has a character set value.  SIP and Q.SIG have the
ability to indicate what character set a name string is using so it could
be presented properly.

* The dialed party now has a numbering plan value that could be useful to
have available.

The various channel drivers will need to be updated to support the new
core features as needed.  They have simply been converted to supply
current functionality at this time.


The following items of note were either corrected or enhanced:

* The CONNECTEDLINE() and REDIRECTING() dialplan functions were
consolidated into func_callerid.c to share party id handling code.

* CALLERPRES() is now deprecated because the name and number have their
own presentation values.

* Fixed app_alarmreceiver.c write_metadata().  The workstring[] could
contain garbage.  It also can only contain the caller id number so using
ast_callerid_parse() on it is silly.  There was also a typo in the
CALLERNAME if test.

* Fixed app_rpt.c using ast_callerid_parse() on the channel's caller id
number string.  ast_callerid_parse() alters the given buffer which in this
case is the channel's caller id number string.  Then using
ast_shrink_phone_number() could alter it even more.

* Fixed caller ID name and number memory leak in chan_usbradio.c.

* Fixed uninitialized char arrays cid_num[] and cid_name[] in
sig_analog.c.

* Protected access to a caller channel with lock in chan_sip.c.

* Clarified intent of code in app_meetme.c sla_ring_station() and
dial_trunk().  Also made save all caller ID data instead of just the name
and number strings.

* Simplified cdr.c set_one_cid().  It hand coded the ast_callerid_merge()
function.

* Corrected some weirdness with app_privacy.c's use of caller
presentation.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@276347 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-14 15:48:36 +00:00
Tilghman Lesher 50d5f134c8 FILE() now supports line-mode and writing (altering) files.
(closes issue #16461)
 Reported by: skyman
 Patches: 
       20100622__issue16461.diff.txt uploaded by tilghman (license 14)
 Tested by: tilghman
 
Review: https://reviewboard.asterisk.org/r/737/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@276114 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-13 18:31:41 +00:00
Tilghman Lesher da8450323f Kill some startup warnings and errors and make some messages more helpful in tracking down the source.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@275105 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-09 17:00:22 +00:00
Russell Bryant 6bb906f87c Fix an off by one error that caused a unit test to occasionally crash.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@269711 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-10 13:17:51 +00:00
Richard Mudgett afd4454c44 Generic Advice of Charge.
Asterisk Generic AOC Representation
- Generic AOC encode/decode routines.
  (Generic AOC must be encoded to be passed on the wire in the AST_CONTROL_AOC frame)
- AST_CONTROL_AOC frame type to represent generic encoded AOC data
- Manager events for AOC-S, AOC-D, and AOC-E messages

Asterisk App Support
- app_dial AOC-S pass-through support on call setup
- app_queue AOC-S pass-through support on call setup

AOC Unit Tests
- AOC Unit Tests for encode/decode routines
- AOC Unit Test for manager event representation.

SIP AOC Support
- Pass-through of generic AOC-D and AOC-E messages to snom phones via the
  snom AOC specification.
- Creation of chan_sip page3 flags for the addition of the new
  'snom_aoc_enabled' sip.conf option.

IAX AOC Support
- Natively supports AOC pass-through through the use of the new
  AST_CONTROL_AOC frame type

DAHDI AOC Support
- ETSI PRI full AOC Pass-through support
- 'aoc_enable' chan_dahdi.conf option for independently enabling
  pass-through of AOC-S, AOC-D, AOC-E.
- 'aoce_delayhangup' option for retrieving AOC-E on disconnect.
- DAHDI A() dial string option for requesting AOC services.
  example usage:
  ;requests AOC-S, AOC-D, and AOC-E on call setup
  exten=>1111,1,Dial(DAHDI/g1/1112/A(s,d,e))

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@267096 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-02 18:10:15 +00:00
Tilghman Lesher b0357dcc3e Support setting locale per-mailbox (changes date/time languages for email, pager messages).
(closes issue #14333)
 Reported by: klaus3000
 Patches: 
       20090515__issue14333.diff.txt uploaded by tilghman (license 14)
       app_voicemail.c-svn-trunk-rev211675-patch.txt uploaded by klaus3000 (license 65)
 Tested by: klaus3000


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@266828 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-01 21:28:19 +00:00
Tilghman Lesher 8d6ee962c7 Add kqueue(2) implementation to Asterisk in various places.
This will save a considerable amount of CPU on the BSDs, including Mac OS X,
as it eliminates several places in the code that we previously used a busy
loop.  Additionally, this adds a res_timing interface, using kqueue timers.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@262852 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-13 05:37:31 +00:00
Russell Bryant be77c44d45 Add test case for removing random elements from a heap.
I modified the original patch for trunk to use the unit test API.

(issue #17277)
Reported by: cappucinoking
Patches:
      test_heap.diff uploaded by cappucinoking (license 1036)
Tested by: cappucinoking, russell


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@261500 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-06 14:15:57 +00:00
Russell Bryant 52a8ddba51 Add ast_event subscription unit test and fix some ast_event API bugs.
This patch introduces another test in test_event.c that exercises most of the
subscription related ast_event API calls.  I made some minor additions to the
existing event allocation test to increase API coverage by the test code.
Finally, I made a list in a comment of API calls not yet touched by the test
module as a to-do list for future test development.

During the development of this test code, I discovered a number of bugs in
the event API.

1) subscriptions to AST_EVENT_ALL were not handled appropriately in a couple
   of different places.  The API allows a subscription to all event types,
   but with IE parameters, just as if it was a subscription to a specific
   event type.  However, the parameters were being ignored.  This affected
   ast_event_check_subscriber() and event distribution to subscribers.

2) Some of the logic in ast_event_check_subscriber() for checking subscriptions
   against query parameters was wrong.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@258632 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-22 21:06:53 +00:00
Tilghman Lesher 8ced3317ed Merged revisions 257544 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r257544 | tilghman | 2010-04-15 16:23:24 -0500 (Thu, 15 Apr 2010) | 6 lines
  
  Allow application options with arguments to contain parentheses, through a variety of escaping techniques.
  
  Fixes SWP-1194 (ABE-2143).
  
  Review: https://reviewboard.asterisk.org/r/604/
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@257560 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-15 21:26:19 +00:00
Russell Bryant 387f2eb733 test_substitution expects func_curl to be present to work.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@256783 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-12 02:19:02 +00:00
Russell Bryant c78b29cb11 Add ASTERISK_FILE_VERSION() macro
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@256745 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-11 22:04:01 +00:00
Mark Michelson ae7b76a1b9 Fix some compiler errors that popped up after the CCSS merge.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@256529 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-09 15:56:55 +00:00
Mark Michelson 49e2cd4291 Add unit test for testing ACL functionality.
There are two unit tests contained here.

1. "Invalid ACL" This attempts to read a bunch of badly formatted ACL entries
and add them to a host access rule. The goal of this test is to be sure that
all invalid entries are rejected as they should be.

2. "ACL" This sets up four ACLs. One is a permit all, one is a deny all, and
the other two have specific rules about which subnets are allowed and which
are not. Then a set of test addresses is used to determine whether we would
allow those addresses to access us when each ACL is applied. This test, by the
way, was what resulted in AST-2010-003's creation.

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@254557 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-25 17:52:20 +00:00
Tzafrir Cohen 69f7901fc0 Change the name of the category 'TEST' to match the name of the subdir
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@254001 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-23 19:19:52 +00:00
Tilghman Lesher 91d6592e61 Switch to using intptr_t, as suggested by Kevin Fleming on the -dev list
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@253113 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-17 14:16:54 +00:00
Tilghman Lesher e93c16ccc6 Argh.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@253004 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-17 00:23:12 +00:00
Tilghman Lesher 374e4e9d72 Fix bamboo compile error by calculating an integer with the same size as a pointer.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@252980 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-17 00:14:29 +00:00
Tilghman Lesher ae5a398322 Mask out previous arguments on each nested invocation of Gosub.
(closes issue #16758)
 Reported by: wdoekes
 Patches: 
       20100316__issue16758.diff.txt uploaded by tilghman (license 14)
 
Review: https://reviewboard.asterisk.org/r/561/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@252976 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-16 23:49:35 +00:00
Russell Bryant 1239a9792d Re-enable test_time on non-Linux.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@252849 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-16 19:36:55 +00:00
Tilghman Lesher 385a40226a Fix test_time on Mac OS X (and other platforms without inotify)
Reviewboard: https://reviewboard.asterisk.org/r/554/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@252846 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-16 19:34:01 +00:00
Russell Bryant 477393db3c Disable this test on non-Linux for now.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@252759 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-16 18:36:34 +00:00
Russell Bryant 1da59b1f7a Resolve compiler warning by paying attention to system() return value.
This resolves the last compile failure on bamboo.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@252229 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-13 22:17:05 +00:00
Tilghman Lesher 6f6a170380 Test script to verify that timezone cache is properly removed on zonefile alteration.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@252133 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-12 23:18:20 +00:00
Tilghman Lesher c83f35d4a0 Fix tests on 32-bit systems.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@251881 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-11 20:29:19 +00:00
Jeff Peeler 2d26a2da1f Add new unit test for stringfields.
(Copied from reviewboard)
Tests the following:
1. Basic allocation and setting of string fields.
2. Shrinking a string field and re-expanding it.
3. Growing the last allocation in a string field pool.
4. Setting a string to a large value such that a new string field pool must be
allocated.
In each part, we make sure that the string field is accurate (has the correct
value in it), make sure that the 2 bytes before the string field has the correct
capacity for the field, and for tests 2-4, we make sure that the string field is
where we expect it to be in memory.

Also tested:
5. Shrinking a string field and partially re-expanding it.
6. Setting strings in such a way as to create three separate string field pools
and then removing the middle pool.

There is a bug fix in the init function, which ensures the embedded_pool is set
to NULL which is important for stack allocated structures.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@251736 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-10 23:15:55 +00:00
Tilghman Lesher dd3176cc91 It's amazing what writing a test will find.
(issue #16900)
 Reported by: bluecrow76


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@251677 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-10 20:30:34 +00:00
David Vossel 8429882ad8 base64 unit test
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@250235 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-02 23:38:29 +00:00
Russell Bryant 02a9366aed Add ASTERISK_FILE_VERSION macro.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@248533 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-24 06:38:10 +00:00
Mark Michelson ecf4c97f83 Unit test for ast_str API.
Review: https://reviewboard.asterisk.org/r/517


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@248489 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-23 22:29:06 +00:00
Russell Bryant 29c57c6dac Tweak copyright and author lines.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@248225 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-22 06:43:02 +00:00
Jeff Peeler 27a4cda821 Add support for GROUP_MATCH_COUNT regex matching on category
Current support for regex matching was previously only available on the group.
Also, error reporting for regex failures has been added. In addition to this
feature enhancement a unit test has been written to check the regular expression
logic to ensure the count operation is working as expected.

(closes issue #16642)
Reported by: kobaz
Patches: 
      groupmatch2.patch uploaded by kobaz (license 834)

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@247295 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-17 19:51:53 +00:00
David Vossel e8d201e870 modified device2extension_test's category
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@247282 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-17 19:23:35 +00:00
David Vossel 5b0b04f2d8 unit test for combined device state mapping and device to exten state mapping
Review: https://reviewboard.asterisk.org/r/516/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@247262 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-17 19:18:44 +00:00
Mark Michelson 0d4a8f642d Add unit test for dialplan pattern matching.
This test works by reading input from arrays to build a sample
dialplan. From there, patterns are attempted to be matched against
said dialplan, with the expected match given. We then search in our
example dialplan to see if we find a match and if what we find matches
what we expected it to match.

(closes issue #16809)
Reported by: lmadsen
Tested by: mmichelson

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@246942 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-16 18:29:42 +00:00
David Vossel 6d9c531237 fixes some test description formatting inconsistencies so log file looks nice
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@246338 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-11 21:57:37 +00:00
David Vossel 9478670527 astobj2 unit test and bug fix
A bug was discovered during the creation of the astobj2 unit test.
When OBJ_MULTIPLE | OBJ_UNLINK is used, the objects being returned
had a ref count issue.  This patch resolves that.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@246299 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-11 18:42:25 +00:00
Russell Bryant 1321748c19 Add a test module for the event API, test_event.c.
This module includes a single test so far that creates events using two
different methods and does some verification on the result to make sure
the correct data can be retrieved from the event that was created.

One bug was found in the event API while developing this test, which makes
me happy.  :-)

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@246260 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-10 23:19:16 +00:00
Russell Bryant bbed34f764 Various updates to the unit test API.
1) It occurred to me that the difference in usage between the error ast_str and
the ast_test_update_status() usage has turned out to be a bit ambiguous in
practice.  In a lot of cases, the same message was being sent to both.
In other cases, it was only sent to one or the other.  My opinion now is that
in every case, I think it makes sense to do both; we should output it to the
CLI as well as save it off for logging purposes.

This change results in most of the changes in this diff, since it required
changes to all existing unit tests.  It also allowed for some simplifications
of unit test API implementation code.

2) Update ast_test_status_update() to include the file, function, and line
number for the code providing the update.

3) There are some formatting tweaks here and there.  Hopefully they aren't too
distracting for code review purposes.  Reviewboard's diff viewer seems to do a
pretty good job of pointing out when something is a whitespace change.

4) I moved the md5_test and sha1_test into the test_utils module.  It seemed
like a better approach since these tests are so tiny.

5) I changed the number of nodes used in heap_test_2 from 1 million to
100 thousand.  The only reason for this was to reduce the time it took
for this test to run.

6) Remove an unused function prototype that was at the bottom of utils.h.

7) Simplify test_insert() using the LIST_INSERT_SORTALPHA() macro.  The one
minor difference in behavior is that it no longer checks for a test registered
with the same name.

8) Expand the code in test_alloc() to provide specific error messages for each
failure case, to clearly inform developers if they forget to set the name,
summary, description, etc.

9) Tweak the output of the "test show registered" CLI command.  I swapped the
name and category to have the category first.  It seemed more natural since
that is the sort key.

10) Don't output the status ast_str in the "test show results" CLI command.
This is going to tend to be pretty verbose, so just leave that for the
detailed test logs (test generate results).

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@245864 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-09 23:32:14 +00:00
Russell Bryant 38ed79a076 UNREGISTER instead of REGISTER in unload_module().
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@245623 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-08 23:34:01 +00:00
Russell Bryant fe19e1fbd3 Add a SHA1 test module.
Review: https://reviewboard.asterisk.org/r/492/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@245345 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-08 00:42:21 +00:00
Russell Bryant b0a0ee6bfe Remove unnecessary include, ast_md5_hash() comes from utils.h.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@245344 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-08 00:24:54 +00:00
Russell Bryant c54ab1ae21 Add an MD5 test module.
Review: https://reviewboard.asterisk.org/r/491/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@245307 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-07 21:56:04 +00:00
Russell Bryant 0ea944df9e Fix a couple of spelling errors, and add format module dependencies.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@245306 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-07 21:43:11 +00:00
Tilghman Lesher cf6592e58e Merge tests that verify the same thing. (Oops.)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@245046 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-05 19:07:18 +00:00
David Vossel d16b89be17 RFC compliant uri and display-name encode/decode
1.  URI Encoding
This patch changes ast_uri_encode()'s behavior when doreserved is enabled.
Previously when doreserved was enabled only a small set of reserved
characters were encoded.  This set was comprised primarily of the reserved
characters defined in RFC3261 section 25.1, but contained other characters as
well.  Rather than only escaping the reserved set, doreserved now escapes
all characters not within the unreserved set as defined by RFC 3261 and
RFC 2396.  Also, the 'doreserved' variable has been renamed to 'do_special_char'
in attempts to avoid confusion.

When doreserve is not enabled, the previous logic of only encoding the
characters <= 0X1F and > 0X7f remains, except for the '%' character, which
must always be encoded as it signifies a HEX escaped character during the decode
process.

2. URI Decoding: Break up URI before decode.
In chan_sip.c ast_uri_decode is called on the entire URI instead of it's
individual parts after it is parsed.  This is not good as ast_uri_decode
can introduce special characters back into the URI which can mess up parsing.
This patch resolves this by not decoding a URI until parsing is completely
done.  There are many instances where we check to see if pedantic checking
is enabled before we decode a URI.  In these cases a new macro,
SIP_PEDANTIC_DECODE, is used on the individual parsed segments of the URI
rather than constantly putting if (pedantic) { decode() } checks everywhere
in the code.  In the areas where ast_uri_decode is not dependent upon
pedantic checking this macro is not used, but decoding is still moved to
each individual part of the URI.  The only behavior that should change from
this patch is the time at which decoding occurs.

Since I had to look over every place URI parsing occurs to create this
patch, I found several places where we use duplicate code for parsing.
To consolidate the code, those areas have updated to use the parse_uri()
function where possible.

3. SIP display-name decoding according to RFC3261 section 25.
To properly decode the display-name portion of a FROM header, chan_sip's
get_calleridname() function required a complete re-write.  More information
about this change can be found in the comments at the beginning of this function.

4. Unit Tests.
Unit tests for ast_uri_encode, ast_uri_decode, and get_calleridname() have been
written.  This involved the addition of the test_utils.c file for testing the
utils api.

(closes issue #16299)
Reported by: wdoekes
Patches:
      astsvn-16299-get_calleridname.diff uploaded by wdoekes (license 717)
      get_calleridname_rewrite.diff uploaded by dvossel (license 671)
Tested by: wdoekes, dvossel, Nick_Lewis

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@243200 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-26 16:30:08 +00:00
Russell Bryant 2ce1ffc664 Log the variable name being tested.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@243158 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-26 15:46:53 +00:00
Russell Bryant 3e0463107e Update test_substitution to show failures in the test log.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@243157 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-26 15:35:40 +00:00
Tilghman Lesher 847b171f6b Fixing last errors in the conversion, though it appears that the AES_* functions are still broken.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@243077 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-26 01:56:24 +00:00
Tilghman Lesher 8d58f5bf37 Using a dummy channel causes CDR() testing to fail.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@243076 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-26 01:41:47 +00:00
Tilghman Lesher 114d259192 Wish I had gotten to the review before this got submitted, because there's failures we need to address.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@243075 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-26 01:35:19 +00:00
Russell Bryant 6ab50cb0e8 Make unit test modules depend on TEST_FRAMEWORK instead of off by default.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@242965 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-25 21:32:38 +00:00
Russell Bryant 8e50021376 Convert test_substitution module to the unit test API.
Review: https://reviewboard.asterisk.org/r/474/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@242954 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-25 21:25:23 +00:00
Tilghman Lesher f9f4f6aa3d The irony of not compile-testing a test program before committing is killing me.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@242317 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-22 15:09:12 +00:00
Russell Bryant 2a6d62e94d Convert scheduler API entry order test to the test API.
Review: https://reviewboard.asterisk.org/r/470/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@242185 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-22 04:50:38 +00:00
Russell Bryant 8f4383d1fa Add test API usage example to test_skel.c.
Review: https://reviewboard.asterisk.org/r/471/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@242184 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-22 04:49:26 +00:00
Matthew Nicholson f92938ff67 Added a test for ast_format_reduce_str().
(related to issue #16560)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@238716 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-08 21:04:51 +00:00
David Vossel 73cb2d507b Unit Test Framework API
The Unit Test Framework is a new API that manages registration and
execution of unit tests in Asterisk with the purpose of verifying the
operation of C functions.  The Framework consists of a single test
manager accompanied by a list of registered test functions defined
within the code.  A test is defined, registered, and unregistered
from the framework using a set of macros which allow the test code
to only be compiled within asterisk when the TEST_FRAMEWORK flag is
enabled in menuselect.  This allows the test code to exist in the
same file as the C functions it intends to verify.  Registered tests
may be viewed and executed via a set of new CLI commands.  CLI commands
are also present for generating and exporting test results into xml
and txt formats.

For more information and use cases please refer to the documentation
provided at the beginning of the test.h file.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@236027 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-12-22 16:09:11 +00:00
David Brooks dfa1fa560d ami_testhooks.c automatically registers hook
ami_testhooks.c was registering for AMI events upon module load. Moved the registration
to its own CLI command. Added CLI command for unregistering the hook. Changed some of
the wording, removed unnecessary arguments/parameters.

Reported by: rmudgett


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@228661 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-11-06 22:07:22 +00:00
David Brooks d87006ca1c AMI hook interface
This patch, originally submitted by jozza, enables custom modules to send actions to AMI
and receive messages from AMI via a hook interface. Included is a simple test module to
illustrate the interface.

(closes issue #14635)
Reported by: jozza

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@227448 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-11-03 21:26:28 +00:00
Russell Bryant 4cf8a968fd Add an API for reporting security events, and a security event logging module.
This commit introduces the security events API.  This API is to be used by
Asterisk components to report events that have security implications.
A simple example is when a connection is made but fails authentication.  These
events can be used by external tools manipulate firewall rules or something
similar after detecting unusual activity based on security events.

Inside of Asterisk, the events go through the ast_event API.  This means that
they have a binary encoding, and it is easy to write code to subscribe to these
events and do something with them.

One module is provided that is a subscriber to these events - res_security_log.
This module turns security events into a parseable text format and sends them
to the "security" logger level.  Using logger.conf, these log entries may be
sent to a file, or to syslog.

One service, AMI, has been fully updated for reporting security events.
AMI was chosen as it was a fairly straight forward service to convert.
The next target will be chan_sip.  That will be more complicated and will
be done as its own project as the next phase of security events work.

For more information on the security events framework, see the documentation
generated from doc/tex/.  "make asterisk.pdf"

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@206021 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-07-11 19:15:03 +00:00
Russell Bryant 0264eef115 Merge the new Channel Event Logging (CEL) subsystem.
CEL is the new system for logging channel events.  This was inspired after
facing many problems trying to represent what is possible to happen to a call
in Asterisk using CDR records.  For more information on CEL, see the built in
HTML or PDF documentation generated from the files in doc/tex/.

Many thanks to Steve Murphy (murf) and Brian Degenhardt (bmd) for their hard
work developing this code.  Also, thanks to Matt Nicholson (mnicholson) and
Sean Bright (seanbright) for their assistance in the final push to get this
code ready for Asterisk trunk.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@203638 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-26 15:28:53 +00:00
Kevin P. Fleming d1e0b11343 Add ability for modules to dynamically register logger levels
This patch adds the ability for modules to dynamically create logger levels for their own use; these are named levels just like the built-in levels, and can be directed to any destination that the logger can send any level to, by including their names in logger.conf.

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@194610 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-15 13:13:47 +00:00
Kevin P. Fleming 995d03a235 Minor changes in test modules
Correct command description in test_sched.c and include asterisk/cli.h in test_skel.c, since it's highly unlikely that a test module will *not* want to provide CLI commands to execute the tests



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@191997 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-04 12:52:44 +00:00
Tilghman Lesher a866a75900 Merge str_substitution branch.
This branch adds additional methods to dialplan functions, whereby the result
buffers are now dynamic buffers, which can be expanded to the size of any
result.  No longer are variable substitutions limited to 4095 bytes of data.
In addition, the common case of needing buffers much smaller than that will
enable substitution to only take up the amount of memory actually needed.
The existing variable substitution routines are still available, but users
of those API calls should transition to using the dynamic-buffer APIs.
Reviewboard: http://reviewboard.digium.com/r/174/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@191140 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-29 18:53:01 +00:00
Russell Bryant 32cd7d1d60 Disable test modules by default.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@187675 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-10 16:00:29 +00:00
Russell Bryant 989e617e1f Fix a regression in scheduler entry ordering, and add a regression test for it.
(closes issue #14522)
Reported by: pj
Tested by: russell


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@178022 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-23 17:29:16 +00:00
Mark Michelson 5d2a7dea85 Use constants from inttypes.h to clear up 32-bit compilation errors
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@176706 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-17 22:02:42 +00:00
Russell Bryant 044cf691fe Significantly improve scheduler performance under high load.
This patch changes the scheduler to use a max-heap to store pending scheduler
entries instead of a fully sorted doubly linked list.  When the number of
entries in the scheduler gets large, this will perform much better.  For much
more detailed information on this change, see the review request.

Review: http://reviewboard.digium.com/r/160/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@176639 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-17 21:04:08 +00:00
Russell Bryant 56b9180bd7 Add a test module for the heap implementation.
Review: http://reviewboard.digium.com/r/160/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@176635 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-17 20:56:26 +00:00
Steve Murphy 27891e6b4b Introducing doubly linked lists to trunk from branch team/murf/bug11210.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114172 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-16 17:14:18 +00:00
Kevin P. Fleming d83f08d1b4 add some simple infrastructure for modules to be used for testing parts of Asterisk
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@96272 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-03 20:04:30 +00:00