Commit Graph

144 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
Jonathan Rose af4cd65143 Channels: Masquerades to automatically move frame/audio hooks
Whenever possible, audiohooks and framehooks will now be copied over
to the channel that the masquerading channel gets cloned into. This
should occur for all audiohooks and most framehooks. As a result,
in Asterisk 12.5 and up, the AUDIOHOOK_INHERIT function is now
deprecated and its behavior is essentially the new default for all
audiohooks, plus some additional audiohooks/framehooks.

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@418936 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-18 16:28:10 +00:00
Jonathan Rose 5c988cc4e6 res_fax: Provide AMI equivalents for fax CLI commands
Specifically the following equivalents were created:
fax show session -> FAXSession
fax show sessions -> FAXSessions
fax show stats -> FAXStats

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@418911 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-18 15:49:46 +00:00
Matthew Jordan fb5690ce4b Logger/CLI/etc.: Fix some aesthetic issues; reduce chatty verbose messages
This patch addresses some aesthetic issues in Asterisk. These are all just
minor tweaks to improve the look of the CLI when used in a variety of
settings. Specifically:
 * A number of chatty verbose messages were removed or demoted to DEBUG
   messages. Verbose messages with a verbosity level of 5 or higher were -
   if kept as verbose messages - demoted to level 4. Several messages
   that were emitted at verbose level 3 were demoted to 4, as announcement
   of dialplan applications being executed occur at level 3 (and so the
   effects of those applications should generally be less).
 * Some verbose messages that only appear when their respective 'debug'
   options are enabled were bumped up to always be displayed.
 * Prefix/timestamping of verbose messages were moved to the verboser
   handlers. This was done to prevent duplication of prefixes when the
   timestamp option (-T) is used with the CLI.
 * Verbose magic is removed from messages before being emitted to
   non-verboser handlers. This prevents the magic in multi-line verbose
   messages (such as SIP debug traces or the output of DumpChan) from
   being written to files.
 * _Slightly_ better support for the "light background" option (-W) was
   added. This includes using ast_term_quit in the output of XML
   documentation help, as well as changing the "Asterisk Ready" prompt to
   bright green on the default background (which stands a better chance of
   being displayed properly than bright white).

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@414798 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-28 22:54:12 +00:00
Kinsey Moore abd3e4040b Allow Asterisk to compile under GCC 4.10
This resolves a large number of compiler warnings from GCC 4.10 which
cause the build to fail under dev mode. The vast majority are
signed/unsigned mismatches in printf-style format strings.
........

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@413589 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-09 22:49:26 +00:00
Richard Mudgett 45ade68cb4 Remove unused RAII_VAR() declarations.
* Remove unused RAII_VAR() declarations.  The compiler cannot catch these
because the cleanup function "references" the unused variable.  Some
actually allocated and released resources that were never used.

* Fixed some whitespace issues in stasis_bridges.c.
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@412400 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-04-15 18:01:47 +00:00
Richard Mudgett d277f3ec3e json: Fix off-nominal json ref counting issues.
* Fixed off-nominal json ref counting issue with using the following API
calls: ast_json_object_set() and ast_json_array_append().

* Fixed off-nominal error reporting in ast_ari_endpoints_list().

* Fixed some miscellaneous off-nominal json ref counting issues in
report_receive_fax_status() and dial_to_json().
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@408714 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-02-21 18:04:54 +00:00
Kevin Harwell a48798ce95 res_fax: check_modem_rate() returned incorrect rate for V.27
According to the new standard for V.27 and V.32 they are able to transmit
at a bit rate of 4,800 or 9,600.  The check_mode_rate function needed to be
updated to reflect this.  Also, because of this change the default 'minrate'
value was updated to be 4800.

(closes issue ASTERISK-22790)
Reported by: Paolo Compagnini
Patches:
     res_fax.txt uploaded by looserouting (license 6548)
........

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@405695 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-16 19:13:05 +00:00
Scott Griepentrog c061f634da res_fax.c: crash on framehook with no dsp in fax detect
In fax_detect_framehook() a null pointer reference can occur where a
voice frame is processed but no dsp is attached to the fax detection
structure.  The code block that rejects frames that detection cannot
be processed on is checking for dsp but falls through when it should
instead return, as this change implements.

(closes issue ASTERISK-22942)
Reported by: adomjan
Review: https://reviewboard.asterisk.org/r/3076/
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404353 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-19 17:03:20 +00:00
Richard Mudgett 057d105c5a Add channel lock protection around translation path setup.
Most callers of ast_channel_make_compatible() happen before the channels
enter a two party bridge.  With the new bridging framework, two party
bridging technologies may also call ast_channel_make_compatible() when
there is more than one thread involved with the two channels.

