Commit Graph

399 Commits

Author SHA1 Message Date
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
Russell Bryant d9b034a430 Merged revisions 179608 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r179608 | russell | 2009-03-03 07:53:52 -0600 (Tue, 03 Mar 2009) | 9 lines

Make it easier to detect an improper call to ast_read().

When you call ast_waitfor() on a channel, the index into the channel fds array
that holds the file descriptor that poll() determines has input available is
stored in fdno.  This patch clears out this value after a call to ast_read()
and also reports errors if ast_read() is called without an fdno set.

From a discussion on the asterisk-dev list.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@179609 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-03 13:54:41 +00:00
Jeff Peeler aa81288bab Merged revisions 179536 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r179536 | jpeeler | 2009-03-02 17:54:39 -0600 (Mon, 02 Mar 2009) | 15 lines
  
  Fix bridging regression from commit 176701
  
  This fixes a bad regression where the bridge would exit after an attended
  transfer was made. The problem was due to nexteventts getting set after the
  masquerade which caused the bridge to return AST_BRIDGE_COMPLETE.
  
  (closes issue #14315)
  Reported by: tim_ringenbach
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@179537 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-03 00:01:51 +00:00
Russell Bryant 0c0479602e Merged revisions 179461 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r179461 | russell | 2009-03-02 16:58:18 -0600 (Mon, 02 Mar 2009) | 8 lines

Ensure that only one thread is calling ast_settimeout() on a channel at a time.

For example, with an IAX2 channel, you can have both the channel thread and the
chan_iax2 processing threads calling this function, and doing so twice at the
same time is a bad thing.

(Found in a debugging session with dvossel and mmichelson)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@179462 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-02 23:00:30 +00:00
Jeff Peeler f40edf2793 Merged revisions 176701 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r176701 | jpeeler | 2009-02-17 15:54:34 -0600 (Tue, 17 Feb 2009) | 17 lines
  
  Modify bridging to properly evaluate DTMF after first warning is played
  
  The main problem is currently if the Dial flag L is used with a warning sound,
  DTMF is not evaluated after the first warning sound. To fix this, a flag has 
  been added in ast_generic_bridge for playing the warning which ensures that if
  a scheduled warning is missed, multiple warrnings are not played back (due to a
  feature evaluation or waiting for digits). ast_channel_bridge was modified to
  store the nexteventts in the ast_bridge_config structure as that information
  was lost every time ast_channel_bridge was reentered, causing a hangup due to
  incorrect time calculations.
  
  (closes issue #14315)
  Reported by: tim_ringenbach
 
  Reviewed on reviewboard:
  http://reviewboard.digium.com/r/163/
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@176708 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-17 22:08:00 +00:00
Russell Bryant c461d29b0b Update the timing API to have better support for multiple timing interfaces.
1) Add module use count handling so that timing modules can be unloaded.

2) Implement unload_module() functions for the timing interface modules.

3) Allow multiple timing modules to be loaded, and use the one with the
   highest priority value.

4) Report which timing module is being use in the "timing test" CLI command.

(closes issue #14489)
Reported by: russell

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


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

The changes included are:

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

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

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

3) The API documentation has been filled out.

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

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

6) Configuration parsing has been mostly re-written.

7) "Code cleanup"

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@176627 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-17 20:41:24 +00:00
Russell Bryant 96326f5aa1 Make the causes array static, and remove the type name as it is not needed.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@175983 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-16 02:54:42 +00:00
Mark Michelson 47ebea6a8d Fix 'd' option for app_dial and add new option to Answer application
The 'd' option would not work for channel types which use RTP to transport
DTMF digits. The only way to allow for this to work was to answer the channel
if we saw that this option was enabled.

I realized that this may cause issues with CDRs, specifically with giving false
dispositions and answer times. I therefore modified ast_answer to take another
parameter which would tell if the CDR should be marked answered.

I also extended this to the Answer application so that the channel may be answered
but not CDRified if desired.

I also modified app_dictate and app_waitforsilence to only answer the channel if it
is not already up, to help not allow for faulty CDR answer times.

All of these changes are going into Asterisk trunk. For 1.6.0 and 1.6.1, however, all
the changes except for the change to the Answer application will go in since we do
not introduce new features into stable branches

