Commit Graph

1314 Commits

Author SHA1 Message Date
Kevin P. Fleming
7c82c2b240 Fix 'inconsistent line endings' when autoconf 2.63 is used
Attempt to make configure script regeneration 'safe' using autoconf 2.63, which embeds a bare CR into the script, thus making Subversion complain about inconsistent line endings

This commit changes the MIME type of the configure script to be 'binary' thus making Subversion no longer inspect line endings, and as a bonus 'svn diff' will no longer try to generate diff output for it, which is not generally useful anyway.



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@190721 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-27 19:29:46 +00:00
Olle Johansson
1dac2a69e2 unistd.h is required for usleep() on Darwin. It will not hurt to include it always
on other platforms either.


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@190187 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-23 10:07:26 +00:00
Tilghman Lesher
c922eca9a8 Detect availability of pthread_rwlock_timedwrlock() before using it.
(closes issue #14930)
 Reported by: tilghman
 Patches: 
       20090420__bug14930.diff.txt uploaded by tilghman (license 14)
 Tested by: mvanbaak, tilghman


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@190092 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-22 21:35:03 +00:00
Doug Bailey
9d266db16a Add check in configure script to check for GLOB_NOMAGIC and GLOB_BRACE in glob.h
This allows config.c to compile when linked against uclibc that does not support these parameters


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@189601 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-21 14:00:55 +00:00
Tilghman Lesher
200db93157 Oops, typo
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@187482 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-09 18:39:07 +00:00
Tilghman Lesher
34672a3919 Race condition between ast_cli_command() and 'module unload' could cause a deadlock.
Add lock timeouts to avoid this potential deadlock.
(closes issue #14705)
 Reported by: jamessan
 Patches: 
       20090320__bug14705.diff.txt uploaded by tilghman (license 14)
 Tested by: jamessan


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@187428 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-09 18:08:20 +00:00
Tilghman Lesher
a8dc553099 Add debugging mode for diagnosing file descriptor leaks.
(Related to issue #14625)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@187300 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-09 04:31:38 +00:00
Joshua Colp
ddb260532b Fix a problem with the crypto variable definitions not actually being defined properly.
(closes issue #14804)
Reported by: jvandal


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@186320 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-03 15:48:56 +00:00
David Vossel
f42e9eb6bf Cleaning up a few things in detect disconnect patch
Initialized ast_call_feature in detect_disconnect to avoid accessing uninitialized memory.  Cleaned up /param tags in features.h.  No longer send dynamic features in ast_feature_detect. 

issue #11583


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@183386 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-19 19:40:07 +00:00
Russell Bryant
47af9f8fd5 Remove the use of RTLD_NOLOAD, as it is not behaving like expected.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@183241 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-19 17:52:52 +00:00
David Vossel
dd17912d68 Allow disconnect feature before a call is bridged
feature.conf has a disconnect option.  By default this option is set to '*', but it could be anything.  If a user wishes to disconnect a call before the other side answers, only '*' will work, regardless if the disconnect option is set to something else.  This is because features are unavailable until bridging takes place.  The default disconnect option, '*', was hardcoded in app_dial, which doesn't make any sense from a user perspective since they may expect it to be something different.  This patch allows features to be detected from outside of the bridge, but not operated on.  In this case, the disconnect feature can be detected before briding and handled outside of features.c.

(closes issue #11583)
Reported by: sobomax
Patches:
	patch-apps__app_dial.c uploaded by sobomax (license 359)
	11583.latest-patch uploaded by murf (license 17)
	detect_disconnect.diff uploaded by dvossel (license 671)
Tested by: sobomax, dvossel
Review: http://reviewboard.digium.com/r/195/






git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@183126 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-19 16:15:16 +00:00
Kevin P. Fleming
e536392919 fix another symbol namespace issue (reported by Andrew on asterisk-dev)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@182882 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-18 11:31:41 +00:00
Russell Bryant
6efa254bea Fix cases where the internal poll() was not being used when it needed to be.
We have seen a number of problems caused by poll() not working properly on 
Mac OSX.  If you search around, you'll find a number of references to using 
select() instead of poll() to work around these issues.  In Asterisk, we've 
had poll.c which implements poll() using select() internally.  However, we 
were still getting reports of problems.

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

The changes are:

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

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

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

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

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@182810 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-18 02:09:13 +00:00
Kevin P. Fleming
7e1ee720ba Improve the build system to *properly* remove unnecessary symbols from the runtime global namespace. Along the way, change the prefixes on some internal-only API calls to use a common prefix.
With these changes, for a module to export symbols into the global namespace, it must have *both* the AST_MODFLAG_GLOBAL_SYMBOLS flag and a linker script that allows the linker to leave the symbols exposed in the module's .so file (see res_odbc.exports for an example).



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@182808 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-18 01:55:22 +00:00
Kevin P. Fleming
59f867a5cb revert commit that included extranous changes
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@182807 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-18 01:51:21 +00:00
Kevin P. Fleming
f1f417a9d8 Improve the build system to *properly* remove unnecessary symbols from the runtime global namespace. Along the way, change the prefixes on some internal-only API calls to use a common prefix.
With these changes, for a module to export symbols into the global namespace, it must have *both* the AST_MODFLAG_GLOBAL_SYMBOLS flag and a linker script that allows the linker to leave the symbols exposed in the module's .so file (see res_odbc.exports for an example).



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@182802 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-18 01:28:42 +00:00
Jeff Peeler
21ca773c28 Fix malloc debug macros to work properly with h323.
The main problem here was that cstdlib was undefining free thereby causing the
proper debug macros to not be used. ast_h323.cxx has been changed to call
ast_free instead to avoid the issue. Because using the ast prefix calls are
a better choice, ast_free_ptr is the new wrapper for free to pass to functions.
Also, a little bit of clean up was done to avoid the debug macros intentionally
being redefined.

(closes issue #13593)
Reported by: pj



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@181133 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-11 03:25:04 +00:00
Kevin P. Fleming
5436d8709f Fix problems when RTP packet frame size is changed
During some code analysis, I found that calling ast_rtp_codec_setpref() on an ast_rtp session does not work as expected; it does not adjust the smoother that may on the RTP session, in fact it summarily drops it, even if it has data in it, even if the current format's framing size has not changed. This is not good.

This patch changes this behavior, so that if the packetization size for the current format changes, any existing smoother is safely updated to use the new size, and if no smoother was present, one is created. A new API call for smoothers, ast_smoother_reconfigure(), was required to implement these changes.

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@180372 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-05 18:22:16 +00:00
Tilghman Lesher
426cee0362 This exception does not appear to still be true for Solaris 10, and OpenSolaris definitely needs it to be removed.
Fixed for snuff-home on -dev channel.


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@177701 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-20 21:15:01 +00:00
David Vossel
a5198f55e0 Fixes issue with undefined audio codecs in chan_iax2
During iax2 call negotiation, supported codecs are passed in an Information Element containing a 2 byte field where each bit correlates to a specific codec.  In 1.4 only audio codec bits 0-12 are defined, leaving bits 13-15 undefined.  By default all bits are enabled unless specified otherwise.  Since its a 2 byte field and 13-15 are not defined, these bits are never turned off.  In trunk, bits 13-15 are defined, which means 1.4 is advertising support for codecs it does not have when talking to trunk.  I fixed this by adding #define for undefined audio codec bits.  These bits are then removed from iax2's full bandwidth capabilities.   

(closes issue #14283)
Reported by: jcovert



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@177696 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-20 20:17:37 +00:00
Tilghman Lesher
c66921ec43 Document the return value of the update method (as requested on -dev list)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@177096 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-18 18:30:38 +00:00
Jeff Peeler
de8f6bab86 Modify bridging to properly evaluate DTMF after first warning is played
The main problem is currently if the Dial flag L is used with a warning sound,
DTMF is not evaluated after the first warning sound. To fix this, a flag has 
been added in ast_generic_bridge for playing the warning which ensures that if
a scheduled warning is missed, multiple warrnings are not played back (due to a
feature evaluation or waiting for digits). ast_channel_bridge was modified to
store the nexteventts in the ast_bridge_config structure as that information
was lost every time ast_channel_bridge was reentered, causing a hangup due to
incorrect time calculations.

(closes issue #14315)
Reported by: tim_ringenbach

Reviewed on reviewboard:
http://reviewboard.digium.com/r/163/



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@176701 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-17 21:54:34 +00:00
Michiel van Baak
db4dc67740 fix mis-spelling of the word registered.
Reported by De_Mon on #asterisk-dev.


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@175921 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-15 23:37:03 +00:00
Jason Parker
3cc3863d28 Zaptel is not DAHDI. Rather, Zaptel is actually Zaptel. (in case you're confused, DAHDI is still DAHDI)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@175698 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-13 21:53:16 +00:00
Terry Wilson
4e069885ce Fix feature inheritance with builtin features
When using builtin features like parking and transfers, the AST_FEATURE_* flags
would not be set correctly for all instances when either performing a builtin
attended transfer, or parking a call and getting the timeout callback.  Also,
there was no way on a per-call basis to specify what features someone should
have on picking up a parked call (since that doesn't involve the Dial() command).
There was a global option for setting whether or not all users who pickup a
parked call should have AST_FEATURE_REDIRECT set, but nothing for DISCONNECT,
AUTOMON, or PARKCALL.

This patch:
1) adds the BRIDGE_FEATURES dialplan variable which can be set either in the
dialplan or with setvar in channels that support it.  This variable can be set
to any combination of 't', 'k', 'w', and 'h' (case insensitive matching of the
equivalent dial options), to set what features should be activated on this
channel.  The patch moves the setting of the features datastores into the
bridging code instead of app_dial to help facilitate this.

2) adds global options parkedcallparking, parkedcallhangup, and
parkedcallrecording to be similar to the parkedcalltransfers option for
globally setting features.

3) has builtin_atxfer call builtin_parkcall if being transfered to the parking
extension since tracking everything through multiple masquerades, etc. is
difficult and error-prone

4) attempts to fix all cases of return calls from parking and completed builtin
transfers not having the correct permissions
(closes issue #14274)
Reported by: aragon
Patches: 
      fix_feature_inheritence.diff.txt uploaded by otherwiseguy (license 396)
Tested by: aragon, otherwiseguy

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@172517 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-30 17:47:41 +00:00
Steve Murphy
13a60eba0c 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/branches/1.4@172030 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-28 18:51:16 +00:00
Tilghman Lesher
e2d1540779 AST_RWLOCK_INIT_VALUE is always defined. What we really wanted to ask is
whether autoconf detected a static initializer value.  This fixes rwlocks
on all such platforms (mainly, Mac OS X).
(closes issue #13767)
 Reported by: jcovert
 Patches: 
       20090121__bug13767.diff.txt uploaded by Corydon76 (license 14)
 Tested by: jcovert, Corydon76


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@169943 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-22 00:43:31 +00:00
Tilghman Lesher
d671bb1404 Fix the conjugation of Russian and Ukrainian languages.
(related to issue #12475)
 Reported by: chappell
 Patches: 
       vm_multilang.patch uploaded by chappell (license 8)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@168828 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-16 18:41:35 +00:00
Russell Bryant
9161b7fc87 Revert unnecessary indications API change from rev 122314
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@168561 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-13 19:13:05 +00:00
Russell Bryant
acd0af78ea Re-work ref count handling of MoH classes using astobj2 to resolve crashes.
(closes issue #13566)
Reported by: igorcarneiro
Tested by: russell
Review: http://reviewboard.digium.com/r/106/


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@166262 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-22 14:45:27 +00:00
Mark Michelson
7fdf99803e Backport of AUDIOHOOK_INHERIT for Asterisk 1.4
(closes issue #13538)
Reported by: mbit
Patches:
      13538.patch uploaded by putnopvut (license 60)
Tested by: putnopvut



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@166157 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-19 23:34:57 +00:00
Steve Murphy
e3700a13a4 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/branches/1.4@166093 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-19 22:30:32 +00:00
Jeff Peeler
e0bec5d67d (closes issue #13480)
Reported by: tzafrir

Replace a bunch of if defined checks for Zaptel/DAHDI through several new defines in dahdi_compat.h. This removes a lot of code duplication. Example from bug:

#ifdef HAVE_ZAPTEL
  fd = open("/dev/zap/pseudo", O_RDWR);
#else
  fd = open("/dev/dahdi/pseudo", O_RDWR);
#endif

is replaced with:
  fd = open(DAHDI_FILE_PSEUDO, O_RDRW);



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@165991 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-19 19:48:00 +00:00
Russell Bryant
083047a794 Fix memory leak and invalid reporting issues with DEBUG_THREADLOCALS.
One issue was that the ast_mutex_* API was being used within the context of the
thread local data destructors.  We would go off and allocate more thread local data
while the pthread lib was in the middle of destroying it all.  This led to a memory 
leak.

Another issue was an invalid argument being provided to the the object_add
API call.

(closes issue #13678)
Reported by: ys
Tested by: russell


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@164736 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-16 17:06:29 +00:00
Mark Michelson
ccf5565ccd Add the deadlock note to ast_spawn_extension as well
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@164422 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-15 19:53:08 +00:00
Mark Michelson
a43cf62956 Add notes to autoservice and pbx doxygen regarding a potential
deadlock scenario so that it is avoided in the future



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@164416 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-15 19:45:07 +00:00
Joshua Colp
b80ffd6d26 Use autoconf logic to determine whether the system has timersub or not. Do not blindly assume Solaris does not.
(closes issue #13838)
Reported by: ano


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@164343 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-15 17:43:59 +00:00
Russell Bryant
c518ed3be1 Resolve issues that could cause DTMF to be processed out of order.
These changes come from team/russell/issue_12658

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

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@163448 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-12 13:44:08 +00:00
Mark Michelson
4cad4bff2c Update to stringfield handling so that side-effects on
parameters are not evaluated multiple times.

An example where this caused a problem was in chan_sip.c, with
the line

  ast_string_field_set(p, fromdomain, ++fromdomain);

This patch was originally uploaded to issue #13783 by
jamessan. While the issue was closed for other reasons, this
patch is valid and fixes a separate problem, and is thus
being committed.



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@162670 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-10 16:44:37 +00:00
Russell Bryant
c2446000d9 Remove the test_for_thread_safety() function completely.
The test is not valid.  Besides, if we actually suspected that recursive
mutexes were not working, we would get a ton of LOG_ERROR messages when
DEBUG_THREADS is turned on.

(inspired by a discussion on the asterisk-dev list)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@162413 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-09 22:17:39 +00:00
Steve Murphy
a36a0d7dbd (closes issue #14019)
Reported by: ckjohnsonme
Patches:
      14019.diff uploaded by murf (license 17)
Tested by: ckjohnsonme, murf

This crash was the result of a few small errors that
would combine in 64-bit land to result in a crash.

32-bit land might have seen these combine to mysteriously
drop the args to an application call, in certain
circumstances.

Also, in trying to find this bug, I spotted
a situation in the flex input, where, in passing
back a 'word' to the parser, it would allocate
a buffer larger than necessary. I changed the
usage in such situations, so that strdup was
not used, but rather, an ast_malloc, followed
by ast_copy_string.

I removed a field from the pval struct, in
u2, that was never getting used, and set in
one spot in the code. I believe it was an
artifact of a previous fix to make switch
cases work invisibly with extens.

And, for goto's I removed a '!' from
before a strcmp, that has been there
since the initial merging of AEL2, that
might prevent the proper target of a 
goto from being found. This was pretty
harmless on its own, as it would just
louse up a consistency check for users.

Many thanks to ckjohnsonme for providing
a simplified and complete set of information
about the bug, that helped considerably in
finding and fixing the problem.

Now, to get aelparse up and running again
in trunk, and out of its "horribly broken" state,
so I can run the regression suite!



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@162013 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-09 16:31:55 +00:00
Sean Bright
ffc0c7e4ae Merged revisions 161421 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
  r161421 | seanbright | 2008-12-05 15:50:23 -0500 (Fri, 05 Dec 2008) | 8 lines
  
  Fix build errors on FreeBSD (uint -> unsigned int).
  
  (closes issue #14006)
  Reported by: alphaque
  Patches:
        astobj2.h-patch uploaded by alphaque (license 259)
        (Slightly modified by seanbright)
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@161426 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-05 21:02:20 +00:00
Terry Wilson
a3724485b4 make compile with dev mode and malloc debug
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@160266 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-02 01:16:30 +00:00
Tilghman Lesher
1653a9ef65 Ensure that Asterisk builds with --enable-dev-mode, even on the latest gcc
and glibc.


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@160207 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-02 00:25:16 +00:00
Kevin P. Fleming
50515ed372 update dev-mode compiler flags to match the ones used by default on Ubuntu Intrepid, so all developers will see the same warnings and errors
since this branch already had some printf format attributes, enable checking for them and tag functions that didn't have them

format attributes in a consistent way



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@159808 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-29 16:58:29 +00:00
Russell Bryant
07741a3261 Add ao2_trylock() to go along with ao2_lock() and ao2_unlock()
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@159158 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-25 17:34:50 +00:00
Tilghman Lesher
929c14e432 System call ioperm is non-portable, so check for its existence in autoconf.
(Closes issue #13863)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@159025 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-25 04:50:00 +00:00
Jeff Peeler
c7dcb086dd (closes issue #13786)
Reported by: tzafrir

When compiling against Zaptel dahdi_compat will now only define all the DAHDI defines if the Zaptel define is present. Also, there is no such thing as DAHDI_PRI.


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@158629 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-22 00:04:36 +00:00
Russell Bryant
a0bf88537a When compiling with DEBUG_THREADS, report the real file/func/line for ao2_lock/ao2_unlock
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@158539 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-21 22:05:55 +00:00
Mark Michelson
6a632a5a2b There was an issue when attempting to reference an embedded
frame in a freed ast_filestream. This patch makes use of the
ao2 functions to make sure that we do not free an ast_filestream
structure until the embedded ast_frame has been "freed" as well.

(closes issue #13496)
Reported by: fst-onge
Patches:
      filestream_frame_1_4.diff uploaded by putnopvut (license 60)
Tested by: putnopvut

Closes AST-89



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@158126 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-20 18:06:48 +00:00