Commit Graph

191 Commits

Author SHA1 Message Date
Matthew Jordan a2c912e997 media formats: re-architect handling of media for performance improvements
In the old times media formats were represented using a bit field. This was
fast but had a few limitations.
 1. Asterisk was limited in how many formats it could handle.
 2. Formats, being a bit field, could not include any attribute information.
    A format was strictly its type, e.g., "this is ulaw".
This was changed in Asterisk 10 (see
https://wiki.asterisk.org/wiki/display/AST/Media+Architecture+Proposal for
notes on that work) which led to the creation of the ast_format structure.
This structure allowed Asterisk to handle attributes and bundle information
with a format.

Additionally, ast_format_cap was created to act as a container for multiple
formats that, together, formed the capability of some entity. Another
mechanism was added to allow logic to be registered which performed format
attribute negotiation. Everywhere throughout the codebase Asterisk was
changed to use this strategy.

Unfortunately, in software, there is no free lunch. These new capabilities
came at a cost.

Performance analysis and profiling showed that we spend an inordinate
amount of time comparing, copying, and generally manipulating formats and
their related structures. Basic prototyping has shown that a reasonably
large performance improvement could be made in this area. This patch is the
result of that project, which overhauled the media format architecture
and its usage in Asterisk to improve performance.

Generally, the new philosophy for handling formats is as follows:
 * The ast_format structure is reference counted. This removed a large amount
   of the memory allocations and copying that was done in prior versions.
 * In order to prevent race conditions while keeping things performant, the
   ast_format structure is immutable by convention and lock-free. Violate this
   tenet at your peril!
 * Because formats are reference counted, codecs are also reference counted.
   The Asterisk core generally provides built-in codecs and caches the
   ast_format structures created to represent them. Generally, to prevent
   inordinate amounts of module reference bumping, codecs and formats can be
   added at run-time but cannot be removed.
 * All compatibility with the bit field representation of codecs/formats has
   been moved to a compatibility API. The primary user of this representation
   is chan_iax2, which must continue to maintain its bit-field usage of formats
   for interoperability concerns.
 * When a format is negotiated with attributes, or when a format cannot be
   represented by one of the cached formats, a new format object is created or
   cloned from an existing format. That format may have the same codec
   underlying it, but is a different format than a version of the format with
   different attributes or without attributes.
 * While formats are reference counted objects, the reference count maintained
   on the format should be manipulated with care. Formats are generally cached
   and will persist for the lifetime of Asterisk and do not explicitly need
   to have their lifetime modified. An exception to this is when the user of a
   format does not know where the format came from *and* the user may outlive
   the provider of the format. This occurs, for example, when a format is read
   from a channel: the channel may have a format with attributes (hence,
   non-cached) and the user of the format may last longer than the channel (if
   the reference to the channel is released prior to the format's reference).

For more information on this work, see the API design notes:
  https://wiki.asterisk.org/wiki/display/AST/Media+Format+Rewrite

Finally, this work was the culmination of a large number of developer's
efforts. Extra thanks goes to Corey Farrell, who took on a large amount of the
work in the Asterisk core, chan_sip, and was an invaluable resource in peer
reviews throughout this project.

There were a substantial number of patches contributed during this work; the
following issues/patch names simply reflect some of the work (and will cause
the release scripts to give attribution to the individuals who work on them).

Reviews:
 https://reviewboard.asterisk.org/r/3814
 https://reviewboard.asterisk.org/r/3808
 https://reviewboard.asterisk.org/r/3805
 https://reviewboard.asterisk.org/r/3803
 https://reviewboard.asterisk.org/r/3801
 https://reviewboard.asterisk.org/r/3798
 https://reviewboard.asterisk.org/r/3800
 https://reviewboard.asterisk.org/r/3794
 https://reviewboard.asterisk.org/r/3793
 https://reviewboard.asterisk.org/r/3792
 https://reviewboard.asterisk.org/r/3791
 https://reviewboard.asterisk.org/r/3790
 https://reviewboard.asterisk.org/r/3789
 https://reviewboard.asterisk.org/r/3788
 https://reviewboard.asterisk.org/r/3787
 https://reviewboard.asterisk.org/r/3786
 https://reviewboard.asterisk.org/r/3784
 https://reviewboard.asterisk.org/r/3783
 https://reviewboard.asterisk.org/r/3778
 https://reviewboard.asterisk.org/r/3774
 https://reviewboard.asterisk.org/r/3775
 https://reviewboard.asterisk.org/r/3772
 https://reviewboard.asterisk.org/r/3761
 https://reviewboard.asterisk.org/r/3754
 https://reviewboard.asterisk.org/r/3753
 https://reviewboard.asterisk.org/r/3751
 https://reviewboard.asterisk.org/r/3750
 https://reviewboard.asterisk.org/r/3748
 https://reviewboard.asterisk.org/r/3747
 https://reviewboard.asterisk.org/r/3746
 https://reviewboard.asterisk.org/r/3742
 https://reviewboard.asterisk.org/r/3740
 https://reviewboard.asterisk.org/r/3739
 https://reviewboard.asterisk.org/r/3738
 https://reviewboard.asterisk.org/r/3737
 https://reviewboard.asterisk.org/r/3736
 https://reviewboard.asterisk.org/r/3734
 https://reviewboard.asterisk.org/r/3722
 https://reviewboard.asterisk.org/r/3713
 https://reviewboard.asterisk.org/r/3703
 https://reviewboard.asterisk.org/r/3689
 https://reviewboard.asterisk.org/r/3687
 https://reviewboard.asterisk.org/r/3674
 https://reviewboard.asterisk.org/r/3671
 https://reviewboard.asterisk.org/r/3667
 https://reviewboard.asterisk.org/r/3665
 https://reviewboard.asterisk.org/r/3625
 https://reviewboard.asterisk.org/r/3602
 https://reviewboard.asterisk.org/r/3519
 https://reviewboard.asterisk.org/r/3518
 https://reviewboard.asterisk.org/r/3516
 https://reviewboard.asterisk.org/r/3515
 https://reviewboard.asterisk.org/r/3512
 https://reviewboard.asterisk.org/r/3506
 https://reviewboard.asterisk.org/r/3413
 https://reviewboard.asterisk.org/r/3410
 https://reviewboard.asterisk.org/r/3387
 https://reviewboard.asterisk.org/r/3388
 https://reviewboard.asterisk.org/r/3389
 https://reviewboard.asterisk.org/r/3390
 https://reviewboard.asterisk.org/r/3321
 https://reviewboard.asterisk.org/r/3320
 https://reviewboard.asterisk.org/r/3319
 https://reviewboard.asterisk.org/r/3318
 https://reviewboard.asterisk.org/r/3266
 https://reviewboard.asterisk.org/r/3265
 https://reviewboard.asterisk.org/r/3234
 https://reviewboard.asterisk.org/r/3178

ASTERISK-23114 #close
Reported by: mjordan
  media_formats_translation_core.diff uploaded by kharwell (License 6464)
  rb3506.diff uploaded by mjordan (License 6283)
  media_format_app_file.diff uploaded by kharwell (License 6464) 
  misc-2.diff uploaded by file (License 5000)
  chan_mild-3.diff uploaded by file (License 5000) 
  chan_obscure.diff uploaded by file (License 5000) 
  jingle.diff uploaded by file (License 5000) 
  funcs.diff uploaded by file (License 5000) 
  formats.diff uploaded by file (License 5000) 
  core.diff uploaded by file (License 5000) 
  bridges.diff uploaded by file (License 5000) 
  mf-codecs-2.diff uploaded by file (License 5000) 
  mf-app_fax.diff uploaded by file (License 5000) 
  mf-apps-3.diff uploaded by file (License 5000) 
  media-formats-3.diff uploaded by file (License 5000) 

ASTERISK-23715
  rb3713.patch uploaded by coreyfarrell (License 5909)
  rb3689.patch uploaded by mjordan (License 6283)
  
ASTERISK-23957
  rb3722.patch uploaded by mjordan (License 6283) 
  mf-attributes-3.diff uploaded by file (License 5000) 

ASTERISK-23958
Tested by: jrose
  rb3822.patch uploaded by coreyfarrell (License 5909) 
  rb3800.patch uploaded by jrose (License 6182)
  chan_sip.diff uploaded by mjordan (License 6283) 
  rb3747.patch uploaded by jrose (License 6182)

ASTERISK-23959 #close
Tested by: sgriepentrog, mjordan, coreyfarrell
  sip_cleanup.diff uploaded by opticron (License 6273)
  chan_sip_caps.diff uploaded by mjordan (License 6283) 
  rb3751.patch uploaded by coreyfarrell (License 5909) 
  chan_sip-3.diff uploaded by file (License 5000) 

ASTERISK-23960 #close
Tested by: opticron
  direct_media.diff uploaded by opticron (License 6273) 
  pjsip-direct-media.diff uploaded by file (License 5000) 
  format_cap_remove.diff uploaded by opticron (License 6273) 
  media_format_fixes.diff uploaded by opticron (License 6273) 
  chan_pjsip-2.diff uploaded by file (License 5000) 

ASTERISK-23966 #close
Tested by: rmudgett
  rb3803.patch uploaded by rmudgetti (License 5621)
  chan_dahdi.diff uploaded by file (License 5000) 
  
ASTERISK-24064 #close
Tested by: coreyfarrell, mjordan, opticron, file, rmudgett, sgriepentrog, jrose
  rb3814.patch uploaded by rmudgett (License 5621) 
  moh_cleanup.diff uploaded by opticron (License 6273) 
  bridge_leak.diff uploaded by opticron (License 6273) 
  translate.diff uploaded by file (License 5000) 
  rb3795.patch uploaded by rmudgett (License 5621) 
  tls_fix.diff uploaded by mjordan (License 6283) 
  fax-mf-fix-2.diff uploaded by file (License 5000) 
  rtp_transfer_stuff uploaded by mjordan (License 6283) 
  rb3787.patch uploaded by rmudgett (License 5621) 
  media-formats-explicit-translate-format-3.diff uploaded by file (License 5000) 
  format_cache_case_fix.diff uploaded by opticron (License 6273) 
  rb3774.patch uploaded by rmudgett (License 5621) 
  rb3775.patch uploaded by rmudgett (License 5621) 
  rtp_engine_fix.diff uploaded by opticron (License 6273) 
  rtp_crash_fix.diff uploaded by opticron (License 6273) 
  rb3753.patch uploaded by mjordan (License 6283) 
  rb3750.patch uploaded by mjordan (License 6283) 
  rb3748.patch uploaded by rmudgett (License 5621) 
  media_format_fixes.diff uploaded by opticron (License 6273) 
  rb3740.patch uploaded by mjordan (License 6283) 
  rb3739.patch uploaded by mjordan (License 6283) 
  rb3734.patch uploaded by mjordan (License 6283) 
  rb3689.patch uploaded by mjordan (License 6283) 
  rb3674.patch uploaded by coreyfarrell (License 5909) 
  rb3671.patch uploaded by coreyfarrell (License 5909) 
  rb3667.patch uploaded by coreyfarrell (License 5909) 
  rb3665.patch uploaded by mjordan (License 6283) 
  rb3625.patch uploaded by coreyfarrell (License 5909) 
  rb3602.patch uploaded by coreyfarrell (License 5909) 
  format_compatibility-2.diff uploaded by file (License 5000) 
  core.diff uploaded by file (License 5000) 
  


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@419044 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-20 22:06:33 +00:00
Richard Mudgett 86e8ab5ed4 voicemail API callbacks: Extract the sayname API call to its own registerd callback.
* Extract the sayname API call to its own registerd callback.  This allows
the app_directory and app_chanspy applications to say a mailbox owner's
name using an alternate provider when app_voicemail is not available
because you are using res_mwi_external.  app_directory still uses the
voicemail.conf file.

AFS-64 #close
Reported by: Mark Michelson


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@416830 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-20 17:06:42 +00:00
Jonathan Rose 643a7f02d6 app_chanspy: Fix a test that was failing on account of r413551
ASTERISK-23381 #close
ASTERISK-23381 #comment Reported by: Robert Moss
Review: https://reviewboard.asterisk.org/r/3505/
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@413713 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-12 22:33:28 +00:00
Jonathan Rose 5770483217 app_chanspy: Fix a bug where Barge mode could fail
If the barge audiohook was attached prior to the spyee and its peer
actually being bridged, the audiohook would not be applied and the
connected peer would not be able to hear audio from the spy when the
spy is in barge mode.

(closes issue ASTERISK-23381)
Reported by: Robert Moss
Review: https://reviewboard.asterisk.org/r/3505/
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@413557 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-09 17:03:41 +00:00
Michael L. Young ef46c82cfb app_chanspy: Documentation Update To Clarify "x" Option
When using the "x" option (specify a DTMF digit to exit the application), it is
not obvious in the documentation that this only works when spying on a channel.
If a channel being used to spy on other channels is waiting to connect to a
channel or is no longer attached to a channel, the DTMF is ignored.

As noted on the issue tracker, since there are workarounds available and this is
a rarely used option we are opting for a documentation change here.

(closes issue ASTERISK-22661)
Reported by: Chris Hillman
Patches:
    asterisk-22661-doc-clarify-chan_spy.diff
                                     uploaded by Michael L. Young (license 5026)

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

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@408539 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-02-21 00:50:02 +00:00
Richard Mudgett aeb4466656 ChanSpy: Add ability to specify channel uniqueids as well as channel names.
* Made ChanSpy accept a channel uniqueid or a fully specified channel name
as the chanprefix parameter if the 'u' option is specified.

(closes issue AFS-42)

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@407033 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-31 23:04:25 +00:00
Rusty Newton f7c60b8fb6 Several components: fixing Typos in comments and code, "avaliable" instead of "available"
(issue ASTERISK-23021)
(closes issue ASTERISK-23021)
Reported by: Jeremy Lainé
Tested by: Rusty Newton
Patches:
   available.patch uploaded by Jeremy Lainé (license 6561)
........

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


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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397493 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-22 22:33:48 +00:00
Mark Michelson f8622e7c5c Get rid of ast_bridged_channel() and the bridged_channel field on ast_channels.
This commit is smaller than the initial review placed on review board. This is because
a change to allow for channel drivers to access parking functionality externally was
committed and invalidated quite a few of the changes initially made.

(closes issue ASTERISK-22039)
reported by Matt Jordan

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396103 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-02 14:05:07 +00:00
Matthew Jordan 06be8463b6 Migrate a large number of AMI events over to Stasis-Core
This patch moves a number of AMI events over to the Stasis-Core message bus.
This includes:
 * ChanSpyStart/Stop
 * MonitorStart/Stop
 * MusicOnHoldStart/Stop
 * FullyBooted/Reload
 * All Voicemail/MWI related events

In addition, it adds some Stasis-Core and AMI support for generic AMI messages,
refactors the message router in AMI to use a single router with topic
forwarding for the topics that AMI cares about, and refactors MWI message
types and topics to be more name compliant.

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

(closes issue ASTERISK-21462)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@389733 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-24 20:44:07 +00:00
Richard Mudgett 3d63833bd6 Merge in the bridge_construction branch to make the system use the Bridging API.
Breaks many things until they can be reworked.  A partial list:
chan_agent
chan_dahdi, chan_misdn, chan_iax2 native bridging
app_queue
COLP updates
DTMF attended transfers
Protocol attended transfers


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@389378 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-21 18:00:22 +00:00
Michael L. Young 5cf9eb4645 Fix Not Unreferencing A Spied Channel
When a channel hangs up while being spied upon and the option to exit the
ChanSpy application when the spied on channel hangs up is set,
ast_autochan_destroy is not being called and therefore a reference to the spied
upon channel is not removed.

The symptom being reported was that when using func_group in the dialplan and
calling "group show channels" at the cli, the spied upon channel was still
being shown while "core show channels" showed that the channel was not up.

This patch calls ast_autochan_destroy when a spied upon channel hangs up and
the option to exit the ChanSpy application is set, removing the reference to
the channel allowing the count for the group that the spied channel was part of
to be decremented.

(closes issue ASTERISK-17515)
Reported by: Arkadiusz Malka
Tested by: Alexandr Gordeev, Michael L. Young
Patches: 
    asterisk-17515-destroy-autochan.diff
                                    uploaded by Michael L. Young (license 5026)
........

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

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


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

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

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

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369346 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-25 17:59:34 +00:00
Jonathan Rose d1e7473649 Coverity Report: Fix issues for error type UNINIT in Core supported modules
(issue ASTERISK-19652)
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/1909/
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366051 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-10 15:57:26 +00:00
Kinsey Moore 781f4657b9 Fix many issues from the NULL_RETURNS Coverity report
Most of the changes here are trivial NULL checks.  There are a couple
optimizations to remove the need to check for NULL and outboundproxy parsing
in chan_sip.c was rewritten to avoid use of strtok.  Additionally, a bug was
found and fixed with the parsing of outboundproxy when "outboundproxy=," was
set.

(Closes issue ASTERISK-19654)
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@365400 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-04 22:17:38 +00:00
Kinsey Moore a485f44022 Add missing newlines to CLI logging
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@361476 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-06 18:19:03 +00:00
Jonathan Rose 0399daaa2e Prevent chanspy from binding to zombie channels
This patch addresses a bug with chanspy on local channels which roughly 50% of the time
would create a situation where chanspy can latch onto a zombie channel, keeping the zombie
alive forever and causing the channel doing the spying to never be able to hang up.

(closes issue ASTERISK-19493)
Reported by: lvl
Review: https://reviewboard.asterisk.org/r/1819/
........

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

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


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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@358907 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-13 18:20:34 +00:00
Richard Mudgett 2ce386d198 Remove bad usage of goto in ChanSpy next_channel().
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@357834 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-02 16:26:01 +00:00
Richard Mudgett 3af920cf01 Fix channel reference leak in ChanSpy.
* Fix next_channel() channel reference leak in ChanSpy.

(closes issue ASTERISK-19461)
Reported by: Irontec
Patches:
      app_chanspy_iteartor_next_unref.patch (license #6213) patch uploaded by Irontec

(issue ASTERISK-17515)
........

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

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


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


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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@356042 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-20 23:43:27 +00:00
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
Walter Doekes db24fc2523 Avoid cppcheck warnings; removing unused vars and a bit of cleanup.
Patch by: Clod Patry
Review: https://reviewboard.asterisk.org/r/1651


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

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

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

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


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

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


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

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

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@350223 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-09 22:15:50 +00:00
Sean Bright 35a64c2e61 Merged revisions 349045 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10

................
  r349045 | seanbright | 2011-12-23 12:32:33 -0500 (Fri, 23 Dec 2011) | 25 lines
  
  Merged revisions 349044 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.8
  
  ........
    r349044 | seanbright | 2011-12-23 12:25:01 -0500 (Fri, 23 Dec 2011) | 18 lines
    
    In ChanSpy, don't create audiohooks that will never be used.
    
    When ChanSpy is initialized it creates and attaches 3 audiohooks:
    
      1) Read audio off of the channel that we are spying on
      2) Write audio to the channel that we are spying on
      3) Write audio to the channel that is bridged to the channel that we are
         spying on.
    
    The first is always necessary, but the others are used only when specific
    options are passed to the ChanSpy application (B, d, w, and W to be specific).
    
    When those flags are not passed, neither of those audiohooks are ever sent
    frames, but we still try to process the hooks for each voice frame that we
    recieve on the channel.
    
    So in short - only create and attach audiohooks that we actually need.
  ........
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@349046 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-12-23 17:36:14 +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
David Vossel a3fd2b77b6 Merged revisions 316650 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

