Commit Graph

402 Commits

Author SHA1 Message Date
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
Russell Bryant 4e105063a8 Formatting change to test something on the svn server
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@140820 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-09-03 13:41:51 +00:00
Steve Murphy 1c79a23b8e Merged revisions 140670 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

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

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

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

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



........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@140691 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-09-02 22:50:59 +00:00
Steve Murphy ea898dc6c3 Merged revisions 139764 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r139764 | murf | 2008-08-25 09:33:14 -0600 (Mon, 25 Aug 2008) | 9 lines

This patch reverts the changes made via 139347, and 139635, as users
are seeing adverse difference. 

I will un-close 13251.

Back to the drawing board/ concept/ beginning/ whatever!



........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@139770 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-08-25 15:54:18 +00:00
Steve Murphy 2488366a75 Merged revisions 139347 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r139347 | murf | 2008-08-21 17:03:50 -0600 (Thu, 21 Aug 2008) | 47 lines


(closes issue #13251)
Reported by: sergee
Tested by: murf



THis is a bold move for a static release fix, but I wouldn't have
made it if I didn't feel confident (at least a *bit* confident)
that it wouldn't mess everyone up.

The reasoning goes something like this:

1. We simply cannot do anything with CDR's at the current point
(in pbx.c, after the __ast_pbx_run loop). It's way too late to
have any affect on the CDRs. The CDR is already posted and gone,
and the remnants have been cleared.

2. I was very much afraid that moving the running of the 'h'
extension down into the bridge code (where it would be now
practical to do it), would result in a lot more calls to the
'h' exten, so I implemented it as another exten under another
name, but found, to my pleasant surprise, that there was a 
1:1 correspondence to the running of the 'h' exten in the
pbx_run loop, and the new spot at the end of the bridge.
So, I ifdef'd out the current 'h' loop, and moved it into
the bridge code. The only difference I can see is the stuff
about the AST_PBX_KEEPALIVE, and hopefully, if this 
is still an important decision point, I can replicate it
if there are complaints. To be perfectly honest,
the KEEPALIVE situation is not totally clear to me,
and how it relates to a post-bridge situation is less
clear. I suspect the users will point out everything
in total clarity if this steps on anyone's toes!

3. I temporarily swap the bridge_cdr into the channel
before running the 'h' exten, which makes it possible
for users to edit the cdr before it goes out the door.
And, of course, with the endbeforehexten config var set,
the users can also get at the billsec/duration vals.
After the h exten finishes, the cdr is swapped back
and processing continues as normal.

Please, all who deal with CDR's, please test this version
of Asterisk, and file bug reports as appropriate!


........

I also made a little fix to the app_dial's 'e' option,
that is related to my updates.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@139627 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-08-22 22:03:13 +00:00
Steve Murphy 04795d963f These changes are in regards to bug 13249, where users are being surprised by the changes made
to the Set app in trunk/1.6.x, as they come from the 1.4 world. They are only bitten if
they write their AEL dialplan in the 1.4 world, and then carry it over to a trunk/1.6.x 
installation where a "make samples" was executed, or where they hand-edited the 
asterisk.conf file and added the [compat] category with app_set = 1.6 (or higher).

(this commit does not totally solve 13249, at least not yet)

The change involves issueing a single warning while the AEL file is loading, if:
 1. app_set is present in the config file, and set to 1.6 or higher.
 2. there are double quotes in an assignment statement (eg x = "hi there";)
 3. the warning was not already issued.

The standalone app, aelparse, does not (yet) issue this warning. I'd have to
have it read in the asterisk.conf file, and that's a bit of hassle. I'll add
it if users request it, tho.




git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@138815 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-08-19 15:59:12 +00:00
Tilghman Lesher f4586f3018 Also make sure hinting won't crash on reload.
(Closes issue #13312)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@138409 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-08-16 12:52:06 +00:00
Tilghman Lesher 3a5eb27579 Remove deprecated syntax from sample config file
(closes issue #13314)
 Reported by: kue


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@138206 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-08-15 20:35:24 +00:00
Tilghman Lesher d5c673e441 Change free to ast_free_ptr, too
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@138148 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-08-15 19:36:11 +00:00
Tilghman Lesher af69ec03ed e->data can be NULL, so use the safe version of ast_strdup()
(closes issue #13312)
 Reported by: pj


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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@137089 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-08-10 20:23:50 +00:00
Mark Michelson 316fb598d2 Don't allow Answer() to accept a negative argument.
Negative argument means an infinite delay and we
don't want that.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@136635 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-08-07 19:58:32 +00:00
Kevin P. Fleming 7df8b8b848 make datastore creation and destruction a generic API since it is not really channel related, and add the ability to add/find/remove datastores to manager sessions
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@135680 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-08-05 16:56:11 +00:00
Steve Murphy 9051edfa4a (closes issue #13202)
Reported by: falves11
Tested by: murf

falves11 ==

The changes I introduce here seem to clear up the problem
for me. However, if they do not for you, please reopen this
bug, and we'll keep digging.

The root of this problem seems to be a subtle memory corruption
introduced when creating an extension with an empty extension
name. While valgrind cannot detect it outside of DEBUG_MALLOC
mode, when compiled with DEBUG_MALLOC, this is certain death.

The code in main/features.c is a puzzle to me. On the initial
module load, the code is attempting to add the parking extension
before the features.conf file has even been opened!

I just wrapped the offending call with an if() that will not
try to add the extension if the extension name is empty. THis
seems to solve the corruption, and let the "memory show allocations"
work as one would expect.

But, really, adding an extension with an empty name is a seriously
bad thing to allow, as it will mess up all the pattern matching 
algorithms, etc. So, I added a statement to the add_extension2 code to return
a -1 if this is attempted.




git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@135265 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-08-02 04:51:29 +00:00
Steve Murphy 1adecc56eb (closes issue #13144)
Reported by: murf
Tested by: murf
For: J. Geis

The 'data' field in the ast_exten struct was being
'moved' from the current dialplan to the replacement
dialplan. This was not good, as the current dialplan
could have problems in the time between the change
and when the new dialplan is swapped in.

So, I modified the merge_and_delete code to strdup
the 'data' field (the args to the app call), and
then it's freed as normal.

I improved a few messages; I added code to limit
the number of calls to the context_merge_incls_swits_igps_other_registrars()
to one per context. I don't think having it called
multiple times per context was doing anything bad,
but it was inefficient.

I hope this fixes the problems Mr. Geiss was noting in
asterisk-users, see 
http://lists.digium.com/pipermail/asterisk-users/2008-July/215634.html




git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@133299 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-07-23 22:03:48 +00:00
Tilghman Lesher 1517710d7e Change several 'core' commands to be 'dialplan' commands (with appropriate
deprecation, of course)
(closes issue #13016)
 Reported by: caio1982
 Patches: 
       dialplan_globals6.diff uploaded by caio1982 (license 22)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@131606 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-07-17 14:00:27 +00:00
Steve Murphy a1fe3d917f (closes issue #12960)
Reported by: mnicholson

Spent most of the day on this bug, and the
solution was so simple. Just had to find and
understand the problem.

The problem was, that the routine to copy
the existing switches, includes, and ignorepats
from the old context to the new one, wasn't
getting called when the context is already 
existent. (In other words, if AEL is adding
a new context to the mix, they get copied,
but if pbx_config already defined a context,
then the copy wasn't happening. This made
no sense, so I moved the call to copy the 
includes & etc, no matter the case.




git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@131129 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-07-15 23:36:19 +00:00
Tilghman Lesher 49715c05f1 Merged revisions 130959 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r130959 | tilghman | 2008-07-15 12:19:13 -0500 (Tue, 15 Jul 2008) | 8 lines

astman_send_error does not need a newline appended -- the API takes care of
that for us.
(closes issue #13068)
 Reported by: gknispel_proformatique
 Patches: 
       asterisk_1_4_astman_send.patch uploaded by gknispel (license 261)
       asterisk_trunk_astman_send.patch uploaded by gknispel (license 261)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@131044 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-07-15 18:25:34 +00:00
Steve Murphy 42942b790d (closes issue #13041)
Reported by: eliel

OK, now the context registrar slot is strdup'd. It is freed
on destruction. I don't see the need to do this with all
the structs' registrar fields, but if some wild case proves
they should also be handled this way, then we can 
put in the extra work at that time.




git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@130297 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-07-11 22:03:19 +00:00
Steve Murphy 2ca242b2ba (closes issue #13041)
Reported by: eliel
Tested by: murf

(closes issue #12960)
Reported by: mnicholson

In this 'omnibus' fix, I **think** I solved both
the problem in 13041, where unloading pbx_ael.so
caused crashes, or incomplete removal of previous
registrar'ed entries. And I added code to completely
remove all includes, switches, and ignorepats that
had a matching registrar entry, which should
appease 12960.

I also added a lot of seemingly useless brackets
around single statement if's, which helped debug 
so much that I'm leaving them there.

I added a routine to check the correlation between
the extension tree lists and the hashtab 
tables. It can be amazingly helpful when you have
lots of dialplan stuff, and need to narrow
down where a problem is occurring. It's ifdef'd
out by default.

I cleaned up the code around the new CIDmatch code.
It was leaving hanging extens with bad ptrs, getting confused
over which objects to remove, etc. I tightened
up the code and changed the call to remove_exten
in the merge_and_delete code.

I added more conditions to check for empty context
worthy of deletion. It's not empty if there are
any includes, switches, or ignorepats present.

If I've missed anything, please re-open this bug,
and be prepared to supply example dialplan code.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@130145 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-07-11 18:24:31 +00:00
Matthew Fredrickson 0b185a2276 Add Proceeding() application (#13025)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@129399 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-07-09 15:57:06 +00:00
Tilghman Lesher 4ff527903e Code wasn't ready to be merged - see -dev list discussion
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@129307 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-07-09 03:39:59 +00:00
Brett Bryant d185405755 Janitor project to convert sizeof to ARRAY_LEN macro.
(closes issue #13002)
Reported by: caio1982
Patches:
      janitor_arraylen5.diff uploaded by caio1982 (license 22)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@129045 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-07-08 16:40:28 +00:00
Olle Johansson 6f400edeab Changing name of global api call to ast_*
My mistake, pointed out by Russell.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@128378 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-07-06 08:28:58 +00:00
Olle Johansson 45e79490ba Implement flags for AGI in the channel structure so taht "show channels" and
AMI commands can display that a channel is under control of an AGI.

Work inspired by work at customer site, but paid for by Edvina AB


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@128240 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-07-05 20:54:30 +00:00
Tilghman Lesher 12e5c68622 Merged revisions 127973 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r127973 | tilghman | 2008-07-03 22:30:30 -0500 (Thu, 03 Jul 2008) | 8 lines

Fix the 'dialplan remove extension' logic, so that it a) works with cidmatch,
and b) completes contexts correctly when the extension is ambiguous.
(closes issue #12980)
 Reported by: licedey
 Patches: 
       20080703__bug12980.diff.txt uploaded by Corydon76 (license 14)
 Tested by: Corydon76

........


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

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

The CDRfix4/5/6 omnibus cdr fixes.

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

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


(closes issue #11849)
Reported by: greyvoip

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

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

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



........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@127793 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-07-03 17:16:44 +00:00
Tilghman Lesher 6d5b1d76ab If we don't match registrar when destroying a context, it can cause a crash.
(closes issue #12835)
 Reported by: ys
 Patches: 
       pbx.c.diff uploaded by ys (license 281)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@123358 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-17 18:23:01 +00:00
Steve Murphy f4c85ebd22 (closes issue #12689)
Reported by: ys

Many thanks to ys for doing the research on this problem.
I didn't think it would be best to unlock the contexts
and then relock them after the remove_extension2() call,
so I added an extra arg to remove_extension2() and set it
appropriately in each call. There were not that many.

I considered forcing the code to lock the contexts before
the call to remove_extension2(), but that would require
a slightly greater degree of changes, especially since
the find_context_locked is local to pbx.c

I did a simple sanity test to make sure the code doesn't
mess things up in general.




git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@123165 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-16 20:43:46 +00:00
Russell Bryant e9d72e0cb2 Merge another big set of changes from team/russell/events
This commit merges in the rest of the code needed to support distributed device
state.  There are two main parts to this commit.

Core changes:
 - The device state handling in the core has been updated to understand device
   state across a cluster of Asterisk servers.  Every time the state of a device
   changes, it looks at all of the device states on each node, and determines the
   aggregate device state.  That resulting device state is what is provided to
   modules in Asterisk that take actions based on the state of a device.

New module, res_ais:
 - A module has been written to facilitate the communication of events between
   nodes in a cluster of Asterisk servers.  This module uses the SAForum AIS
   (Service Availability Forum Application Interface Specification) CLM and EVT
   services (Cluster Management and Event) to handle this task.  This module
   currently supports sharing Voicemail MWI (Message Waiting Indication) and
   device state events between servers.  It has been tested with openais, though
   other implementations of the spec do exist.

For more information on testing distributed device state, see the following doc:
  - doc/distributed_devstate.txt


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@121559 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-10 15:12:17 +00:00
Russell Bryant 42c1e3601e Merge another change from team/russell/events
This commit breaks out some logic from pbx.c into a simple API.  The hint
processing code had logic for taking the state from multiple devices and
turning that into the state for a single extension.  So, I broke this out
and made an API that lets you take multiple device states and determine
the aggregate device state.  I needed this for some core device state changes
to support distributed device state.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@121501 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-10 14:06:29 +00:00
Russell Bryant f4a8062e93 Merge another change from team/russell/events ...
DUNDi uses a concept called the Entity ID for unique server identifiers.  I have
pulled out the handling of EIDs and made it something available to all of Asterisk.
There is now a global Entity ID that can be used for other purposes as well, such
as code providing distributed device state, which is why I did this.  The global
Entity ID is set automatically, just like it was done in DUNDi, but it can also be
set in asterisk.conf.  DUNDi will now use this global EID unless one is specified
in dundi.conf.

The current EID for the system can be seen in the "core show settings" CLI command.
It is also available in the dialplan via the ENTITYID variable.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@121439 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-10 12:48:50 +00:00
Tilghman Lesher 2d825ed7de Implement FINDLABEL matching for the new extension matching engine.
(closes issue #12800)
 Reported by: chris-mac
 Patches: 
       20080608__bug12800.diff.txt uploaded by Corydon76 (license 14)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@121279 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-09 16:35:06 +00:00
Tilghman Lesher ab988ac6f4 Make extension match characters case-insensitive.
(closes issue #12777)
 Reported by: jsmith
 Patches: 
       lower_case_patterns-trunk-v1.patch uploaded by jsmith (license 15)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@121010 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-06 19:55:08 +00:00
Steve Murphy d0384ab3aa a small fix for a crash that occurs when compiling AEL with global vars
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@120828 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-05 21:34:42 +00:00
Tilghman Lesher 12cf254253 MSet doesn't necessarily need chan to be set
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@120477 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-04 20:34:52 +00:00
Tilghman Lesher 76506b7baa Move compatibility options into asterisk.conf, default them to on for upgrades,
and off for new installations.  This includes the translation from pipes to commas
for pbx_realtime and the EXEC command for AGI, as well as the change to the Set
application not to support multiple variables at once.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@120171 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-03 22:05:16 +00:00
Tilghman Lesher 316e334751 Change space-zero to now evaluate to false, as is expected by a great many.
(Inspired by a post on the -users list)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@118223 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-05-25 14:31:29 +00:00
Joshua Colp 0d85a0eff7 Add a missing context unlock.
(closes issue #12649)
Reported by: ys
Patches:
      pbx.c.diff uploaded by ys (license 281)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@116461 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-05-14 21:11:49 +00:00
Jeff Peeler 4729632721 Fixed a few problems with multiparking: call not being parked in the correct parking spot, caller not being notified of parking spot position, and improperly hanging up the call during a transfer due to timing out (not providing the extension in which to transfer).
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@116297 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-05-14 16:52:30 +00:00
Russell Bryant e40c662a06 Merged revisions 115551 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r115551 | russell | 2008-05-08 10:24:54 -0500 (Thu, 08 May 2008) | 4 lines

Don't use a channel before checking for channel allocation failure.
(closes issue #12609)
Reported by: edantie

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@115552 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-05-08 15:26:49 +00:00
Dwayne M. Hubbard ca4ae77c91 pbx uses a taskprocessor for device state changes
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@115272 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-05-03 04:12:54 +00:00
Tilghman Lesher b5a127daac Modify TIMEOUT() to be accurate down to the millisecond.
(closes issue #10540)
 Reported by: spendergrass
 Patches: 
       20080417__bug10540.diff.txt uploaded by Corydon76 (license 14)
 Tested by: blitzrage


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@115076 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-05-01 23:06:23 +00:00
Tilghman Lesher 6a81da594d Add incomplete matching to PBX code and app_dial
(closes issue #12351)
 Reported by: Corydon76
 Patches: 
       20080402__pbx_incomplete__3.diff.txt uploaded by Corydon76 (license 14)
       pbx_incomplete_with_timeout.diff uploaded by fabled (license 448)
 Tested by: Corydon76, fabled


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114773 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-28 16:37:45 +00:00
Joshua Colp c3dd5e3e27 Merged revisions 114579 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r114579 | file | 2008-04-23 11:54:11 -0300 (Wed, 23 Apr 2008) | 4 lines

Instead of stopping dialplan execution when SayNumber attempts to say a large number that it can not print out a message informing the user and continue on.
(closes issue #12502)
Reported by: bcnit

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114580 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-23 14:55:03 +00:00
Steve Murphy 76155d60ce (closes issue #12469)
Reported by: triccyx

I had a bit a problem reproducing this in my setup (trying not to disturb my other stuff)
but finally, I got it. The problem appears to be that the extension is being added in
replace mode, which kinda assumes that the pattern trie has been formed, when in fact,
in this case, it was not. The checks being done are not nec. when the tree is not yet
formed, as changes like this will be summarized when the trie is formed in the future.

I tested the fix, and the crash no longer happens. Feel free to open the bug again if
this fix doesn't cure the problem.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114553 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-22 21:57:57 +00:00
Jason Parker 6f549bc324 Allow setqueuevar=yes (et al) to work, after changes to pbx_builtin_setvar()
(closes issue #12490)
Reported by: bcnit
Patches:
      12490-queuevars-3.diff uploaded by qwell (license 4)
Tested by: qwell


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114540 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-22 18:14:09 +00:00
Steve Murphy 5b4222c9de These changes:
a. fix a self-found problem with SPAWN-ing an extension,
      where matches were not being found
   b. correct some wording in a comment
   c. Add some debug for future debugging.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114146 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-15 19:59:50 +00:00
Mark Michelson 28bd5d88c1 There was a subtle logical difference between 1.4 and trunk with regards to how timeouts
were handled. In 1.4, if the absolute timeout were reached on a call, no matter what
the return value of ast_spawn_extension was, the pbx would attempt to go to the 'T'
extension or hangup otherwise. The rearrangement of this function in trunk made this check
only happen in the case that ast_spawn_extension returned 0. If ast_spawn_extension returned
1, then the fact that the timeout expired resulted in a no-op, and would cause an infinite
loop to occur in __ast_pbx_run. This change fixes this problem. Now timeouts will
behave as they did in 1.4

(closes issue #11550)
Reported by: pj
Tested by: putnopvut



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@113836 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-09 17:48:33 +00:00
Steve Murphy da41d47a83 Bumped across another test set for the new exten pattern matcher, which revealed a problem with the CANMATCH/MATCHMORE modes. Direct matches were getting in the way. Fixed.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@112357 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-01 22:45:10 +00:00
Steve Murphy 2fb0bfba35 (closes issue #12298)
Reported by: falves11
Patches:
      12298.patch1 uploaded by murf (license 17)
Tested by: murf

I have hopes that the changes made over the last few days will
finalize and solidify this code. While there are bound to be 
small tweaks still needed, I feel that the job (at last) is
somewhat completed. Finally, I had a chance to comprehend how
the scoring of extension patterns was done in the previous
version, and I've come very close to using the exact same
criteria in the new pattern matching code. The left-right
sorting is now replicated in the trie structure itself, such
that the first match found will the 'best' match. Compared
the results against 1.4 for several extensions. Replicated
falves11's setup and it works. Used some devious patterns
provided by jsmith, supplemented with a few of my own.
Looks good.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@112289 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-01 20:02:19 +00:00
Steve Murphy 3d4cb09ae8 comment cleanup and iron out a really dumb mistake in handling the '.'-wildcard in the new exten pattern matcher.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@111497 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-27 21:25:55 +00:00
Steve Murphy 6928ccfa02 Merged revisions 111391 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r111391 | murf | 2008-03-27 07:03:28 -0600 (Thu, 27 Mar 2008) | 9 lines

These small documentation updates made in response to a query in
asterisk-users, where a user was using Playback, but needed the
features of Background, and had no idea that Background existed,
or that it might provide the features he needed. I thought the
best way to avert these kinds of queries was to provide "See Also"
references in all three of "Background", "Playback", "WaitExten".
Perhaps a project to do this with all related apps is in order.


........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@111410 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-27 13:29:41 +00:00
Joshua Colp e097cc7221 Add the ability to use a pattern match for a hint.
(closes issue #7767)
Reported by: Corydon76
Patches:
      20070314__simple_hint_lookup.diff.txt uploaded by Corydon76
      pbx-trunk-98436.diff uploaded by plack (license 365)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@109970 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-19 16:54:12 +00:00
Russell Bryant 4c6486782f Fix some more breakage that I introduced when changing extension state callbacks to the list macros.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@109910 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-19 15:45:49 +00:00
Russell Bryant 89ad4ace67 Remove an unneeded variable. This compiled, but I missed the uninitialized warning
because I always compile without optimizations turned on.  Sorry!


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@109907 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-19 15:22:13 +00:00
Russell Bryant b47eee2187 Convert handling of extension state callbacks to the list macros.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@109883 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-19 04:32:13 +00:00
Russell Bryant e1bd198bc0 Minor coding style changes, including adding handling for memory allocation failure
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@109842 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-19 04:14:12 +00:00
Steve Murphy 0af58d3f5c (closes issue #12238)
Reported by: mvanbaak
Tested by: murf, mvanbaak

Due to a bug that occurred when merge_contexts_and_delete scanned the "old" or existing contexts, and found a context
that doesn't exist in the new set, yet owned by a different registrar. The context is created in the new set, with the
old registrar, and and all the priorities and extens that have a different registrar are copied into it. But, not the
includes, ignorepats, and switches. I added code to do this immediately after the context is created.

This still leaves a logical hole in the code. If you define a context in two places, (eg. in extensions.conf and also 
in extensions.ael), and they both have includes, but different in composition, no new context will be generated, and
therefore the 'old' includes, switches, and ignorepats will not be copied. I'd have added code to simply add any non-duplicates
into the 'new' context that had a different registrar, but there is one big complication: includes, and switches are definitely
order dependent. (ignorepats I'm not sure about). And we'll have to develop some sort of policy about how we 
merge order dependent lists, especially if the intersection of the two sets is empty. (in other words, they do not have any
elements in common). Do the new go first, or the old? I've elected to punt this issue until a user complains. Hopefully,
this is pretty rare thing.




git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@109169 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-17 17:47:36 +00:00
Russell Bryant 072eb8a913 Remove a double write lock of the contexts lock in ast_wrlock_contexts().
How did this ever work?

(closes issue #12219)
Reported by: ys
Patches: 
      pbx.c.diff uploaded by ys (license 281)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@108894 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-15 16:21:04 +00:00
Tilghman Lesher bdad3c9889 (closes issue #6019)
Reported by: ssokol
 Patches: 
       20080304__bug6019.diff.txt uploaded by Corydon76 (license 14)
 Tested by: putnopvut


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@107231 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-10 21:48:20 +00:00
Russell Bryant 0ee1f43b4a Merged revisions 107161 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r107161 | russell | 2008-03-10 15:17:11 -0500 (Mon, 10 Mar 2008) | 8 lines

Fix another bug specifically related to asynchronous call origination.  Once the
PBX is started on the channel using ast_pbx_start(), then the ownership of the
channel has been passed on to another thread.  We can no longer access it in this
code.  If the channel gets hung up very quickly, it is possible that we could
access a channel that has been free'd.

(inspired by BE-386)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@107162 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-10 20:17:37 +00:00
Russell Bryant 2d95fb33bd Merged revisions 107158 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r107158 | russell | 2008-03-10 15:04:27 -0500 (Mon, 10 Mar 2008) | 9 lines

Fix some bugs related to originating calls.  If the code failed to start a PBX
on the channel (such as if you set a call limit based on the system's load
average), then there were cases where a channel that has already been free'd
using ast_hangup() got accessed.  This caused weird memory corruption and
crashes to occur.

(fixes issue BE-386)
(much debugging credit goes to twilson, final patch written by me)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@107159 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-10 20:05:12 +00:00
Steve Murphy 377e51c4d4 (closes issue #6002)
Reported by: rizzo
Tested by: murf

Proposal of the changes to be made, and then an announcement of how they were accomplished:

http://lists.digium.com/pipermail/asterisk-dev/2008-February/032065.html

and:

http://lists.digium.com/pipermail/asterisk-dev/2008-March/032124.html

Here is a recap, file by file, of what I have done:

pbx/pbx_config.c
pbx/pbx_ael.c

All funcs that were passed a ptr to the context list, now will ALSO be passed a hashtab ptr to the same set.
Why? because (for the time being), the dialplan is stored in both, to facilitate a quick, low-cost move to
hash-tables to speed up dialplan processing. If it was deemed necessary to pass the context LIST, well, it
is just as necessary to have the TABLE available. This is because the list/table in question might not be
the global one, but temporary ones we would use to stage the dialplan on, and then swap into the global
position when things are ready.

We now have one external function for apps to use, "ast_context_find_or_create()" instead of the pre-existing
"find" and "create", as all existing usages used both in tandem anyway.

pbx_config, and pbx_ael, will stage the reloaded dialplan into local lists and tables, and 
then call merge_contexts_and_delete, which will merge (now) existing contexts and 
priorities from other registrars into this local set by copying them. Then, merge_contexts_and_delete will
lock down the contexts, swap the lists and tables, and unlock (real quick), and then 
destroy the old dialplan.



chan_sip.c
chan_iax.c
chan_skinny.c

All the channel drivers that would add regcontexts now use the ast_context_find_or_create now.

chan_sip also includes a small fix to get rid of warnings about removing priorities that never got entered.


apps/app_meetme.c
apps/app_dial.c
apps/app_queue.c

All the apps that added a context/exten/priority were also modified to use ast_context_find_or_create instead.


include/asterisk/pbx.h

ast_context_create() is removed. Find_or_create_ is the new method.
ast_context_find_or_create()  interface gets the hashtab added.
ast_merge_contexts_and_delete() gets the local hashtab arg added.
ast_wrlock_contexts_version() is added so you can detect if someone else got a writelock between your readlocking and writelocking.
ast_hashtab_compare_contexts was made public for use in pbx_config/pbx_ael
ast_hashtab_hash_contexts was in like fashion make public.


include/asterisk/pval.h

ast_compile_ael2() interface changed to include the local hashtab table ptr.


main/features.c

For the sake of the parking context, we use ast_context_find_or_create().



main/pbx.c

I changed all the "tree" names to "table" instead. That's because the original
implementation was based on binary trees. (had a free library). Then I moved
to hashtabs. Now, the names move forward too.

refcount field added to contexts, so you can keep track of how many modules
wanted this context to exist.

Some log messages that are warnings were inflated from LOG_NOTICE to LOG_WARNING.

Added some calls to ast_verb(3,...) for debug messages

Lots of little mods to ast_context_remove_extension2, which is now excersized in ways
it was not previously; one definite bug fixed.

find_or_create was upgraded to handle both local lists/tables as well as the globals.

context_merge() was added to do the per-context merging of the old/present contexts/extens/prios into the new/proposed local list/tables

ast_merge_contexts_and_delete() was heavily modified.

ast_add_extension2() was also upgraded to handle changes. 

the context_destroy() code was re-engineered to handle the new way of doing things,
by exten/prio instead of by context.



res/ael/pval.c
res/ael/ael.tab.c
res/ael/ael.tab.h
res/ael/ael.y
res/ael/ael_lex.c
res/ael/ael.flex
utils/ael_main.c
utils/extconf.c
utils/conf2ael.c
utils/Makefile

Had to change the interface to ast_compile_ael2(), to include the hashtab ptr.
This ended up involving several external apps.  The main gotcha was I had to 
include lock.h and hashtab.h in several places.


As a side note, I tested this stuff pretty thoroughly, I replicated the problems
originally reported by Luigi, and made triply sure that reloads worked, and everything
worked thru "stop gracefully". I found a and fixed a few bugs as I was merging into
trunk, that did not appear in my tests of bug6002.

How's this for verbose commit messages?




git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@106757 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-07 18:57:57 +00:00
Mark Michelson 924b7d3636 Merged revisions 106437 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r106437 | mmichelson | 2008-03-06 16:10:07 -0600 (Thu, 06 Mar 2008) | 8 lines

Quell an annoying message that is likely to print every single time that 
ast_pbx_outgoing_app is called. The reason is that __ast_request_and_dial
allocates the cdr for the channel, so it should be expected that the channel
will have a cdr on it.

Thanks to joetester on IRC for pointing this out


........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@106438 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-06 22:11:26 +00:00
Tilghman Lesher cfc1df4c1a Whitespace changes only
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@105840 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-04 23:04:29 +00:00
Russell Bryant 6d3b251588 - Add curly braces around the while loop
- Properly break out of the loop on error when an included context is not found


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@105590 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-04 04:28:48 +00:00
Russell Bryant 71173779dc Use ast_copy_string() instead of strncpy(), and use sizeof() instead of
a magic number


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@105589 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-04 04:26:39 +00:00
Jason Parker 62c63a8412 Merged revisions 105005 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r105005 | qwell | 2008-02-28 13:20:10 -0600 (Thu, 28 Feb 2008) | 9 lines

Make pbx_exec pass an empty string into applications, if we get NULL.
This protects against possible segfaults in applications that may try
 to use data before checking length (ast_strdupa'ing it, for example)

(closes issue #12100)
Reported by: foxfire
Patches:
      12100-nullappargs.diff uploaded by qwell (license 4)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@105006 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-28 19:21:15 +00:00
Joshua Colp 2a7eac9940 Add an 'e' option to ResetCDR which re-enables a CDR that has been disabled.
(closes issue #11170)
Reported by: kratzers
Patches:
      ResetCDR.1.diff uploaded by kratzers (license 307)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@104215 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-26 19:14:04 +00:00
Joshua Colp e6a260c747 Add an API call (ast_async_parseable_goto) which parses a goto string and does an async goto instead of an explicit goto.
(closes issue #11753)
Reported by: johan


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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@103754 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-18 04:43:33 +00:00
Mark Michelson 566a005512 Add proper "false" case behavior to GotoIfTime
(closes issue #11719)
Reported by: kshumard
Patches:
      gotoiftime.twobranches.patch uploaded by kshumard (license 92)
	  Tested by: kshumard



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@103738 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-15 23:07:12 +00:00
Joshua Colp c81350d6f6 Just some minor coding style cleanup...
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@103318 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-11 18:27:47 +00:00
Joshua Colp ef267cd838 Fix Manager Redirect while in an AGI.
(closes issue #10661)
Reported by: junky


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@103317 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-11 17:25:04 +00:00
Russell Bryant 1ec8cb41a8 Merge changes from team/mvanbaak/cli-command-audit
(closes issue #8925)

About a year ago, as Leif Madsen and Jim van Meggelen were going over the CLI
commands in Asterisk 1.4 for the next version of their book, they documented
a lot of inconsistencies.  This set of changes addresses all of these issues
and has been reviewed by Leif.

While this does introduce even more changes to the CLI command structure, it
makes everything consistent, which is the most important thing.

Thanks to all that helped with this one!


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@103171 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-08 21:26:32 +00:00
Mark Michelson fe9821cc10 Get rid of any remaining ast_verbose calls in the code in favor of
ast_verb

(closes issue #11934)
Reported by: mvanbaak
Patches:
      20080205_astverb-2.diff.txt uploaded by mvanbaak (license 7)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@102525 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-05 23:00:15 +00:00
Jason Parker dc6e5d6aae Change where priority of a goto is adjusted.
Partially reverts 102272.

Closes issue #11929
(credit to file for fix suggestion - we still <3 you)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@102500 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-05 20:51:50 +00:00
Joshua Colp c6fc44f927 Update handling of asyncgoto so it properly works on channels that are currently executing a PBX.
(closes issue #11914)
Reported by: arnd
(closes issue #11753)
Reported by: johan


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@102272 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-04 15:16:05 +00:00
Steve Murphy 671c08af6d Merged revisions 101480 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r101480 | murf | 2008-01-31 12:30:37 -0700 (Thu, 31 Jan 2008) | 1 line

closes issue #11845; that's the one where there's a 1004 byte cdr leak with every AMI Redirect to a zap channel
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@101481 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-31 19:43:40 +00:00
Tilghman Lesher 2f44f53ea4 Merged revisions 100675 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r100675 | tilghman | 2008-01-28 15:02:02 -0600 (Mon, 28 Jan 2008) | 2 lines

WaitExten didn't handle AbsoluteTimeout properly (went to 't' instead of 'T')

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@100677 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-28 21:05:29 +00:00
Russell Bryant f877028d76 Clean up some formatting, and simplify a bit of code using ast_str
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@100565 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-28 14:27:28 +00:00
Joshua Colp 3a37332880 Print out a warning when spaces are used in the variable name in Set and MSet. It is extremely hard to debug this issue so this should make it easier.
(closes issue #11759)
Reported by: caio1982
Patches:
      setvar_space_warning1.diff uploaded by caio1982 (license 22)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@98714 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-14 15:07:30 +00:00
Russell Bryant d0c89ab7ed Add a new CLI command, "core set chanvar", which allows you to set a channel
variable (or function) on an active channel from the CLI.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@98558 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-12 19:34:38 +00:00
Tilghman Lesher 857e3412f4 Several manager changes:
1) Add the Dialplan class, for NewExten and VarSet events, which should cut
down on the volume of traffic in the Call class.
2) Permit some commands to be run from multiple classes, such as allowing
DBGet to be run from either the System or the Reporting class.
3) Heavily document each class in the sample config, as there were several
that made no sense to be in the write= line, and two that made no sense to be
in the read= line (since they controlled no permissions there).

(Closes issue #10386)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@97651 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-10 00:12:35 +00:00
Russell Bryant 3e28c57081 Print out the name of a function being registered in color, just like the name
of applications when they get registered.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@96716 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-05 22:04:08 +00:00
Mark Michelson 3b830da053 Merged revisions 95577 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r95577 | mmichelson | 2007-12-31 17:43:13 -0600 (Mon, 31 Dec 2007) | 9 lines

Avoiding a potentially bad locking situation. ast_merge_contexts_and_delete writelocks the conlock, then
calls ast_hint_extension, which attempts to readlock the same lock. Recursion with read-write locks is 
dangerous, so the inner lock needs to be removed. I did this by copying the "guts" of ast_hint_extension
into ast_merge_contexts_and_delete (sans the extra lock).

(this change is inspired by the locking problems seen in issue #11080, but I have no idea if this is the
problematic area experienced by the reporters of that issue)


........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@95578 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-31 23:44:45 +00:00
Mark Michelson 74577dd091 I needed to increment the numbers used on the VERBOSITY_ATLEAST calls by 1.
Thanks to kpfleming for pointing this out.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@93065 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-14 19:19:07 +00:00
Mark Michelson 83f152b95c Changed VERBOSITY_LEVEL to VERBOSITY_ATLEAST to be more accurate.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@93063 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-14 18:54:48 +00:00
Mark Michelson 4f75e15665 After reading Russell's e-mail to the dev list stating that checking option_verbose is not
equivalent to the check done by ast_verb, I wrote a macro, VERBOSITY_LEVEL, which does this
check. I did a quick look in the source and used this macro in some places where option_verbose
was used.

I also converted some verbose messages in logger.c to use ast_verb instead of ast_verbose.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@93042 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-14 18:47:44 +00:00
Tilghman Lesher d5b454bf8d Convert ast_verbose to ast_verb.
Reported by: snuffy
Patch by: snuffy
(Closes issue #11547)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@92913 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-14 14:48:38 +00:00
Jason Parker 7dbfcdecae Merged revisions 92809 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r92809 | qwell | 2007-12-13 14:13:48 -0600 (Thu, 13 Dec 2007) | 1 line

Make application help text a little more clear about the use of extensions in a filename.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@92810 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-13 20:14:26 +00:00
Jason Parker 02ea9face7 Add count of total number of calls processed by asterisk during it's lifetime.
Add number of total calls and current calls to SNMP.

Closes issue #10057, patch by jcmoore.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@91779 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-07 16:11:05 +00:00
Russell Bryant f52c068605 Merged revisions 90967 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r90967 | russell | 2007-12-04 13:57:39 -0600 (Tue, 04 Dec 2007) | 7 lines

Make some changes to some additions I made recently for doing channel autoservice
when looking up extensions.  This code was added to handle the case where a
dialplan switch was in use that could block for a long time.  However, the way
that I added it, it did this for all extension lookups.  However, lookups in the
in-memory tree of extensions should _not_ take long enough to matter.  So, move
the autoservice stuff to be only around executing a switch.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@91011 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-04 22:07:35 +00:00
Olle Johansson 25cbb792b9 (closes issue #11422)
Reported by: eliel
Patches: 
      core.show.hint.patch uploaded by eliel (license 64)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@90853 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-04 15:07:53 +00:00
Mark Michelson e3c122863d Removing a pointless check of option_debug
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@90061 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-28 22:17:38 +00:00
Mark Michelson 0b3ab17bfa Merged revisions 90059 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r90059 | mmichelson | 2007-11-28 16:08:50 -0600 (Wed, 28 Nov 2007) | 13 lines

Removing some seemingly pointless code. This sets a channel variable for every priority
executed in the dialplan if you have debug set to anything non-zero. This seems pointless
due to the fact that these channel variables are not referenced anywhere else in the code and
their names are esoteric enough that they would not be practical to reference in the dialplan. Plus
the fact that this behavior isn't documented anywhere means that the change is not likely to cause
any disruption. If anything, this may actually cause a slight performance increase if running with
debug on.

The motivating influence for this code change is the eventwhencalled option for queues. If set to
vars, all channel variables will be output to the manager. These unnecessary channel variables make
the output a lot more difficult to deal with.


........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@90060 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-28 22:10:36 +00:00
Jason Parker aa0f63d65f Remove "old"-style CLI handler, since nothing uses it anymore.
Closes issue #11403, patch by eliel.  This also completes the janitor project.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@90038 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-28 20:27:40 +00:00
Russell Bryant 880fb1ece9 Merged revisions 89893 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r89893 | russell | 2007-11-27 18:20:13 -0600 (Tue, 27 Nov 2007) | 4 lines

 - update documentation for some of the goto functions to note that they
   handle locking the channel as needed
 - update ast_explicit_goto() to lock the channel as needed

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89915 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-28 00:24:19 +00:00
Russell Bryant 79bc5ede5f Merged revisions 89839 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r89839 | russell | 2007-11-27 17:16:00 -0600 (Tue, 27 Nov 2007) | 2 lines

Don't start/stop autoservice in pbx_extension_helper() unless a channel exists

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89840 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-27 23:17:36 +00:00
Steve Murphy 1f792f1745 closes issue #11294; missed the conditional unlock of the contexts when the hash table is used instead; also, used the ast_free_ptr as advised.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89792 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-27 22:14:55 +00:00