]> git.ipfire.org Git - thirdparty/asterisk.git/log
thirdparty/asterisk.git
14 years agoAdd some API documentation
Tilghman Lesher [Wed, 19 Jan 2011 21:20:28 +0000 (21:20 +0000)] 
Add some API documentation

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@302663 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoURI encode the user part of the contact header.
Matthew Nicholson [Tue, 18 Jan 2011 21:35:03 +0000 (21:35 +0000)] 
URI encode the user part of the contact header.

ABE-2705

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@302311 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoIssues with DTMF triggered attended transfers.
Richard Mudgett [Tue, 18 Jan 2011 18:04:36 +0000 (18:04 +0000)] 
Issues with DTMF triggered attended transfers.

Issue #17999
1) A calls B. B answers.
2) B using DTMF dial *2 (code in features.conf for attended transfer).
3) A hears MOH. B dial number C
4) C ringing. A hears MOH.
5) B hangup. A still hears MOH. C ringing.
6) A hangup. C still ringing until "atxfernoanswertimeout" expires.
For v1.4 C will ring forever until C answers the dead line. (Issue #17096)

Problem: When A and B hangup, C is still ringing.

Issue #18395
SIP call limit of B is 1
1. A call B, B answered
2. B *2(atxfer) call C
3. B hangup, C ringing
4. Timeout waiting for C to answer
5. Recall to B fails because B has reached its call limit.

Because B reached its call limit, it cannot do anything until the transfer
it started completes.

Issue #17273
Same scenario as issue 18395 but party B is an FXS port.  Party B cannot
do anything until the transfer it started completes.  If B goes back off
hook before C answers, B hears ringback instead of the expected dialtone.

**********
Note for the issue #17273 and #18395 fix:

DTMF attended transfer works within the channel bridge.  Unfortunately,
when either party A or B in the channel bridge hangs up, that channel is
not completely hung up until the transfer completes.  This is a real
problem depending upon the channel technology involved.

For chan_dahdi, the channel is crippled until the hangup is complete.
Either the channel is not useable (analog) or the protocol disconnect
messages are held up (PRI/BRI/SS7) and the media is not released.

For chan_sip, a call limit of one is going to block that endpoint from any
further calls until the hangup is complete.

For party A this is a minor problem.  The party A channel will only be in
this condition while party B is dialing and when party B and C are
conferring.  The conversation between party B and C is expected to be a
short one.  Party B is either asking a question of party C or announcing
party A.  Also party A does not have much incentive to hangup at this
point.

For party B this can be a major problem during a blonde transfer.  (A
blonde transfer is our term for an attended transfer that is converted
into a blind transfer.  :)) Party B could be the operator.  When party B
hangs up, he assumes that he is out of the original call entirely.  The
party B channel will be in this condition while party C is ringing, while
attempting to recall party B, and while waiting between call attempts.

WARNING:
The ATXFER_NULL_TECH conditional is a hack to fix the problem.  It will
replace the party B channel technology with a NULL channel driver to
complete hanging up the party B channel technology.  The consequences of
this code is that the 'h' extension will not be able to access any channel
technology specific information like SIP statistics for the call.

ATXFER_NULL_TECH is not defined by default.
**********

