Commit Graph

136 Commits

Author SHA1 Message Date
David Brooks 174c36ad41 Fixes Park() argument handling
Park() was not respecting the arguments passed to it. Any extension/context/priority
given to it was being ignored. This patch remedies this.

(closes issue #15380)
Reported by: DLNoah


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@205254 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-07-08 17:26:26 +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
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 bd2e4dc229 Merged revisions 203375 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r203375 | russell | 2009-06-25 16:02:18 -0500 (Thu, 25 Jun 2009) | 9 lines
  
  Fix a case where CDR answer time could be before the start time involving parking.
  
  (closes issue #13794)
  Reported by: davidw
  Patches:
        13794.patch uploaded by murf (license 17)
        13794.patch.160 uploaded by murf (license 17)
  Tested by: murf, dbrooks
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@203376 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-25 21:04:55 +00:00
Tilghman Lesher ad0d1bfd9e Merged revisions 201828 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r201828 | tilghman | 2009-06-18 19:40:41 -0500 (Thu, 18 Jun 2009) | 6 lines
  
  If the "h" extension fails, give it another chance in main/pbx.c.
  If the "h" extension fails, give it another chance in main/pbx.c, when it
  returns from the bridge code.  Fixes an issue where the "h" extension may
  occasionally not fire, when a Dial is executed from a Macro.
  Debugged in #asterisk with user tompaw.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@201829 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-19 00:43:41 +00:00
Kevin P. Fleming 82fb56886e More 'static' qualifiers on module global variables.
The 'pglobal' tool is quite handy indeed :-)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@200620 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-15 17:34:30 +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
Eliel C. Sardanons 2c882626a0 Implement a new element in AstXML for AMI actions documentation.
A new xml element was created to manage the AMI actions documentation,
using AstXML.
To register a manager action using XML documentation it is now possible
using ast_manager_register_xml().
The CLI command 'manager show command' can be used to show the parsed
documentation.

Example manager xml documentation:
<manager name="ami action name" language="en_US">
    <synopsis>
        AMI action synopsis.
    </synopsis>
    <syntax>
        <xi:include xpointer="xpointer(...)" /> <-- for ActionID
        <parameter name="header1" required="true">
	    <para>Description</para>
	</parameter>
	...
    </syntax>
    <description>
        <para>AMI action description</para>
    </description>
    <see-also>
    	...
    </see-also>
</manager>



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@196308 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-22 17:52:35 +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
Mark Michelson 1e3ac401f4 Pass connected line updates along during a bridge.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@195992 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-21 19:06:08 +00:00
Joshua Colp b4c24d2da1 Merged revisions 195688 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r195688 | file | 2009-05-20 14:30:25 -0300 (Wed, 20 May 2009) | 5 lines
  
  Fix some code that wrongly assumed a pointer would always be non-NULL when dealing with CDRs after a bridge.
  
  (closes issue #15079)
  Reported by: barryf
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@195698 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-20 17:33:02 +00:00
Russell Bryant 23f54f4c76 Fix a typo where an equality check should be an assignment.
(closes issue #15103)
Reported by: lmsteffan
Patches:
      transfer_crash.patch uploaded by lmsteffan (license 779)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@194477 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-14 21:24:17 +00:00
Kevin P. Fleming 1c988d8996 add 'const' qualifiers in various places where they should have been
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@193832 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-12 13:59:35 +00:00
Jeff Peeler 1c05448f5a Merged revisions 192858 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r192858 | jpeeler | 2009-05-06 17:15:19 -0500 (Wed, 06 May 2009) | 10 lines
  
  Make ParkedCall application stop execution of the dialplan after hang up
  
  Just changed park_exec to always return non-zero. I really wasn't entirely sure
  at first if this was a bug. Decided it was since it would be surprising when 
  not using ParkedCall in the dialplan to hang up and have dialplan execution
  continue.
  
  (closes issue #14555)
  Reported by: francesco_r
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@192861 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-06 22:17:27 +00:00
Richard Mudgett 7019ff68db Fixed crashes from issue8824 review board channel locking changes.
The local struct ast_party_connected_line connected_caller variable
was uninitialized when the copy function was called.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@192590 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-05 20:54:07 +00:00
Joshua Colp 77e9d51c93 Merged revisions 192454 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r192454 | file | 2009-05-05 15:22:27 -0300 (Tue, 05 May 2009) | 8 lines
  
  Fix an incorrect assumption that certain values on the channel will always exist when they may not.
  
  The CDR code involved with bridges wrongly assumed that the currently executing application and data
  values will always exist. It is possible for this to be false when call forwarding is involved.
  
  (closes issue #14984)
  Reported by: gincantalupo
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@192462 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-05 18:23:58 +00:00
Russell Bryant cba19c8a67 Convert the ast_channel data structure over to the astobj2 framework.
There is a lot that could be said about this, but the patch is a big 
improvement for performance, stability, code maintainability, 
and ease of future code development.

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

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

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

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

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

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

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

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

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@190423 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-24 14:04:26 +00:00
Russell Bryant 559f908016 Fix call parking callback. Pipes -> Commas.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@189951 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-22 16:56:43 +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
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 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
David Vossel 9d3527bddf Merged revisions 183386 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r183386 | dvossel | 2009-03-19 14:40:07 -0500 (Thu, 19 Mar 2009) | 6 lines
  
  Cleaning up a few things in detect disconnect patch
  
  Initialized ast_call_feature in detect_disconnect to avoid accessing uninitialized memory.  Cleaned up /param tags in features.h.  No longer send dynamic features in ast_feature_detect. 
  
  issue #11583
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@183436 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-19 20:30:39 +00:00
David Vossel 2764c2821f Merged revisions 183126 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r183126 | dvossel | 2009-03-19 11:15:16 -0500 (Thu, 19 Mar 2009) | 17 lines
  
  Allow disconnect feature before a call is bridged
  
  feature.conf has a disconnect option.  By default this option is set to '*', but it could be anything.  If a user wishes to disconnect a call before the other side answers, only '*' will work, regardless if the disconnect option is set to something else.  This is because features are unavailable until bridging takes place.  The default disconnect option, '*', was hardcoded in app_dial, which doesn't make any sense from a user perspective since they may expect it to be something different.  This patch allows features to be detected from outside of the bridge, but not operated on.  In this case, the disconnect feature can be detected before briding and handled outside of features.c.
  
  (closes issue #11583)
  Reported by: sobomax
  Patches:
  	patch-apps__app_dial.c uploaded by sobomax (license 359)
  	11583.latest-patch uploaded by murf (license 17)
  	detect_disconnect.diff uploaded by dvossel (license 671)
  Tested by: sobomax, dvossel
  Review: http://reviewboard.digium.com/r/195/
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@183172 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-19 16:28: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
Mark Michelson 0892cdb958 Remove ast_ prefix from functions which are not public.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@182071 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-13 17:49:01 +00:00
Mark Michelson 88e3279f83 Merged revisions 181990 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r181990 | mmichelson | 2009-03-13 12:12:32 -0500 (Fri, 13 Mar 2009) | 35 lines
  
  Check the DYNAMIC_FEATURES of both the chan and peer when interpreting DTMF.
  
  Dynamic features defined in the applicationmap section of features.conf allow
  one to specify whether the caller, callee, or both have the ability to use the
  feature. The documentation in the features.conf.sample file could be interpreted
  to mean that one only needs to set the DYNAMIC_FEATURES channel variable on the
  calling channel in order to allow for the callee to be able to use the features
  which he should have permission to use. However, the DYNAMIC_FEATURES variable
  would only be read from the channel of the participant that pressed the DTMF
  sequence to activate the feature. The result of this was that the callee was
  unable to use dynamic features unless the dialplan writer had taken measures
  to be sure that the DYNAMIC_FEATURES variable was set on the callee's channel.
  
  This commit changes the behavior of ast_feature_interpret to concatenate the
  values of DYNAMIC_FEATURES from both parties involved in the bridge. The features
  themselves determine who has permission to use them, so there is no reason to believe
  that one side of the bridge could gain the ability to perform an action that they
  should not have the ability to perform.
  
  Kevin Fleming pointed out on the asterisk-users list that the typical way that this
  was worked around in the past was by setting _DYNAMIC_FEATURES on the calling channel
  so that the value would be inherited by the called channel. While this works, the
  documentation alone is not enough to figure out why this is necessary for the callee
  to be able to use dynamic features. In this particular case, changing the code to match
  the documentation is safe, easy, and will generally make things easier for people for
  future installations.
  
  This bug was originally reported on the asterisk-users list by David Ruggles.
  
  (closes issue #14657)
  Reported by: mmichelson
  Patches:
        14657.patch uploaded by mmichelson (license 60)
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@182029 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-13 17:26:43 +00:00
Jeff Peeler 58cf8b69da Fix malloc debug macros to work properly with h323.
The main problem here was that cstdlib was undefining free thereby causing the
proper debug macros to not be used. ast_h323.cxx has been changed to call
ast_free instead to avoid the issue. 

A few other issues were addressed:
- There were a few instances of functions improperly passing ast_free instead
of ast_free_ptr.
- Some clean up was done to avoid the debug macros intentionally being redefined.
(copied below from Kevin's commit, appreciate the help)
- disable astmm.h from doing anything when STANDALONE is defined, which is used
by the tools in the utils/ directory that use parts of Asterisk header files in
hackish ways; also ensure that utils/extconf.c and utils/conf2ael.c are
compiled with STANDALONE defined.

(closes issue #13593)
Reported by: pj



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@181135 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-11 04:06:44 +00:00
Joshua Colp bcf5ecde90 Merged revisions 179840 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r179840 | file | 2009-03-03 14:27:09 -0400 (Tue, 03 Mar 2009) | 9 lines
  
  Do not assume that the bridge_cdr is still attached to the channel when the 'h' exten is finished executing.
  
  It is possible for a masquerade operation to occur when the 'h' exten is operating. This operation moves
  the CDR records around causing the bridge_cdr to no longer exist on the channel where it is expected to.
  We can not safely modify it afterwards because of this, so don't even try.
  
  (closes issue #14564)
  Reported by: meric
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@179841 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-03 18:28:46 +00:00
Steve Murphy ec6101595e Merged revisions 178956 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

In this case, it's just a matter of reducing the default timeouts from 2000
to 1000 msec, as the max def feature digit timeout is no longer halved.

........
  r178956 | murf | 2009-02-26 14:27:32 -0700 (Thu, 26 Feb 2009) | 18 lines
  
  This change moves the default feature digit timeout to 1000 ms from the previous default of 500.
  
  As per bug 14515, a dev discussion arrived at a "mediated concensus" 
  of a default feature digit timeout of 1.0 sec. Some voted for 1300;
  ctooley thought 1500 for distracted phone users in phone booths; 
  kpfleming put his foot down at 1.0 sec. 
  
  Users who found the previous default max delay of 250 msec perfect,
  are welcome to override the new default. Notice that I said that
  250 msec was the default; wait a minute, you might say, the config
  file said it was 500 msec!; well, because of the bug fix for 14515,
  we found that 500 msec was actually enforcing a max of 250. The bug
  fix would restore 500 msec, but we felt even that was a bit tight
  for most users... 2000 msec was pushed earlier by mmichelson, so
  that reduces to 1000 msec after the bug fix. Enjoy!
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@178986 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-27 03:45:58 +00:00
Tilghman Lesher 63561aea00 Sound confirmation of call pickup success.
(closes issue #13826)
 Reported by: azielke
 Patches: 
       pickupsound2-trunk.patch uploaded by azielke (license 548)
       __20081124_bug_13826_updated.patch uploaded by lmadsen (license 10)
 Tested by: lmadsen


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@178919 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-26 18:41:28 +00:00
Steve Murphy fe216b2f9d Merged revisions 178804 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r178804 | murf | 2009-02-26 10:09:03 -0700 (Thu, 26 Feb 2009) | 28 lines
  
  This patch prevents the feature detection timeout from being cut in half.
  
  Because the ast_channel_bridge() call will return 0 and pass
  a frame pointer for both DTMF_BEGIN and DTMF_END, the feature_timer
  field in hte config struct is getting decremented twice, which 
  effectively cuts the digittimeout in half. I added conditions
  to the if statement to only let DTMF_END frames to flow thru,
  which solved the problem. Also, when the frame pointer is null,
  let control flow thru-- this usually happens on timeouts. I added
  a comment to the code to explain what's going on and why.
  
  Many thanks to sodom for reporting this problem. Personnally, it always seemed
  like something was wrong with the featuredigittimeout, but I never
  could quite decide what... and was too busy to investigate.
  This bug forced the issue, and now we know.
  
  Sodom had other issues in 14515, but I couldn't reproduce them. If
  he still has problems, and wants to get them solved, he is welcome
  to reopen 14515.
  
  
  (closes issue #14515)
  Reported by: sodom
  Patches:
        14515.patch uploaded by murf (license 17)
  Tested by: murf, sodom
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@178828 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-26 17:22:11 +00:00
Jeff Peeler 90a6374871 Fix mismerge from revision 176708 pointed out by Kaloyan Kovachev on the
asterisk-dev mailing list. Thanks!



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@177356 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-19 15:56:31 +00:00
David Vossel e30d2c1d45 Locking issue in action_bridge and bridge_exec
action_bridge() and bridge_exec() both search for the channels to bridge to, and then immediately drop the lock.  Instead, they should hold the lock until the masquerade is complete.  This will guarantee the channel remains and prevent any other weirdness from occurring.  In action_bridge() some more weirdness comes into play.  Both channels are needlessly locked at the same time and perform the exact same logic.  It makes sense from a coding organizational standpoint, but could cause a theoretical deadlock so I split the code up.  There is an issue associated with this, but since its a rather complicated thing to reproduce I'm not certain this alone will close it.

issue# 14296
Review: http://reviewboard.digium.com/r/167/




git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@177226 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-18 22:51:38 +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
Jeff Peeler a46d290802 Merged revisions 175294 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r175294 | jpeeler | 2009-02-12 14:34:36 -0600 (Thu, 12 Feb 2009) | 9 lines
  
  Fix ParkedCall event information for From field in the case of a blind transfer
  
  If the parker information can not be obtained from the peer, try and see if
  the BLINDTRANSFER channel variable has been set. Previously, a blind transfer
  to the ParkAndAnnounce app would return nothing for the From.
  
  Closes AST-189
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@175298 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-12 20:48:56 +00:00
Jeff Peeler 66e88633a5 Merged revisions 175187 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r175187 | jpeeler | 2009-02-12 11:57:10 -0600 (Thu, 12 Feb 2009) | 6 lines
  
  Fix crash in event of failed attempt to transfer to parking
  
  The peer may not necessarily exist, such as in the case of a transfer to 
  ParkAndAnnounce. In this case don't try to play a sound to it.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@175188 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-12 18:00:11 +00:00
Jeff Peeler 39ec5d1576 Merged revisions 173211 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r173211 | jpeeler | 2009-02-03 15:57:01 -0600 (Tue, 03 Feb 2009) | 17 lines
  
  Parking attempts made to one end of a bridge no longer will hang up due to a
  parking failure.
  
  Parking attempts made using either one-touch, or doing either a blind or 
  assisted transfer to the parking extension now keep up the bridge instead of
  hanging up the attempted parked party. Normal causes for the parking attempt
  to fail includes the specific specified extension (via PARKINGEXTEN) not being 
  available or if all the parking spaces are currently in use. To avoid having
  to reverse a masquerade park_space_reserve was made to provide foresight if
  a parking attempt will succeed and if so reserve the parking space.
  
  (closes issue #13494)
  Reported by: mdu113
  
  Reviewed by Russell: http://reviewboard.digium.com/r/133/
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@173500 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-04 21:17:53 +00:00
Terry Wilson 34be09bf5c Merged revisions 173066 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r173066 | twilson | 2009-02-02 17:48:06 -0600 (Mon, 02 Feb 2009) | 2 lines
  
  Fix a feature inheritance bug I added after code review
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@173067 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-02 23:57:25 +00:00
Steve Murphy 53d9b77898 This reverts the changes I made for 11583; will
reviewboard this before committing again...
reopened 11583 until all Russell's issues are
resolved.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@172929 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-02 19:02:24 +00:00
Steve Murphy c61e8a7865 This change allows the disconnect feature (as in "one-touch" in features.c)
to be used within the dial app, before a call is bridged.

Many thanks to sobomax for submitting this patch. 

Quoting from bug 11582:

  "So the goal of the patch was to use the user configured feature code during the 
   call setup phase. The original ast_feature_interpret() function is not well suited 
   for this purpose as it uses much call bridge specific data and doesn't separate a 
   detection of feature from a feature handler call. So a new function ast_feature_detect() 
   has been extracted off the ast_feature_interpret() function but keeping the original 
   logic intact except some insignificant changes to locking.

  "Having created the ast_feature_detect() function the possibility to use feature detection 
   in almost any place of the asterisk code. So a call to this function has been added to 
   wait_for_answer() function of app_dial.so module. This code doesn't call the feature handler 
   however and uses old call leg disconnect logic to make the changes as small and simple as 
   possible to prevent unexpected problems. A disconnect feature currently is the only one 
   supported during call setup as other features as call parking and call transfer don't make much 
   sense during call setup. However if need in some of the features would arise it is much easier to 
   implement as the infrastructure changes are already in place with this patch."

I have cleaned up the patch somewhat, and verified that the existing functionality is not
harmed, and that the new functionality works. Terry has committed his stuff, and there were
no conflicts (see 14274).

(closes issue #11583)
Reported by: sobomax
Patches:
      patch-apps__app_dial.c uploaded by sobomax (license 359)
      patch-include__asterisk__features.h uploaded by sobomax (license 359)
      patch-res__res_features.c uploaded by sobomax (license 359)
      enable-features-during-call-setup.diff uploaded by sobomax (license 359)
      11583.newdiff uploaded by murf (license 17)
      enable-features-during-call-setup-1.diff uploaded by sobomax (license 359)
      11583.latest-patch uploaded by murf (license 17)
Tested by: sobomax, murf




git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@172890 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-02 17:37:15 +00:00
Terry Wilson 8d782f96b8 Merged revisions 172517 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r172517 | twilson | 2009-01-30 11:47:41 -0600 (Fri, 30 Jan 2009) | 37 lines
  
  Fix feature inheritance with builtin features
  
  When using builtin features like parking and transfers, the AST_FEATURE_* flags
  would not be set correctly for all instances when either performing a builtin
  attended transfer, or parking a call and getting the timeout callback.  Also,
  there was no way on a per-call basis to specify what features someone should
  have on picking up a parked call (since that doesn't involve the Dial() command).
  There was a global option for setting whether or not all users who pickup a
  parked call should have AST_FEATURE_REDIRECT set, but nothing for DISCONNECT,
  AUTOMON, or PARKCALL.
  
  This patch:
  1) adds the BRIDGE_FEATURES dialplan variable which can be set either in the
  dialplan or with setvar in channels that support it.  This variable can be set
  to any combination of 't', 'k', 'w', and 'h' (case insensitive matching of the
  equivalent dial options), to set what features should be activated on this
  channel.  The patch moves the setting of the features datastores into the
  bridging code instead of app_dial to help facilitate this.
  
  2) adds global options parkedcallparking, parkedcallhangup, and
  parkedcallrecording to be similar to the parkedcalltransfers option for
  globally setting features.
  
  3) has builtin_atxfer call builtin_parkcall if being transfered to the parking
  extension since tracking everything through multiple masquerades, etc. is
  difficult and error-prone
  
  4) attempts to fix all cases of return calls from parking and completed builtin
  transfers not having the correct permissions
  (closes issue #14274)
  Reported by: aragon
  Patches: 
        fix_feature_inheritence.diff.txt uploaded by otherwiseguy (license 396)
  Tested by: aragon, otherwiseguy
  
  Review http://reviewboard.digium.com/r/138/
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@172580 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-30 21:29:12 +00:00
Steve Murphy 268ac221a2 Merged revisions 172030 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r172030 | murf | 2009-01-28 11:51:16 -0700 (Wed, 28 Jan 2009) | 46 lines
  
  This patch fixes h-exten running misbehavior in manager-redirected 
  situations.
  
  What it does:
  1. A new Flag value is defined in include/asterisk/channel.h,
   AST_FLAG_BRIDGE_HANGUP_DONT, which used as a messenge to the
   bridge hangup exten code not to run the h-exten there (nor
   publish the bridge cdr there). It will done at the pbx-loop
   level instead.
  2. In the manager Redirect code, I set this flag on the channel
   if the channel has a non-null pbx pointer. I did the same for the
   second (chan2) channel, which gets run if name2 is set...
   and the first succeeds.
  3. I restored the ending of the cdr for the pbx loop h-exten
   running code. Don't know why it was removed in the first place.
  4. The first attempt at the fix for this bug was to place code
     directly in the async_goto routine, which was called from a
     large number of places, and could affect a large number of
     cases, so I tested that fix against a fair number of transfer
     scenarios, both with and without the patch. In the process,
     I saw that putting the fix in async_goto seemed not to affect
     any of the blind or attended scenarios, but still, I was
     was highly concerned that some other scenarios I had not tested
     might be negatively impacted, so I refined the patch to 
     its current scope, and jmls tested both. In the process, tho,
     I saw that blind xfers in one situation, when the one-touch
     blind-xfer feature is used by the peer, we got strange 
     h-exten behavior.  So, I  inserted code to swap CDRs and
     to set the HANGUP_DONT field, to get uniform behavior.
  5. I added code to the bridge to obey the HANGUP_DONT flag,
     skipping both publishing the bridge CDR, and running
     the h-exten; they will be done at the pbx-loop (higher)
     level instead.
  6. I removed all the debug logs from the patch before committing.
  7. I moved the AUTOLOOP set/reset in the h-exten code in res_features
     so it's only done if the h-exten is going to be run. A very
     minor performance improvement, but technically correct.
  
  
  (closes issue #14241)
  Reported by: jmls
  Patches:
        14241_redirect_no_bridgeCDR_or_h_exten_via_transfer uploaded by murf (license 17)
  Tested by: murf, jmls
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@172063 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-28 20:31:06 +00:00
Terry Wilson 01b95990b0 Make a proper builtin attended transfer to parking work
This is an ugly hack from 1.4 that allows the timeout callback from a parked
call to use the right channel name for the callback when the park is done with
a builtin attended transfer (that isn't completed early).  This hasn't ever
worked in trunk and no one has complained yet, so eh.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@169510 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-20 19:22:24 +00:00
Terry Wilson a6855a48b2 Merged revisions 169485 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r169485 | twilson | 2009-01-20 12:40:56 -0600 (Tue, 20 Jan 2009) | 6 lines
  
  Don't play audio to the channel if we've masqueraded
  
  (closes issue #14066)
  Reported by: bluefox
  Tested by: otherwiseguy, bluefox
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@169486 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-20 18:48:14 +00:00
Terry Wilson ec1cfe02d1 Merged revisions 168716 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r168716 | twilson | 2009-01-15 12:22:49 -0600 (Thu, 15 Jan 2009) | 12 lines
  
  Convert call to park_call_full to masq_park_call_announce
  
  Since we removed the AST_PBX_KEEPALIVE return value, we need to use masqueraded
  parking, otherwise we will try to call ast_hangup() in __pbx_run() and in
  do_parking_thread() and then promptly crash.
  (closes issue #14215)
  	Reported by: waverly360	
  	Tested by: otherwiseguy
  (closes issue #14228)
  	Reported by: kobaz
  	Tested by: otherwiseguy
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@168941 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-16 22:16:23 +00:00
Steve Murphy aa905e347e Merged revisions 166093 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

In order to merge this 1.4 patch into trunk,
I had to resolve some conflicts and wait for
Russell to make some changes to res_agi.
I re-ran all the tests; 39 calls in all, and
made fairly careful notes and comparisons: I
don't want this to blow up some aspect of 
asterisk; I completely removed the KEEPALIVE
from the pbx.h decls. The first 3 scenarios
involving feature park; feature xfer to 700;
hookflash park to Park() app call all behave
the same, don't appear to leave hung channels,
and no crashes.

........
  r166093 | murf | 2008-12-19 15:30:32 -0700 (Fri, 19 Dec 2008) | 131 lines
  
  This merges the masqpark branch into 1.4
  
  These changes eliminate the need for (and use of)
  the KEEPALIVE return code in res_features.c;
  There are other places that use this result code
  for similar purposes at a higher level, these appear
  to be left alone in 1.4, but attacked in trunk.
  
  The reason these changes are being made in 1.4, is
  that parking ends a channel's life, in some situations,
  and the code in the bridge (and some other places),
  was not checking the result code properly, and dereferencing
  the channel pointer, which could lead to memory corruption
  and crashes.
  
  Calling the masq_park function eliminates this danger 
  in higher levels.
  
  A series of previous commits have replaced some parking calls
  with masq_park, but this patch puts them ALL to rest,
  (except one, purposely left alone because a masquerade
  is done anyway), and gets rid of the code that tests
  the KEEPALIVE result, and the NOHANGUP_PEER result codes.
  
  While bug 13820 inspired this work, this patch does
  not solve all the problems mentioned there.
  
  I have tested this patch (again) to make sure I have
  not introduced regressions. 
  
  Crashes that occurred when a parked party hung up
  while the parking party was listening to the numbers
  of the parking stall being assigned, is eliminated.
  
  These are the cases where parking code may be activated:
  
  1. Feature one touch (eg. *3)
  2. Feature blind xfer to parking lot (eg ##700)
  3. Run Park() app from dialplan (eg sip xfer to 700)
     (eg. dahdi hookflash xfer to 700)
  4. Run Park via manager.
  
  The interesting testing cases for parking are:
  I. A calls B, A parks B
      a. B hangs up while A is getting the numbers announced.
      b. B hangs up after A gets the announcement, but 
         before the parking time expires
      c. B waits, time expires, A is redialed,
         A answers, B and A are connected, after
         which, B hangs up.
      d. C picks up B while still in parking lot.
  
  II. A calls B, B parks A
      a. A hangs up while B is getting the numbers announced.
      b. A hangs up after B gets the announcement, but 
         before the parking time expires
      c. A waits, time expires, B is redialed,
         B answers, A and B are connected, after
         which, A hangs up.
      d. C picks up A while still in parking lot.
  
  Testing this throroughly involves acting all the permutations
  of I and II, in situations 1,2,3, and 4.
  
  Since I added a few more changes (ALL references to KEEPALIVE in the bridge
  code eliimated (I missed one earlier), I retested
  most of the above cases, and no crashes.
  
  H-extension weirdness.
  
  Current h-extension execution is not completely
  correct for several of the cases.
  
  For the case where A calls B, and A parks B, the
  'h' exten is run on A's channel as soon as the park
  is accomplished. This is expected behavior.
  
  But when A calls B, and B parks A, this will be
  current behavior:
  
  After B parks A, B is hung up by the system, and
  the 'h' (hangup) exten gets run, but the channel
  mentioned will be a derivative of A's...
  
  Thus, if A is DAHDI/1, and B is DAHDI/2,
  the h-extension will be run on channel
  Parked/DAHDI/1-1<ZOMBIE>, and the 
  start/answer/end info will be those 
  relating to Channel A.
  
  And, in the case where A is reconnected to
  B after the park time expires, when both parties
  hang up after the joyful reunion, no h-exten
  will be run at all.
  
  In the case where C picks up A from the 
  parking lot, when either A or C hang up,
  the h-exten will be run for the C channel.
  
  CDR's are a separate issue, and not addressed
  here.
  
  As to WHY this strange behavior occurs, 
  the answer lies in the procedure followed
  to accomplish handing over the channel
  to the parking manager thread. This procedure
  is called masquerading. In the process,
  a duplicate copy of the channel is created,
  and most of the active data is given to the
  new copy. The original channel gets its name
  changed to XXX<ZOMBIE> and keeps the PBX
  information for the sake of the original
  thread (preserving its role as a call 
  originator, if it had this role to begin
  with), while the new channel is without
  this info and becomes a call target (a
  "peer").
  
  In this case, the parking lot manager
  thread is handed the new (masqueraded)
  channel. It will not run an h-exten
  on the channel if it hangs up while
  in the parking lot. The h exten will
  be run on the original channel instead,
  in the original thread, after the bridge
  completes.
  
  See bug 13820 for our intentions as
  to how to clean up the h exten behavior.

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

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@166665 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-23 18:13:49 +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
Mark Michelson 7828e7a966 Add an appropriate goto if ast_call fails
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@163198 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-11 20:21:44 +00:00
Mark Michelson 62130ba876 Reduce indentation level of ast_feature_request_and_dial
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@163166 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-11 19:40:18 +00:00