Commit Graph

28 Commits

Author SHA1 Message Date
Kevin P. Fleming cdd1f9e296 Finish implementaton of astobj2 OBJ_MULTIPLE, and convert ast_channel_iterator to use it.
This patch finishes the implementation of OBJ_MULTIPLE in astobj2 (the
case where multiple results need to be returned; OBJ_NODATA mode
already was supported). In addition, it converts ast_channel_iterators
(only the targeted versions, not the ones that iterate over all
channels) to use this method.

During this work, I removed the 'ao2_flags' arguments to the
ast_channel_iterator constructor functions; there were no uses of that
argument yet, there is only one possible flag to pass, and it made the
iterators less 'opaque'. If at some point in the future someone really
needs an ast_channel_iterator that does not lock the container, we can
provide constructor(s) for that purpose.

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@225244 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-10-21 21:08:47 +00:00
Tilghman Lesher 642bec4d6f AST-2009-005
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@211539 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-08-10 19:20:57 +00:00
Russell Bryant cba19c8a67 Convert the ast_channel data structure over to the astobj2 framework.
There is a lot that could be said about this, but the patch is a big 
improvement for performance, stability, code maintainability, 
and ease of future code development.

The channel list is no longer an unsorted linked list.  The main container 
for channels is an astobj2 hash table.  All of the code related to searching 
for channels or iterating active channels has been rewritten.  Let n be 
the number of active channels.  Iterating the channel list has gone from 
O(n^2) to O(n).  Searching for a channel by name went from O(n) to O(1).  
Searching for a channel by extension is still O(n), but uses a new method 
for doing so, which is more efficient.

The ast_channel object is now a reference counted object.  The benefits 
here are plentiful.  Some benefits directly related to issues in the 
previous code include:

1) When threads other than the channel thread owning a channel wanted 
   access to a channel, it had to hold the lock on it to ensure that it didn't 
   go away.  This is no longer a requirement.  Holding a reference is 
   sufficient.

2) There are places that now require less dealing with channel locks.

3) There are places where channel locks are held for much shorter periods 
   of time.

4) There are places where dealing with more than one channel at a time becomes 
   _MUCH_ easier.  ChanSpy is a great example of this.  Writing code in the 
   future that deals with multiple channels will be much easier.

Some additional information regarding channel locking and reference count 
handling can be found in channel.h, where a new section has been added that 
discusses some of the rules associated with it.

Mark Michelson also assisted with the development of this patch.  He did the 
conversion of ChanSpy and introduced a new API, ast_autochan, which makes it 
much easier to deal with holding on to a channel pointer for an extended period 
of time and having it get automatically updated if the channel gets masqueraded.
Mark was also a huge help in the code review process.

Thanks to David Vossel for his assistance with this branch, as well.  David 
did the conversion of the DAHDIScan application by making it become a wrapper 
for ChanSpy internally.

The changes come from the svn/asterisk/team/russell/ast_channel_ao2 branch.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@190423 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-24 14:04:26 +00:00
Russell Bryant 4ec301360c Merge a large set of updates to the Asterisk indications API.
This patch includes a number of changes to the indications API.  The primary
motivation for this work was to improve stability.  The object management
in this API was significantly flawed, and a number of trivial situations could
cause crashes.

The changes included are:

1) Remove the module res_indications.  This included the critical functionality
   that actually loaded the indications configuration.  I have seen many people
   have Asterisk problems because they accidentally did not have an
   indications.conf present and loaded.  Now, this code is in the core,
   and Asterisk will fail to start without indications configuration.

   There was one part of res_indications, the dialplan applications, which did
   belong in a module, and have been moved to a new module, app_playtones.

2) Object management has been significantly changed.  Tone zones are now
   managed using astobj2, and it is no longer possible to crash Asterisk by
   issuing a reload that destroys tone zones while they are in use.

3) The API documentation has been filled out.

4) The API has been updated to follow our naming conventions.

5) Various bits of code throughout the tree have been updated to account
   for the API update.

6) Configuration parsing has been mostly re-written.

7) "Code cleanup"

The code is from svn/asterisk/team/russell/indications/.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@176627 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-17 20:41:24 +00:00
Russell Bryant e77b3cea6b Merged revisions 174148 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r174148 | russell | 2009-02-07 10:15:07 -0600 (Sat, 07 Feb 2009) | 2 lines

Fix a race condition that could cause a crash.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@174149 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-07 16:16:50 +00:00
Russell Bryant ef6ad2b53c Merged revisions 168561 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r168561 | russell | 2009-01-13 13:13:05 -0600 (Tue, 13 Jan 2009) | 2 lines

Revert unnecessary indications API change from rev 122314

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@168562 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-13 19:22:13 +00:00
Sean Bright 1a4a30aaea Use ast_str_strlen() instead of recalculating the string length.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@164054 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-13 18:25:58 +00:00
Michiel van Baak 517afad041 nuke another use of the ast_str internals.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@164028 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-13 13:26:13 +00:00
Michiel van Baak ef965af270 Make res_snmp.so compile on OpenBSD.
OpenBSD uses an old version of gcc which throws an error
if you use a macro that's not #defined


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@162583 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-10 11:34:09 +00:00
Mark Michelson 1235d47242 Make res/snmp/agent.c build
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@115199 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-05-02 14:51:59 +00:00
Jason Parker 3c594ab9fa Merged revisions 105572 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r105572 | qwell | 2008-03-03 12:06:52 -0600 (Mon, 03 Mar 2008) | 7 lines