(closes issue #17999)
Reported by: iskatel
Tested by: rmudgett
JIRA SWP-2246

(closes issue #17096)
Reported by: gelo
Tested by: rmudgett
JIRA SWP-1192

(closes issue #18395)
Reported by: shihchuan
Tested by: rmudgett

(closes issue #17273)
Reported by: grecco
Tested by: rmudgett

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@302172 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoMerged revisions 293493 via svnmerge from
Terry Wilson [Mon, 17 Jan 2011 17:45:39 +0000 (17:45 +0000)] 
Merged revisions 293493 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8 [^]

........
  r293493 | twilson | 2010-11-01 09:58:00 -0500 (Mon, 01 Nov 2010) | 14 lines

  Only offer codecs both sides support for directmedia

  When using directmedia, Asterisk needs to limit the codecs offered to just
  the ones that both sides recognize, otherwise they may end up sending audio
  that the other side doesn't understand.

  (closes issue 0017403)
  Reported by: one47
  Patches:
        sip_codecs_simplified4 uploaded by one47 (license 23)
  Tested by: one47, falves11

  Review: https://reviewboard.asterisk.org/r/967/ [^]
........

Back port a fix that should have been included

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@302087 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoFix issue with cross-compiling failing
Leif Madsen [Fri, 14 Jan 2011 20:21:00 +0000 (20:21 +0000)] 
Fix issue with cross-compiling failing

(closes issue #18301)
Reported by: abelbeck
Patches:
      asterisk-1.4-bugid18301.patch.txt uploaded by abelbeck (license 946)
Tested by: abelbeck, russellb

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@301869 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoDon't store the thread id for the manager session in the structure we pass to
Matthew Nicholson [Wed, 12 Jan 2011 18:39:03 +0000 (18:39 +0000)] 
Don't store the thread id for the manager session in the structure we pass to
the thread for the manager session.

ABE-2543

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@301591 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoFix CPU spike when pressing DTMF after agent login.
Jeff Peeler [Wed, 12 Jan 2011 18:10:42 +0000 (18:10 +0000)] 
Fix CPU spike when pressing DTMF after agent login.

The problem here is that DTMF was being continuously deferred and requeued
since ast_safe_sleep is called in a loop. There are serveral other places in the
code that sleeps and then loops in a similar fashion. Because of this fact I
opted to not defer DTMF any more, which will not affect the original fix:

https://reviewboard.asterisk.org/r/674

(closes issue #18130)
Reported by: rgj

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@301502 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoPrevent buffer overflows in ast_uri_encode()
Matthew Nicholson [Tue, 11 Jan 2011 18:34:40 +0000 (18:34 +0000)] 
Prevent buffer overflows in ast_uri_encode()

ABE-2705

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@301305 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agochange variable name to the same used in later branches
Jeff Peeler [Fri, 7 Jan 2011 17:18:11 +0000 (17:18 +0000)] 
change variable name to the same used in later branches

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@300924 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoEnsure good bye prompt in voicemail is played at the correct time.
Jeff Peeler [Fri, 7 Jan 2011 17:13:21 +0000 (17:13 +0000)] 
Ensure good bye prompt in voicemail is played at the correct time.

Specifically in the case of timing out but not leaving voicemail nothing
should be heard. And when leaving voicemail it should be heard.

ABE-2647

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@300918 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoUse the sanity check in place of the disconnect/connect cycle.
Tilghman Lesher [Wed, 5 Jan 2011 18:47:46 +0000 (18:47 +0000)] 
Use the sanity check in place of the disconnect/connect cycle.

The disconnect/connect cycle has the potential to cause random crashes.

(closes issue #18243)
 Reported by: ks3
 Patches:
       res_odbc.patch uploaded by ks3 (license 1147)
 Tested by: ks3

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@300621 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoUpdate the autosupport script from Digium support.
Russell Bryant [Tue, 4 Jan 2011 20:56:04 +0000 (20:56 +0000)] 
Update the autosupport script from Digium support.

(closes AST-395)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@300428 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoDon't authenticate SUBSCRIBE re-transmissions
Terry Wilson [Tue, 4 Jan 2011 17:11:48 +0000 (17:11 +0000)] 
Don't authenticate SUBSCRIBE re-transmissions

This only skips authentication on retransmissions that are already
authenticated. A similar method is already used for INVITES. This
is the kind of thing we end up having to do when we don't have a
transaction layer...

(closes issue #18075)
Reported by: mdu113
Patches:
      diff.txt uploaded by twilson (license 396)
Tested by: twilson, mdu113

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@300216 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoMove check for extension existence below variable inheritance, due to the possible...
Tilghman Lesher [Sat, 25 Dec 2010 10:04:06 +0000 (10:04 +0000)] 
Move check for extension existence below variable inheritance, due to the possible use of an eswitch.

(closes issue #16228)
 Reported by: jlaguilar

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@299624 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoUse ast_free() instead of free()
Matthew Nicholson [Mon, 20 Dec 2010 21:21:39 +0000 (21:21 +0000)] 
Use ast_free() instead of free()

ABE-2656

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@299220 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoRemove changes to via processing that were not supposed to go into the last commit.
Matthew Nicholson [Mon, 20 Dec 2010 21:00:44 +0000 (21:00 +0000)] 
Remove changes to via processing that were not supposed to go into the last commit.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@299198 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoRespond as soon as possible with a 202 Accepted to refer requests.
Matthew Nicholson [Mon, 20 Dec 2010 20:45:38 +0000 (20:45 +0000)] 
Respond as soon as possible with a 202 Accepted to refer requests.

This change also plugs a few memory leaks that can occur when parking sip calls.

ABE-2656

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@299194 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoTypos: recieved => received
Tzafrir Cohen [Mon, 20 Dec 2010 09:13:18 +0000 (09:13 +0000)] 
Typos: recieved => received

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@299002 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoLet Asterisk find better backtrace information with libbfd.
Tilghman Lesher [Fri, 17 Dec 2010 21:40:56 +0000 (21:40 +0000)] 
Let Asterisk find better backtrace information with libbfd.

The menuselect option BETTER_BACKTRACES, if enabled, will use libbfd to search
for better symbol information within both the Asterisk binary, as well as
loaded modules, to assist when using inline backtraces to track down problems.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@298905 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoDocument the -F option.
Tilghman Lesher [Fri, 17 Dec 2010 21:12:00 +0000 (21:12 +0000)] 
Document the -F option.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@298820 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoAfter recording only silence for a voicemail prepending, restore backup files.
Jeff Peeler [Thu, 16 Dec 2010 23:29:30 +0000 (23:29 +0000)] 
After recording only silence for a voicemail prepending, restore backup files.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@298683 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoFix improper hangup when doing an attended transfer to queue.
Jeff Peeler [Thu, 16 Dec 2010 20:46:52 +0000 (20:46 +0000)] 
Fix improper hangup when doing an attended transfer to queue.

Had to indicate ringing in wait_for_answer so the attended transfer code would
not try and hang up the local channel it created, which would kill the call.

ABE-2624

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@298596 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoOnly increment the pointer once per loop, otherwise we corrupt the value.
Tilghman Lesher [Thu, 16 Dec 2010 09:03:40 +0000 (09:03 +0000)] 
Only increment the pointer once per loop, otherwise we corrupt the value.

(closes issue #18251)
 Reported by: bcnit
 Patches:
       20101110__issue18251.diff.txt uploaded by tilghman (license 14)
 Tested by: trev, jthurman, elguero

(closes issue #18279)
 Reported by: zerohalo
 Patches:
       20101109__issue18279.diff.txt uploaded by tilghman (license 14)
 Tested by: zerohalo

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@298480 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoUnregister before shutting down the connection, to avoid a race.
Tilghman Lesher [Thu, 16 Dec 2010 00:28:04 +0000 (00:28 +0000)] 
Unregister before shutting down the connection, to avoid a race.

(closes issue #18481)
 Reported by: pabelanger
 Patches:
       20101215__issue18481.diff.txt uploaded by tilghman (license 14)
 Tested by: pabelanger

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@298392 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoFix reference and container leaks when running 'astobj2 test.'
Sean Bright [Wed, 15 Dec 2010 21:28:29 +0000 (21:28 +0000)] 
Fix reference and container leaks when running 'astobj2 test.'

We need to make sure that ao2_iterator_destroy is called once for each time that
ao2_iterator_init is called.  Also make sure to unref a newly allocated object
that we've linked into a container.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@298345 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoOutgoing PRI/BRI calls cannot do DTMF triggered transfers.
Richard Mudgett [Mon, 13 Dec 2010 16:56:07 +0000 (16:56 +0000)] 
Outgoing PRI/BRI calls cannot do DTMF triggered transfers.

Outgoing PRI/BRI calls cannot do DTMF triggered transfers if a PROCEEDING
message is not received.  The debug output shows that the DTMF begin event
is seen, but the DTMF end event is missing.  When the DTMF begin happens,
the call is muted so we now have one way audio (until a DTMF end event is
somehow seen).

* Made set the proceeding flag when the PRI_EVENT_ANSWER event is
received.

* Made absorb the DTMF begin and DTMF end events if we are overlap dialing
and have not seen a PROCEEDING message.

* Added a debug message when absorbing a DTMF event.

JIRA SWP-2690
JIRA ABE-2697

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@298193 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoIgnore spurious REGISTER requests
Terry Wilson [Thu, 9 Dec 2010 22:00:30 +0000 (22:00 +0000)] 
Ignore spurious REGISTER requests

If a REGISTER request with a Call-ID matching an existing transaction is received
it was possible that the REGISTER request would overwrite the initreq of the
private structure. This info is used to generate messages for other responses in
the transaction. This patch ignores REGISTER requests that match non-REGISTER
transactions.

(closes issue #18051)
Reported by: eeman
Tested by: twilson

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@297959 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoRevert code that changed SSRC for DTMF.
Jeff Peeler [Tue, 7 Dec 2010 22:57:48 +0000 (22:57 +0000)] 
Revert code that changed SSRC for DTMF.

Some previous behavior was attempted to be restored, but mistakingly I did
not realize that the previous behavior was incorrect. This fixes DTMF not
being detected since DTMF shouldn't cause the SSRC to change.

(related to issue #17404)
(closes issue #18189)
(closes issue #18352)
Reported by: marcbou
Tested by: cmbaker82

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@297823 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoUse non-deprecated APIs for CoreAudio
Tilghman Lesher [Tue, 7 Dec 2010 22:35:50 +0000 (22:35 +0000)] 
Use non-deprecated APIs for CoreAudio

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@297818 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoAvoid a crash if we don't pass an argument to 'astobj2 test.'
Sean Bright [Tue, 7 Dec 2010 15:23:18 +0000 (15:23 +0000)] 
Avoid a crash if we don't pass an argument to 'astobj2 test.'

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@297775 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoDon't create a Local channel if the target extension does not exist.
Tilghman Lesher [Tue, 7 Dec 2010 00:07:37 +0000 (00:07 +0000)] 
Don't create a Local channel if the target extension does not exist.

(closes issue #18126)
 Reported by: junky
 Patches:
       followme.diff uploaded by junky (license 177)
       (partially restructured by me to avoid a possible memory leak)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@297689 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoImprove handling of REGISTER requests with multiple contact headers.
Jeff Peeler [Mon, 6 Dec 2010 21:57:15 +0000 (21:57 +0000)] 
Improve handling of REGISTER requests with multiple contact headers.

The changes here attempt to more strictly follow RFC 3261 section 10.3.
Basically the following will now cause a 400 Bad Response to be returned, if:
- multiple Contact headers are present with one set to expire all bindings ("*")
- wildcard parameter is specified for Contact without Expires header or Expires
  header is not set to zero.

ABE-2442
ABE-2443

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@297603 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoResolve compile error under FreeBSD
Paul Belanger [Thu, 2 Dec 2010 20:01:08 +0000 (20:01 +0000)] 
Resolve compile error under FreeBSD

We now set _ASTCFLAGS+=-march=i686 for i386 processors, still allowing ASTCFLAGS
to override the setting.

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@297404 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoInitialize offset for adaptive jitter buffer
Terry Wilson [Thu, 2 Dec 2010 18:00:27 +0000 (18:00 +0000)] 
Initialize offset for adaptive jitter buffer

When the adaptive jitter buffer is enabled in sip.conf, the first frame placed
in the jitter buffer fails with something like:

jb_warning_output: Resyncing the jb. last_delay 0, this delay -215886466,
threshold 1000, new offset 215886466

This happens because the offset is not initialized before calling jb_put(). This
patch modifies jb_put_first_adaptive() to set the offset to the frame's
timestamp.

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@297310 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoAdd "DAHDI" to a couple of app_meetme error messages.
Russell Bryant [Thu, 2 Dec 2010 13:16:15 +0000 (13:16 +0000)] 
Add "DAHDI" to a couple of app_meetme error messages.

This is in response to some questions on IRC.  To the user, there was nothing
that made it obvious that this error had anything to do with DAHDI not being
loaded.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@297228 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoIf we get a NOTIFY from a non-existing subscription we should answer with 481, not...
Olle Johansson [Thu, 2 Dec 2010 08:37:17 +0000 (08:37 +0000)] 
If we get a NOTIFY from a non-existing subscription we should answer with 481, not bad event.

If we answer 481 the subscription that we don't want will be cancelled.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@297185 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoFix not stopping MOH when transfered local channel queue member is answered.
Jeff Peeler [Wed, 1 Dec 2010 17:50:09 +0000 (17:50 +0000)] 
Fix not stopping MOH when transfered local channel queue member is answered.

The problem here is only present when local channels are used with the MOH
passthru option as well as no optimization (/nm). I will describe the slightly
bizarre scenario that was used to test, where phones B and C are queue members:

Phone A dials into a queue with two members using local channels and the above
options. Phone B answers. Phone A blind transfers phone B into the same queue.
Phone A hangs up. Phone C answers, but phone B didn't stop playing MOH.

In this scenario, the unhold frame that should have gotten to phone B never
arrived due to the masquerade from the blind transfer. This is usually fine
since app_queue manages the starting and stopping of MOH. However, with the
passthrough option enabled when app_queue attempts to stop MOH it tries to do
so on the local channel rather than the real channel. The easiest solution
was to just make sure to send an unhold frame during the transfer since it
wouldn't make sense to have MOH playing after a transfer anyway. This only
modifies SIP transfers, but the other transfers did not seem to be a problem.
If DTMF based transfers were a problem it might be okay to add ast_moh_stop
to finishup, but I didn't want to have to add that unless required.

ABE-2624

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@297072 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoClarify documentation on how we store codec preference lists.
Tilghman Lesher [Wed, 1 Dec 2010 16:59:26 +0000 (16:59 +0000)] 
Clarify documentation on how we store codec preference lists.

(closes issue #18397)
 Reported by: birgita

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@296990 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoProperly restore backup information file when hanging up during message prepending.
Jeff Peeler [Wed, 1 Dec 2010 00:23:19 +0000 (00:23 +0000)] 
Properly restore backup information file when hanging up during message prepending.

ABE-2654

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@296868 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoGet rid of the annoying startup and shutdown errors on OS X.
Tilghman Lesher [Wed, 1 Dec 2010 00:20:05 +0000 (00:20 +0000)] 
Get rid of the annoying startup and shutdown errors on OS X.

This mainly deals with the problem of constructors on platforms where an
explicit constructor order cannot be specified (any system with gcc 4.2
or less).  However, this is only a problem on those systems where we need
to initialize mutexes with a constructor, because we have other code that
also relies upon constructors, and we cannot specify that mutexes are
initialized first (and destroyed last).

There are two approaches to dealing with this issue, related to whether the
code exists in the core Asterisk binary or in a separate code module.  In the
core case, constructors are run immediately upon load, and the file_versions
list mutex needs to be already initialized, as it is referenced in the first
constructor within each core source file.  In this case, we use pthread_once
to ensure that the mutex is initialized immediately before it is used for the
first time.  The only caveat is that the mutex is not ever destroyed, but
because this is the core, it makes no real difference; the only time when
destruction is safe would be just prior to process destruction, which takes
care of that anyway.  And due to using pthread_once, the mutex will never be
reinitialized, which means only one structure has leaked at the end of the
process.  Hence, it is not a problematic leak.

The second approach is to use the load_module and unload_module routines,
which, for obvious reasons, exist only in loadable modules.  In this second
case, we don't have a problem with the constructors, but only with destructor
order, because mutexes can be destroyed before their final usage is employed.
However, we need the mutexes to still be destroyed, in certain scenarios:  if
the module is unloaded prior to the process ending, it should be clean, with
no allocations by the module hanging around after that point in time.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@296867 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoMake sure nothing else is needed before destroying the scheduler.
Paul Belanger [Mon, 29 Nov 2010 22:49:39 +0000 (22:49 +0000)] 
Make sure nothing else is needed before destroying the scheduler.

(closes issue #18398)
Reported by: pabelanger

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@296670 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoFix bugs in saying numbers using the Swedish language syntax
Olle Johansson [Fri, 26 Nov 2010 09:53:31 +0000 (09:53 +0000)] 
Fix bugs in saying numbers using the Swedish language syntax

(closes issue #18355)
Reported by: oej
Patch by: oej

Much help from Peter Lindahl. Testing by the ClearIT team during a coffee break.

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@296309 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoMake Asterisk less crashy.
Russell Bryant [Wed, 24 Nov 2010 23:26:43 +0000 (23:26 +0000)] 
Make Asterisk less crashy.

Since we might not put a new translation path on the channel, go ahead and
set it to NULL right after destroying the old one to ensure we don't try
to free an invalid translation path later on.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@296213 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoOneway audio to SIP phone from FXS port after FXS port gets a CallWaiting pip.
Richard Mudgett [Wed, 24 Nov 2010 22:41:07 +0000 (22:41 +0000)] 
Oneway audio to SIP phone from FXS port after FXS port gets a CallWaiting pip.

The FXS connected phone has to have CW/CID support to fail, as it will
send back a DTMF 'A' or 'D' when it's ready to receive CallerID.  A normal
phone with no CID never fails.  Also the SIP phone does not hear MOH when
the CW call is answered.

The DTMF end frame is suppressed when the phone acknowledges the CW signal
for CID.  The problem is the DTMF begin frame needs to be suppressed as
well.  The DTMF begin frame is causing SIP to start sending the DTMF RTP
frames.  Since the DTMF end frame is suppressed, SIP will not stop sending
those DTMF RTP packets.

* Suppress the DTMF begin and end frames when the channel driver is
looking for DTMF digits.

* Fixed a couple issues caused by not cleaning up the CID spill if you
answer the CW call while it is sending the CID spill.

* Fixed not sending CW/CID spill to the phone when the call is natively
bridged.  (Fixed by not using native bridge if CW/CID is possible.)

* Suppress received audio when sending CW/CID spills.  The other parties
involved do not need to hear the CW/CID spills and may be confused if the
CW call is for them.

(closes issue #18129)
Reported by: alecdavis
Patches:
      issue_18129_v1.8_v3.patch uploaded by rmudgett (license 664)
Tested by: alecdavis, rmudgett

NOTE:

* v1.4 does not have the main problem fixed by suppressing the DTMF start
frames.  The other three items fixed are relevant.

* If you really must restore native bridging between analog ports, you
need to disable CW/CID either by configuring chan_dahdi.conf
callwaitingcallerid=no or dialing *70 before dialing the number to
temporarily disable CW.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@296165 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoFix false reporting of an error by set_format().
Russell Bryant [Wed, 24 Nov 2010 20:22:32 +0000 (20:22 +0000)] 
Fix false reporting of an error by set_format().

In the case that the native format was able to be changed to match the
new requested format, the code proceeded to attempt to build a translation
path, anyway.  The result would be NULL, since no translation path is
necessary and resulted in this function thinking an error has occurred.
This case is now specifically caught and no attempt to build a translation
path is attempted.

Thanks to our automated tests and bamboo.asterisk.org for catching this problem
and making a whole lot of noise when things started failing.  :-)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@296082 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoHandle failures building translation paths more effectively.
Russell Bryant [Wed, 24 Nov 2010 16:48:39 +0000 (16:48 +0000)] 
Handle failures building translation paths more effectively.

The problem scenario occurred on a heavily loaded system that was using the
codec_dahdi module and exceeded the hardware transcoding capacity.  The failure
mode at that point was not good.  The report came in to us as an Asterisk
lock-up.  The "core show locks" shows a ton of threads locked up (but no
obvious deadlock).  Upon deeper investigation, when the system is in this
state, the CPU was maxed out.  The CPU was being consumed by the Asterisk
logger spewing messages on every audio frame for calls set up after transcoder
capacity was reached.

The purpose of this patch is to make Asterisk handle failures to create a
translation path in a more graceful manner.  If we can't translate, then the
call just needs to be dropped, as it's not going to work.  These are the
changes:

1) In set_format() of channel.c (which is called by set_read_format() and
set_write_format()), it was ignoring if ast_translator_build_path() failed and
returned NULL.  It now pays attention to that case and returns a result
reflecting failure.  With this change in place, the bridging code will
immediately detect a failure and end the bridge instead of proceeding to try to
bridge frames that can't be translated and making channel drivers freak out by
sending them frames in a format they weren't expecting.

2) In ast_indicate_data() of channel.c, failure of ast_playtones_start() was
ignored.  It is now reflected in the return value of the function.  This didn't
turn out to have any affect on the bug, but seemed like a good change to leave
in.

3) In app_dial(), when only sending a call to a single endpoint, it will
attempt to do some bridging of its own of early audio.  It uses
make_compatible() when it's going to do this.  However, it ignored failure from
make compatible.  So, even with the fix from #1, if there was early audio going
through app_dial, there would still be a period of invalid frames passing
through.  After detecting failure here, Dial() exits.

ABE-2658

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@296000 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoFix support of saynumber(1,n) in the Swedish language
Olle Johansson [Tue, 23 Nov 2010 09:28:14 +0000 (09:28 +0000)] 
Fix support of saynumber(1,n) in the Swedish language

(closes issue #18353)
Reported by: oej

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@295906 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoThe channel redirect function (CLI or AMI) hangs up the call instead of redirecting...
Richard Mudgett [Mon, 22 Nov 2010 18:46:26 +0000 (18:46 +0000)] 
The channel redirect function (CLI or AMI) hangs up the call instead of redirecting the call.

To recreate the problem:
1) Party A calls Party B
2) Invoke CLI "channel redirect" command to redirect channel call leg
associated with A.
3) All associated channels are hung up.

Note that if the CLI command were done on the channel call leg associated
with B it works.

This regression was a result of the fix for issue #16946
(https://reviewboard.asterisk.org/r/740/).

The regression affects all features that use an async goto to execute the
dialplan because of an external event: Channel redirect, AMI redirect, SIP
REFER, and FAX detection.

The struct ast_channel._softhangup code is a mess.  The variable is used
for several purposes that do not necessarily result in the call being hung
up.  I have added doxygen comments to describe how the various _softhangup
bits are used.  I have corrected all the places where the variable was
tested in a non-bit oriented manner.

The primary fix is the new AST_CONTROL_END_OF_Q frame.  It acts as a weak
hangup request so the soft hangup requests that do not normally result in
a hangup do not hangup.

JIRA SWP-2470
JIRA SWP-2489

(closes issue #18171)
Reported by: SantaFox
(closes issue #18185)
Reported by: kwemheuer
(closes issue #18211)
Reported by: zahir_koradia
(closes issue #18230)
Reported by: vmarrone
(closes issue #18299)
Reported by: mbrevda
(closes issue #18322)
Reported by: nerbos

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@295790 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoDiscard responses with more than one Via
Terry Wilson [Fri, 19 Nov 2010 20:53:36 +0000 (20:53 +0000)] 
Discard responses with more than one Via

This is not a perfect solution as headers that are joined via commas are not
detected. This is a parsing issue that to fix "correctly" would necessitate
a new SIP parser.

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@295628 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoRevert a new feature which should have gone into trunk.
Erin Spiceland [Fri, 19 Nov 2010 19:32:04 +0000 (19:32 +0000)] 
Revert a new feature which should have gone into trunk.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@295553 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoAdd extra functionality to AGI command WAIT FOR DIGIT.
Erin Spiceland [Fri, 19 Nov 2010 19:24:05 +0000 (19:24 +0000)] 
Add extra functionality to AGI command WAIT FOR DIGIT.

Add the ability to play a sound file, listen for more than just one digit, specify
escape characters. Backwards compatible (to work with only timeout specified).

(closes issue #15531)
Reported by: diLLec
Patches:
      asterisk-res_agi-203638-patched.patch uploaded by diLLec (license 839)
Tested by: diLLec, espiceland

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@295552 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoDead code elimination in channel.c:ast_channel_bridge() variable who.
Richard Mudgett [Tue, 16 Nov 2010 22:52:06 +0000 (22:52 +0000)] 
Dead code elimination in channel.c:ast_channel_bridge() variable who.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@295280 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoEnsure original message duration is preserved when prepending a message.
Jeff Peeler [Tue, 16 Nov 2010 21:29:29 +0000 (21:29 +0000)] 
Ensure original message duration is preserved when prepending a message.

It seems the fix to issue 17103 was a little overzealous and removed the code
that backed up the textfile containing the original message duration. This
code has now been restored.

(related to issue #17103)
ABE-2654

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@295200 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoErr, oops. Made it const to verify that it wasn't altered, but forgot to revert...
Tilghman Lesher [Mon, 15 Nov 2010 18:05:49 +0000 (18:05 +0000)] 
Err, oops.  Made it const to verify that it wasn't altered, but forgot to revert before commit.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@295031 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoCreate test verifying results of expression parser
Tilghman Lesher [Mon, 15 Nov 2010 17:58:37 +0000 (17:58 +0000)] 
Create test verifying results of expression parser

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@295026 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoFix regression causing abort in voicemail after opening a mailbox with no mesgs.
Jeff Peeler [Fri, 12 Nov 2010 20:49:09 +0000 (20:49 +0000)] 
Fix regression causing abort in voicemail after opening a mailbox with no mesgs.

In order to be more safe, some error handling code was changed to respect more
error conditions including the potential memory allocation failure for deleted
and heard message tracking introduced in 293004. However, last_message_index
returns -1 for zero messages (perhaps as expected) and was triggering the
stricter error checking. Because last_message_index is only called directly
in one place, just return 0 from open_mailbox (for file based storage) when no
messages are detected unless a real error has occurred.

(closes issue #18240)
Reported by: leobrown
Patches:
      bug18240.1-6-2.diff.txt uploaded by alecdavis (license 585)
Tested by: pabelanger

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@294903 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoAsterisk is getting a "No D-channels available!" warning message every 4 seconds.
Richard Mudgett [Fri, 12 Nov 2010 02:41:13 +0000 (02:41 +0000)] 
Asterisk is getting a "No D-channels available!" warning message every 4 seconds.

Asterisk is just whining too much with this message: "No D-channels
available!  Using Primary channel XXX as D-channel anyway!".

Filtered the message so it only comes out once if there is no D channel
available without an intervening D channel available period.

(closes issue #17270)
Reported by: jmls

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@294821 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoI didn't mean to merge this, sorry
Jeff Peeler [Thu, 11 Nov 2010 22:11:33 +0000 (22:11 +0000)] 
I didn't mean to merge this, sorry

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@294739 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoFix problem with qualify option packets for realtime peers never stopping.
Jeff Peeler [Thu, 11 Nov 2010 21:12:27 +0000 (21:12 +0000)] 
Fix problem with qualify option packets for realtime peers never stopping.

The option packets not only never stopped, but if a realtime peer was not in
the peer list multiple options dialogs could accumulate over time. This
scenario has the potential to progress to the point of saturating a link just
from options packets. The fix was to ensure that the poke scheduler checks to
see if a peer is in the peer list before continuing to poke. The reason a peer
must be in the peer list to be able to properly manage an options dialog is
because otherwise the call pointer is lost when the peer is regenerated from
the database, which is how existing qualify dialogs are detected.

(closes issue #16382)
Reported by: lftsy
Patches:
      bug16382-3.patch uploaded by jpeeler (license 325)
Tested by: zerohalo

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@294688 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoOne small addition to 294384 found while very carefully merging to 1.6.
Jeff Peeler [Thu, 11 Nov 2010 19:52:14 +0000 (19:52 +0000)] 
One small addition to 294384 found while very carefully merging to 1.6.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@294641 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoFix a deadlock in device state change processing.
Jeff Peeler [Tue, 9 Nov 2010 17:37:59 +0000 (17:37 +0000)] 
Fix a deadlock in device state change processing.

Copied from some notes from the original author (Russell):

Deadlock scenario:
Thread 1: device state change thread
  Holds - rdlock on contexts
  Holds - hints lock
  Waiting on channels container lock

Thread 2: SIP monitor thread
  Holds the "iflock"
  Holds a sip_pvt lock
  Holds channel container lock
  Waiting for a channel lock

Thread 3: A channel thread (chan_local in this case)
  Holds 2 channel locks acquired within app_dial
  Holds a 3rd channel lock it got inside of chan_local
  Holds a local_pvt lock
  Waiting on a rdlock of the contexts lock

A bunch of other threads waiting on a wrlock of the contexts lock

To address this deadlock, some locking order rules must be put in place and
enforced. Existing relevant rules:

1) channel lock before a pvt lock
2) contexts lock before hints lock
3) channels container before a channel

What's missing is some enforcement of the order when you involve more than any
two. To fix this problem, I put in some code that ensures that (at least in the
code paths involved in this bug) the locks in (3) come before the locks in (2).
To change the operation of thread 1 to comply, I converted the storage of hints
to an astobj2 container. This allows processing of hints without holding the
hints container lock. So, in the code path that led to thread 1's state, it no
longer holds either the contexts or hints lock while it attempts to lock the
channels container.

(closes issue #18165)
Reported by: antonio

ABE-2583

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@294384 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoModify our handling of 491 responses to drop any pending reinvite retry scheduler...
Matthew Nicholson [Mon, 8 Nov 2010 18:59:20 +0000 (18:59 +0000)] 
Modify our handling of 491 responses to drop any pending reinvite retry scheduler entries if we get a new 491.

This prevents a scheduler entry from leaking if we receive a 491 response when one is pending.  If a scheduler entry leaks, the pvt it is associated my get destroyed before the scheduler entry fires, and then memory corruption and crashes can occur when the scheduled reinvite attempts to access and modify the memory of the destroyed pvt.

ABE-2543

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@294163 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agocodecs/codec_dahdi: Prevent "choppy" audio when receiving unexpected frame sizes.
Shaun Ruffell [Fri, 5 Nov 2010 00:02:53 +0000 (00:02 +0000)] 
codecs/codec_dahdi: Prevent "choppy" audio when receiving unexpected frame sizes.

dahdi-linux 2.4.0 (specifically commit 9034) added the capability for
the wctc4xxp to return more than a single packet of data in response to
a read.  However, when decoding packets, codec_dahdi was still assuming
that the default number of samples was in each read.

In other words, each packet your provider sent you, regardless of size,
would result in 20 ms of decoded data (30 ms if decoding G723). If your
provider was sending 60 ms packets then codec_dahdi would end up
stripping 40 ms of data from each transcoded frame resulting in "choppy"
audio.

This would only affect systems where G729 packets are arriving in sizes
greater than 20ms or G723 packets arriving in sizes greater than 30ms.

DAHDI-744.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@293968 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoFixes ringback tone on feature semi-attended transfer
David Vossel [Thu, 4 Nov 2010 21:28:12 +0000 (21:28 +0000)] 
Fixes ringback tone on feature semi-attended transfer

ABE-2168

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@293922 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoParty A in an analog 3-way call would continue to hear ringback after party C answers.
Richard Mudgett [Wed, 3 Nov 2010 18:23:04 +0000 (18:23 +0000)] 
Party A in an analog 3-way call would continue to hear ringback after party C answers.

All parties are analog FXS ports.
1) A calls B.
2) A flash hooks to call C.
3) A flash hooks to bring C into 3-way call before C answers.  (A and B hear ringback)
4) C answers
5) A continues to hear ringback during the 3-way call. (All parties can hear each other.)

* Fixed use of wrong variable in dahdi_bridge() that stopped ringback on
the wrong subchannel.

* Made several debug messages have more information.

A similar issue happens if B and C are SIP channels.  B continues to hear
ringback.  For some reason this only affects v1.8 and trunk.

* Don't start ringback on the real and 3-way subchannels when creating the
3-way conference.  Removing this code is benign on v1.6.2 and earlier.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@293805 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoAdd enabled/disabled information for rtautoclear sip show settings output.
Jeff Peeler [Tue, 2 Nov 2010 23:02:51 +0000 (23:02 +0000)] 
Add enabled/disabled information for rtautoclear sip show settings output.

When setting to zero/"no", the numeric default was shown making it not obvious
the disabled setting was respected.

(closes issue #18123)
Reported by: zerohalo

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@293722 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoMake warning message have more useful information in it.
Richard Mudgett [Tue, 2 Nov 2010 21:24:13 +0000 (21:24 +0000)] 
Make warning message have more useful information in it.

Change "Unable to get index, and nullok is not asserted" to "Unable to get
index for '<channel-name>' on channel <number> (<function>(), line
<number>)".

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@293639 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoRemove some more code that serves no purpose.
Richard Mudgett [Sat, 30 Oct 2010 01:45:49 +0000 (01:45 +0000)] 
Remove some more code that serves no purpose.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@293416 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoRemove some code that serves no purpose.
Richard Mudgett [Sat, 30 Oct 2010 00:34:12 +0000 (00:34 +0000)] 
Remove some code that serves no purpose.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@293339 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years ago"!00" evaluated as false, which is incorrect. Fixing.
Tilghman Lesher [Thu, 28 Oct 2010 19:44:37 +0000 (19:44 +0000)] 
"!00" evaluated as false, which is incorrect.  Fixing.

Reported (though the reporter did not understand he was reporting a bug) on the asterisk-users list:
http://lists.digium.com/pipermail/asterisk-users/2010-October/255505.html

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@293194 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoFix inprocess_container in voicemail to correctly restrict max messages.
Jeff Peeler [Mon, 25 Oct 2010 22:55:28 +0000 (22:55 +0000)] 
Fix inprocess_container in voicemail to correctly restrict max messages.

The comparison function logic was off, so the number of sessions for a given
mailbox were not being incremented properly. This problem caused the maximum
number of messages per folder to not be respected when simultaneously leaving
multiple voicemails just below the threshold.

These problems should be fixed by the above, but just in case:
Fixed resequence_mailbox to rely on the actual number of detected number of
files in a directory rather than just assuming only 10 messages more than the
maximum had been left. Also if more messages than the maximum are deleted they
are actually removed now.

The second purpose of this commit should have been separated out probably, but
is related to the above. Again, if the number of messages in a given voicemail
folder exceeds the maximum set limit make sure to allocate enough space for the
deleted and heard index tracking array.

A few random fixes:
There was a forgotten decrement of the inprocess count in imap_store_file.

When using IMAP storage, do not look in the directory where file based storage
messages may still reside and influence the message count.

Ensure to use only the first format in sendmail.

ABE-2516

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@293004 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoThis patch turns chan_local pvts into astobj2 objects.
David Vossel [Mon, 25 Oct 2010 19:05:07 +0000 (19:05 +0000)] 
This patch turns chan_local pvts into astobj2 objects.

chan_local does some dangerous things involving deadlock avoidance.
tech_pvt functions like hangup and queue_frame are provided with a
locked channel upon entry.  Those functions are completely safe as
long as you don't attempt to give up that channel lock, but that is
impossible to guarantee due to the required deadlock avoidance necessary
to lock both the tech_pvt and both channels involved.

In the past, we have tried to account for this by doing things like
setting a "glare" flag that indicates what function should destroy the
pvt.  This was used in local_hangup and local_queue_frame to decided
who should destroy the pvt if they collided in separate threads.  I
have removed the need to do this by converting all chan_local tech_pvts
to astobj2.  This means we can ref a pvt before deadlock avoidance
and not have to worry about that pvt possibly getting destroyed under
us.  It also cleans up where we destroy the tech_pvt.  The only unlink
from the tech_pvt container occurs in local_hangup now, which is where
it should occur.

Since there still may be thread collisions on some functions like
local_hangup after deadlock avoidance, I have added some checks to detect
those collisions and exit appropriately.  I think this patch is going to
solve quite a bit of weirdness we have had with local channels in the past.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@292866 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoRecord priv-recordintro as sln, not gsm
Paul Belanger [Thu, 21 Oct 2010 00:00:51 +0000 (00:00 +0000)] 
Record priv-recordintro as sln, not gsm

This removes the gsm->sln step when transcoding
priv-recordintro.

(closes issue #18176)
Reported by: pabelanger
Patches:
      chan_sip.diff uploaded by pabelanger (license 224)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@292411 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoFix improper operator key acceptance and clean up temp recording files.
Jeff Peeler [Mon, 18 Oct 2010 21:50:30 +0000 (21:50 +0000)] 
Fix improper operator key acceptance and clean up temp recording files.

This is a fix for when pressing the operator key after recording an unavailable,
busy, name, or temporary message in mailbox options. The operator key should not
be accepted here, but should be allowed during the message recording. If the
operator key is pressed during ensure the file is saved or deleted as
apporopriate.  Also, ensure removal of temporary recorded files after an early
hang up or when message acceptance confirmation times out.

ABE-2518

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@292223 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoAdd support for the new English (Australian Accent) sound files.
Leif Madsen [Mon, 18 Oct 2010 21:47:25 +0000 (21:47 +0000)] 
Add support for the new English (Australian Accent) sound files.

(closes issue #17426)
Reported by: camsown
Patches:
      core-sounds-en_AU.txt uploaded by camsown (license 1050)
      add_AU_sounds.patch.txt uploaded by lmadsen (license 10)
Tested by: camsown, lmadsen, jtodd, qwell

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@292222 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoClean up formatting.
Paul Belanger [Fri, 15 Oct 2010 19:30:41 +0000 (19:30 +0000)] 
Clean up formatting.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@291938 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoDon't access o->next after freeing o on unload
Terry Wilson [Fri, 15 Oct 2010 02:13:17 +0000 (02:13 +0000)] 
Don't access o->next after freeing o on unload

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@291862 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoDeadlock between dahdi_exception() and dahdi_indicate().
Richard Mudgett [Wed, 13 Oct 2010 23:29:58 +0000 (23:29 +0000)] 
Deadlock between dahdi_exception() and dahdi_indicate().

There is a deadlock between dahdi_exception() and dahdi_indicate() for
analog ports.  The call-waiting and three-way-calling feature can
experience deadlock if these features are trying to do something and an
event from the bridged channel happens at the same time.

Deadlock avoidance code added to obtain necessary channel locks before
attemting an operation with call-waiting and three-way-calling.

(closes issue #16847)
Reported by: shin-shoryuken
Patches:
      issue_16847_v1.4.patch uploaded by rmudgett (license 664)
      issue_16847_v1.6.2.patch uploaded by rmudgett (license 664)
      issue_16847_v1.8_v2.patch uploaded by rmudgett (license 664)
Tested by: alecdavis, rmudgett

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@291643 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoDon't ignore frames that have been queued when softhangup'd
Terry Wilson [Wed, 13 Oct 2010 22:45:15 +0000 (22:45 +0000)] 
Don't ignore frames that have been queued when softhangup'd

When an outgoing call is answered and hung up by the far end *very* quickly, we
may not read any frames and therefor end up with a call that displays the wrong
disposition/DIALSTATUS. The reason is because ast_queue_hangup() immediately
sets the _softhangup flag on the channel and then queues the HANGUP control
frame, but __ast_read refuses to read any frames if ast_check_hangup() indicates
that a hangup request has been made (which it will if _softhangup is set). So,
we end up losing control frames.

This change makes __ast_read continue to read frames even if a soft hangup has
been requested. It queues a hangup frame to make sure that __ast_read() will
still eventually return NULL.

Much thanks to David Vossel for all of the reviews, discussion, and help!

(closes issue #16946)
Reported by: davidw

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@291577 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoLock pvt so pvt->owner can't disappear when queueing up a frame.
Russell Bryant [Wed, 13 Oct 2010 15:23:19 +0000 (15:23 +0000)] 
Lock pvt so pvt->owner can't disappear when queueing up a frame.

This fixes a crash due to a hangup race condition.

ABE-2601

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@291392 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoOops, incorrect range (although unallocated at ARIN)
Tilghman Lesher [Tue, 12 Oct 2010 16:55:30 +0000 (16:55 +0000)] 
Oops, incorrect range (although unallocated at ARIN)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@291263 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoAdd missing unlock to an exception condition in reload_config().
Richard Mudgett [Mon, 11 Oct 2010 18:29:43 +0000 (18:29 +0000)] 
Add missing unlock to an exception condition in reload_config().

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@291109 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoEnsure editline cleanup occurs when Ctrl-C is pressed at control console.
Jeff Peeler [Fri, 8 Oct 2010 02:35:29 +0000 (02:35 +0000)] 
Ensure editline cleanup occurs when Ctrl-C is pressed at control console.

A recent change was made to avoid a race condition on shutdown which only called
the end functions from the console thread. However, when pressing Ctrl-C the
quit handler is called from the signal handler thread.

(closes issue #17698)
Reported by: jmls

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@290862 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoAllow PRI to build properly when using --with-pri.
Jason Parker [Thu, 7 Oct 2010 20:56:04 +0000 (20:56 +0000)] 
Allow PRI to build properly when using --with-pri.

Use the directories found for the parent when using lib dependencies.

(closes issue #17314)
Reported by: tzafrir
Patches:
      17314-withdeps.diff uploaded by qwell (license 4)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@290750 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoFix a crash by ensuring that we don't alter memory after it's freed.
Tilghman Lesher [Tue, 5 Oct 2010 20:20:07 +0000 (20:20 +0000)] 
Fix a crash by ensuring that we don't alter memory after it's freed.

(closes issue #17387)
 Reported by: jmls
 Patches:
       20100726__issue17387.diff.txt uploaded by tilghman (license 14)
 Tested by: jmls

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@290392 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoMerged revision 258974 from
Richard Mudgett [Tue, 5 Oct 2010 17:41:18 +0000 (17:41 +0000)] 
Merged revision 258974 from
https://origsvn.digium.com/svn/asterisk/trunk

..........
  r258974 | diruggles | 2010-04-26 14:05:47 -0500 (Mon, 26 Apr 2010) | 4 lines

  Line 24 missed in compatibility fix in revision 233577

  added a "fun:" prefix line 24
..........

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@290323 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoFixing Mac OS X auto-builder.
Tilghman Lesher [Mon, 4 Oct 2010 20:15:26 +0000 (20:15 +0000)] 
Fixing Mac OS X auto-builder.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@290177 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoAutomatically re-run configure test for menuselect, when the relevant makeopts settin...
Tilghman Lesher [Sun, 3 Oct 2010 21:04:29 +0000 (21:04 +0000)] 
Automatically re-run configure test for menuselect, when the relevant makeopts settings change.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@290100 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoAdd documentation for undocumented option to AMI action originate
Olle Johansson [Sat, 2 Oct 2010 08:50:05 +0000 (08:50 +0000)] 
Add documentation for undocumented option to AMI action originate

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@289949 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoWhen forwarding a message, a prepend means that the filesystem will always have a...
Tilghman Lesher [Sat, 2 Oct 2010 04:42:08 +0000 (04:42 +0000)] 
When forwarding a message, a prepend means that the filesystem will always have a better copy.

(closes issue #17803)
 Reported by: dpetersen
 Patches:
       20100923__issue17803.diff.txt uploaded by tilghman (license 14)
 Tested by: dpetersen

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@289873 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoChange RFC2833 DTMF event duration on end to report actual elapsed time.
Jeff Peeler [Fri, 1 Oct 2010 22:58:38 +0000 (22:58 +0000)] 
Change RFC2833 DTMF event duration on end to report actual elapsed time.

The scenario here is with a non P2P early media session. The reported time
length of DTMF presses are coming up short when sending to the remote side.
Currently the event duration is a running total that is incremented when sending
continuation packets. These continuation packets are only triggered upon
incoming media from the remote side, which means that the running total probably
is not going to end up matching the actual length of time Asterisk received
DTMF. This patch changes the end event duration to be lengthened if it is
detected that the end event is going to come up short.

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

ABE-2476

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@289797 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoDisable debugging by default
Paul Belanger [Fri, 1 Oct 2010 17:03:11 +0000 (17:03 +0000)] 
Disable debugging by default

and reformat .config file.

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@289703 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoEnsure user portion of SIP URI matches dialplan when using encoded characters.
Jeff Peeler [Fri, 1 Oct 2010 16:20:00 +0000 (16:20 +0000)] 
Ensure user portion of SIP URI matches dialplan when using encoded characters.

This commit takes a simliar approach to 288112 and checks the dialplan to
determine the proper action for an incoming contact header as to whether or not
it should be decoded or not. sip_new was blindly always decoding the extension,
which also caused the outgoing contact header to be incorrect as well as failing
to match the encoded extension in the dialplan.

(closes issue #17892)
Reported by: wdoekes
Patches:
      bug17892-1.patch uploaded by jpeeler (license 325)
Tested by: wdoekes

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@289699 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agodon't iterate through all dialogs to find and delete old subscribes
Stefan Schmidt [Fri, 1 Oct 2010 09:42:22 +0000 (09:42 +0000)] 
don't iterate through all dialogs to find and delete old subscribes

On every incoming subscribe there is a iteration through all dialogs to find old subscribes and delete them. This is slow and not RFC conform. This was only needed in 1.2 cause a subscribe was not deleted when a dialog was destroyed, after 1.4 a subscribe get removed when its dialog is destroyed.

(closes issue #17950)
Reported by: schmidts
Tested by: schmidts

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@289622 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agores_agi.c:handle_getvariablefull() could recursively lock a channel and not
Brett Bryant [Thu, 30 Sep 2010 17:08:20 +0000 (17:08 +0000)] 
res_agi.c:handle_getvariablefull() could recursively lock a channel and not
release it if an argument is the current channel's name.

(closes issue #17970)
Reported by: mdu113
Patches:
      res_agi.c.diff3 uploaded by mdu113 (license 582)
      Tested by: mdu113

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@289500 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoFix a crash in app_sms.
Russell Bryant [Thu, 30 Sep 2010 15:34:29 +0000 (15:34 +0000)] 
Fix a crash in app_sms.

Since the data being passed to the generator callback is on the stack of the
SMS() application, we must ensure that the generator is stopped before the
application exits.

ABE-2587

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@289424 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoAllow a manager originate to succeed on forwarded devices.
Jason Parker [Wed, 29 Sep 2010 20:56:26 +0000 (20:56 +0000)] 
Allow a manager originate to succeed on forwarded devices.

The timeout to wait for an answer was being set to 0 when a device forwarded to another
extension.  We don't always need the timeout set like this, so make it an optional
parameter, and don't use it in this case.

ABE-2544

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@289338 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoSet the caller id on CDRs when it is set on the parent channel.
Matthew Nicholson [Wed, 29 Sep 2010 15:03:27 +0000 (15:03 +0000)] 
Set the caller id on CDRs when it is set on the parent channel.

(closes issue #17569)
Reported by: tbelder
Patches:
      17569.diff uploaded by tbelder (license 618)
Tested by: tbelder

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@289177 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoFixes an issue with the Newchannel AMI event during the Masquerading process.
Brett Bryant [Tue, 28 Sep 2010 18:10:19 +0000 (18:10 +0000)] 
Fixes an issue with the Newchannel AMI event during the Masquerading process.

Fixes an issue with the Newchannel AMI event during the Masquerading process,
where no Newchannel AMI event was generated for the psuedo channel used during
the masquerading process.

(closes issue #17987)
Reported by: RadicAlish
Patches:
      newchannel.patch.txt uploaded by RadicAlish (license 1122)
      Tested by: RadicAlish

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@289094 65c4cc65-6c06-0410-ace0-fbb531ad65f3

14 years agoDon't fail a masquerade if it is already being hung up
Terry Wilson [Fri, 24 Sep 2010 15:26:09 +0000 (15:26 +0000)] 
Don't fail a masquerade if it is already being hung up

This avoids noise on some Local channel situations where we don't use /n.
Thanks to Alec Davis for the suggestion.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@288746 65c4cc65-6c06-0410-ace0-fbb531ad65f3