(closes issue #14164)
Reported by: DennisD
Patches:
      14164.patch uploaded by putnopvut (license 60)
Tested by: putnopvut

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@174945 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-11 22:41:01 +00:00
Joshua Colp 8435535300 Tell the device state core a change happened when a channel is freed but not a specific state.
We need to do this because while we know that the freeing of the channel may cause something to become
not in use we do not know this for sure. There may be another channel that is still up which would cause
it to be in use.
(closes issue #13238)
Reported by: kowalma
Patches:
      20090121__bug13238.diff.txt uploaded by Corydon76 (license 14)
Tested by: alecdavis


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@174844 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-11 14:44:47 +00:00
Olle Johansson 84053c05c7 Add extensions and context on manager event when new channel is created.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@171263 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-26 12:32:30 +00:00
Joshua Colp 3fd61d729c Merged revisions 170648 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r170648 | file | 2009-01-23 16:16:39 -0400 (Fri, 23 Jan 2009) | 4 lines
  
  When a channel is answered make sure any indications currently playing stop. Usually the phone would do this but if the channel was already answered then they are being generated by Asterisk and we darn well need to stop them.
  (closes issue #14249)
  Reported by: RadicAlish
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@170652 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-23 20:18:05 +00:00
Mark Michelson dccc06063f Merged revisions 170392 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r170392 | mmichelson | 2009-01-23 09:40:39 -0600 (Fri, 23 Jan 2009) | 28 lines

Fix broken call pickup

There was a subtle change in ast_do_masquerade which
resulted in failed attempts to pickup calls. The problem
was that the value of the AST_FLAG_OUTGOING flag was
copied from the clone to the original channel. In the case
of call pickup, this meant that the AST_FLAG_OUTGOING flag
ended up being cleared on the channel that was attempting
to execute the pickup.

Because this flag was not set, when ast_read came across
an answer frame, it ignored it. The result of this was that
the calling channel was never properly answered.

This fix changes the behavior in ast_do_masquerade to set
the flags on the original channel to the union of the flags
on the clone channel. This way, if the AST_FLAG_OUTGOING
flag is set on either of the two channels involved in the
masquerade, the resulting channel will have the flag set
as well.

(closes issue #14206)
Reported by: francesco_r
Patches:
      14206.patch uploaded by putnopvut (license 60)
Tested by: francesco_r, aragon, putnopvut


........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@170393 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-23 15:44:27 +00:00
Russell Bryant ef6ad2b53c Merged revisions 168561 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

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

Revert unnecessary indications API change from rev 122314

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@168562 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-13 19:22:13 +00:00
Mark Michelson 859ae78977 Merged revisions 166568 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r166568 | mmichelson | 2008-12-23 09:16:26 -0600 (Tue, 23 Dec 2008) | 12 lines

Fix a crash resulting from a datastore with inheritance but no duplicate callback

The fix for this is to simply set the newly created datastore's data pointer
to NULL if it is inherited but has no duplicate callback.

(closes issue #14113)
Reported by: francesco_r
Patches:
      14113.patch uploaded by putnopvut (license 60)
Tested by: francesco_r


........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@166569 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-23 15:17:54 +00:00
Tilghman Lesher 18e07935ed Merged revisions 166509 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r166509 | tilghman | 2008-12-22 22:05:25 -0600 (Mon, 22 Dec 2008) | 4 lines
  
  Use the integer form of condition for integer comparisons.
  (closes issue #14127)
   Reported by: andrew
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@166533 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-23 04:32:15 +00:00
Mark Michelson 9733b30ff0 Adding a new dialplan function AUDIOHOOK_INHERIT
This function is being added as a method to allow for
an audiohook to move to a new channel during a channel
masquerade. The most obvious use for such a facility is
for MixMonitor when a transfer is performed. Prior to
the addition of this functionality, if a channel 
running MixMonitor was transferred by another party, then
the recording would stop once the transfer had completed.
By using AUDIOHOOK_INHERIT, you can make MixMonitor 
continue recording the call even after the transfer
has completed.

It has also been determined that since this is seen
by most as a bug fix and is not an invasive change,
this functionality will also be backported to 1.4 and
merged into the 1.6.0 branches, even though they are
feature-frozen.

(closes issue #13538)
Reported by: mbit
Patches:
      13538.patch uploaded by putnopvut (license 60)
	  Tested by: putnopvut

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@166092 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-19 22:26:16 +00:00
Russell Bryant c9eb01c899 Merged revisions 164201 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r164201 | russell | 2008-12-15 08:31:37 -0600 (Mon, 15 Dec 2008) | 31 lines

Handle a case where a call can be bridged to a channel that is still ringing.

The issue that was reported was about a case where a RINGING channel got 
redirected to an extension to pick up a call from parking.  Once the parked 
call got taken out of parking, it heard silence until the other side answered.  
Ideally, the caller that was parked would get a ringing indication.  This patch
fixes this case so that the caller receives ringback once it comes out of 
parking until the other side answers.

The fixes are:

 - Make sure we remember that a channel was an outgoing channel when doing 
   a masquerade.  This prevents an erroneous ast_answer() call on the channel,
   which causes a bogus 200 OK to be sent in the case of SIP.

 - Add some additional comments to explain related parts of code.

 - Update the handling of the ast_channel visible_indication field.  Storing 
   values that are not stateful is pointless.  Control frames that are events 
   or commands should be ignored.

 - When a bridge first starts, check to see if the peer channel needs to be 
   given ringing indication because the calling side is still ringing.

 - Rework ast_indicate_data() a bit for the sake of readability.

(closes issue #13747)
Reported by: davidw
Tested by: russell
Review: http://reviewboard.digium.com/r/90/

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@164203 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-15 14:40:24 +00:00
Joshua Colp 035a7552d6 Since chan_sip is callback devicestate driven do not pass in actual states, pass in unknown so we get asked. Additionally do not pass in an actual device state value in ast_setstate since the channel may be callback driven.
(closes issue #13525)
Reported by: pj


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@163579 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-12 16:55:15 +00:00
Russell Bryant 7fcac067b2 Merged revisions 163448 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r163448 | russell | 2008-12-12 07:44:08 -0600 (Fri, 12 Dec 2008) | 26 lines

Resolve issues that could cause DTMF to be processed out of order.

These changes come from team/russell/issue_12658

1) Change autoservice to put digits on the head of the channel's frame readq 
   instead of the tail.  If there were frames on the readq that autoservice 
   had not yet read, the previous code would have resulted in out of order 
   processing.  This required a new API call to queue a frame to the head 
   of the queue instead of the tail.

2) Change up the processing of DTMF in ast_read().  Some of the problems 
   were the result of having two sources of pending DTMF frames.  There 
   was the dtmfq and the more generic readq.  Both were used for pending 
   DTMF in various scenarios.  Simplifying things to only use the frame 
   readq avoids some of the problems.

3) Fix a bug where a DTMF END frame could get passed through when it 
   shouldn't have.  If code set END_DTMF_ONLY in the middle of digit emulation,
   and a digit arrived before emulation was complete, digits would get 
   processed out of order.

(closes issue #12658)
Reported by: dimas
Tested by: russell, file
Review: http://reviewboard.digium.com/r/85/

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@163449 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-12 13:55:30 +00:00
Russell Bryant fb242bc8fd Fix the "failed" extension for outgoing calls.
The conversion to use ast_check_hangup() everywhere instead of checking the softhangup
flag directly introduced this problem.  The issue is that ast_check_hangup() checked
for tech_pvt to be NULL.  Unfortunately, this will be NULL is some valid circumstances,
such as with a dummy channel.

The fix is simple.  Don't check tech_pvt.  It's pointless, because the code path that
sets this to NULL is when the channel hangup callback gets called.  This happens inside
of ast_hangup(), which is the same function responsible for freeing the channel.  Any
code calling ast_check_hangup() better not be calling it after that point, and if so,
we have a bigger problem at hand.

(closes issue #14035)
Reported by: erogoza


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@163171 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-11 20:07:47 +00:00
Sean Bright 48522988ab In order to move away from nested function use, some changes to the recently introduced
ast_channel_search_locked need to be made.  Specifically, the caller needs to be able to
pass arbitrary data which in turn is passed to the callback.  This patch addresses all
of the nested functions currently in asterisk trunk.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@155590 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-09 01:59:59 +00:00
Steve Murphy f7c20e0dec Merged revisions 154685 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r154685 | murf | 2008-11-05 09:06:53 -0700 (Wed, 05 Nov 2008) | 1 line

This fix was prompted by communication from user, who was seeing thousands of error logs... looks like EAGAIN. Made such uninteresting.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@154687 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-05 16:11:11 +00:00
Sean Bright 086a52d9d1 Introduce a new API call ast_channel_search_locked, which iterates through the
channel list calling a caller-defined callback.  The callback returns non-zero
if a match is found.  This should speed up some of the code that I committed
earlier today in chan_sip (which is also updated by this commit).

Reviewed by russellb and kpfleming via ReviewBoard:
	http://reviewboard.digium.com/r/28/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@154429 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-04 23:23:39 +00:00
Kevin P. Fleming bd4eb070f3 bring over all the fixes for the warnings found by gcc 4.3.x from the 1.4 branch, and add the ones needed for all the new code here too
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@153616 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-02 18:52:13 +00:00
Russell Bryant 511ce6b2bf Use the ast_str API call to reset the string instead of manually editing its internals
(closes issue #13816)
Reported by: eliel
Patches: 
      channel.c.patch uploaded by eliel (license 64)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@153057 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-10-31 09:31:10 +00:00
Russell Bryant fbe13cfb86 Modify ast_answer() to not hold the channel lock while calling ast_safe_sleep()
or when calling ast_waitfor().  These are inappropriate times to hold the channel
lock.  This is what has caused "could not get the channel lock" messages from
chan_sip and has likely caused a negative impact on performance results of SIP
in Asterisk 1.6.  Thanks to file for pointing out this section of code.

(closes issue #13287)
(closes issue #13115)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@141949 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-09-09 01:47:56 +00:00
Steve Murphy 0f0c10993c Merged revisions 141156 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r141156 | murf | 2008-09-05 08:15:43 -0600 (Fri, 05 Sep 2008) | 1 line

A small change to prevent double-posting of CDR's; thanks to Daniel Ferrer for bringing it to our attention
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@141157 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-09-05 14:18:43 +00:00
Steve Murphy 2fceed7f6d Merged revisions 140690 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r140690 | murf | 2008-09-02 16:40:13 -0600 (Tue, 02 Sep 2008) | 1 line

After reconsidering, with respect to 13409, ast_cdr_detach should be OK, better in fact, than ast_cdr_free, which generates lots of useless warnings that will undoubtably generate complaints.

Hmmm. It doesn't hush the useless warnings, but it does allow control of posting via the detach and post routines, for those possible situations,
where you'd want to post single-channel cdrs.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@140692 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-09-02 22:55:12 +00:00
Steve Murphy 1c79a23b8e Merged revisions 140670 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r140670 | murf | 2008-09-02 16:15:57 -0600 (Tue, 02 Sep 2008) | 14 lines

(closes issue #13409)
Reported by: tomaso
Patches:
      asterisk-1.6.0-rc2-cdrmemleak.patch uploaded by tomaso (license 564)

I basically spent the day, verifying that this patch 
solves the problem, and doesn't hurt in non-problem 
cases. Why valgrind did not plainly reveal this leak
absolutely mystifies and stuns me. 

Many, many thanks to tomaso for finding and providing the fix.



........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@140691 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-09-02 22:50:59 +00:00
Tilghman Lesher fdd92290af Convert deprecated routines to the new names.
(closes issue #13297)
 Reported by: snuffy
 Patches: 
       bug13297_20080814.diff uploaded by snuffy (license 35)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@137456 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-08-13 17:36:15 +00:00
Sean Bright 790fde68d9 Another batch of files from RSW. The remaining apps and a few more
files from main/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@137089 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-08-10 20:23:50 +00:00
Sean Bright b69c8e6ab5 Another big chunk of changes from the RSW branch. Bunch of stuff from main/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@137082 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-08-10 19:35:50 +00:00
Mark Michelson 9b5b8246c5 Fix a calculation error I had made in the poll. The poll
would reset to 500 ms every time a non-voice frame
was received. The total time we poll should be 500 ms, so
now we save the amount of time left after the poll returned
and use that as our argument for the next call to poll



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@136633 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-08-07 19:54:27 +00:00
Mark Michelson ed4e6bf52b Scrap the 500 ms delay when Asterisk auto-answers a channel.
Instead, poll the channel until receiving a voice frame. The
cap on this poll is 500 ms.

The optional delay is still allowable in the Answer() application,
but the delay has been moved back to its original position, after
the call to the channel's answer callback. The poll for the voice
frame will not happen if a delay is specified when calling Answer().

(closes issue #12708)
Reported by: kactus



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@136631 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-08-07 19:36:46 +00:00
Tilghman Lesher 700d4501b8 Merged revisions 135949 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r135949 | tilghman | 2008-08-05 22:53:36 -0500 (Tue, 05 Aug 2008) | 4 lines

Fix a longstanding bug in channel walking logic, and fix the explanation to
make sense.
(Closes issue #13124)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@135950 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-08-06 03:55:49 +00:00
Mark Michelson 89c2844242 Merged revisions 135841,135847,135850 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r135841 | mmichelson | 2008-08-05 19:25:10 -0500 (Tue, 05 Aug 2008) | 27 lines

Merging the issue11259 branch.

The purpose of this branch was to take into account
"burps" which could cause jitterbuffers to misbehave.
One such example is if the L option to Dial() were used
to inject audio into a bridged conversation at regular
intervals. Since the audio here was not passed through
the jitterbuffer, it would cause a gap in the jitterbuffer's
timestamps which would cause a frames to be dropped for a 
brief period.

Now ast_generic_bridge will empty and reset the jitterbuffer
each time it is called. This causes injected audio to be handled
properly.

ast_generic_bridge also will empty and reset the jitterbuffer
if it receives an AST_CONTROL_SRCUPDATE frame since the change
in audio source could negatively affect the jitterbuffer.

All of this was made possible by adding a new public API call
to the abstract_jb called ast_jb_empty_and_reset.

(closes issue #11259)
Reported by: plack
Tested by: putnopvut


........
r135847 | mmichelson | 2008-08-05 19:27:54 -0500 (Tue, 05 Aug 2008) | 4 lines

Revert inadvertent changes to app_skel that occurred when
I was testing for a memory leak


........
r135850 | mmichelson | 2008-08-05 19:29:54 -0500 (Tue, 05 Aug 2008) | 3 lines

Remove properties that should not be here


........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@135851 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-08-06 00:30:53 +00:00
Steve Murphy 5eaf8450d6 Merged revisions 135799 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r135799 | murf | 2008-08-05 17:13:20 -0600 (Tue, 05 Aug 2008) | 34 lines

(closes issue #12982)
Reported by: bcnit
Tested by: murf

I discovered that also, in the previous bug fixes and changes,
the cdr.conf 'unanswered' option is not being obeyed, so
I fixed this.

And, yes, there are two 'answer' times involved in this
scenario, and I would agree with you, that the first 
answer time is the time that should appear in the CDR.
(the second 'answer' time is the time that the bridge
was begun).

I made the necessary adjustments, recording the first
answer time into the peer cdr, and then using that to
override the bridge cdr's value.

To get the 'unanswered' CDRs to appear, I purposely
output them, using the dial cmd to mark them as
DIALED (with a new flag), and outputting them if
they bear that flag, and you are in the right mode.

I also corrected one small mention of the Zap device
to equally consider the dahdi device.

I heavily tested 10-sec-wait macros in dial, and
without the macro call; I tested hangups while the
macro was running vs. letting the macro complete
and the bridge form. Looks OK. Removed all the
instrumentation and debug.



........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@135821 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-08-05 23:45:32 +00:00
Kevin P. Fleming 7df8b8b848 make datastore creation and destruction a generic API since it is not really channel related, and add the ability to add/find/remove datastores to manager sessions
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@135680 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-08-05 16:56:11 +00:00
Kevin P. Fleming 6291cd19bf remove remaining Zaptel references in various places
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@134086 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-07-28 16:42:00 +00:00
Tilghman Lesher 0c23159464 Deprecate *_device_state_* APIs in favor of *_devstate_* APIs
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@133860 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-07-25 21:20:03 +00:00
Tilghman Lesher c780a443bf Merged revisions 133649 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r133649 | tilghman | 2008-07-25 12:19:39 -0500 (Fri, 25 Jul 2008) | 8 lines

Fix some errant device states by making the devicestate API more strict in
terms of the device argument (only without the unique identifier appended).
(closes issue #12771)
 Reported by: davidw
 Patches: 
       20080717__bug12771.diff.txt uploaded by Corydon76 (license 14)
 Tested by: davidw, jvandal, murf

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@133665 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-07-25 17:24:43 +00:00
Brett Bryant d185405755 Janitor project to convert sizeof to ARRAY_LEN macro.
(closes issue #13002)
Reported by: caio1982
Patches:
      janitor_arraylen5.diff uploaded by caio1982 (license 22)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@129045 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-07-08 16:40:28 +00:00
Steve Murphy bc2cfb3e81 Merged revisions 127663 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r127663 | murf | 2008-07-02 18:16:25 -0600 (Wed, 02 Jul 2008) | 30 lines

The CDRfix4/5/6 omnibus cdr fixes.

(closes issue #10927)
Reported by: murf
Tested by: murf, deeperror

(closes issue #12907)
Reported by: falves11
Tested by: murf, falves11


(closes issue #11849)
Reported by: greyvoip

As to 11849, I think these changes fix the core problems 
brought up in that bug, but perhaps not the more global
problems created by the limitations of CDR's themselves
not being oriented around transfers.

Reopen if necc, but bug reports are not the best
medium for enhancement discussions. We need to start
a second-generation CDR standardization effort to cover
transfers.

(closes issue #11093)
Reported by: rossbeer
Tested by: greyvoip, murf



........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@127793 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-07-03 17:16:44 +00:00
Mark Michelson 37db658b1f Place the delay in __ast_answer prior to the channel-specific answer
callback. This change differs from commit 127113 in that now the 
channel is not set to AST_STATE_UP until after the answer callback.

(closes issue #12924)
Reported by: snyfer



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@127157 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-07-01 21:16:00 +00:00
Kevin P. Fleming 8cdb1f7f41 change the process of inserting a delay into the ast_answer() path so that we don't tell the calling channel that it has been answered unutil after the delay; for a single-thread call this won't matter all, but for a dual-thread call (using chan_local) this may fix the problem in issue 12924
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@127113 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-07-01 19:53:03 +00:00
Russell Bryant 02b1317d0f - add get_max_rate timing API call
- change ast_settimeout() to honor max rate in edge cases of file playback
  (this will make some warning messages go away at the end of playing back
   a file)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@125332 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-26 15:37:01 +00:00
Kevin P. Fleming fd4a60c459 Merged revisions 125132 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r125132 | kpfleming | 2008-06-25 17:21:30 -0500 (Wed, 25 Jun 2008) | 10 lines

allow tonezone to live in a different place than DAHDI/Zaptel, since dahdi-tools and dahdi-linux are now separate packages and can be installed in different places

don't include tonezone.h in dahdi_compat.h, because only a couple of modules need it

get app_rpt building again after the DAHDI changes

(closes issue #12911)
Reported by: tzafrir


........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@125138 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-25 23:05:28 +00:00
Tilghman Lesher 56654fc0f2 Merged revisions 123930 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r123930 | tilghman | 2008-06-19 11:58:19 -0500 (Thu, 19 Jun 2008) | 5 lines

Change informative messages to use the _multiple variant when multiple formats
are possible.
(Closes issue #12848)
Reported by klaus3000

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@123931 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-19 17:02:54 +00:00
Russell Bryant e27a98ce5a - Fix a typo in a timing API call
- Convert the last part of channel.c over to use the timing API.  This would
   not have made a difference when using the dahdi timing module.  I noticed
   it when trying to use another timing source.  Oops.  :)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@122923 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-16 12:48:11 +00:00
Russell Bryant b6457ecf4c Merge changes from timing branch
- Convert chan_iax2 to use the timing API
 - Convert usage of timing in the core to use the timing API instead of
   using DAHDI directly
 - Make a change to the timing API to add the set_rate() function
 - change the timing core to use a rwlock
 - merge a timing implementation, res_timing_dahdi

Basic testing was successful using res_timing_dahdi


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@122523 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-13 12:45:50 +00:00
Jeff Peeler ef3b214728 Goodbye Zaptel, hello DAHDI. Removes Zaptel driver support with DAHDI. Configuration file and dialplan backwards compatability has been put in place where appropiate. Release announcement to follow.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@122234 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-12 17:27:55 +00:00
Tilghman Lesher 1af7ea2df1 Merged revisions 122130 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r122130 | tilghman | 2008-06-12 10:11:30 -0500 (Thu, 12 Jun 2008) | 4 lines

Occasionally, the alertpipe loses its nonblocking status, so detect and correct
that situation before it causes a deadlock.  (Reported and tested by ctooley
via #asterisk-dev)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@122131 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-12 15:14:37 +00:00
Tilghman Lesher 467c6f5f90 Merged revisions 121861 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r121861 | tilghman | 2008-06-11 13:18:16 -0500 (Wed, 11 Jun 2008) | 3 lines

Make calls to ast_assert() actually test something, so that the error message
printed is not nonsensical (reported by mvanbaak via #asterisk-bugs).

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@121867 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-11 18:19:24 +00:00
Joshua Colp 610faf1132 Merged revisions 121442 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r121442 | file | 2008-06-10 09:52:06 -0300 (Tue, 10 Jun 2008) | 4 lines

Update BRIDGEPEER variable before we do a generic bridge in case we just broke out of a native bridge and fell through to generic.
(closes issue #12815)
Reported by: ramonpeek

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@121444 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-10 12:54:39 +00:00
Russell Bryant 85a631f767 arbitrary formatting change to test a mantis change
(closes issue #12824)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@121285 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-09 16:53:26 +00:00
Russell Bryant 0bee0c65b2 Minor formatting change to test a mantis change ...
(closes issue #12824)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@121284 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-09 16:48:26 +00:00
Russell Bryant 90cb28f89c Merged revisions 121280 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r121280 | russell | 2008-06-09 11:35:40 -0500 (Mon, 09 Jun 2008) | 10 lines

Do not attempt to do emulation if an END digit is received and the length is
less than the defined minimum digit length, and the other end only wants END
digits (SIP INFO, for example).

(closes issue #12778)
Reported by: tsearle
Patches:
      12778.rev1.txt uploaded by russell (license 2)
Tested by: tsearle

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@121282 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-09 16:37:08 +00:00
Russell Bryant 51051ce949 Add lock tracking for rwlocks. Previously, lock.h only had the ability to
hold tracking information for mutexes.  Now, the "core show locks" output
will output information about who is holding a rwlock when a thread is
waiting on it.

(closes issue #11279)
Reported by: ys
Patches:
      trunk_lock_utils.v8.diff uploaded by ys (license 281)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@120064 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-03 18:26:51 +00:00
Michiel van Baak f1e9371da8 - revert change to ast_queue_hangup and create ast_queue_hangup_with_cause
- make data member of the ast_frame struct a named union instead of a void

Recently the ast_queue_hangup function got a new parameter, the hangupcause
Feedback came in that this is no good and that instead a new function should be created.
This I did.

The hangupcause was stored in the seqno member of the ast_frame struct. This is not very
elegant, and since there's already a data member that one should be used.
Problem is, this member was a void *.
Now it's a named union so it can hold a pointer, an uint32 and there's a padding in case someone
wants to store another type in there in the future.

This commit is so massive, because all ast_frame.data uses have to be
altered to ast_frame.data.data

Thanks russellb and kpfleming for the feedback.

(closes issue #12674)
Reported by: mvanbaak


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@117802 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-05-22 16:29:54 +00:00
Russell Bryant 7d2d373d6f Minor formatting change to test a mantis change ...
(issue #12674)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@117212 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-05-19 20:45:25 +00:00
Russell Bryant 08f91c1192 Merged revisions 116463 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r116463 | russell | 2008-05-14 16:32:00 -0500 (Wed, 14 May 2008) | 4 lines

Add ast_assert(), which can be used to handle fatal errors.  It is only compiled
in if dev-mode is enabled, and only aborts if DO_CRASH is defined.
(inspired by issue #12650)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@116469 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-05-14 21:40:43 +00:00
Mark Michelson b6aef57619 Merged revisions 116088 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r116088 | mmichelson | 2008-05-13 18:47:49 -0500 (Tue, 13 May 2008) | 12 lines

A change to the way channel locks are handled when DEBUG_CHANNEL_LOCKS is defined.

After debugging a deadlock, it was noticed that when DEBUG_CHANNEL_LOCKS
is enabled in menuselect, the actual origin of channel locks is obscured
by the fact that all channel locks appear to happen in the function
ast_channel_lock(). This code change redefines ast_channel_lock to be a
macro which maps to __ast_channel_lock(), which then relays the proper
file name, line number, and function name information to the core lock
functions so that this information will be displayed in the case that
there is some sort of locking error or core show locks is issued.


........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@116089 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-05-13 23:54:01 +00:00
Tilghman Lesher b5a127daac Modify TIMEOUT() to be accurate down to the millisecond.
(closes issue #10540)
 Reported by: spendergrass
 Patches: 
       20080417__bug10540.diff.txt uploaded by Corydon76 (license 14)
 Tested by: blitzrage


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@115076 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-05-01 23:06:23 +00:00
Michiel van Baak 08e674bce0 Pass the hangup cause all the way to the calling app/channel.
(closes issue #11328)
Reported by: rain
Patches:
      20071207__pass_cause_in_hangup_control_frame.diff.txt uploaded by Corydon76 (license 14)
brought up-to-date to trunk by me


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114637 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-24 22:16:48 +00:00
Russell Bryant 96638d7bb5 re-add a fix that got lost with a recent change
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114548 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-22 20:25:56 +00:00
Jason Parker efb767e432 Convert several DEBUG logs into ast_debug.
(closes issue #12444)
Reported by: IgorG
Patches:
      channel_c_debug.diff uploaded by IgorG (license 20)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114131 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-15 15:20:47 +00:00
Mark Michelson 0270776ca5 Merged revisions 114117 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r114117 | mmichelson | 2008-04-14 12:41:03 -0500 (Mon, 14 Apr 2008) | 11 lines

Increase the retry count when attempting to show channels. This apparently
cleared an issue someone was seeing when attempting to show channels when
the load was high.

(closes issue #11667)
Reported by: falves11
Patches:
      11677.txt uploaded by russell (license 2)
Tested by: falves11


........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114118 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-14 17:42:20 +00:00
Mark Michelson 9ddc843fbe Merged revisions 114106 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r114106 | mmichelson | 2008-04-14 09:58:02 -0500 (Mon, 14 Apr 2008) | 5 lines

Save a local copy of the generate callback prior to unlocking the channel in
case the generate callback goes NULL on us after the channel is unlocked. Thanks
to Russell for pointing this need out to me.


........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114107 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-14 15:01:36 +00:00
Mark Michelson be02a94138 Merged revisions 113065 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r113065 | mmichelson | 2008-04-07 11:08:45 -0500 (Mon, 07 Apr 2008) | 13 lines

This fix prevents a deadlock that was experienced in chan_local. There was
deadlock prevention in place in chan_local, but it would not work in a specific
case because the channel was recursively locked. By unlocking the channel prior
to calling the generator's generate callback in ast_read_generator_actions(), we
prevent the recursive locking, and therefore the deadlock.

(closes issue #12307)
Reported by: callguy
Patches:
      12307.patch uploaded by putnopvut (license 60)
Tested by: callguy


........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@113066 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-07 16:12:30 +00:00
Joshua Colp 738e4ec94e Add a special dialplan variable to chan_sip which will cause an audio file to be played upon completion of an attended transfer.
(closes issue #9239)
Reported by: sunder


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@110631 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-25 15:18:41 +00:00
Russell Bryant 3c6cf5dcc5 Add some fixes that I made in regards to wideband codec handling to get
G.722 music on hold working for me.

(issue #12164, reported by milazzo and jsmith, patches by me)

res/res_musiconhold.c:
 - I moved a single line so that the sample queue update happened before
   ast_write().  The reason that this was a bug is that the G.722 frame
   originally says it has 320 samples in it (which is correct).  However,
   when the frame is written to a channel that uses RTP, main/rtp.c modifies
   the frame to cut the number of samples in half before it sends it on
   the wire.  This is to account for the stupid incorrect G.722 spec that
   makes it so we have to lie about the number of samples with RTP.  I should
   probably go and re-work the RTP code so it doesn't modify the frame so
   that a bug like this won't happen in the future.  However, this change to
   MOH is harmless.

main/channel.c:
 - I made two fixes in regards to generator timing.  Generators use samples
   for timing.  However, this code assumed 8 kHz samples.  In one case, it was
   a hard coded 160 samples, that is now written as the sample rate / 50.  The
   other place was dealing with timing a generator based on frames coming from
   the other direction.  However, that would have only worked if the sample
   rates for the formats in both directions were the same.  The code now takes
   into account that the sample rates may differ, and scales the generator
   samples accordingly.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@110268 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-20 17:41:22 +00:00
Russell Bryant 835df7d30f Merged revisions 108583 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r108583 | russell | 2008-03-13 16:38:16 -0500 (Thu, 13 Mar 2008) | 11 lines

Fix another issue that was causing crashes in chanspy.  This introduces a new
datastore callback, called chan_fixup().  The concept is exactly like the
fixup callback that is used in the channel technology interface.  This callback
gets called when the owning channel changes due to a masquerade.  Before this
was introduced, if a masquerade happened on a channel being spyed on, the
channel pointer in the datastore became invalid.

(closes issue #12187)
(reported by, and lots of testing from atis)
(props to file for the help with ideas)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@108584 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-13 21:40:43 +00:00
Russell Bryant b38cb44acd Merged revisions 108135 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r108135 | russell | 2008-03-12 14:57:42 -0500 (Wed, 12 Mar 2008) | 40 lines

(closes issue #12187, reported by atis, fixed by me after some brainstorming
 on the issue with mmichelson)

- Update copyright info on app_chanspy.

- Fix a race condition that caused app_chanspy to crash.  The issue was that
  the chanspy datastore magic that was used to ensure that spyee channels did
  not disappear out from under the code did not completely solve the problem.
  It was actually possible for chanspy to acquire a channel reference out of
  its datastore to a channel that was in the middle of being destroyed.  That
  was because datastore destruction in ast_channel_free() was done near the
  end.  So, this left the code in app_chanspy accessing a channel that was
  partially, or completely invalid because it was in the process of being free'd
  by another thread.  The following sort of shows the code path where the race 
  occurred:

  =============================================================================
  Thread 1 (PBX thread for spyee chan)  ||   Thread 2 (chanspy)
  --------------------------------------||-------------------------------------
  ast_channel_free()                    ||
    - remove channel from channel list  ||
    - lock/unlock the channel to ensure ||
      that no references retrieved from ||
      the channel list exist.           ||
  --------------------------------------||-------------------------------------
                                        || channel_spy()
    - destroy some channel data         ||  - Lock chanspy datastore
                                        ||  - Retrieve reference to channel
                                        ||  - lock channel
                                        ||  - Unlock chanspy datastore
  --------------------------------------||-------------------------------------
     - destroy channel datastores       ||
        - call chanspy datastore d'tor  ||  
          which NULL's out the ds'      ||  - Operate on the channel ...
          reference to the channel      ||     
                                        ||
    - free the channel                  || 
                                        ||
                                        ||  - unlock the channel
  --------------------------------------||-------------------------------------
  =============================================================================

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@108137 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-12 19:59:05 +00:00
Russell Bryant f7e28b12fe Merged revisions 108031 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r108031 | russell | 2008-03-12 11:59:07 -0500 (Wed, 12 Mar 2008) | 4 lines

Destroy the channel lock after the channel datastores.

(inspired by issue #12187)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@108032 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-12 17:02:57 +00:00
Russell Bryant 86fe5cc800 Merged revisions 107102 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r107102 | russell | 2008-03-10 12:13:17 -0500 (Mon, 10 Mar 2008) | 2 lines

Resolve a compiler warning.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@107103 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-10 17:13:34 +00:00
Russell Bryant 541039ce1b Merged revisions 107099 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r107099 | russell | 2008-03-10 11:58:57 -0500 (Mon, 10 Mar 2008) | 3 lines

Fix a race condition where the generator can go away
(closes issue #12175, reported by edantie, patched by me)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@107100 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-10 16:59:13 +00:00
Joshua Colp 733a740922 Merged revisions 106788 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r106788 | file | 2008-03-07 15:32:00 -0400 (Fri, 07 Mar 2008) | 4 lines

Ignore source update control frame.
(closes issue #12168)
Reported by: plack

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@106789 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-07 19:33:09 +00:00
Tilghman Lesher 8718878490 Merged revisions 106552 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r106552 | tilghman | 2008-03-07 00:36:33 -0600 (Fri, 07 Mar 2008) | 6 lines

Safely use the strncat() function.
(closes issue #11958)
 Reported by: norman
 Patches: 
       20080209__bug11958.diff.txt uploaded by Corydon76 (license 14)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@106553 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-07 06:54:47 +00:00
Joshua Colp 496adc6fc0 Merged revisions 106235 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r106235 | file | 2008-03-05 18:32:10 -0400 (Wed, 05 Mar 2008) | 4 lines

Add a control frame to indicate the source of media has changed. Depending on the underlying technology it may need to change some things.
(closes issue #12148)
Reported by: jcomellas

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@106239 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-05 22:43:22 +00:00
Tilghman Lesher cfc1df4c1a Whitespace changes only
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@105840 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-04 23:04:29 +00:00
Russell Bryant 8372a9bf08 3) In addition to merging the changes below, change trunk back to a regular
LIST instead of an RWLIST.  The way this list works makes it such that
   a RWLIST provides no additional benefit.  Also, a mutex is needed for
   use with the thread condition.


Merged revisions 105563 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r105563 | russell | 2008-03-03 09:50:43 -0600 (Mon, 03 Mar 2008) | 24 lines

Merge in some changes from team/russell/autoservice-nochans-1.4

These changes fix up some dubious code that I came across while auditing what
happens in the autoservice thread when there are no channels currently in
autoservice.

1) Change it so that autoservice thread doesn't keep looping around calling
   ast_waitfor_n() on 0 channels twice a second.  Instead, use a thread condition
   so that the thread properly goes to sleep and does not wake up until a
   channel is put into autoservice.

   This actually fixes an interesting bug, as well.  If the autoservice thread
   is already running (almost always is the case), then when the thread goes
   from having 0 channels to have 1 channel to autoservice, that channel would
   have to wait for up to 1/2 of a second to have the first frame read from it.

2) Fix up the code in ast_waitfor_nandfds() for when it gets called with no
   channels and no fds to poll() on, such as was the case with the previous code
   for the autoservice thread.  In this case, the code would call alloca(0), and
   pass the result as the first argument to poll().  In this case, the 2nd
   argument to poll() specified that there were no fds, so this invalid pointer
   shouldn't actually get dereferenced, but, this code makes it explicit and
   ensures the pointers are NULL unless we have valid data to put there.

(related to issue #12116)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@105564 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-03 15:59:50 +00:00
Joshua Colp b21ca22fb0 Merged revisions 105560 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r105560 | file | 2008-03-03 11:28:59 -0400 (Mon, 03 Mar 2008) | 7 lines

It is possible for no audio to pass between the current digit and next digit so expand logic that clears emulation to AST_FRAME_NULL.
(closes issue #11911)
Reported by: edgreenberg
Patches:
      v1-11911.patch uploaded by dimas (license 88)
Tested by: tbsky

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@105561 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-03 15:30:29 +00:00
Jason Parker 63ab8ad66c Make sure to mask out non-audio first as well
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@103832 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-19 22:35:23 +00:00
Jason Parker 59bdc278be Maybe we should set the value before we test it? Fixes an issue people have been seeing (unreported?) with file playback not working.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@103831 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-19 22:23:04 +00:00
Joshua Colp 227112138e Merged revisions 103801 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r103801 | file | 2008-02-18 19:56:48 -0400 (Mon, 18 Feb 2008) | 10 lines

Ensure that emulated DTMFs do not get interrupted by another begin frame.
(closes issue #11740)
Reported by: gserra
Patches:
      v1-11740.patch uploaded by dimas (license 88)
(closes issue #11955)
Reported by: tsearle
(closes issue #10530)
Reported by: xmarksthespot

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@103802 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-18 23:58:38 +00:00
Joshua Colp e54da94808 Add a non-invasive API for application level manipulation of T38 on a channel. This uses control frames (so they can even pass across IAX2) to negotiate T38 and provided a way of getting the current status of T38 using queryoption. This should by no means cause any issues and if it does I will take responsibility for it.
(closes issue #11873)
Reported by: dimas
Patches:
      v4-t38-api.patch uploaded by dimas (license 88)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@103799 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-18 23:47:01 +00:00
Olle Johansson f04d5fb83d Make sure we can set up calls without audio (text+video).
And ... it works!



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@103772 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-18 17:12:13 +00:00
Tilghman Lesher 26755e3882 Context tracing for channels
(closes issue #11268)
 Reported by: moy
 Patches: 
       chantrace-datastored-encapsulated-rev94934.patch uploaded by moy (license 222)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@103754 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-18 04:43:33 +00:00
Jason Parker 72bc8a7c7d Fix up some doxygen issues.
(closes issue #11996)
Patches:
      bug_11996_doxygen.diff uploaded by snuffy (license 35)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@103723 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-15 17:29:08 +00:00
Joshua Colp 9587f09103 Add support for allowing a native bridge to happen when the L option is enabled. The RTP bridging could already handle this, it just needed to be enabled in the main bridging code.
(issue #10647)
Reported by: samdell3


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@103314 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-11 16:17:15 +00:00
Russell Bryant 1c74c549d7 Merged revisions 100581 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r100581 | russell | 2008-01-28 11:15:41 -0600 (Mon, 28 Jan 2008) | 9 lines

Make some deadlock related fixes.  These bugs were discovered and reported
internally at Digium by Steve Pitts.
 - Fix up chan_local to ensure that the channel lock is held before the local
   pvt lock.
 - Don't hold the channel lock when executing the timing function, as it can
   cause a deadlock when using chan_local.  This actually changes the code back
   to be how it was before the change for issue #10765.  But, I added some other
   locking that I think will prevent the problem reported there, as well.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@100582 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-28 17:21:24 +00:00
Russell Bryant 87800e1913 Make a couple more uses of ARRAY_LEN, and convert some spaces to tabs
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@100533 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-28 04:43:14 +00:00
Russell Bryant e8f7cbf358 - Simplify a line with ARRAY_LEN()
- Make a few little formatting changes


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@100532 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-28 04:30:44 +00:00
Russell Bryant 79be2b8b0e These readlocks always fail for me on my mac, and I saw it happen again
today on another mac.  We ignore the return value of locking operations almost
everywhere in Asterisk.  So, ignore these, as well, so Asterisk will actually
work on systems where this is occurring while I look into what the issue is.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@100514 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-28 00:56:14 +00:00
Joshua Colp 1d47c036dd Some more cosmetic changes.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@100095 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-24 03:34:57 +00:00
Joshua Colp 15515ec671 Add some spacing.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@100094 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-24 03:30:56 +00:00
Olle Johansson b8aa3248ec Add a generic function to set the bridged call PVT unique id string
as a channel variable BRIDGEPVTCALLID

This is important for call tracing in log files and CDRs, so that
the SIP callID can be traced along servers.

The CHANNEL dialplan function won't work here, since the outbound
channel is gone when we need the Call-ID.

Other channel drivers may now implement the same function :-),
but this patch only supports chan_sip.so.

Inspired by (issue #11816)
Reported by: ctooley

Patch by oej



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@99644 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-22 20:35:10 +00:00
Russell Bryant d09fdcf61d Add AST_FORMAT_SLINEAR16 to the list for ast_best_codec()
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@99008 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-17 23:20:37 +00:00
Mark Michelson e04aa9eed4 Merged revisions 98315 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r98315 | mmichelson | 2008-01-11 13:10:57 -0600 (Fri, 11 Jan 2008) | 5 lines

Properly report the hangup cause as no answer when someone does not answer

(closes issue #10574, reported by boch, patched by moy)


........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@98316 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-11 19:12:05 +00:00
Tilghman Lesher afb2031389 Allow the uniqueid to be used for searching for a channel in the list.
Reported and initially patched by: michael-fig
(Closes issue #11340)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@96301 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-03 21:27:57 +00:00
Russell Bryant b749217bcb Merged revisions 95024 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r95024 | russell | 2007-12-27 15:40:02 -0600 (Thu, 27 Dec 2007) | 9 lines

Don't report a syntax error when an empty string is passed to ast_get_group.
Just return 0.

(closes issue #11540)
Reported by: tzafrir
Patches: 
      group_empty.diff uploaded by tzafrir (license 46)
	   -- slightly changed by me

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@95025 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-27 21:41:22 +00:00
Russell Bryant f853918c53 Leave a note for a minor bug that was pointed out by d1mas
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@94796 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-26 18:19:46 +00:00
Tilghman Lesher 9c1dcfea5a Merged revisions 94767 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r94767 | tilghman | 2007-12-24 13:36:59 -0600 (Mon, 24 Dec 2007) | 5 lines

Race: we need to wait to queue a NewChannel event until after the channel is
inserted into the channel list.  The reason is because some manager users
immediately queue requests from the channel when they see that event and are
confused when Asterisk reports no such channel. (Closes issue #11632)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@94768 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-24 19:43:36 +00:00
Mark Michelson 5e7f167073 Merged revisions 93625 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r93625 | mmichelson | 2007-12-18 11:02:48 -0600 (Tue, 18 Dec 2007) | 6 lines

Rework deadlock avoidance used in ast_write, since it meant that agent channels which were being monitored
had one audio file recorded and one empty audio file saved.

(closes issue #11529, reported by atis patched by me)


........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@93626 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-18 17:05:19 +00:00
Olle Johansson 1e07078c60 Changes to manager events in channel.c
- Newstate event
        - Now has "CalleridNum" for numeric caller id, like Newchannel
        - The event does not send "<unknown>" for unknown caller IDs just an empty field
- Newstate and Newchannel events
        - these have changed headers
        "State"         -> ChannelStateDesc     Text based channel state
                        -> ChannelState         Numeric channel state
        - The events does not send "<unknown>" for unknown caller IDs just an empty field

- Newstate event
        - Now has "CalleridNum" for numeric caller id, like Newchannel
        - The event does not send "<unknown>" for unknown caller IDs just an empty field

- Link and Unlink events
        - The "Link" and "Unlink" bridge events in channel.c are now renamed to "Bridge"
        - The link state is in the bridgestate: header as "Link" or "Unlink"
        - For channel.c bridges, "Bridgetype: core" is added. This opens up for
          bridge events in rtp.c and channel drivers

- The "Rename" manager event has a renamed header, to use the same
        terminology for the current channel as other events
        - Oldname       -> Channel

(Moremanager)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@91409 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-06 15:29:05 +00:00
Joshua Colp 3faa47ab5b Instead of iterating through the entire epoll events array just look at the ones that will actually contain data. (props to eliel on IRC for this)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@91328 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-06 04:37:36 +00:00
Jason Parker 0ef0259302 Merged revisions 90876 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

(closes issue #11454)
........
r90876 | qwell | 2007-12-04 11:28:08 -0600 (Tue, 04 Dec 2007) | 4 lines

If we fail to create a channel after allocating a timing fd, we need to make sure to close it.

Issue 11454, patch by eliel.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@90879 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-04 17:38:51 +00:00
Tilghman Lesher 0147028b51 Avoid an additional function call. Reported by: eliel Patch by: eliel (Closes issue #11438)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@90591 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-03 20:30:02 +00:00
Joshua Colp 46d2c050c5 Merged revisions 90548 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r90548 | file | 2007-12-03 14:40:56 -0400 (Mon, 03 Dec 2007) | 2 lines

Preserve the indication currently playing on a channel when a masquerade operation happens. (issue #BE-88)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@90550 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-03 18:44:16 +00:00
Russell Bryant 53a5f22849 Merged revisions 90145 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r90145 | russell | 2007-11-28 18:20:34 -0600 (Wed, 28 Nov 2007) | 5 lines

This set of changes is to make some callerID handling thread-safe.
The ast_set_callerid() function needed to lock the channel.  Also, the handlers
for the CALLERID() dialplan function needed to lock the channel when reading
or writing callerid values directly on the channel structure.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@90146 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-29 00:28:10 +00:00
Joshua Colp 867b734868 Merged revisions 89577 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r89577 | file | 2007-11-26 11:34:38 -0400 (Mon, 26 Nov 2007) | 6 lines

If channel allocation fails because the alert pipe could not be created also free the scheduler context.
(closes issue #11355)
Reported by: eliel
Patches:
      main.channel.c.patch uploaded by eliel (license 64)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89578 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-26 15:36:27 +00:00
Olle Johansson 595961655a Try to get channel.h and channel.c aligned in regards to ast_set_callerid as well
as change name of variables to follow the rest of the naming.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89564 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-25 19:33:33 +00:00
Luigi Rizzo e0ff5fef5c remove a bunch of useless #include "options.h"
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89511 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-21 23:09:02 +00:00