Fix types for astNumChannels and astConfigCallsProcessed.

(closes issue #12114)
Reported by: jeffg
Patches:
      12114.patch uploaded by jeffg (license 192)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@105573 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-03 18:08:05 +00:00
Steve Murphy 6bb33538e1 small change to allow this file to compile. No problem if you don't install the libsnmp package.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@104301 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-26 22:14:22 +00:00
Russell Bryant 4f0cb30f4a Convert this file over the new method of getting the Asterisk version.
(I don't have this building on this machine, so caio1982 on IRC is going to
 test it for me.  :) )


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@96743 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-05 23:05:35 +00:00
Luigi Rizzo 5e24835995 modify http://svn.digium.com/view/asterisk?view=rev&rev=93603
so that paths and filename are writable by asterisk.c without
causing segfaults.

This involves defining the variables as const char *,
and having them point to as static, writable buffer
defined in asterisk.c

On passing, fix some errors in using these variables
in some files in utils/ , and in res/snmp/agent.c
which was redefining a variable without using paths.h

(not applicable to 1.4)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@94168 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-20 09:55:05 +00:00
Luigi Rizzo 094ec6521d make netsmp build under AST_DEVMODE. Description, included in the source,
is below. I should note that the PACKAGE_* macros that asterisk
defines in autoconfig.h are not used anywhere in the tree so
they should just be removed.

 /*
  * There is some collision collision between netsmp and asterisk names,
  * causing build under AST_DEVMODE to fail.
  *
  * The following PACKAGE_* macros are one place.
  * Also netsnmp has an improper check for HAVE_DMALLOC_H, using
  *    #if HAVE_DMALLOC_H   instead of #ifdef HAVE_DMALLOC_H
  * As a countermeasure we define it to 0, however this will fail
  * when the proper check is implemented.
  */

No


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@93875 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-19 08:12:33 +00:00
Tilghman Lesher d5b454bf8d Convert ast_verbose to ast_verb.
Reported by: snuffy
Patch by: snuffy
(Closes issue #11547)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@92913 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-14 14:48:38 +00:00
Jason Parker 02ea9face7 Add count of total number of calls processed by asterisk during it's lifetime.
Add number of total calls and current calls to SNMP.

Closes issue #10057, patch by jcmoore.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@91779 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-07 16:11:05 +00:00
Russell Bryant c50975fd06 Fix a typo in the Asterisk MIB and fix astNumChanBridged so it acts as a counter again
(closes issue #10118, patch by jeffg)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@80510 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-23 17:27:07 +00:00
Tilghman Lesher 81bc1d7af5 Merge in ast_strftime branch, which changes timestamps to be accurate to the microsecond, instead of only to the second
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@75706 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-07-18 19:47:20 +00:00
Russell Bryant f379df9773 Simplify some logic and convert spaces to tabs
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@69068 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-06-13 16:19:37 +00:00
Russell Bryant 5d350e0f81 The variable used for the return value must be declared as static. I broke
this when applying the patch, sorry!
(issue #9637, jeffg)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@69067 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-06-13 16:05:22 +00:00
Russell Bryant 3b9a36109f Add support for retrieving the number of channels that are currently bridged
via SNMP.
(closes issue #9637, initial patch from jeffg, modified by me)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@68507 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-06-08 21:31:33 +00:00
Luigi Rizzo 09f75aa6dc rename the structs struct tone_zone_sound and struct tone_zone
defined in indications.h to ind_tone_zone_sound and ind_tone_zone,
to avoid conflicts with the structs with the same names
defined in tonezone.h

Hope i haven't missed any instance.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48958 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-12-25 06:38:09 +00:00
Joshua Colp 09de4d2b67 Update res_snmp to use new API declaration of pbx_builtin_serialize_variables (issue #8627 reported by johann8384)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48595 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-12-19 22:55:26 +00:00
Kevin P. Fleming e3ddee7d7f make latest header file changes for this file too
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@33482 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-06-11 15:10:26 +00:00
Russell Bryant 8085f4e14b a bunch of conversion to ast_channel_*lock (issue #7058)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@23355 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-29 14:50:18 +00:00
Luigi Rizzo 48864ab877 do not export the tzlock and the list head, and introduce a new method,
ast_walk_indications(), to walk through the list of indications.
The new method returns an unlocked record, which is no different from the
behaviour of other existing methods in indications.c
(i.e. they all need to be fixed, with refcounts or some similar
method).

Note that ast_walk_indications() uses the pointer argument only as a
search key, so its implementation is completely safe.

In turn, this change allows the removal of AST_MUTEX_DEFINE_EXPORTED.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@16532 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-03-30 17:10:11 +00:00
Mark Spencer 6a86c7c5c9 Add SNMP support (bug #6439)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@11193 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-02-26 20:46:11 +00:00