* Added channel lock protection in set_format() and
ast_channel_make_compatible_helper() when dealing with the channel's
native formats while setting up a translation path.

* Fixed best_src_fmt and best_dst_fmt usage consistency in
ast_channel_make_compatible_helper().  The call to
ast_translator_best_choice() got them backwards.

* Updated some callers of ast_channel_make_compatible() and the function
documentation.  There is actually a difference between the two channels
passed in.

* Fixed the deadlock potential in res_fax.c dealing with
ast_channel_make_compatible().  The deadlock potential was already there
anyway because res_fax called ast_channel_make_compatible() with chan
locked.

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@401240 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-10-18 16:59:09 +00:00
Matthew Jordan cc29957a6f Properly pack the parameters into ast_json_pack when sending a send fax message
This patch properly packs the parameters into the send fax message so that it
actually work.

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392676 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-06-23 19:19:30 +00:00
Matthew Jordan 175b9831f2 Properly extract channel variables for the SendFAX/ReceiveFAX Stasis messages
By the time something extracts the pointers from ast_json_pack, the channels
will already be disposed of. This patch properly pulls the information out of
the variables and packs them into the JSON blob.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392607 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-06-22 22:42:34 +00:00
Matthew Jordan ea03516cb5 Fix a deadlock and possible crash in res_fax
This patch fixes two bugs.
(1) It unlocks the channel in the framehook handlers before attempting to grab
    the peer from the bridge. The locking order for the bridging framework is
    bridge first, then channel - having the channel locked while attempting to
    obtain the bridge lock causes a locking inversion and a deadlock. This
    patch bumps the channel ref count prior to releasing the lock in the
    framehook to avoid lifetime issues.

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

(issue ASTERISK-21951)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392564 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-06-22 13:58:07 +00:00
Matthew Jordan 071c1e290d Pack the right number of items into the status and receive fax blobs
The code was still attempting to pack an additional item into the blobs
that didn't exist. Crashes ensued. This patch modifies the publishing of
these messages so that the correct number of items are packed in the JSON.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@389990 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-29 03:22:04 +00:00
Kinsey Moore 6851801a5e Resolve a merge conflict
When ast_channel_cached_blob_create was merged,
ast_channel_blob_create_from_cache was partially removed in an
unresolved merge conflict. This restores ast_channel_blob_create_from_cache
and refactors usage of ast_channel_cached_blob_create (requires an
ast_channel) to use ast_channel_blob_create_from_cache (requires a
channel uniqueid) instead.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@389974 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-29 02:26:17 +00:00
Matthew Jordan 2d2a47fae3 Fix some more fax test errors due to needing the peer in a bridge
In r389799, a number of fax errors in gateway mode were fixed by using the
appropriate function to get a channel's peer while in a bridge. This patch
does two things:
(1) It uses the same function in res_fax_spandsp while starting the fax
    gateway. Without this, the fax gateway will not actually start up, as
    res_fax_spandsp also must inspect the channel's peer in a two-party
    bridge
(2) It refactors some ao2 objects in sendfax_exec to use RAII_VAR. This was
    reverted in r389799 as some off nominal paths were getting hit without
    the fix in (1) that indicated an ao2 object issue; this turned out to
    be a red herring (which is an odd phrase)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@389827 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-27 01:33:12 +00:00
Matthew Jordan 9e35096623 Fix a few fax gateway failures
Fax gateway requires knowledge of a channel's peer in a bridge. This patch
now uses the supported mechanisms to get this information.

This is acceptable for a few reasons:
* Fax gateway can only ever work in a 2-party bridge
* Fax gateway cannot work when not in a bridge
* Fax gateway cannot work without knowledge of the capabilities of both
  channels in the fax operation (it is, after all, a gateway)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@389799 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-26 16:49:28 +00:00
Matthew Jordan fe3ca5401f Fix a variety of memory corruption/assertion errors
* Initialize a Stasis-Core message type prior to initializing a caching topic.
  The caching topic will attempt to use the message type.
