Commit Graph

312 Commits

Author SHA1 Message Date
Richard Mudgett 28ad5ced1a Initial minimum ast_party_caller support.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@210354 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-08-04 16:36:41 +00:00
Mark Michelson 214453904e Fix order and redundancy of channel rename manager events in ast_do_masquerade.
Patch contributed by Mark Spencer.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@210027 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-08-03 14:29:17 +00:00
Kevin P. Fleming 0a6e06c7ff Rework of T.38 negotiation and UDPTL API to address interoperability problems
Over the past couple of months, a number of issues with Asterisk
negotiating (and successfully completing) T.38 sessions with various
endpoints have been found. This patch attempts to address many of
them, primarily focused around ensuring that the endpoints'
MaxDatagram size is honored, and in addition by ensuring that T.38
session parameter negotiation is performed correctly according to the
ITU T.38 Recommendation.

The major changes here are:

1) T.38 applications in Asterisk (app_fax) only generate/receive IFP
packets, they do not ever work with UDPTL packets. As a result of
this, they cannot be allowed to generate packets that would overflow
the other endpoints' MaxDatagram size after the UDPTL stack adds any
error correction information. With this patch, the application is told
the maximum *IFP* size it can generate, based on a calculation using
the far end MaxDatagram size and the active error correction mode on
the T.38 session. The same is true for sending *our* MaxDatagram size
to the remote endpoint; it is computed from the value that the
application says it can accept (for a single IFP packet) combined with
the active error correction mode.

2) All treatment of T.38 session parameters as 'capabilities' in
chan_sip has been removed; these parameters are not at all like
audio/video stream capabilities. There are strict rules to follow for
computing an answer to a T.38 offer, and chan_sip now follows those
rules, using the desired parameters from the application (or channel)
that wants to accept the T.38 negotiation.

3) chan_sip now stores and forwards ast_control_t38_parameters
structures for tracking 'our' and 'their' T.38 session parameters;
this greatly simplifies negotiation, especially for pass-through
calls.

