Commit Graph

402 Commits

Author SHA1 Message Date
Tilghman Lesher e4c1fc1e4a Merged revisions 235421 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r235421 | tilghman | 2009-12-17 11:17:51 -0600 (Thu, 17 Dec 2009) | 8 lines
  
  Use context from which Macro is executed, not macro context, if applicable.
  Also, ensure that the extension COULD match, not just that it won't match more.
  (closes issue #16113)
   Reported by: OrNix
   Patches: 
         20091216__issue16113.diff.txt uploaded by tilghman (license 14)
   Tested by: OrNix
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@235422 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-12-17 17:19:08 +00:00
Tilghman Lesher d32c333f7c Trim leading/trailing spaces from the filename, to deal with common user error.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@234458 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-12-13 09:41:43 +00:00
David Vossel 176c8a0185 Merged revisions 231853 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r231853 | dvossel | 2009-12-01 15:14:31 -0600 (Tue, 01 Dec 2009) | 3 lines
  
  WaitExten m option with no parameters generates frame with zero datalen but non-null data ptr
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@231867 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-12-01 21:20:19 +00:00
David Brooks bac499e521 Merged revisions 229498 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r229498 | dbrooks | 2009-11-11 13:46:19 -0600 (Wed, 11 Nov 2009) | 8 lines
  
  Solaris doesn't like NULL going to ast_log
  
  Solaris will crash if NULL is passed to ast_log. This simple patch simply uses S_OR to
  get around this.
  
  (closes issue #15392)
  Reported by: yrashk
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@229499 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-11-11 19:48:18 +00:00
Tilghman Lesher 4c8319190b Merged revisions 229360 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r229360 | tilghman | 2009-11-10 16:09:16 -0600 (Tue, 10 Nov 2009) | 12 lines
  
  If two pattern classes start with the same digit and have the same number of characters, they will compare equal.
  The example given in the issue report is that of [234] and [246], which have
  these characteristics, yet they are clearly not equivalent.  The code still
  uses these two characteristics, yet when the two scores compare equal, an
  additional check will be done to compare all characters within the class to
  verify equality.
  (closes issue #15421)
   Reported by: jsmith
   Patches: 
         20091109__issue15421__2.diff.txt uploaded by tilghman (license 14)
   Tested by: jsmith, thedavidfactor
........


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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@227580 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-11-04 14:05:12 +00:00
Tilghman Lesher 496282194c Merged revisions 225105 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r225105 | tilghman | 2009-10-21 11:02:12 -0500 (Wed, 21 Oct 2009) | 4 lines
  
  Fix documentation for ast_softhangup() and correct the misuse thereof.
  (closes issue #16103)
   Reported by: majorbloodnok
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@225360 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-10-22 17:11:23 +00:00
Tilghman Lesher c74a2d0b45 Create an API for adding an optional time unit onto the ends of time periods.
Two examples of its use are included, and the usage could be expanded in some
cases into certain configuration options where time periods are specified.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@224225 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-10-15 22:33:30 +00:00
David Vossel 9456ab2724 Deadlock in channel masquerade handling
Channels are stored in an ao2_container.  When accessing an item within
an ao2_container the proper locking order is to first lock the container,
and then the items within it.

In ast_do_masquerade both the clone and original channel must be locked
for the entire duration of the function.  The problem with this is that
it attemptes to unlink and link these channels back into the ao2_container
when one of the channel's name changes.  This is invalid locking order as
the process of unlinking and linking will lock the ao2_container while
the channels are locked!!! Now, both the channels in do_masquerade are
unlinked from the ao2_container and then locked for the entire function.
At the end of the function both channels are unlocked and linked back
into the container with their new names as hash values.

This new method of requiring all channels and tech pvts to be unlocked
before ast_do_masquerade() or ast_change_name() required several
changes throughout the code base.

(closes issue #15911)
Reported by: russell
Patches:
      masq_deadlock_trunk.diff uploaded by dvossel (license 671)
Tested by: dvossel, atis

(closes issue #15618)
Reported by: lmsteffan
Patches:
      deadlock_local_attended_transfers_trunk.diff uploaded by dvossel (license 671)
Tested by: lmsteffan, dvossel

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@222761 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-10-07 22:58:38 +00:00
Tilghman Lesher 1cf5422dc8 Merged revisions 220288 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r220288 | tilghman | 2009-09-24 14:39:41 -0500 (Thu, 24 Sep 2009) | 6 lines
  
  Implicitly sending a progress signal breaks some applications.
  Call Progress() in your dialplan if you explicitly want progress to be sent.
  (Reverts change 216430, closes issue #15957)
  Reported by: Pavel Troller on the Asterisk-Dev mailing list
  http://lists.digium.com/pipermail/asterisk-dev/2009-September/039897.html
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@220289 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-09-24 19:41:02 +00:00
David Brooks 077b44c43f Merged revisions 218867 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r218867 | dbrooks | 2009-09-16 13:00:45 -0500 (Wed, 16 Sep 2009) | 13 lines
  
  Fixes CID pattern matching behavior to mirror that of extension pattern matching.
  
  Pattern matching for extensions uses a type of scoring system, giving values for
  specificity to each character in the pattern. Unfortunately, this is done character
  by character, in order. This does lead to some less specific patterns being first
  in line for matching, but it will usually get the job done.
  
  This patch merely brings CID matching to the same level as extension matching.
  This patch does not attempt to tackle the problem shared by extension matching.
  
  (closes issue #14708)
  Reported by: klaus3000
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@218868 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-09-16 18:06:42 +00:00
Tilghman Lesher 1ca9bc4e1e Check the origination priority for more matches, not the current priority.
Found by Pavel Troller on the -dev list.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@218050 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-09-11 05:58:11 +00:00
Tilghman Lesher ad69df830d Enable turning off the application delimiter warning with the 'dontwarn' option.
Suggested on the -dev list, and implemented in an alternate way by me.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@216547 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-09-04 17:31:44 +00:00
Olle Johansson 98f18d56b8 Merged revisions 216430 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r216430 | oej | 2009-09-04 15:45:48 +0200 (Fre, 04 Sep 2009) | 27 lines

Make apps send PROGRESS control frame for early media and fix too early media issue in SIP

The issue at hand is that some legacy (dying) PBX systems send empty media frames on PRI
links *before* any call progress. The SIP channel receives these frames and by default
signals 183 Session progress and starts sending media. This will cause phones to 
play silence and ignore the later 180 ringing message. A bad user experience.

The fix is twofold:
- We discovered that asterisk apps that support early media ("noanswer") did not send
  any PROGRESS frame to indicate early media. Fixed.
- We introduce a setting in chan_sip so that users can disable any relay of media frames
  before the outbound channel actually indicates any sort of call progress.
  In 1.4, 1.6.0 and 1.6.1, this will be disabled for backward compatibility. In later versions
  of Asterisk, this will be enabled. We don't assume that it will change your Asterisk
  phone experience - only for the better.

We encourage third-party application developers to make sure that if they have applications
that wants to send early media, add a PROGRESS control frame transmission to make sure that
all channel drivers actually will start sending early media. This has not been the default
in Asterisk previous to this patch, so if you got inspiration from our code, you need to
update accordingly. Sorry for the trouble and thanks for your support.

This code has been running for a few months in a large scale installation (over 250
servers with PRI and/or BRI links to old PBX systems). 
That's no proof that this is an excellent patch, but, well, it's tested :-)


........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@216438 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-09-04 14:02:34 +00:00
Tilghman Lesher c1b4f0c4c9 Merged revisions 213970 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r213970 | tilghman | 2009-08-25 01:34:44 -0500 (Tue, 25 Aug 2009) | 7 lines
  
  Improve error message by informing user exactly which function is missing a parethesis.
  (closes issue #15242)
   Reported by: Nick_Lewis
   Patches: 
         pbx.c-funcparenthesis.patch2 uploaded by dbrooks (license 790)
         pbx.c-funcparenthesis-1.4.diff uploaded by loloski (license 68)
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@213971 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-08-25 06:35:37 +00:00
Tilghman Lesher 642bec4d6f AST-2009-005
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@211539 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-08-10 19:20:57 +00:00
Matthew Nicholson a638000451 Fix a CEL related regression with hints updating by subscribing to AST_DEVICE_STATE instead of AST_DEVICE_STATE_CHANGED.
(closes issue #15440)
Reported by: lmsteffan


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@205469 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-07-08 23:07:09 +00:00
David Vossel e39a252b1e Merged revisions 205409 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r205409 | dvossel | 2009-07-08 16:35:12 -0500 (Wed, 08 Jul 2009) | 6 lines
  
  moving ast_devstate_to_extenstate to pbx.c from devicestate.c
  
  ast_devstate_to_extenstate belongs in pbx.c.  This change
  fixes a compile time error with chan_vpb as well.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@205412 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-07-08 22:15:06 +00:00
David Vossel 48c9a85d91 Merged revisions 204681 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r204681 | dvossel | 2009-07-02 10:05:57 -0500 (Thu, 02 Jul 2009) | 14 lines
  
  Improved mapping of extension states from combined device states.
  
  This fixes a few issues with incorrect extension states and adds
  a cli command, core show device2extenstate, to display all possible
  state mappings.
  
  (closes issue #15413)
  Reported by: legart
  Patches:
        exten_helper.diff uploaded by dvossel (license 671)
  Tested by: dvossel, legart, amilcar
  
  Review: https://reviewboard.asterisk.org/r/301/
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@204710 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-07-02 16:03:44 +00:00
Russell Bryant cce4fad522 Make invalid hints report Unavailable instead of Idle.
(closes issue #14413)
Reported by: pj


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@203702 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-26 19:31:14 +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
David Brooks df649a8671 Fixes the argument order in definition of new_find_extension().
In the definition of new_find_extension(), the arguments 'callerid' and
'label' were swapped. The prototype declaration and all calls to the
function are ordered 'callerid' then 'label', but the function itself
was ordered 'label' then 'callerid'.

(closes issue #15303)
Reported by: JimDickenson


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@199957 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-10 20:00:45 +00:00
Sean Bright 3abe8a963e Add new ast_complete_applications function so that we can use it with the
'channel originate ... application <app>' CLI command.

(And yeah, I cleaned up some whitespace in res_clioriginate.c... big whoop,
wanna fight about it!?)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@196758 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-26 14:36:11 +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
Sean Bright fcda626f3c Fix build under dev mode and remove some casts that are no longer necessary as
a result of the const-ify the world patch.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@196227 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-22 16:10:33 +00:00
Eliel C. Sardanons bb838bc67a Avoid using prototypes when not necessary (it is already defined in the header
file).
Make log_match_char_tree() static to main/pbx.c (only used there).



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@196114 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-22 13:34:01 +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
Eliel C. Sardanons d24179825f Warn about the use of the application WaitExten() within a Macro().
Update applications documentation to warn the user about the use of the
WaitExten() application within a Macro(). Recommend the use of Read()
instead.

(closes issue #14444)
Reported by: ewieling


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@195162 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-18 14:45:23 +00:00
Eliel C. Sardanons 766972a3cd Fix a missing unlock in case of error, and a missing free().
Always free the allocated memory for a string field, because
we are always using it (not only when xmldocs are enabled).
Also if there is an error allocating memory for the string field
remember to unlock the list of registered applications, before returning.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@194945 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-16 18:32:11 +00:00
Tilghman Lesher 5a3797643c If the timing ended on a zero, then we would loop forever.
(closes issue #14983)
 Reported by: teox
 Patches: 
       20090513__issue14983.diff.txt uploaded by tilghman (license 14)
 Tested by: teox


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@194430 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-14 16:22:14 +00:00
Tilghman Lesher b399b5389d Merged revisions 194137 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r194137 | tilghman | 2009-05-12 19:52:03 -0500 (Tue, 12 May 2009) | 7 lines
  
  Fix logic for how to proceed with a single digit extension.
  (closes issue #15091)
   Reported by: andrew
   Patches: 
         20090512__issue15091.diff.txt uploaded by tilghman (license 14)
   Tested by: andrew
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@194138 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-13 00:52:49 +00:00
Tilghman Lesher c524f905a6 Two fixes found while debugging with ast_backtrace():
1) If MALLOC_DEBUG is used when concurrently using ast_backtrace, the free()
used in that routine will trigger an error, because the memory was allocated
internally to libc, where we could not intercept that call to wrap it.
Therefore, it's not memory we knew about, and the free is reported as an
error.

2) Now that channels are objects, the old hack of initializing a channel
to all zeroes no longer works, since we may try to call something like
ast_channel_lock() within a function on that reference.  In that case, it's
reported as an error, because the pointer isn't an object reference.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@194101 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-13 00:13:43 +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
Tilghman Lesher 9cd0a94aeb Merged revisions 193119 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r193119 | tilghman | 2009-05-07 18:41:11 -0500 (Thu, 07 May 2009) | 19 lines
  
  Fix Background within a Macro for FreePBX.
  If the single digit DTMF is an extension in the specified context, then
  go there and signal no DTMF.  Otherwise, we should exit with that DTMF.
  If we're in Macro, we'll exit and seek that DTMF as the beginning of an
  extension in the Macro's calling context.  If we're not in Macro, then
  we'll simply seek that extension in the calling context.  Previously,
  someone complained about the behavior as it related to the interior of a
  Gosub routine, and the fix (#14011) inadvertently broke FreePBX
  (#14940).  This change should fix both of these situations, but with the
  possible incompatibility that if a single digit extension does not exist
  (but a longer extension COULD have matched), it would have previously
  gone immediately to the "i" extension, but will now need to wait for a
  timeout.
  (closes issue #14940)
   Reported by: p_lindheimer
   Patches: 
         20090420__bug14940.diff.txt uploaded by tilghman (license 14)
   Tested by: p_lindheimer
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@193120 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-07 23:42:28 +00:00
Jeff Peeler 658f81cb57 If no extension was found in the pattern tree, don't crash.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@192853 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-06 22:02:46 +00:00
Tilghman Lesher ec37b8e527 Part of the merge did not happen correctly, which resulted in a compile error
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@191211 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-29 22:23:27 +00:00
Tilghman Lesher a866a75900 Merge str_substitution branch.
This branch adds additional methods to dialplan functions, whereby the result
buffers are now dynamic buffers, which can be expanded to the size of any
result.  No longer are variable substitutions limited to 4095 bytes of data.
In addition, the common case of needing buffers much smaller than that will
enable substitution to only take up the amount of memory actually needed.
The existing variable substitution routines are still available, but users
of those API calls should transition to using the dynamic-buffer APIs.
Reviewboard: http://reviewboard.digium.com/r/174/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@191140 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-29 18:53:01 +00:00
Tilghman Lesher b88343b248 Don't warn on pipe in the System call.
(closes issue #14979)
 Reported by: pj


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@190726 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-27 19:34:48 +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
Tilghman Lesher d6c48bc134 Labels are sometimes (most of the time?) NULL for extensions.
(closes issue #14895)
 Reported by: chris-mac
 Patches: 
       20090423__bug14895__2.diff.txt uploaded by tilghman (license 14)
 Tested by: lmadsen


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@190352 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-23 20:42:11 +00:00
Matthew Nicholson 37213d492e Merged revisions 189009 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r189009 | mnicholson | 2009-04-17 10:43:09 -0500 (Fri, 17 Apr 2009) | 5 lines
  
  Make Busy() application set the CDR disposition to BUSY.
  
  (closes issue #14306)
  Reported by: cristiandimache
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@189010 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-17 15:44:18 +00:00
Mark Michelson f7292de7ba Fix a spacing issue that I claimed I would when I committed this code.
Nothing major though.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@188942 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-17 14:33:50 +00:00
Mark Michelson 6c29f76d2c Several fixes to the extenpatternmatchnew logic.
1. Differentiate between literal characters in an extension
and characters that should be treated as a pattern match. Prior to
these fixes, an extension such as NNN would be treated as a pattern,
rather than a literal string of N's.

2. Fixed the logic used when matching an extension with a bracketed
expression, such as 2[5-7]6.

3. Removed all areas of code that were executed when NOT_NOW was
#defined. The code in these areas had the potential to crash, for
one thing, and the actual intent of these blocks seemed counterproductive.

4. Fixed many many coding guidelines problems I encountered while looking
through the corresponding code.

5. Added failure cases and warning messages for when duplicate extensions
are encountered.

6. Miscellaneous fixes to incorrect or redundant statements.

(closes issue #14615)
Reported by: steinwej
Tested by: mmichelson

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@188901 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-17 13:29:33 +00:00
Tilghman Lesher a74fda63fd As suggested by Russell, warn users when their dialplan arguments contain pipes, but not commas.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@188210 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-14 05:45:13 +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 de4af72f9f Add ability for dialplan execution to continue when caller hangs up.
The F option to app_dial has been modified to accept no parameters and perform
the above functionality. I don't see anywhere else that is doing function
overloading, but this really is the best place for this operation because:

- It makes it close to the 'g' option in the argument list which provides
similar functionality.
- The existing code to support the current F option provides a very
convienient location to add this new feature.

(closes issue #12381)
Reported by: michael-fig



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@187491 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-09 19:10:02 +00:00
Russell Bryant b564b2105f Change g_eid to ast_eid_default.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@184630 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-27 14:00:18 +00:00
Tilghman Lesher ac7e490b94 Spacing changes only
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@181027 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-11 00:28:28 +00:00
Tilghman Lesher 4ec79becd3 Merged revisions 177786 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r177786 | tilghman | 2009-02-20 16:59:52 -0600 (Fri, 20 Feb 2009) | 9 lines
  
  Don't print the CR-NL combination when we aren't outputting to the manager.
  
  An embedded CR-NL in a CLI command screws up several AMI parsers that don't
  expect to see that combination in the middle of output.
  
  (Closes issue #14305)
  Reported by: martins
  Patch by: tilghman
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@177787 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-20 23:02:35 +00:00
Steve Murphy 0fe1df19df This patch fixes merge_contexts_and_delete so it does not deadlock when hints are present.
Reason: when I re-engineered the merge_and_delete func to
reduce its lock time, I failed to notice that the 
functions it calls still also do locking as before.
This leads to deadlocks on dialplan reloads, when
there are actually living, subscribed hints registered
in the system.

While the reporter come across this problem while using
AEL, I might note that these deadlocks should also happen
if extensions.conf were used.

Here I added these routines to pbx.c:

ast_add_extension_nolock
add_pri_lockopt
ast_add_extension2_lockopt
find_context
add_hint_nolock

All of the above routines are static and restricted
to be used only within pbx.c, and more specifically
within the merge_contexts_and_delete routine.

They are pretty much the same as their counterparts
except they don't lock contexts or hints.

Most of them now do the real work of their
name-alike, with optional locking via extra arguments,
and are called by their name-alike. The goal was to
have the original functions so they would behave
exactly as before.

Both PJ and I tested these fixes, and the deadlocking
problem is no longer encountered.

(closes issue #14357)
Reported by: pj
Patches:
      14357.diff uploaded by murf (license 17)
Tested by: pj, murf



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@176943 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-18 15:35:26 +00:00
Russell Bryant a844cfa904 Fix a number of incorrect uses of strncpy().
The big problem here is that the 3rd argument provided in these uses of strncpy()
did not reserve a byte for the null terminator, leaving the potential for writing
one byte past the end of the buffer.

Aside from this, there were coding guidelines violations with regards to spacing,
as well as hard coded lengths being used instead of sizeof().


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@176901 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-18 06:00: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 184872fdfd Fix a race condition that caused device states to become incorrect for hints.
The problem here is that the hint processing code was subscribed to the wrong
event type.  So, it started processing state for a hint too soon, before the
device state cache had been updated.

Also, fix a similar bug in app_queue, as it was also subscribed to the wrong
event type.

(closes issue #14461)
Reported by: alecdavis


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@176557 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-17 17:33:38 +00:00
Russell Bryant 6a0773602a add missing </para>
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@175623 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-13 20:23:39 +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
Tilghman Lesher f90021fdd0 Ensure that commas placed in the middle of extension character classes do not
interfere with correct parsing of the extension.  Also, if an unterminated
character class DOES make its way into the pbx core (through some other
method), ensure that it does not crash Asterisk.
(closes issue #14362)
 Reported by: Nick_Lewis
 Patches: 
       20090129__bug14362.diff.txt uploaded by Corydon76 (license 14)
 Tested by: Corydon76


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@173311 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-04 00:43:52 +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
Joshua Colp 49785e775e Merged revisions 170050 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r170050 | file | 2009-01-22 11:13:56 -0400 (Thu, 22 Jan 2009) | 6 lines
  
  Do a string comparison instead of pointer comparison since some people specify the context they are actually in as an argument to get around some funkiness.
  (closes issue #14011)
  Reported by: dveiga
  Patches:
        pbx.c.patch uploaded by dveiga (license 665)
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@170051 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-22 15:14:50 +00:00
Joshua Colp 99f31b91cf Merged revisions 169867 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r169867 | file | 2009-01-21 19:20:47 -0400 (Wed, 21 Jan 2009) | 4 lines
  
  Read lock the contexts to maintain the locking order when we are notified that the state of a device has changed.
  (closes issue #13839)
  Reported by: mcallist
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@169869 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-21 23:25: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
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 50a25ac847 Remove the need for AST_PBX_KEEPALIVE with the GoSub option from Dial.
This is part of an effort to completely remove AST_PBX_KEEPALIVE and other
similar return codes from the source.  While this usage was perfectly safe,
there are others that are problematic.  Since we know ahead of time that
we do not want to PBX to destroy the channel, the PBX API has been changed
so that information can be provided as an argument, instead, thus removing
the need for the KEEPALIVE return value.

Further changes to get rid of KEEPALIVE and related code is being done by
murf.  There is a patch up for that on review 29.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@165723 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-18 19:33:42 +00:00
Tilghman Lesher 27cbfc1bd5 Add timezone to the possible fields in a timespec.
(closes issue #14028)
 Reported by: mostyn
 Patches: 
       timezone-v2.patch uploaded by mostyn (license 398)
       (with additional code guideline fixes and a memory leak fix by me - license 14)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@164976 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-16 22:57:17 +00:00
Steve Murphy 9de00f16f6 (closes issue #14076)
Reported by: toc
Tested by: murf

OK, Well this issue has had its share of flip-flopping.
I found the following:

1. the code in question, in ext_cmp1 in pbx.c, would not
allow two extensions that vary only by any dashes contained
within them, to be defined in the same context.

2. for input dialstrings, dashes are NOT ignored.
So, skipping them when sorting patterns seemed a bit silly.
Thus, you might declare ext 891 in a context, but
if you try dialing 8-9-1, it will NOT match 891.

So, I proposed to remove the code from ext_cmp1 to 
skip the spaces and dashes. Just kept us from 
declaring 891 and 8-9-1 in the same context,
forcing users to generate otherwise uselessly
obfuscated dialplan code to get the same effect.

Then, I tried out 1.4, and found that:

1. you can declare 891 and 8-9-1 in the
same context!

2. You can't define 891, and have 8-9-1 match
it! Nor can you define 8-9-1, and have 891
match it!

So, it appears that my proposal simply restores
the pbx to behaving as it did in 1.4.




git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@164801 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-16 20:04:46 +00:00
Steve Murphy eb73f5673a Merged revisions 164634 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r164634 | murf | 2008-12-16 08:15:58 -0700 (Tue, 16 Dec 2008) | 5 lines

I added a sentence to clarify why - and ' ' are ignored in patterns
as per bug 14076. Leif says he'll put some stuff about it in the
extensions.conf sample, etc.


........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@164648 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-16 15:31:54 +00:00
Tilghman Lesher c8223fc957 Merge ast_str_opaque branch (discontinue usage of ast_str internals)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@163991 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-13 08:36:35 +00:00
Tilghman Lesher 8c89090160 Previously missing line, now the substitution works correctly
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@162930 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-10 23:01:14 +00:00
Tilghman Lesher 689465ba98 Checking global variables here actually overwrote the previous substitution by
channel variables, and in any case, was redundant;
pbx_substitute_variables_helper ALREADY does substitution for global
variables.
(closes issue #13327)
 Reported by: pj


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@162922 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-10 22:48:09 +00:00
Mark Michelson 5f4dc23293 Merged revisions 162265 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r162265 | mmichelson | 2008-12-09 14:28:44 -0600 (Tue, 09 Dec 2008) | 6 lines

If we fail to start a thread for the pbx to run in, we need to
be sure to decrease the number of active calls on the system.

This fix may relate to ABE-1713, but it is not certain yet.


........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@162266 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-09 20:30:07 +00:00
Brandon Kruse 390b5bbcd6 Note that the recently changed waittime parameter is in milliseconds.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@161911 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-08 23:04:49 +00:00
Joshua Colp db99faa00d Fix a regression introduced when the PBX timeouts were converted to milliseconds. collect_digits now gets milliseconds fed to it, not seconds.
(closes issue #14012)
Reported by: dveiga
Patches:
      14012.patch uploaded by bkruse (license 132)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@161787 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-08 18:47:32 +00:00
Russell Bryant de811c9490 Merged revisions 161287 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r161287 | russell | 2008-12-05 08:12:14 -0600 (Fri, 05 Dec 2008) | 2 lines

Fix a NULL format string warning found by buildbot.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@161288 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-05 14:16:24 +00:00
Eliel C. Sardanons 1e8e12efcf Janitor, use ARRAY_LEN() when possible.
(closes issue #13990)
Reported by: eliel
Patches:
      array_len.diff uploaded by eliel (license 64)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@161218 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-05 10:31:25 +00:00
Tilghman Lesher 3d4c0cd421 Merged revisions 160207 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r160207 | tilghman | 2008-12-01 18:25:16 -0600 (Mon, 01 Dec 2008) | 3 lines
  
  Ensure that Asterisk builds with --enable-dev-mode, even on the latest gcc
  and glibc.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@160208 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-02 00:37:21 +00:00
Russell Bryant bcde91337b Make a formatting change to test a new post-commit hook for reviewboard.
http://reviewboard.digium.com/r/65/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@159666 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-26 22:11:55 +00:00
Russell Bryant bd341895b3 Make a formatting change to test a new post-commit hook for reviewboard.
http://reviewboard.digium.com/r/65/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@159665 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-26 22:08:33 +00:00
Russell Bryant 40a52b50fa Make a formatting change to test a new post-commit hook for reviewboard.
http://reviewboard.digium.com/r/65/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@159664 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-26 22:01:34 +00:00
Tilghman Lesher f9461535d3 Don't limit the length of the hint at the final step (from ~8100 chars max
(or ~500 chars max on LOW_MEMORY) to 80 chars max).  This will allow more
channels to be used in a single hint.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@159162 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-25 17:44:30 +00:00
Tilghman Lesher 35213dff98 Allow space within an extension, when the space is within a character class.
(requested by lmadsen on -dev, patch by me)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@158605 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-21 23:33:22 +00:00
Tilghman Lesher 7bd6f1744b Merged revisions 158600 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r158600 | tilghman | 2008-11-21 17:07:46 -0600 (Fri, 21 Nov 2008) | 5 lines
  
  The passed extension may not be the same in the list as the current entry,
  because we strip spaces when copying the extension into the structure.
  Therefore, use the copied item to place the item into the list.
  (found by lmadsen on -dev, fixed by me)
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@158602 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-21 23:14:11 +00:00
Jeff Peeler 93a59f5bda (closes issue #13891)
Reported by: smurfix

This reverts a change I made in 116297. At the time it seemed the change was required to solve an issue with attempting a transfer but then letting it timeout without dialing any digits. However, I didn't realize that having an empty extension was possible. I'm removing the immediate return that was added in pbx_find_extension if the extension is null.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@156649 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-13 19:17:50 +00:00
Steve Murphy 449c012c68 Merged revisions 156297 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r156297 | murf | 2008-11-12 12:36:16 -0700 (Wed, 12 Nov 2008) | 18 lines

It turns out that the 0x0XX00 codes being returned for
N, X, and Z are off by one, as per conversation with
jsmith on #asterisk-dev;  he was teaching a class
and disconcerted that this published rule was not
being followed, with patterns _NXX, _[1-8]22 and
_[2-9]22... and NXX was winning, but [1-8] should
have been. 

This change, tested on these 3 patterns now 
picks the proper one.

However, this change may surprise users who
set up dialplans based on previous behavior,
which has been there for what, 2 and half 
years or so now.



........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@156299 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-12 19:47:29 +00:00
Michiel van Baak 86f900b201 This commit does two things:
- Add CLI aliases module to asterisk.
- Remove all deprecated CLI commands from the code

Initial work done by file.
Junk-Y and lmadsen did a lot of work and testing to
get the list of deprecated commands into the configuration file.

Deprecated CLI commands are now handled by this new module,
see cli_aliases.conf for more info about that.

ok russellb@ via reviewboard

(closes issue #13735)
Reported by: mvanbaak


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@156120 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-12 06:46:04 +00:00
Eliel C. Sardanons 23adb8e509 Move all the XML documentation API from pbx.c to xmldoc.c.
Export the XML documentation API:
   ast_xmldoc_build_synopsis()
   ast_xmldoc_build_syntax()
   ast_xmldoc_build_description()
   ast_xmldoc_build_seealso()
   ast_xmldoc_build_arguments()
   ast_xmldoc_printable()
   ast_xmldoc_load_documentation()



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@155711 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-10 13:53:23 +00:00
Russell Bryant 1a239454f1 Fix some code in chan_sip that was intended to unlink multiple objects from a
container.  The OBJ_MULTIPLE flag must be provided here.  Otherwise, this would
only remove a single object.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@155241 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-07 14:50:30 +00:00
Eliel C. Sardanons 9cc7bc998b If 'asterisk.conf' is not found, instead of giving up,
load documentation for the 'en_US' language (fix my last
commit).


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@155204 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-07 03:02:01 +00:00
Eliel C. Sardanons 65d4d1eb0f Fix an asterisk crash if no asterisk.conf configuration file is present.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@155175 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-07 02:37:47 +00:00
Eliel C. Sardanons e771f08f60 Simplify the output of [See Also].
Functions are printed without parenthesis like: FUNTION
Applications are printed with parenthesis like: AppName()
Cli commands are printed like: 'core show application'
The other type of references are printed as they are inside the <ref> tag.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@154967 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-06 18:19:00 +00:00
Eliel C. Sardanons 990a6bebe8 Add more SeeAlso references based on TFOT.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@154647 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-05 14:37:07 +00:00
Eliel C. Sardanons f18699be24 - Add more <see-also> based on TFOT.
- Add the 'filename' type to the see-also ref. To be able to reference a filename.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@154578 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-05 13:07:29 +00:00
Sean Bright f349f18eaa GLOB_BRACE is already added to MY_GLOB_FLAGS if it is supported on the
platform.  This should resolve some build errors on Solaris.

(issue #13704)
Reported by: dougm


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@154191 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-04 17:23:33 +00:00
Russell Bryant 5b168ee34b Merge changes from team/group/appdocsxml
This commit introduces the first phase of an effort to manage documentation of the
interfaces in Asterisk in an XML format.  Currently, a new format is available for
applications and dialplan functions.  A good number of conversions to the new format
are also included.

For more information, see the following message to asterisk-dev:

http://lists.digium.com/pipermail/asterisk-dev/2008-October/034968.html


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@153365 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-01 21:10:07 +00:00
Tilghman Lesher fa06ce2e6c Track down and fix annoying lock errors
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@152689 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-10-30 00:45:47 +00:00
Steve Murphy db7299f4bc Hmmm. Nobody (but me) is interested in seeing
the trie info when they do 'dialplan show ...'
(even with debug set to non-zero); so I set up a 
   'dialplan debug [context]' cli command instead, 
to explicitly show just the trie info.  I even
added an extension_exists() call to make sure the
trie info is built. I moved the explanatory header
to above the extension loop to ensure it only prints
once. And it will do this now, whether debug is set
or not.

I removed the trie printing from the 'dialplan show' 
command entirely. 



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@148519 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-10-13 17:14:38 +00:00
Steve Murphy e235a07376 (closes issue #13557)
Reported by: nickpeirson
Patches:
      pbx.c.patch uploaded by nickpeirson (license 579)
      replace_bzero+bcopy.patch uploaded by nickpeirson (license 579)
Tested by: nickpeirson, murf

1. replaced all refs to bzero and bcopy to memset and memmove instead.
2. added a note to the CODING-GUIDELINES
3. add two macros to asterisk.h to prevent bzero, bcopy from creeping
   back into the source
4. removed bzero from configure, configure.ac, autoconfig.h.in




git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@147807 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-10-09 14:17:33 +00:00
Steve Murphy 579177ae80 Merged revisions 144677 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r144677 | murf | 2008-09-26 11:47:13 -0600 (Fri, 26 Sep 2008) | 12 lines

(closes issue #13563)
Reported by: mnicholson
Patches:
      found1.diff uploaded by mnicholson (license 96)

This patch was mainly meant to apply to trunk and 1.6.x,
but I'm applying it to 1.4 also, which should be a perfectly
harmless fix to the vast majority of users who are not using
external switches, but the few who might be affected 
will not have to go to the pain of filing a bug report.


........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@144678 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-09-26 17:50:35 +00:00
Steve Murphy e74584ca3c (closes issue #13557)
Reported by: nickpeirson

The user attached a patch, but the license is not yet
recorded. I took the liberty of finding and replacing
ALL index() calls with strchr() calls, and that
involves more than just main/pbx.c;

chan_oss, app_playback, func_cut also had calls
to index(), and I changed them out. 1.4 had no
references to index() at all.




git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@144569 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-09-25 22:21:28 +00:00
Steve Murphy 67f7ac0499 Merged revisions 142675 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r142675 | murf | 2008-09-11 22:29:34 -0600 (Thu, 11 Sep 2008) | 29 lines

Tested by: sergee, murf, chris-mac, andrew, KNK

This is a "second attempt" to restore the previous "endbeforeh" behavior
in 1.4 and up. In order to capture information concerning all the
legs of transfers in all their infinite combinations, I was forced
to this particular solution by a chain of logical necessities, the
first being that I was not allowed to rewrite the CDR mechanism from 
the ground up!

This change basically leaves the original machinery alone, which allows
IVR and local channel type situations to generate CDR's as normal, but
a channel flag can be set to suppress the normal running of the h exten.
That flag would be set by the code that runs the h exten from the
ast_bridge_call routine, to prevent the h exten from being run twice.
Also, a flag in the ast_bridge_config struct passed into ast_bridge_call
can be used to suppress the running of the h exten in that routine. This
would happen, for instance, if you use the 'g' option in the Dial app.

Running this routine 'early' allows not only the CDR() func to be used
in the h extension for reading CDR variables, but also allows them to
be modified before the CDR is posted to the backends.

While I dearly hope that this patch overcomes all problems, and 
introduces no new problems, reality suggests that surely someone
will have problems. In this case, please re-open 13251 (or 13289),
and we'll see if we can't fix any remaining issues.

** trunk note: some code to suppress the h exten being run 
from app_queue was added; for the 'continue' option available
only in trunk/1.6.x.


........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@142676 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-09-12 04:50:48 +00:00
Russell Bryant 1452b6dd97 Merged revisions 141806 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r141806 | russell | 2008-09-08 16:02:36 -0500 (Mon, 08 Sep 2008) | 7 lines

When doing an async goto, detect if the channel is already in the middle of a
masquerade.  This can happen when chan_local is trying to optimize itself out.
If this happens, fail the async goto instead of bursting into flames.

(closes issue #13435)
Reported by: geoff2010

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@141807 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-09-08 21:05:01 +00:00
Steve Murphy 068859119a In these changes, I have added some explanation
of changes to the Set and MSet apps, so people aren't
so shocked and surprised when they upgrade from
1.4 to 1.6.

Also, for the sake of those upgrading from 1.4 to
1.6 with AEL, I provide automatic support for the 
"old" way of using Set(), that still does the
exact same old thing with quotes and backslashes
and so on as 1.4 did, by having AEL compile in the
use of MSet() instead of Set(), everywhere it inserts
this code.

But, if the app_set var is set to 1.6 or higher,
it uses the "new", non-evaluative Set().

This only usually happens if the user manually 
inserts this into the asterisk.conf file, or runs
the "make samples" command.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@140824 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-09-03 14:01:27 +00:00