................
  r316650 | dvossel | 2011-05-04 09:25:03 -0500 (Wed, 04 May 2011) | 15 lines
  
  Merged revisions 316644 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.6.2
  
  ........
    r316644 | dvossel | 2011-05-04 09:23:39 -0500 (Wed, 04 May 2011) | 9 lines
    
    Fixes one-way-audio when chanspy activated with the 'o' option
    
    (closes issue #18382)
    Reported by: jkister
    Patches: 
          0001-Bugfix-18382-one-way-audio-when-chanspy-activated.patch.txt uploaded by malin (license )
    Tested by: firstsip, Greenlightcrm, malin, wdoekes, boroda, dvossel
  ........
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@316657 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-05-04 14:26:33 +00:00
Jonathan Rose d956ecb96e Merged revisions 311197 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r311197 | jrose | 2011-03-17 14:03:34 -0500 (Thu, 17 Mar 2011) | 11 lines
  
  This fixes a nasty chanspy bug which was causing a channel leak every time a spied on channel made a call.
  
  In addition to the above, it makes certain channel destruction occurs so that applications don't get stuck waiting for datastore destruction while monitored by chanspy.
  
  (closes issue #18742)
  Reported by: jkister
  Tested by: jkister, jcovert, jrose
  
  Review: http://reviewboard.digium.internal/r/106/
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@311198 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-03-17 19:05:42 +00:00
David Vossel d760e81f37 Media Project Phase2: SILK 8khz-24khz, SLINEAR 8khz-192khz, SPEEX 32khz, hd audio ConfBridge, and other stuff
-Functional changes
1. Dynamic global format list build by codecs defined in codecs.conf
2. SILK 8khz, 12khz, 16khz, and 24khz with custom attributes defined in codecs.conf
3. Negotiation of SILK attributes in chan_sip.
4. SPEEX 32khz with translation
5. SLINEAR 8khz, 12khz, 24khz, 32khz, 44.1khz, 48khz, 96khz, 192khz with translation
   using codec_resample.c
6. Various changes to RTP code required to properly handle the dynamic format list
   and formats with attributes.
7. ConfBridge now dynamically jumps to the best possible sample rate.  This allows
   for conferences to take advantage of HD audio (Which sounds awesome)
8. Audiohooks are no longer limited to 8khz audio, and most effects have been
   updated to take advantage of this such as Volume, DENOISE, PITCH_SHIFT.
9. codec_resample now uses its own code rather than depending on libresample.

-Organizational changes
Global format list is moved from frame.c to format.c
Various format specific functions moved from frame.c to format.c

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@308582 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-02-22 23:04:49 +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
Paul Belanger addc30d3f1 Merged revisions 299865 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

................
  r299865 | pabelanger | 2010-12-28 13:53:37 -0500 (Tue, 28 Dec 2010) | 9 lines
  
  Merged revisions 299864 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.6.2
  
  ........
    r299864 | pabelanger | 2010-12-28 13:51:13 -0500 (Tue, 28 Dec 2010) | 2 lines
    
    Documentation typo
  ........
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@299866 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-12-28 19:00:04 +00:00
Terry Wilson 01aef13e0c Merged revisions 284921 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

................
  r284921 | twilson | 2010-09-03 11:28:18 -0500 (Fri, 03 Sep 2010) | 19 lines
  
  Merged revisions 284897 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.6.2
  
  ................
    r284897 | twilson | 2010-09-03 11:20:45 -0500 (Fri, 03 Sep 2010) | 12 lines
    
    Merged revisions 284881 via svnmerge from 
    https://origsvn.digium.com/svn/asterisk/branches/1.4
    
    ........
      r284881 | twilson | 2010-09-03 11:10:23 -0500 (Fri, 03 Sep 2010) | 5 lines
      
      Properly detect when a sound file doesn't exist
      
      ast_fileexists returns -1 for error and 0 for a non-existant file. The existing
      code treated missing files as though they existed.
    ........
  ................
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@284922 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-09-03 16:42:53 +00:00
Tilghman Lesher 5e2aa190fe Display a list of channel variables in each channel-oriented event.
(Closes AST-33)
Reviewboard:	https://reviewboard.asterisk.org/r/368/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@230111 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-11-13 20:42:03 +00:00
Jeff Peeler 6aaa119e84 Fix the fix for chanspy option o
In 224178, I assumed the uploaded patch was correct as it had received positive
feedback. The flags were being checked in the incorrect location. Upon testing
the fix this time it was also found that the flags from the dialplan weren't
being copied to the chanspy_translation_helper.

(closes issue #16167)
Reported by: marhbere



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@228189 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-11-05 21:23:06 +00:00
Tilghman Lesher d8e0c58437 Expand codec bitfield from 32 bits to 64 bits.
Reviewboard: https://reviewboard.asterisk.org/r/416/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@227580 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-11-04 14:05:12 +00:00
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
Jeff Peeler a39f3a7521 Readd removed ability to allow listening to one side of the call in app_chanspy
(Option o)

(closes issue #15675)
Reported by: john8675309
Patches:
      issue15675patchtrunk.txt uploaded by dbrooks (license 790)
Tested by: jgutierrez on users list:
 http://lists.digium.com/pipermail/asterisk-users/2009-October/239155.html


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@224178 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-10-15 15:57:14 +00:00
Sean Bright a48d489568 Get this compiling under dev-mode.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@219230 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-09-17 16:25:38 +00:00
Tilghman Lesher cd88adfc6a Add the 'E' option to exit ChanSpy, once the single channel it spied upon hangs up.
In addition, there's a bit of cleanup to the arguments and documentation, in which
I discovered that the last feature added to this application duplicated an option
(oops!) and changed that option so that it now works.
(closes issue #14909)
 Reported by: junky
 Patches: 
       __20090901-spy_hangup_trunk.diff uploaded by lmadsen (license 10)
 Tested by: amilcar, junky, flujan, lmadsen


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@219105 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-09-17 00:58:10 +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 bb1fc3e12f Add 's' option to ChanSpy, which makes the app exit when no channels are left to spy on.
(closes issue #14594)
Reported by: JimDickenson
Patches:
      chanspy.diff uploaded by JimDickenson (license 710)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@203842 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-26 21:48:41 +00:00
Kevin P. Fleming 4c0265664e Merged revisions 200991 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r200991 | kpfleming | 2009-06-16 12:05:38 -0500 (Tue, 16 Jun 2009) | 11 lines
  
  Improve support for media paths that can generate multiple frames at once.
  
  There are various media paths in Asterisk (codec translators and UDPTL, primarily)
  that can generate more than one frame to be generated when the application calling
  them expects only a single frame. This patch addresses a number of those cases,
  at least the primary ones to solve the known problems. In addition it removes the
  broken TRACE_FRAMES support, fixes a number of bugs in various frame-related API
  functions, and cleans up various code paths affected by these changes.
  
  https://reviewboard.asterisk.org/r/175/
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@201056 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-16 18:54:30 +00:00
Russell Bryant 12ff77f975 Global var cleanup - constification and removing unused vars.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@199479 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-07 14:55:51 +00:00
Mark Michelson a7fd763ecc Merged revisions 197537 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r197537 | mmichelson | 2009-05-28 09:49:13 -0500 (Thu, 28 May 2009) | 21 lines
  
  Add flags to chanspy audiohook so that audio stays in sync.
  
  There are two flags being added to the chanspy audiohook here. One
  is the pre-existing AST_AUDIOHOOK_TRIGGER_SYNC flag. With this set,
  we ensure that the read and write slinfactories on the audiohook do
  not skew beyond a certain tolerance.
  
  In addition, there is a new audiohook flag added here,
  AST_AUDIOHOOK_SMALL_QUEUE. With this flag set, we do not allow for
  a slinfactory to build up a substantial amount of audio before 
  flushing it. For this particular issue, this means that the person 
  spying on the call will hear the conversations in real time with very 
  little delay in the audio.
  
  (closes issue #13745)
  Reported by: geoffs
  Patches:
        13745.patch uploaded by mmichelson (license 60)
  Tested by: snblitz
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@197543 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-28 14:58:06 +00:00
Kevin P. Fleming e6b2e9a750 Const-ify the world (or at least a good part of it)
This patch adds 'const' tags to a number of Asterisk APIs where they are appropriate (where the API already demanded that the function argument not be modified, but the compiler was not informed of that fact). The list includes:

- CLI command handlers
- CLI command handler arguments
- AGI command handlers
- AGI command handler arguments
- Dialplan application handler arguments
- Speech engine API function arguments

In addition, various file-scope and function-scope constant arrays got 'const' and/or 'static' qualifiers where they were missing.

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@196072 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-21 21:13:09 +00:00
Kevin P. Fleming 1c988d8996 add 'const' qualifiers in various places where they should have been
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@193832 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-12 13:59:35 +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