4) Since T.38 negotiation without specifying parameters or receiving
the final negotiated parameters is not very worthwhile, the
AST_CONTROL_T38 control frame has been removed. A note has been added
to UPGRADE.txt about this removal, since any out-of-tree applications
that use it will no longer function properly until they are upgraded
to use AST_CONTROL_T38_PARAMETERS.

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@208464 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-07-23 21:57:24 +00:00
Russell Bryant 44301c95d2 Merged revisions 207360 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r207360 | russell | 2009-07-20 11:26:24 -0500 (Mon, 20 Jul 2009) | 9 lines
  
  Only do the chan->fdno check in ast_read() in a developer build.
  
  I changed this check to only happen in a dev-mode build.  I also added a
  comment explaining what is going on.  I also made it so that detection of
  this situation does not affect ast_read() operation.
  
  (closes issue #14723)
  Reported by: seadweller
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@207361 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-07-20 16:36:15 +00:00
Kevin P. Fleming 8b878c8303 Improve handling of AST_CONTROL_T38 and AST_CONTROL_T38_PARAMETERS for non-T.38-capable channels.
This change allows applications that request T.38 negotiation on a channel that
does not support it to get the proper indication that it is not supported, rather
than thinking that negotiation was started when it was not.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@204948 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-07-06 13:38:29 +00:00
Matthew Nicholson fd6a49beac Moved trigger for BRIDGE_END CEL event so that it is more accurate.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@204807 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-07-02 20:37:16 +00:00
Tilghman Lesher b5f6eac49e Allow trunk to once again compile under MALLOC_DEBUG
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@204118 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-29 17:56:29 +00:00
Joshua Colp 59c1998d67 Improve T.38 negotiation by exchanging session parameters between application and channel.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@203699 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-26 19:27:24 +00:00
Russell Bryant 0264eef115 Merge the new Channel Event Logging (CEL) subsystem.
CEL is the new system for logging channel events.  This was inspired after
facing many problems trying to represent what is possible to happen to a call
in Asterisk using CDR records.  For more information on CEL, see the built in
HTML or PDF documentation generated from the files in doc/tex/.

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@203638 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-26 15:28:53 +00:00
Russell Bryant 2affa3e999 Merged revisions 202496 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r202496 | russell | 2009-06-22 15:08:53 -0500 (Mon, 22 Jun 2009) | 4 lines
  
  Report CallerID change during a masquerade.
  
  Reported by: markster
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@202497 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-22 20:11:04 +00:00
Mark Michelson d8cc968adc Merged revisions 201450 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r201450 | mmichelson | 2009-06-17 14:59:31 -0500 (Wed, 17 Jun 2009) | 9 lines
  
  Change the datastore traversal in ast_do_masquerade to use a safe list traversal.
  
  It is possible for datastore fixup functions to remove the datastore from the list
  and free it. In particular, the queue_transfer_fixup in app_queue does this. While
  I don't yet know of this causing any crashes, it certainly could.
  
  Found while discussing a separate issue with Brian Degenhardt.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@201458 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-17 20:04:12 +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
Mark Michelson afcbf2e14f Merged revisions 200360 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r200360 | mmichelson | 2009-06-12 14:06:41 -0500 (Fri, 12 Jun 2009) | 10 lines
  
  Suppress a warning message and give a better return code when generating
  inband ringing after a call is answered.
  
  (closes issue #15158)
  Reported by: madkins
  Patches:
        15158.patch uploaded by mmichelson (license 60)
  Tested by: madkins
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@200361 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-12 19:07:51 +00:00
Eliel C. Sardanons dabfa94fdc Release the allocated channel decreasing the reference counter.
When allocating the channel use ao2_ref(-1) to release it, instead of calling
ast_free().
Also avoid freeing structures inside that channel (on error) if they will be
released by the channel destructor being called if the reference counter reachs
0.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@200108 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-11 15:40:03 +00:00
Mark Michelson 554456f0fc Use ast_channel_unref to instead of ast_free on a newly created channel.
Also I removed an unnecessary free of a cid_name. This will be freed properly
in the channel destructor.

Reported by mnicholson in #asterisk-dev.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@199923 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-10 18:58:12 +00:00
David Vossel c42344b319 ast_call_forward() todo notes and originate flag copy.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@198954 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-03 20:30:10 +00:00
David Vossel 3830c415c7 Generic call forward api, ast_call_forward()
The function ast_call_forward() forwards a call to an extension specified in an ast_channel's call_forward string.  After an ast_channel is called, if the channel's call_forward string is set this function can be used to forward the call to a new channel and terminate the original one.  I have included this api call in both channel.c's ast_request_and_dial() and feature.c's feature_request_and_dial().  App_dial and app_queue already contain call forward logic specific for their application and options.

(closes issue #13630)
Reported by: festr

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@198856 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-02 21:17:49 +00:00
Mark Michelson 298d745fb4 Add the ability to execute connected line interception macros.
When connected line updates are received or generated in the middle
of an application call, it is now possible to execute a macro to
manipulate the connected line data. This way, phone numbers may be
manipulated to be more presentable to users, names may be changed 
for...whatever reason, or whatever else needs to be done may be.

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

AST-165



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@198727 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-01 20:57:31 +00:00
Russell Bryant 8580871fd4 Constify the ast_frame arg to ast_queue_frame().
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@198434 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-31 01:19:30 +00:00
Matthew Nicholson c8b0c41ed8 Merged revisions 198068 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r198068 | mnicholson | 2009-05-29 13:53:01 -0500 (Fri, 29 May 2009) | 15 lines
  
  Use AST_CDR_NOANSWER instead of AST_CDR_NULL as the default CDR disposition.
  
  This change also involves the addition of an AST_CDR_FLAG_ORIGINATED flag that is used on originated channels to distinguish: them from dialed channels.
  
  (closes issue #12946)
  Reported by: meral
  Patches:
        null-cdr2.diff uploaded by mnicholson (license 96)
  Tested by: mnicholson, dbrooks
  
  (closes issue #15122)
  Reported by: sum
  Tested by: sum
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@198072 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-29 19:04:24 +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
Russell Bryant 7e350686d6 Declare private data as static.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@193459 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-09 11:30:15 +00:00
Kevin P. Fleming ec5116f80c Properly account for memory allocated for channels and datastores
As in previous commits, when channels are allocated (with ast_channel_alloc) or datastores are allocated (with ast_datastore_alloc) properly account for the memory being owned by the caller, instead of the allocator function itself.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@192318 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-05 10:34:19 +00:00
Jeff Peeler 7224c99375 Merged revisions 191488 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r191488 | jpeeler | 2009-05-01 12:40:46 -0500 (Fri, 01 May 2009) | 9 lines
  
  Fix DTMF not being sent to other side after a partial feature match
  
  This fixes a regression from commit 176701. The issue was that
  ast_generic_bridge never exited after the feature digit timeout had elapsed,
  which prevented the queued DTMF from being sent to the other side.
  
  This issue was reported to me directly.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@191489 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-01 18:09:23 +00:00
Richard Mudgett fb030f24ef Fix a small memory leak on error in ast_channel_alloc().
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@190797 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-27 21:22:17 +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
Mark Michelson 4988c07e6d Merged revisions 189277 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r189277 | mmichelson | 2009-04-20 09:04:41 -0500 (Mon, 20 Apr 2009) | 12 lines
  
  Move the check for chan->fdno == -1 to after the zombie/hangup check.
  
  Many users were finding that their hung up channels were staying up and
  causing 100% CPU usage.
  
  (issue #14723)
  Reported by: seadweller
  Patches:
        14723_1-4-tip.patch uploaded by mmichelson (license 60)
  Tested by: falves11, bamby
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@189278 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-20 14:05:27 +00:00
Mark Michelson bdcf8fca81 Don't let ast_channel_alloc fail if explicitly passed NULL cid_name or cid_number.
This also fixes a small memory leak.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@187680 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-10 16:06:22 +00:00
Tilghman Lesher 1030a25ac9 Modify headers and macros, according to Russell's suggestions on the -dev list
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@187599 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-10 03:55:27 +00:00
Joshua Colp abcc0b9397 Add support for allowing the channel driver to handle transcoding.
This was accomplished using a set of options and the setoption channel callback.
The core calls into the channel driver using these options and the channel driver
either returns success or failure.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@187360 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-09 16:19:35 +00:00
Jeff Peeler f57fddb5bb Add timer for features so that backup bridge config can go away
The biggest change done here was elimination of the backup_config for use with
features. Previously, the bridging code upon detecting a feature would set the
start time of the bridge to the start time of the feature. Then after the 
feature had either expired or timed out the start time would be reset to the
true bridge start time from the backup_config. Now, the time differences are
calculated with respect to the newly added feature_start_time timeval instead.

There should be no behavior changes from the previous functionality aside from
the bridge timing being unaffected by either valid or partial feature matches.
Previously the timing would be increased by the length of time configured for
featuredigittimeout, which was probably never noticed.

(closes issue #14503)
Reported by: KNK
Tested by: jpeeler

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@187211 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-08 21:00:39 +00:00
Mark Michelson 5d645640e6 Merged revisions 186984 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r186984 | mmichelson | 2009-04-08 10:26:46 -0500 (Wed, 08 Apr 2009) | 24 lines
  
  Make a couple of changes with regards to a new message printed in ast_read().
  
  "ast_read() called with no recorded file descriptor" is a new message added
  after a bug was discovered. Unfortunately, it seems there are a bunch of places
  that potentially make such calls to ast_read() and trigger this error message
  to be displayed. This commit does two things to help to make this message appear
  less.
  
  First, the message has been downgraded to a debug level message if dev mode is
  not enabled. The message means a lot more to developers than it does to end users,
  and so developers should take an effort to be sure to call ast_read only when
  a channel is ready to be read from. However, since this doesn't actually cause an
  error in operation and is not something a user can easily fix, we should not spam
  their console with these messages.
  
  Second, the message has been moved to after the check for any pending masquerades.
  ast_read() being called with no recorded file descriptor should not interfere with
  a masquerade taking place.
  
  This could be seen as a simple way of resolving issue #14723. However, I still want
  to try to clear out the existing ways of triggering this message, since I feel that
  would be a better resolution for the issue.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@186985 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-08 15:27:41 +00:00
Mark Michelson 630bf109bb Merged revisions 186832 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r186832 | mmichelson | 2009-04-07 18:49:49 -0500 (Tue, 07 Apr 2009) | 8 lines
  
  Set the AST_FEATURE_WARNING_ACTIVE flag when a p2p bridge returns AST_BRIDGE_RETRY.
  
  Without this flag set, warning sounds will not be properly played to either party
  of the bridge.
  
  (closes issue #14845)
  Reported by: adomjan
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@186833 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-07 23:50:56 +00:00
Mark Michelson 6f53ed4c67 This commit introduces COLP/CONP and Redirecting party information into Asterisk.
The channel drivers which have been most heavily tested with these enhancements are
chan_sip and chan_misdn. Further work is being done to add Q.SIG support and will be
introduced in a later commit. chan_skinny has code added to it here, but according
to user pj, the support on chan_skinny is not working as of now. This will be fixed in
a later commit.

A special thanks goes out to bugtracker user gareth for getting the ball rolling and
providing the initial support for this work. Without his initial work on this, this would
not have been nearly as painless as it was.

This functionality has been tested by Digium's product quality department, as well as a
customer site running thousands of calls every day. In addition, many many many many bugtracker
users have tested this, too.

(closes issue #8824)
Reported by: gareth

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@186525 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-03 22:41:46 +00:00
Joshua Colp 2d9c6ef3d5 Add better support for relaying success or failure of the ast_transfer() API call.
This API call now waits for a special frame from the underlying channel driver to
indicate success or failure. This allows the return value to truly convey whether
the transfer worked or not. In the case of the Transfer() dialplan application this
means the value of the TRANSFERSTATUS dialplan variable is actually true.

(closes issue #12713)
Reported by: davidw
Tested by: file


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@186382 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-03 16:47:27 +00:00
Russell Bryant 083e57a5e5 Merged revisions 185771 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r185771 | russell | 2009-04-01 08:47:30 -0500 (Wed, 01 Apr 2009) | 6 lines

Fix a case where DTMF could bypass audiohooks.

This change fixes a situation where an audiohook that wants DTMF would not
actually get it.  This is in the code path where we end DTMF digit length
emulation while handling a NULL frame.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@185772 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-01 13:48:26 +00:00
Kevin P. Fleming 9381bff79d Improve timing interface to remember which provider provided a timer
The ability to load/unload timing interfaces is nice, but it means that when a timer is allocated, it may come from provider A, but later provider B becomes the 'preferred' provider. If this happens, all timer API calls on the timer that was provided by provider A will actually be handed to provider B, which will say WTF and return an error.

This patch changes the timer API to include a pointer to the provider of the timer handle so that future operations on the timer will be forwarded to the proper provider.

(closes issue #14697)
Reported by: moy

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@184762 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-27 19:10:32 +00:00
Russell Bryant 2ad737608c Put siren7 and siren14 in ast_best_codec() just so they're in there somewhere.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@184043 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-24 22:00:58 +00:00
Joshua Colp 10b7b842dc Fix an issue where a T38 control frame would get dropped.
If two channels were bridged together using a generic bridge the T38
control frame would get passed up instead of being indicated on the
other channel.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@183057 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-18 22:22:56 +00:00
Russell Bryant 0bdd99ad64 Merged revisions 182810 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r182810 | russell | 2009-03-17 21:09:13 -0500 (Tue, 17 Mar 2009) | 44 lines

Fix cases where the internal poll() was not being used when it needed to be.

We have seen a number of problems caused by poll() not working properly on 
Mac OSX.  If you search around, you'll find a number of references to using 
select() instead of poll() to work around these issues.  In Asterisk, we've 
had poll.c which implements poll() using select() internally.  However, we 
were still getting reports of problems.

vadim investigated a bit and realized that at least on his system, even 
though we were compiling in poll.o, the system poll() was still being used.  
So, the primary purpose of this patch is to ensure that we're using the 
internal poll() when we want it to be used.

The changes are:

1) Remove logic for when internal poll should be used from the Makefile.  
   Instead, put it in the configure script.  The logic in the configure 
   script is the same as it was in the Makefile.  Ideally, we would have 
   a functionality test for the problem, but that's not actually possible, 
   since we would have to be able to run an application on the _target_ 
   system to test poll() behavior.

2) Always include poll.o in the build, but it will be empty if AST_POLL_COMPAT
   is not defined.

3) Change uses of poll() throughout the source tree to ast_poll().  I feel 
   that it is good practice to give the API call a new name when we are 
   changing its behavior and not using the system version directly in all cases.
   So, normally, ast_poll() is just redefined to poll().  On systems where 
   AST_POLL_COMPAT is defined, ast_poll() is redefined to ast_internal_poll().

4) Change poll() in main/poll.c to be ast_internal_poll().

It's worth noting that any code that still uses poll() directly will work fine 
(if they worked fine before).  So, for example, out of tree modules that are 
using poll() will not stop working or anything.  However, for modules to work 
properly on Mac OSX, ast_poll() needs to be used.

(closes issue #13404)
Reported by: agalbraith
Tested by: russell, vadim

http://reviewboard.digium.com/r/198/

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@182847 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-18 02:28:55 +00:00
Russell Bryant 9d6ba51d05 Tweak the handling of the frame list inside of ast_answer().
This does not change any behavior, but moves the frames from the local frame
list back to the channel read queue using an O(n) algorithm instead of O(n^2).


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@182553 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-17 15:22:12 +00:00
Kevin P. Fleming 16b9280ba9 correct logic flaw in ast_answer() changes in r182525
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@182530 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-17 14:59:33 +00:00
Kevin P. Fleming d11b6386a5 Improve behavior of ast_answer() to not lose incoming frames
ast_answer(), when supplied a delay before returning to the caller, use ast_safe_sleep() to implement the delay. Unfortunately during this time any incoming frames are discarded, which is problematic for T.38 re-INVITES and other sorts of channel operations.

When a delay is not passed to ast_answer(), it still delays for up to 500 milliseconds, waiting for media to arrive. Again, though, it discards any control frames, or non-voice media frames.

This patch rectifies this situation, by storing all incoming frames during the delay period on a list, and then requeuing them onto the channel before returning to the caller.

http://reviewboard.digium.com/r/196/



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@182525 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-17 14:38:11 +00:00
Joshua Colp 5308112806 Fix a memory leak in the ast_answer / __ast_answer API call.
For a channel that is not yet answered this API call will wait
until a voice frame is received on the channel before returning.
It does this by waiting for frames on the channel and reading them
in. The frames read in were not freed when they should have been.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@182171 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-16 13:58:24 +00:00
Russell Bryant c61a3f2878 Make handling of the BRIDGE_PLAY_SOUND variable thread-safe.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@181465 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-11 22:25:57 +00:00
Russell Bryant ffc7510e7a Make handling of the BRIDGEPVTCALLID variable thread-safe.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@181428 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-11 22:14:55 +00:00
Russell Bryant 29cfabf335 Merged revisions 181423 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r181423 | russell | 2009-03-11 16:42:58 -0500 (Wed, 11 Mar 2009) | 9 lines

Make code that updates BRIDGEPEER variable thread-safe.

It is not safe to read the name field of an ast_channel without the channel
locked.  This patch fixes some places in channel.c where this was being done,
and lead to crashes related to masquerades.

(closes issue #14623)
Reported by: guillecabeza

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@181424 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-11 21:49:29 +00:00
David Vossel 979eb709ae app_read does not break from prompt loop with user terminated empty string
In app.c, ast_app_getdata is called to stream the prompts and receive DTMF input.  If ast_app_getdata() receives an empty string caused by the user inputing the end of string character, in this case '#', it should break from the prompt loop and return to app_read, but instead it cycles through all the prompts.  I've added a return value for this special case in ast_readstring() which uses an enum I've delcared in apps.h.  This enum is now used as a return value for ast_app_getdata().

(closes issue #14279)
Reported by: Marquis
Patches:
	fix_app_read.patch uploaded by Marquis (license 32)
	read-ampersanmd.patch2 uploaded by dvossel (license 671)
Tested by: Marquis, dvossel
Review: http://reviewboard.digium.com/r/177/




git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@180032 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-03 23:21:18 +00:00
Russell Bryant cfa0d9c0ce Merged revisions 179741 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r179741 | russell | 2009-03-03 10:45:46 -0600 (Tue, 03 Mar 2009) | 6 lines

Ensure chan->fdno always gets reset to -1 after handling a channel fd event.

Since setting fdno to -1 had to be moved, a couple of other code paths that
do process an fd event return early and do not pass through the code path
where it was moved to.  So, set it to -1 in a few other places, too.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@179742 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-03 16:47:28 +00:00
Joshua Colp a65727949c Merged revisions 179671 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r179671 | file | 2009-03-03 10:38:09 -0400 (Tue, 03 Mar 2009) | 3 lines
  
  Move where fdno is set to the default value to *after* the read callback of the channel driver is called.
  We have to do this as the underlying channel driver may need the fdno value to determine what to read.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@179672 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-03 14:40:04 +00:00