* Don't attempt to publish Stasis-Core messages from remote console connections.
  They aren't the main process; they shouldn't attempt to behave as it (they also
  don't have the infrastructure to do so)
* Don't treat a JSON object as an ao2 object (whoops)
* In asterisk.c, ref bump the JSON even package that is distributed with the
  event meta data. The callers assume that they own the reference, and the packing
  routine steals references.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@389785 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-26 04:47:17 +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
Kinsey Moore 34cbefe62f Ensure ReceiveFax provides a CED tone via T.38
When using res_fax_digium, the T.38 CED tone was not being provided
properly which would cause some incoming faxes to fail. This was not an
issue with res_fax_spandsp since it does not strictly honor the
send_ced flag and sends the CED tone whenever receiving a T.38 fax.

(closes issue FAX-343)
Reported-by: Benjamin Tietz
Patch-by: Kinsey Moore
........

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@377658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-12-10 16:56:37 +00:00
Mark Michelson e773bbdd10 Fix a "set but not used" warning on newer gccs.
Turns out the "helpful" setting of ms and res in this
macro is completely useless after the timeout antipattern
fix.

If you're a new guy looking to write code, don't write
a macro like this one.
........

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@376092 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-08 22:10:29 +00:00
Mark Michelson f2bb9afe17 Multiple revisions 375993-375994
........
  r375993 | mmichelson | 2012-11-07 11:01:13 -0600 (Wed, 07 Nov 2012) | 30 lines
  
  Fix misuses of timeouts throughout the code.
  
  Prior to this change, a common method for determining if a timeout
  was reached was to call a function such as ast_waitfor_n() and inspect
  the out parameter that told how many milliseconds were left, then use
  that as the input to ast_waitfor_n() on the next go-around.
  
  The problem with this is that in some cases, submillisecond timeouts
  can occur, resulting in the out parameter not decreasing any. When this
  happens thousands of times, the result is that the timeout takes much
  longer than intended to be reached. As an example, I had a situation where
  a 3 second timeout took multiple days to finally end since most wakeups
  from ast_waitfor_n() were under a millisecond.
  
  This patch seeks to fix this pattern throughout the code. Now we log the
  time when an operation began and find the difference in wall clock time
  between now and when the event started. This means that sub-millisecond timeouts
  now cannot play havoc when trying to determine if something has timed out.
  
  Part of this fix also includes changing the function ast_waitfor() so that it
  is possible for it to return less than zero when a negative timeout is given
  to it. This makes it actually possible to detect errors in ast_waitfor() when
  there is no timeout.
  
  (closes issue ASTERISK-20414)
  reported by David M. Lee
  
  Review: https://reviewboard.asterisk.org/r/2135/
........
  r375994 | mmichelson | 2012-11-07 11:08:44 -0600 (Wed, 07 Nov 2012) | 3 lines
  
  Remove some debugging that accidentally made it in the last commit.
........

Merged revisions 375993-375994 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@376015 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-07 19:15:26 +00:00
Matthew Jordan 069f5f8b93 Only deref a reserved gateway session if we actually reserved one
Its perfectly acceptable to have a gateway session unreserved when we go to
first allocate one.  Unreffing the reserved gateway session - when its NULL -
will result in an assertion error.

This problem was caught by the Asterisk Test Suite (once we had enough of the
debugging flags enabled)
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@375799 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-04 02:44:35 +00:00
Andrew Latham c7857504df Doxygen Updates - Title update
Update and extend the configuration_file group and enable linking to the resource.  Update title that was left behind many years ago.

(issue ASTERISK-20259)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@375003 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-14 21:44:27 +00:00
Andrew Latham e11cc29360 Doxygen Cleanup
Start adding configuration file linking and pages.  Add module loading doxygen block.

Breaking up commits to keep it easy to track

(issue ASTERISK-20259)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374165 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-01 23:24:10 +00:00
Matthew Jordan 294365edd2 Update module support level on a variety of modules and compiler options
Some core support modules and compiler options were no longer tagged with a
module support level.  This patch adds 'core' back to those options.

Note that this patch modifies a few of the patches provided by Andrew Latham
slightly.  res_curl and res_fax are both 'core' supported modules.

(closes issue ASTERISK-20215)
Reported by: Andrew Latham
Tested by: mjordan
Patches:
  astcanary.diff (license #5985) uploaded by Andrew Latham
  cflagsxml.diff (license #5985) uploaded by Andrew Latham
  curl_fax.diff (license #5985) uploaded by Andrew Latham
  soundsxml.diff (license #5985) uploaded by Andrew Latham
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@371508 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-08-18 01:14:42 +00:00
Kinsey Moore c6142cf2cc Fix coverity UNUSED_VALUE findings in core support level files
Most of these were just saving returned values without using them and
in some cases the variable being saved to could be removed as well.

(issue ASTERISK-19672)
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368751 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-11 15:23:30 +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
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
Mark Michelson 8f5c33f95a Adding reload support to res_fax.so
(closes issue ASTERISK-16712)
reported by Frank DiGennaro

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@354552 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-09 17:17:55 +00:00
Jonathan Rose 79979313e8 Fixes a segfault occuring when performing attended transfer with FAXOPT(gateway)=yes
(closes issue ASTERISK-19184)
Reported by: Alexandr
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@353963 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-03 16:23:21 +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
Matthew Jordan 89bbecc724 Fix premature free'ing of the frame committed in r349608
Even though we set the frame to the ast_null_frame and return that,
the caller of the frame hook may still need the frame.  This now is
a bit more careful about when it frees the frame, i.e., only under
the same conditions that applied when we duplicated it in the first
place.
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@349823 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-05 23:58:26 +00:00
Matthew Jordan 12e3f412b5 Free successfully translated frame in fax_gateway_framehook
A frame that is translated via ast_translate is also duplicated via ast_frdup.
This will allocate a new frame on the heap, which needs to be free'd
at the appropriate time.  This issue reporter used valgrind to find that this
occurred in res_fax's fax_gateway_framehook; a quick search through the code
showed that only place this was currently not handling the translatted frame
properly.

(closes issue ASTERISK-19133)
Reported by: Sylvain Rochet
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@349609 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-04 21:40:45 +00:00
Kevin P. Fleming fdda494776 Improve T.38 gateway V.21 preamble detection.
This commit removes the V.21 preamble detection code previously added to the
generic DSP implementation in Asterisk, and instead enhances the res_fax module
to be able to utilize V.21 preamble detection functionality made available by
FAX technology modules. This commit also adds such support to res_fax_spandsp,
which uses the Spandsp modem tone detection code to do the V.21 preamble
detection.

There should be no functional change here, other than much more reliable V.21
preamble detection (and thus T.38 gateway initiation).
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@349249 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-12-28 18:59:16 +00:00
Matthew Nicholson 1c78d82f18 Don't clear LOCALSTATIONID before sending or receiving. The user may set that
variable.

ASTERISK-18921
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@348214 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-12-14 22:05:57 +00:00
Tilghman Lesher 77b670c4ab Allow each logging destination and console to have its own notion of the verbosity level.
Review: https://reviewboard.asterisk.org/r/1599


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@346391 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-11-29 18:43:16 +00:00
Gregory Nietsky b009ea5216 White space fixes in res_fax
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@341769 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-10-21 09:16:12 +00:00
Matthew Nicholson bb07ca66a1 Merged revisions 340109 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10

................
  r340109 | mnicholson | 2011-10-10 09:15:41 -0500 (Mon, 10 Oct 2011) | 18 lines
  
  Merged revisions 340108 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.8
  
  ........
    r340108 | mnicholson | 2011-10-10 09:14:48 -0500 (Mon, 10 Oct 2011) | 11 lines
    
    Load the proper XML documentation when multiple modules document the same application.
    
    This patch adds an optional "module" attribute to the XML documentation spec
    that allows the documentation processor to match apps with identical names from
    different modules to their documentation. This patch also fixes a number of
    bugs with the documentation processor and should make it a little more
    efficient. Support for multiple languages has also been properly implemented.
    
    ASTERISK-18130
    Review: https://reviewboard.asterisk.org/r/1485/
  ........
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@340110 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-10-10 14:16:27 +00:00
Matthew Nicholson 07133b3a96 Merged revisions 339507 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10

................
  r339507 | mnicholson | 2011-10-05 11:32:59 -0500 (Wed, 05 Oct 2011) | 10 lines
  
  Merged revisions 339505 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.8
  
  ........
    r339505 | mnicholson | 2011-10-05 11:31:21 -0500 (Wed, 05 Oct 2011) | 3 lines
    
    The app name in the documentation must match what we register the application
    as.
  ........
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@339509 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-10-05 16:35:03 +00:00
Gregory Nietsky b698038995 Add generic faxdetect framehook to res_fax
Added func FAXOPT(faxdetect)=yes,cng,t38[,timeout]/no
to enable dialplan faxdetect allowing more flexibility.

as soon as a fax tone is detected the framehook is removed.
there is a penalty involved in running this framehook on
non G711 channels as they will be transcoded.

CNG tone is suppresed using the SQUELCH flag to allow
WaitForNoise to be run on the channel to detect Voice.

(Closes issue ASTERISK-18569)
Reported by: Myself
Reviewed by: Matthew Nicholson, Kevin Fleming

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@339465 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-10-05 06:50:18 +00:00
Gregory Nietsky 1b3bd7ddb4 Merged revisions 339463 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10

........
  r339463 | irroot | 2011-10-05 08:28:46 +0200 (Wed, 05 Oct 2011) | 9 lines
  
  Only change the capabilities on the gateway when
  the session is been destroyed there is still
  a race condition that ends in a segfault.
  
  if the caps are changed the logic in res_fax_spandsp
  will run T30 code not gateway code to end the session.
  this has been experienced on a "slower" under spec system.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@339464 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-10-05 06:40:40 +00:00
Matthew Nicholson 69ea68a1f5 Merged revisions 339045 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10

........
  r339045 | mnicholson | 2011-10-03 10:54:55 -0500 (Mon, 03 Oct 2011) | 4 lines
  
  Ported ast_fax_caps_to_str() to 10, not sure why it wasn't already here.
  
  This function prints a list of caps instead of a hex bitfield.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@339046 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-10-03 15:55:28 +00:00
Matthew Nicholson 0932d899e6 Merged revisions 339043 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10

........
  r339043 | mnicholson | 2011-10-03 10:41:36 -0500 (Mon, 03 Oct 2011) | 2 lines
  
  Don't clear the AST_FAX_TECH_MULTI_DOC flag right after we set it.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@339044 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-10-03 15:42:01 +00:00
Matthew Nicholson 9a5de09f92 Merged revisions 339011 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10

........
  r339011 | mnicholson | 2011-10-03 10:19:44 -0500 (Mon, 03 Oct 2011) | 2 lines
  
  properly remove the AST_FAX_TECH_GATEWAY flag (instead of setting all of the other flags)
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@339021 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-10-03 15:21:50 +00:00
Gregory Nietsky ebf3632e08 Merged revisions 338950 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10

........
  r338950 | irroot | 2011-10-03 11:37:59 +0200 (Mon, 03 Oct 2011) | 14 lines
  
  Fixup a race condition in res_fax.c where FAXOPT(gateway)=no will
  turn off the gateway but the framehook is not destroyed.
  
  this problem happens when a gateway is attempted in the dialplan and
  the device is not available i may want to do fax to mail in the server
  it will not be allowed.
  
  instead of checking only AST_FAX_TECH_GATEWAY also check gateway_id
  
  Reverts 338904
  
  Fix some white space.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@338951 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-10-03 09:49:38 +00:00
Gregory Nietsky b5147c8817 Merged revisions 338904 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10

........
  r338904 | irroot | 2011-10-02 16:17:32 +0200 (Sun, 02 Oct 2011) | 8 lines
  
  Remove T38 Gateway capability when detaching framehook.
  
  SET(FAXOPT(gateway)=no) does not remove the capability when 
  detaching the framehook.
  
  small patch to fix this problem.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@338905 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-10-02 14:20:35 +00:00
Matthew Nicholson dadc749dac Merged revisions 334064 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10

........
  r334064 | mnicholson | 2011-08-31 11:31:00 -0500 (Wed, 31 Aug 2011) | 4 lines
  
  only alter the gateway_timeout when attching the gateway to a channel
  
  ASTERISK-18219
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@334067 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-08-31 16:31:30 +00:00
Matthew Nicholson cae7253575 Merged revisions 333895 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10

........
  r333895 | mnicholson | 2011-08-30 09:01:31 -0500 (Tue, 30 Aug 2011) | 6 lines
  
  Replaced FAXOPT(gwtimeout) with a second parameter to FAXOPT(gateway).
  
  Patch by: irroot
  Review: https://reviewboard.asterisk.org/r/1385/
  ASTERISK-18219
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@333896 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-08-30 14:03:02 +00:00
Matthew Nicholson 350545bd8f Merged revisions 333115 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10

........
  r333115 | mnicholson | 2011-08-24 11:51:42 -0500 (Wed, 24 Aug 2011) | 4 lines
  
  Changed the "timeout" option to "gwtimeout".
  
  ASTERISK-18219
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@333117 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-08-24 16:52:56 +00:00
Matthew Nicholson 91d3a7d3a1 Merged revisions 332756 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10

........
  r332756 | mnicholson | 2011-08-22 11:29:45 -0500 (Mon, 22 Aug 2011) | 4 lines
  
  add a way to disable and/or modify the gateway timeout
  
  ASTERISK-18219
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@332757 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-08-22 16:31:59 +00:00
Matthew Nicholson b05b37dc53 Merged revisions 329992 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10

................
  r329992 | mnicholson | 2011-07-28 10:28:21 -0500 (Thu, 28 Jul 2011) | 13 lines
  
  Merged revisions 329991 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.8
  
  ........
    r329991 | mnicholson | 2011-07-28 10:26:56 -0500 (Thu, 28 Jul 2011) | 6 lines
    
    check for CONFIG_STATUS_FILE_INVALID when loading the res_fax config file
    
    Patch by: tzafrir
    Reported by: tzafrir
    (closes issue ASTERISK-18161)
  ........
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@329993 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-07-28 15:30:30 +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
Matthew Nicholson 3f44b08b7b do v21 detection instead of CED detection for the fax gateway
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@327769 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-07-12 15:23:24 +00:00
Matthew Nicholson b2ad651482 renamed fax_gateway_send_ced() to fax_gateway_request_t38()
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@327598 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-07-11 17:23:54 +00:00
Matthew Nicholson c42c024edf actually do something with the ced timeout, also added more debug output
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@327570 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-07-11 16:27:08 +00:00
Matthew Nicholson 4f08a3a8eb write silence on the channel during t.38 negotiation
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@327514 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-07-11 14:13:24 +00:00
Matthew Nicholson 746f93de45 Delay sending an CED tone generated T.38 reinvite to give the CED tone
generating party time to send its own T.38 reinvite.

Also don't forward frames through the gateway if we are negotiating T.38.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@327511 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-07-11 13:29:13 +00:00
Matthew Nicholson 96fad8dba6 fixed wording in a comment
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@327469 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-07-11 12:58:50 +00:00
Matthew Nicholson c3193742e0 updated irroots info for the authors section
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@326006 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-07-01 12:45:09 +00:00
Matthew Nicholson 0f0956e67a Fax gateway functionality (i.e. translating between a T.30 terminal and a T.38
terminal). Can be enabled on a channel by setting FAXOPT(gateway)=yes in the
dialplan.

Big thanks to irroot for porting this code to use the framehooks api.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@325816 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-06-30 18:22:28 +00:00
Gregory Nietsky 32d43ebe19 When a error in T.38 negotiation happens or its rejected on a channel the
state of the channel reverts to unknown this should be rejected.
 
 this is important for negotiating T.38 gateway see #13405

 This patch adds a option T38_REJECTED that behaves as T38_DISABLED except it reports state rejected.

 Trivial Change to res_fax to honnor UNAVAILABLE and REJECTED states.

 (closes issue #18889)
 Reported by: irroot
 Tested by: irroot, darkbasic, 	mnicholson

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@319087 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-05-16 14:56:53 +00:00
Russell Bryant 37aa52fd78 Merged revisions 316265 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r316265 | russell | 2011-05-03 14:55:49 -0500 (Tue, 03 May 2011) | 5 lines
  
  Fix a bunch of compiler warnings generated by gcc 4.6.0.
  
  Most of these are -Wunused-but-set-variable, but there were a few others
  mixed in here, as well.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@316293 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-05-03 20:45:32 +00:00
Jonathan Rose f91462e7ca Merged revisions 311352 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r311352 | jrose | 2011-03-18 11:19:05 -0500 (Fri, 18 Mar 2011) | 10 lines
  
  Changes some print statements/events to use a blank string in place of NULL if the string in question is NULL.
  
  This is supposed to improve Solaris compatibility since Solaris goes berserk when trying to output NULL strings.
  
  (closes issue #18759)
  Reported by: bklang
  Patches:
        null-strings.patch uploaded by bklang (license 919)
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@311373 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-03-18 16:24:19 +00:00
Matthew Nicholson a4a7e95cd5 Merged revisions 311342 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r311342 | mnicholson | 2011-03-18 11:02:50 -0500 (Fri, 18 Mar 2011) | 2 lines
  
  Properly populate the LOCALSTATIONID channel variable.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@311343 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-03-18 16:03:51 +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
Kevin P. Fleming d40ccb8a7b Fix bug with 'F' option for ReceiveFAX and SendFAX.
Skipping the call to set_t38_fax_caps() caused the FAX session
details to not be marked as supporting audio FAX either... the
function's name is a bit misleading. This patch restores the
single bit of non-T.38 behavior from that function when audio
mode is forced.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@304599 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-01-27 20:07:05 +00:00
Kevin P. Fleming e4ec545e59 Rename the SendFAX/ReceiveFAX 'force audio' option.
The recently added option to disable usage of T.38 for a single
session should have been named 'F' for 'force audio', since that
is really what the user is asking to happen (and it's a positive
option instead of a negative option that way).



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@304422 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-01-27 15:57:52 +00:00
Kevin P. Fleming 2a7500021e Add ability to disable T.38 usage for specific SendFAX/ReceiveFAX sessions.
Sometimes during troubleshooting it can be useful to disable T.38 usage in order
to narrow down a problem. This patch adds an 'n' option to SendFAX and ReceiveFAX
so that can be done without having to disable T.38 usage entirely for the peer
that Asterisk is communicating with.

(inspired by trying to assist Bryant Zimmerman on asterisk-users)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@304342 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-01-26 22:39:07 +00:00
Matthew Nicholson 26b7fb0213 Merged revisions 303907 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r303907 | mnicholson | 2011-01-25 14:56:12 -0600 (Tue, 25 Jan 2011) | 2 lines
  
  Reimplemented fax session reservation to reverse the ABI breakage introduced in r297486.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@304152 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-01-26 19:58:14 +00:00
Jason Parker dcc2a9ea5b Merged revisions 302600 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r302600 | qwell | 2011-01-19 14:14:40 -0600 (Wed, 19 Jan 2011) | 1 line
  
  Fix typo pointed out on asterisk-users list.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@302601 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-01-19 20:15:54 +00:00
Matthew Nicholson 9f93c14bf5 Merged revisions 298054 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r298054 | mnicholson | 2010-12-10 10:52:11 -0600 (Fri, 10 Dec 2010) | 2 lines
  
  Prevent a memcpy overlap in GENERIC_FAX_EXEC_SET_VARS
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@298055 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-12-10 16:53:43 +00:00
Matthew Nicholson 23d106b805 Merged revisions 297157,297486,297495 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r297157 | mnicholson | 2010-12-01 13:47:33 -0600 (Wed, 01 Dec 2010) | 2 lines
  
  Changed some NOTICE and WARNING messages to DEBUG messages.
........
  r297486 | mnicholson | 2010-12-02 15:30:47 -0600 (Thu, 02 Dec 2010) | 6 lines
  
  Add support for reserving a fax session before answering the channel.
  
  Note: this change breaks ABI compatibility.
  
  FAX-217
........
  r297495 | mnicholson | 2010-12-03 09:21:52 -0600 (Fri, 03 Dec 2010) | 4 lines
  
  Print a DEBUG message instead of a WARNING message when the selected fax tech does not support reserving sessions.
  
  Answer the channel before quering it for t.38 support.  This is necessary for the query to work properly over local channels.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@297496 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-12-03 15:32:22 +00:00
Matthew Nicholson f02c4ff527 Merged revisions 281358 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r281358 | mnicholson | 2010-08-09 09:49:38 -0500 (Mon, 09 Aug 2010) | 4 lines
  
  Validate minrate, maxrate, and modem settings before attempting a fax session.
  
  FAX-224
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@281359 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-08-09 14:52:21 +00:00
Matthew Nicholson 1862c1b4cf Merged revisions 280909 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r280909 | mnicholson | 2010-08-04 10:11:13 -0500 (Wed, 04 Aug 2010) | 2 lines
  
  Initialize FAXOPT() status variables in sendfax and receivefax instead of when the details structure is created.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@280910 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-08-04 15:22:02 +00:00
Matthew Nicholson 680c3e1883 Merged revisions 280557 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r280557 | mnicholson | 2010-07-29 16:07:21 -0500 (Thu, 29 Jul 2010) | 4 lines
  
  Fix regression introduced in r1664.  Give the fax stack time to shutdown and populate the FAXOPT output variables.
  
  FAX-222
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@280559 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-29 21:08:42 +00:00
Matthew Nicholson 180846d2e7 Don't print failure status when the remote end hangs up, it may not be an actual failure.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@278426 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-21 13:03:01 +00:00
Matthew Nicholson c149b851b3 This commit contains several changes to the way output channel variables are handled.
FAX output channel variables will now match the values reported by FAXOPT() and should be set in all failure and success cases.

This commit also contains a few modifications to the way FAXOPT() variables are populated in a few spots and fixes for some reference count leaks of the session details structure in some failure cases.

Also found and fixed more cases where FAXOPT(status) may not have gotten set.

FAX-214
FAX-203


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@278168 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-20 21:01:26 +00:00
Tilghman Lesher b4e18d5660 Add load priority order, such that preload becomes unnecessary in most cases
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@278132 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-20 19:35:02 +00:00
Bradley Latus c0607e02b5 Update res_fax.c to be a good xml citizen.
(closes issues #17667)
 Reported by: snuffy


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@277667 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-17 00:03:37 +00:00
Matthew Nicholson f03b3691ea Set proper FAXOPT(status), FAXOPT(statusstr), and FAXOPT(error) values where possible. Previously some failure cases did not result in proper FAXOPT values.
FAX-203


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@274540 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-07 16:40:19 +00:00
Matthew Nicholson 390d5781cf Properly detect and report invalid maxrate and maxrate values in the FAXOPT dialplan function. Also make fax_rate_str_to_int() return an unsigned int and return 0 instead of -1 in the event of an error.
FAX-202


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@274243 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-06 19:53:04 +00:00
Matthew Nicholson 6acfd9f20a Properly handle failures of fax->start_session()
FAX-177


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@273464 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-01 19:34:47 +00:00
Matthew Nicholson 480b7e43ca Implemement support for handling multiple documents when sending.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@272558 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-25 19:42:54 +00:00
Russell Bryant 9cc7c55578 Change the method of retrieving the Asterisk version string.
Using this method makes it so res_fax doesn't have to be rebuilt on every
svn update.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@271833 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-22 16:17:14 +00:00
Mark Michelson 0a63e3fa10 Log spandsp's fax debug output to the FAX logger level.
Review: https://reviewboard.asterisk.org/r/658



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@264953 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-21 15:15:58 +00:00
Matthew Nicholson 13f523731a Update res_fax and res_fax_spandsp to be compatible with Fax For Asterisk 1.2.
The fax session initilization code for T.38 faxes has been rewritten. T.38 session initialization was removed from generic_fax_exec, and split into two different code paths for receive and send.  Also the 'z' option (to send a T.38 reinvite if we do not receive one) was added to sendfax.

In the output of 'fax show sessions', the 'Type' column has been renamed to 'Tech' and replaced with a new 'Tech' column that will report 'G.711' or 'T.38'.

Control of ECM defaults has been added to res_fax

A 'fax show settings' CLI command has been added.

Support of the new AST_T38_REQUEST_PARMS control method request to handle channels that have already received a T.38 reinvite before the FAX application is start has been added.

Support for the 'fax show settings' command has been added to res_fax_spandsp and handling of the ECM flag has been slightly altered.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@258896 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-26 14:18:15 +00:00
Kevin P. Fleming 42577406fd Improve handling of T.38 re-INVITEs that arrive before a T.38-capable
application is executing on a channel.

This patch addresses an issue found during working with end-users
using res_fax. If an incoming call is answered in the dialplan, or
jumps to the 'fax' extension due to reception of a CNG tone (with
faxdetect enabled), and then the remote endpoint sends a T.38
re-INVITE, it is possible for the channel's T.38 state to be
'T38_STATE_NEGOTIATING' when the application starts up. Unfortunately,
even if the application wants to use T.38, it can't respond to the
peer's negotiation request, because the AST_CONTROL_T38_PARAMETERS
control frame that chan_sip sent originally has been lost, and the
application needs the content of that frame to be able to formulate a
reply.

This patch adds a new 'request' type to AST_CONTROL_T38_PARAMETERS,
AST_T38_REQUEST_PARMS. If the application sends this request, chan_sip
will re-send the original control frame (with
AST_T38_REQUEST_NEGOTIATE as the request type), and the application
can respond as normal. If this occurs within the five second timeout
in chan_sip, the automatic cancellation of the peer reinvite will be
stopped, and the application will 'own' the negotiation process from
that point onwards.

This also improves the code path in chan_sip to allow sip_indicate(),
when called for AST_CONTROL_T38_PARAMETERS, to be able to return a
non-zero response, which should have been in place before since the
control frame *can* fail to be processed properly. It also modifies
ast_indicate() to return whatever result the channel driver returned
for this control frame, rather than converting all non-zero results
into '-1'. Finally, the new request type intentionally returns a
positive value, so that an application that sends
AST_T38_REQUEST_PARMS can know for certain whether the channel driver
accepted it and will be replying with a control frame of its own, or
whether it was ignored (if the sip_indicate()/ast_indicate() path had
properly supported failure responses before, this would not be
necessary).

This patch also modifies res_fax to take advantage of the new request.

In addition, this patch makes sip_t38_abort() actually lock the
private structure before doing its work... bad programmer, no donut.

This patch also enhances chan_sip's 'faxdetect' support to allow
triggering on T.38 re-INVITEs received as well as CNG tone detection.

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@254450 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-25 15:27:31 +00:00
Kevin P. Fleming 43d922b5a6 Improve handling of values supplied to FAXOPT(ecm).
Previously, values that began with whitespace were silently treated as 'no',
and all non-'yes' values were also treated as 'no'. Now the supplied value
is specifically checked for a 'yes' or 'no' (or equivalent) value, after skipping
leading whitespace. If the value is not valid, then a warning message is generated.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@252709 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-15 22:48:38 +00:00
Matthew Nicholson 8ef8706944 Updated CHANGES file to mention res_fax and res_fax_spandsp.
Also fixed MODULEINFO depends and conflicts for app_fax, res_fax, and res_fax_spandsp.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@250302 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-03 15:39:45 +00:00
Matthew Nicholson 06dc8bc123 Merge res_fax and res_fax_spandsp.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@250190 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-02 23:11:06 +00:00