Commit Graph

235 Commits

Author SHA1 Message Date
Joshua Colp 10eb78d213 Fix an issue where Local channels dialed by app_queue are considered in use immediately.
The chan_local channel driver returns a device state of in use even if a created Local
channel has not yet been dialed. This fix changes the logic to return a state of not
in use until the channel itself has been dialed.

(closes issue ASTERISK-20390)
Reported by: tim_ringenbach

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

Merged revisions 373878 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 373879 from http://svn.asterisk.org/svn/asterisk/branches/10
........

Merged revisions 373880 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@373881 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-09-27 11:33:54 +00:00
Joshua Colp 318c7bea44 Fix T.38 support when used with chan_local in between.
Users of the T.38 API can indicate AST_T38_REQUEST_PARMS on a channel to request that the
channel indicate a T.38 negotiation with the parameters present on the channel. The return
value of this indication is expected to be AST_T38_REQUEST_PARMS upon success but with
chan_local involved this could never occur.

This fix changes chan_local to always return AST_T38_REQUEST_PARMS for this situation. If
the underlying channel technology on the other side does not support T.38 this would have
been determined ahead of time using ast_channel_get_t38_state and an indication would
not occur.

(closes issue ASTERISK-20229)
Reported by: wdoekes
Patches:
     ASTERISK-20229.patch uploaded by wdoekes (license 5674)

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

Merged revisions 373705 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 373706 from http://svn.asterisk.org/svn/asterisk/branches/10
........

Merged revisions 373707 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@373708 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-09-25 20:14:13 +00:00
Jonathan Rose 6f8bad0eac chan_local: Switch from using a random 4 digit hex identifier to unique id
Changes chan_local channels to use an 8 digit hex identifier generated
atomically and sequentially in order to eliminate the chance of having
multiple channels with the same name during high call volume situations.

(issue ASTERISK-20318)
Reported by: Dan Cropp
Review: https://reviewboard.asterisk.org/r/2104/
........

Merged revisions 372902 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 372916 from http://svn.asterisk.org/svn/asterisk/branches/10
........

Merged revisions 372917 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@372918 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-09-11 22:40:02 +00:00
Matthew Jordan 2ffae5745d Add some additional documentation for core AMI events
This patch adds some basic documentation for a number of modules.  This
includes core source files in Asterisk (those in main), as well as
chan_agent, chan_dahdi, chan_local, sig_analog, and sig_pri.  The DTD
has also been updated to allow referencing of AMI commands.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369905 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-07-10 22:26:27 +00:00
Richard Mudgett ac35b92b62 Hangup handlers - Dialplan subroutines that run when the channel hangs up.
Hangup handlers are an alternative to the h extension.  They can be used
in addition to the h extension.  The idea is to attach a Gosub routine to
a channel that will execute when the call hangs up.  Whereas which h
extension gets executed depends on the location of dialplan execution when
the call hangs up, hangup handlers are attached to the call channel.  You
can attach multiple handlers that will execute in the order of most
recently added first.

(closes issue ASTERISK-19549)
Reported by: Mark Murawski
Tested by: rmudgett

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369493 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-29 17:02:32 +00:00
Jonathan Rose 5eb94d7ebb Unique Call ID logging Phases III and IV
Adds call ID logging changes to specific channel drivers that weren't handled
handled in phase II of Call ID Logging. Also covers logging for threads for
threads created by systems that may be involved with many different calls.
Extra special thanks to Richard for rigorous review of chan_dahdi and its
various signalling modules.

review: https://reviewboard.asterisk.org/r/1927/
review: https://reviewboard.asterisk.org/r/1950/



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369414 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-26 21:45:22 +00:00
Kinsey Moore 571445ab9c Convert AST_FLAG_ANSWERED_ELSEWHERE usage to AST_CAUSE_ANSWERED_ELSEWHERE
This was essentially duplicated functionality where normal channels used
AST_CAUSE_ANSWERED_ELSEWHERE while local channels and queues used
AST_FLAG_ANSWERED_ELSEWHERE.  This removes the flag and converts that usage
into AST_CAUSE_ANSWERED_ELSEWHER usage.

Review: https://reviewboard.asterisk.org/r/1944
(closes issue ASTERISK-19865)
Patch-by: Birger Harzenetter


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368519 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-05 14:41:43 +00:00
Richard Mudgett d5d984daa5 The predial routine must be run on the local;1 channel.
When ast_call() operates on a local channel, it copies a lot of things
from the local;1 channel to the local;2 channel.  This includes among
other things, channel variables and party id information.

Other reasons it was a bad idea to run predial on the local;2 channel:

1) The channel has not been completely setup.  The ast_call() completes
the setup.

2) The local;2 caller and connected line party information is opposite to
any other channels predial runs on.  (And it hasn't been setup yet.)

* Partially back out -r366183 by removing the chan_local implementation of
the struct ast_channel_tech.pre_call callback.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366546 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-15 19:36:26 +00:00
Richard Mudgett 0798012e39 Make chan_local use the API call instead of inlining its own version.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366462 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-14 21:34:14 +00:00
Richard Mudgett 4ea636c776 Run predial routine on local;2 channel where you would expect.
Before this patch, the predial routine executes on the ;1 channel of a
local channel pair.  Executing predial on the ;1 channel of a local
channel pair is of limited utility.  Any channel variables set by the
predial routine executing on the ;1 channel will not be available when the
local channel executes dialplan on the ;2 channel.

* Create ast_pre_call() and an associated pre_call() technology callback
to handle running the predial routine.  If a channel technology does not
provide the callback, the predial routine is simply run on the channel.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366183 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-10 21:29:41 +00:00
Richard Mudgett 8842f76a7f Fix local channel chains optimizing themselves out of a call.
* Made chan_local.c:check_bridge() check the return value of
ast_channel_masquerade().  In long chains of local channels, the
masquerade occasionally fails to get setup because there is another
masquerade already setup on an adjacent local channel in the chain.

* Made the outgoing local channel (the ;2 channel) flush one voice or
video frame per optimization attempt.

* Made sure that the outgoing local channel also does not have any frames
in its queue before the masquerade.

* Made do the masquerade immediately to minimize the chance that the
outgoing channel queue does not get any new frames added and thus
unconditionally flushed.

* Made block indication -1 (Stop tones) event when the local channel is
going to optimize itself out.  When the call is answered, a chain of local
channels pass down a -1 indication for each bridge.  This blizzard of -1
events really slows down the optimization process.

(closes issue ASTERISK-16711)
Reported by: Alec Davis
Tested by: rmudgett, Alec Davis
Review: https://reviewboard.asterisk.org/r/1894/
........

Merged revisions 365313 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 365320 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@365356 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-04 17:38:39 +00:00
Terry Wilson 07309e586c Multiple revisions 365006,365068
........
  r365006 | twilson | 2012-05-02 10:49:03 -0500 (Wed, 02 May 2012) | 12 lines
  
  Fix a CEL LINKEDID_END race and local channel linkedids
  
  This patch has the ;2 channel inherit the linkedid of the ;1 channel and fixes
  the race condition by no longer scanning the channel list for "other" channels
  with the same linkedid. Instead, cel.c has an ao2 container of linkedid strings
  and uses the refcount of the string as a counter of how many channels with the
  linkedid exist. Not only does this eliminate the race condition, but it also
  allows us to look up the linkedid by the hashed key instead of traversing the
  entire channel list.
  
  Review: https://reviewboard.asterisk.org/r/1895/
........
  r365068 | twilson | 2012-05-02 12:02:39 -0500 (Wed, 02 May 2012) | 11 lines
  
  Don't leak a ref if out of memory and can't link the linkedid
  
  If the ao2_link fails, we are most likely out of memory and bad things
  are going to happen. Before those bad things happen, make sure to clean
  up the linkedid references.
  
  This patch also adds a comment explaining why linkedid can't be passed
  to both local channel allocations and combines two ao2_ref calls into 1.
  
  Review: https://reviewboard.asterisk.org/r/1895/
........

Merged revisions 365006,365068 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 365083 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@365084 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-02 17:43:16 +00:00
Richard Mudgett 2b7e1affac * Fix error path resouce leak in local_request().
* Restructure local_request() to reduce indentation.
........

Merged revisions 364840 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 364845 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@364846 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-01 22:00:11 +00:00
Richard Mudgett 01194c5811 Use ast_channel_lock_both() where it was inlined before.
The CHANNEL_DEADLOCK_AVOIDANCE() feature of preserving where the channel
lock was originally obtained is overkill where ast_channel_lock_both() was
inlined.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@362888 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-20 16:23:01 +00:00
Terry Wilson 786f5898d1 Finalize ast_channel opaquification
Review: https://reviewboard.asterisk.org/r/1786/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@358907 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-13 18:20:34 +00:00
Terry Wilson a9d607a357 Opaquify ast_channel structs and lists
Review: https://reviewboard.asterisk.org/r/1773/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@357542 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-29 16:52:47 +00:00
Terry Wilson ebaf59a656 Opaquification for ast_format structs in struct ast_channel
Review: https://reviewboard.asterisk.org/r/1770/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@356573 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-24 00:32:20 +00:00
Terry Wilson 57f42bd74f ast_channel opaquification of pointers and integral types
Review: https://reviewboard.asterisk.org/r/1753/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@356042 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-20 23:43:27 +00:00
Terry Wilson 34c55e8e7c Opaquify char * and char[] in ast_channel
Review: https://reviewboard.asterisk.org/r/1733/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@354968 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-13 17:27:06 +00:00
Richard Mudgett 23bc964e1c Constify some more channel driver technology callback parameters.
Review: https://reviewboard.asterisk.org/r/1707/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@353685 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-01 19:53:38 +00:00
Terry Wilson 99cae5b750 Opaquify channel stringfields
Continue channel opaque-ification by wrapping all of the stringfields.
Eventually, we will restrict what can actually set these variables, but
the purpose for now is to hide the implementation and keep people from
adding code that directly accesses the channel structure. Semantic
changes will follow afterward.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@352348 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-24 20:12:09 +00:00
Terry Wilson 04da92c379 Replace direct access to channel name with accessor functions
There are many benefits to making the ast_channel an opaque handle, from
increasing maintainability to presenting ways to kill masquerades. This patch
kicks things off by taking things a field at a time, renaming the field to
'__do_not_use_${fieldname}' and then writing setters/getters and converting the
existing code to using them. When all fields are done, we can move ast_channel
to a C file from channel.h and lop off the '__do_not_use_'.

This patch sets up main/channel_interal_api.c to be the only file that actually
accesses the ast_channel's fields directly. The intent would be for any API
functions in channel.c to use the accessor functions. No more monkeying around
with channel internals. We should use our own APIs.

The interesting changes in this patch are the addition of
channel_internal_api.c, the moving of the AST_DATA stuff from channel.c to
channel_internal_api.c (note: the AST_DATA stuff will have to be reworked to
use accessor functions when ast_channel is really opaque), and some re-working
of the way channel iterators/callbacks are handled so as to avoid creating fake
ast_channels on the stack to pass in matching data by directly accessing fields
(since "name" is a stringfield and the fake channel doesn't init the
stringfields, you can't use the ast_channel_name_set() function). I went with
ast_channel_name(chan) for a getter, and ast_channel_name_set(chan, name) for a
setter.

The majority of the grunt-work for this change was done by writing a semantic
patch using Coccinelle ( http://coccinelle.lip6.fr/ ).

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@350223 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-09 22:15:50 +00:00
Jason Parker 590391c038 Fix typo from r333070
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@333159 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-08-24 19:27:15 +00:00
Olle Johansson 82e1dda364 Formatting changes - Removing some red white space and adding some curly brackets.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@333075 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-08-24 09:17:48 +00:00
Olle Johansson 64fb851843 Add manager event for local channel semi-bridge
(issue AST-17623)

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@333070 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-08-24 09:09:53 +00:00
Olle Johansson 4403a89f50 Formatting changes while working with DTMF...
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@332024 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-08-16 14:47:38 +00:00
Leif Madsen a525edea59 Merged revisions 328247 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.10

................
  r328247 | lmadsen | 2011-07-14 16:25:31 -0400 (Thu, 14 Jul 2011) | 14 lines
  
  Merged revisions 328209 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.8
  
  ........
    r328209 | lmadsen | 2011-07-14 16:13:06 -0400 (Thu, 14 Jul 2011) | 6 lines
    
    Introduce <support_level> tags in MODULEINFO.
    This change introduces MODULEINFO into many modules in Asterisk in order to show
    the community support level for those modules. This is used by changes committed
    to menuselect by Russell Bryant recently (r917 in menuselect). More information about
    the support level types and what they mean is available on the wiki at
    https://wiki.asterisk.org/wiki/display/AST/Asterisk+Module+Support+States
  ........
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@328259 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-07-14 20:28:54 +00:00
Terry Wilson 34e2305ae7 Merged revisions 324048 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r324048 | twilson | 2011-06-16 17:35:41 -0500 (Thu, 16 Jun 2011) | 8 lines
  
  Lock the channel before calling the setoption callback
  
  The channel needs to be locked before calling these callback functions. Also,
  sip_setoption needs to lock the pvt and a check p->rtp is non-null before using
  it.
  
  Review: https://reviewboard.asterisk.org/r/1220/
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@324050 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-06-16 22:49:49 +00:00
David Vossel 3588746c75 Merged revisions 321515 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r321515 | dvossel | 2011-05-31 13:52:54 -0500 (Tue, 31 May 2011) | 12 lines
  
  Chan_local locking cleanup.
  
  This patch removes all of the unnecessary deadlock
  avoidance loops that occur in chan_local.  It also
  resolves an issue with a deadlock triggered by
  local channel optimizations.
  
  (issue #18028)
  
  Review: https://reviewboard.asterisk.org/r/1231/
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@321516 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-05-31 19:01:42 +00:00
David Vossel bb5e875b65 Merged revisions 316330 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

................
  r316330 | dvossel | 2011-05-03 16:37:59 -0500 (Tue, 03 May 2011) | 24 lines
  
  Merged revisions 316329 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.6.2
  
  ................
    r316329 | dvossel | 2011-05-03 16:29:55 -0500 (Tue, 03 May 2011) | 17 lines
    
    Merged revisions 316328 via svnmerge from 
    https://origsvn.digium.com/svn/asterisk/branches/1.4
    
    ........
      r316328 | dvossel | 2011-05-03 16:27:59 -0500 (Tue, 03 May 2011) | 10 lines
      
      Fixes chan_local crashs in local_fixup()
      
      Thanks OEJ for tracking down the issue and submitting the patch.
      
      (closes issue #19053)
      Reported by: oej
      Tested by: oej
      
      Review: https://reviewboard.asterisk.org/r/1158/
    ........
  ................
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@316332 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-05-03 21:45:46 +00:00
Russell Bryant 83ad7a9e6c Merged revisions 315446 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r315446 | russell | 2011-04-26 12:40:23 -0500 (Tue, 26 Apr 2011) | 14 lines
  
  chan_local: resolve a deadlock.
  
  This patch resolves a fairly complex deadlock that can occur with the
  combination of chan_local and a dialplan switch, such as dynamic realtime
  extensions, which pulls autoservice into the picture when doing a dialplan
  lookup.
  
  (closes issue #18818)
  Reported by: nic
  Patches:
        issue18818.patch uploaded by jthurman (license 614)
        18818.v1.txt uploaded by russell (license 2)
  Tested by: nic, jthurman, kterzi, steve-howes, sysreq, IshMalik
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@315447 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-04-26 17:41:51 +00:00
Alec L Davis 472e9aca3f Merged revisions 315053 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

................
  r315053 | alecdavis | 2011-04-25 19:14:32 +1200 (Mon, 25 Apr 2011) | 23 lines
  
  Merged revisions 315052 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.6.2
  
  ................
    r315052 | alecdavis | 2011-04-25 19:11:12 +1200 (Mon, 25 Apr 2011) | 16 lines
    
    Merged revisions 315051 via svnmerge from 
    https://origsvn.digium.com/svn/asterisk/branches/1.4
    
    ........
      r315051 | alecdavis | 2011-04-25 19:06:29 +1200 (Mon, 25 Apr 2011) | 11 lines
      
      chan_local:check_bridge() misplaced misplaced ast_mutex_unlock 
      
      if !p->chan->_bridge->_softhangup path isn't followed, brigde remains locked.
      
      (closes issue #19176)
      Reported by: alecdavis
      Patches: 
            bug19176.diff.txt uploaded by alecdavis (license 585)
    ........
  ................
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@315054 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-04-25 07:17:27 +00:00
Terry Wilson 36da6b6286 Merged revisions 306127 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

................
  r306127 | twilson | 2011-02-03 13:03:26 -0800 (Thu, 03 Feb 2011) | 23 lines
  
  Merged revisions 306126 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.6.2
  
  ................
    r306126 | twilson | 2011-02-03 12:56:00 -0800 (Thu, 03 Feb 2011) | 16 lines
    
    Merged revisions 306119 via svnmerge from 
    https://origsvn.digium.com/svn/asterisk/branches/1.4
    
    ........
      r306119 | twilson | 2011-02-03 12:36:34 -0800 (Thu, 03 Feb 2011) | 9 lines
      
      Set hangup cause in local_hangup
      
      When a call involves a local channel (like SIP -> Local -> SIP), the hangup
      cause was not being set. This resulted in SIP channels sometimes getting a
      503 error instead of a 486 when the far side sent a busy. In Asterisk 1.8+
      this also can cause issues with CCSS that involve a local channel. This patch
      sets the hangupcause for one side of the local channel to the other in
      local_hangup for outbound calls.
    ........
  ................
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@306128 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-02-03 21:13:11 +00:00
David Vossel c26c190711 Asterisk media architecture conversion - no more format bitfields
This patch is the foundation of an entire new way of looking at media in Asterisk.
The code present in this patch is everything required to complete phase1 of my
Media Architecture proposal.  For more information about this project visit the link below.
https://wiki.asterisk.org/wiki/display/AST/Media+Architecture+Proposal

The primary function of this patch is to convert all the usages of format
bitfields in Asterisk to use the new format and format_cap APIs.  Functionally
no change in behavior should be present in this patch.  Thanks to twilson
and russell for all the time they spent reviewing these changes.

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@306010 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-02-03 16:22:10 +00:00
Sean Bright d42cb6fd1d Merged revisions 302412 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r302412 | seanbright | 2011-01-19 10:31:39 -0500 (Wed, 19 Jan 2011) | 10 lines
  
  Use appropriate type for requested format in chan_local.
  
  We were passing and storing the requested format as an int instead of format_t
  resulting in truncation.
  
  (closes issue #18238)
  Reported by: whizemen
  Patches:
        0018238_speex16.patch uploaded by whizemen (license 1143)
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@302413 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-01-19 15:34:07 +00:00
Tilghman Lesher ac87fc136d Merged revisions 299626 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

................
  r299626 | tilghman | 2010-12-25 04:07:15 -0600 (Sat, 25 Dec 2010) | 19 lines
  
  Merged revisions 299625 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.6.2
  
  ................
    r299625 | tilghman | 2010-12-25 04:05:00 -0600 (Sat, 25 Dec 2010) | 12 lines
    
    Merged revisions 299624 via svnmerge from 
    https://origsvn.digium.com/svn/asterisk/branches/1.4
    
    ........
      r299624 | tilghman | 2010-12-25 04:04:06 -0600 (Sat, 25 Dec 2010) | 5 lines
      
      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/trunk@299627 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-12-25 10:08:04 +00:00
David Vossel 7189a944be Merged revisions 292868 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

................
  r292868 | dvossel | 2010-10-25 14:07:50 -0500 (Mon, 25 Oct 2010) | 39 lines
  
  Merged revisions 292867 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.6.2
  
  ................
    r292867 | dvossel | 2010-10-25 14:06:21 -0500 (Mon, 25 Oct 2010) | 32 lines
    
    Merged revisions 292866 via svnmerge from 
    https://origsvn.digium.com/svn/asterisk/branches/1.4
    
    ........
      r292866 | dvossel | 2010-10-25 14:05:07 -0500 (Mon, 25 Oct 2010) | 27 lines
      
      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/trunk@292869 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-10-25 19:11:42 +00:00
Terry Wilson 4e473de5e2 Merged revisions 288748 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

................
  r288748 | twilson | 2010-09-24 09:02:27 -0700 (Fri, 24 Sep 2010) | 19 lines
  
  Merged revisions 288747 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.6.2
  
  ................
    r288747 | twilson | 2010-09-24 08:37:39 -0700 (Fri, 24 Sep 2010) | 12 lines
    
    Merged revisions 288746 via svnmerge from 
    https://origsvn.digium.com/svn/asterisk/branches/1.4
    
    ........
      r288746 | twilson | 2010-09-24 08:26:09 -0700 (Fri, 24 Sep 2010) | 5 lines
      
      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/trunk@288749 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-09-24 16:11:19 +00:00
Terry Wilson 5ad9625cbf Merged revisions 288507 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

................
  r288507 | twilson | 2010-09-22 16:18:27 -0700 (Wed, 22 Sep 2010) | 22 lines
  
  Merged revisions 288500 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.6.2
  
  ................
    r288500 | twilson | 2010-09-22 16:10:09 -0700 (Wed, 22 Sep 2010) | 15 lines
    
    Merged revisions 288499 via svnmerge from 
    https://origsvn.digium.com/svn/asterisk/branches/1.4
    
    ........
      r288499 | twilson | 2010-09-22 16:00:30 -0700 (Wed, 22 Sep 2010) | 8 lines
      
      Don't let a Local channel get bridged to itself
      
      If a local channel gets bridged to itself, it becomes orphaned with no devices
      left to actually tell it to hang up. This patch modifies local_fixup() to detect
      this case and deny it.
      
      Review: https://reviewboard.asterisk.org/r/934
    ........
  ................
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@288519 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-09-22 23:20:27 +00:00
Terry Wilson d04046fbe7 Merged revisions 286189 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

................
  r286189 | twilson | 2010-09-10 17:04:53 -0500 (Fri, 10 Sep 2010) | 30 lines
  
  Merged revisions 286115 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.6.2
  
  ................
    r286115 | twilson | 2010-09-10 15:35:25 -0500 (Fri, 10 Sep 2010) | 23 lines
    
    Merged revisions 286059 via svnmerge from 
    https://origsvn.digium.com/svn/asterisk/branches/1.4
    
    ........
      r286059 | twilson | 2010-09-10 14:25:08 -0500 (Fri, 10 Sep 2010) | 16 lines
      
      Inherit CHANNEL() writes to both sides of a Local channel
      
      Having Local (/n) channels as queue members and setting the language in the
      extension with Set(CHANNEL(language)=fr) sets the language on the Local/...,2
      channel. Hold time report playbacks happen on the Local/...,1 channel and
      therefor do not play in the specified language.
      
      This patch modifies func_channel_write to call the setoption callback and pass
      the CHANNEL() write info to the callback. chan_local uses this information to
      look up the other side of the channel and apply the same changes to it.
      
      (closes issue #17673)
      Reported by: Guggemand
      
      Review: https://reviewboard.asterisk.org/r/903/
    ........
  ................
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@286190 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-09-10 22:15:47 +00:00
Jeff Peeler a0460f3b9c Merged revisions 281466 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r281466 | jpeeler | 2010-08-09 18:04:02 -0500 (Mon, 09 Aug 2010) | 2 lines
  
  Add some more stuff to copy from 281429.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@281467 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-08-09 23:04:59 +00:00
Jeff Peeler 416b05e9da Merged revisions 281429 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

................
  r281429 | jpeeler | 2010-08-09 15:43:54 -0500 (Mon, 09 Aug 2010) | 27 lines
  
  Merged revisions 281391 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.6.2
  
  ................
    r281391 | jpeeler | 2010-08-09 15:07:29 -0500 (Mon, 09 Aug 2010) | 20 lines
    
    Merged revisions 281390 via svnmerge from 
    https://origsvn.digium.com/svn/asterisk/branches/1.4
    
    ........
      r281390 | jpeeler | 2010-08-09 15:04:30 -0500 (Mon, 09 Aug 2010) | 13 lines
      
      Prevent loss of Caller ID information set on local channel after masquerade.
      
      Caller ID set on the channel before a masquerade occurs when using a local
      channel would cause the information to be lost. The problem was that the
      information was set on a channel destined to be hung up. The somewhat confusing
      fix is to detect if any Caller ID has been set on the channel and if so 
      preswap the Caller ID data so that basically the masquerade puts the data back.
      
      (closes issue #17138)
      Reported by: kobaz
      
      Review: https://reviewboard.asterisk.org/r/847/
    ........
  ................
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@281431 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-08-09 20:46:50 +00:00
Matthew Nicholson 3def1196b4 Merged revisions 280307 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

................
  r280307 | mnicholson | 2010-07-29 08:56:35 -0500 (Thu, 29 Jul 2010) | 11 lines
  
  Merged revisions 280306 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.6.2
  
  ........
    r280306 | mnicholson | 2010-07-29 08:45:11 -0500 (Thu, 29 Jul 2010) | 2 lines
    
    Implement support for ast_channel_queryoption on local channels.  Currently only AST_OPTION_T38_STATE is supported.

    ABE-2229
    Review: https://reviewboard.asterisk.org/r/813/
  ........
  
  Additionally, pass AST_CONTROL_T38_PARAMETERS control frames through generic bridges.  This change appears to have been unintentionally left out of rev 203699.
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@280308 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-29 14:03:59 +00:00
Tilghman Lesher b4e18d5660 Add load priority order, such that preload becomes unnecessary in most cases
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@278132 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-20 19:35:02 +00:00
Russell Bryant d27bb2d811 Only call ast_channel_cc_params_init() if allocating a channel succeeds.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@278051 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-20 17:22:36 +00:00
Richard Mudgett ec37ffbdaf ast_callerid restructuring
The purpose of this patch is to eliminate struct ast_callerid since it has
turned into a miscellaneous collection of various party information.

Eliminate struct ast_callerid and replace it with the following struct
organization:

struct ast_party_name {
	char *str;
	int char_set;
	int presentation;
	unsigned char valid;
};
struct ast_party_number {
	char *str;
	int plan;
	int presentation;
	unsigned char valid;
};
struct ast_party_subaddress {
	char *str;
	int type;
	unsigned char odd_even_indicator;
	unsigned char valid;
};
struct ast_party_id {
	struct ast_party_name name;
	struct ast_party_number number;
	struct ast_party_subaddress subaddress;
	char *tag;
};
struct ast_party_dialed {
	struct {
		char *str;
		int plan;
	} number;
	struct ast_party_subaddress subaddress;
	int transit_network_select;
};
struct ast_party_caller {
	struct ast_party_id id;
	char *ani;
	int ani2;
};

The new organization adds some new information as well.

* The party name and number now have their own presentation value that can
be manipulated independently.  ISDN supplies the presentation value for
the name and number at different times with the possibility that they
could be different.

* The party name and number now have a valid flag.  Before this change the
name or number string could be empty if the presentation were restricted.
Most channel drivers assume that the name or number is then simply not
available instead of indicating that the name or number was restricted.

* The party name now has a character set value.  SIP and Q.SIG have the
ability to indicate what character set a name string is using so it could
be presented properly.

* The dialed party now has a numbering plan value that could be useful to
have available.

The various channel drivers will need to be updated to support the new
core features as needed.  They have simply been converted to supply
current functionality at this time.


The following items of note were either corrected or enhanced:

* The CONNECTEDLINE() and REDIRECTING() dialplan functions were
consolidated into func_callerid.c to share party id handling code.

* CALLERPRES() is now deprecated because the name and number have their
own presentation values.

* Fixed app_alarmreceiver.c write_metadata().  The workstring[] could
contain garbage.  It also can only contain the caller id number so using
ast_callerid_parse() on it is silly.  There was also a typo in the
CALLERNAME if test.

* Fixed app_rpt.c using ast_callerid_parse() on the channel's caller id
number string.  ast_callerid_parse() alters the given buffer which in this
case is the channel's caller id number string.  Then using
ast_shrink_phone_number() could alter it even more.

* Fixed caller ID name and number memory leak in chan_usbradio.c.

* Fixed uninitialized char arrays cid_num[] and cid_name[] in
sig_analog.c.

* Protected access to a caller channel with lock in chan_sip.c.

* Clarified intent of code in app_meetme.c sla_ring_station() and
dial_trunk().  Also made save all caller ID data instead of just the name
and number strings.

* Simplified cdr.c set_one_cid().  It hand coded the ast_callerid_merge()
function.

* Corrected some weirdness with app_privacy.c's use of caller
presentation.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@276347 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-14 15:48:36 +00:00
Tilghman Lesher f4d96da591 Merged revisions 273793 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r273793 | tilghman | 2010-07-02 16:36:39 -0500 (Fri, 02 Jul 2010) | 9 lines
  
  Have the DEADLOCK_AVOIDANCE macro warn when an unlock fails, to help catch potentially large software bugs.
  
  (closes issue #17407)
   Reported by: pdf
   Patches: 
         20100527__issue17407.diff.txt uploaded by tilghman (license 14)
   
  Review: https://reviewboard.asterisk.org/r/751/
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@273830 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-03 02:36:31 +00:00
Tim Ringenbach c6b7eae5e6 Add new AMI command LocalOptimizeAway.
This command lets you request a "/n" local channel
optimize itself out of the way anyway.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@272218 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-23 19:59:43 +00:00
Mark Michelson b5d5cc565f Enhancements to connected line and redirecting work.
From reviewboard:

Digium has a commercial customer who has made extensive use of the connected party and
redirecting information present in later versions of Asterisk Business Edition and which
is to be in the upcoming 1.8 release. Through their use of the feature, new problems and solutions
have come about. This patch adds several enhancements to maximize usage of the connected party
and redirecting information functionality.

First, Asterisk trunk already had connected line interception macros. These macros allow you to
manipulate connected line information before it was sent out to its target. This patch adds the
same feature except for redirecting information instead.

Second, the ast_callerid and ast_party_id structures have been enhanced to provide a "tag." This
tag can be set with func_callerid, func_connectedline, func_redirecting, and in the case of DAHDI,
mISDN, and SIP channels, can be set in a configuration file. The idea behind the callerid tag is
that it can be set to whatever value the administrator likes. Later, when running connected line
and redirecting macros, the admin can read the tag off the appropriate structure to determine what
action to take. You can think of this sort of like a channel variable, except that instead of having
the variable associated with a channel, the variable is associated with a specific identity within
Asterisk.

Third, app_dial has two new options, s and u. The s option lets a dialplan writer force a specific
caller ID tag to be placed on the outgoing channel. The u option allows the dialplan writer to force
a specific calling presentation value on the outgoing channel.

Fourth, there is a new control frame subclass called AST_CONTROL_READ_ACTION added. This was added
to correct a very specific situation. In the case of SIP semi-attended (blond) transfers, the party
being transferred would not have the opportunity to run a connected line interception macro to
possibly alter the transfer target's connected line information. The issue here was that during a
blond transfer, the SIP transfer code has no bridged channel on which to queue the connected line
update. The way this was corrected was to add this new control frame subclass. Now, we queue an
AST_CONTROL_READ_ACTION frame on the channel on which the connected line interception macro should
be run. When ast_read is called to read the frame, ast_read responds by calling a callback function
associated with the specific read action the control frame describes. In this case, the action taken
is to run the connected line interception macro on the transferee's channel.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@263541 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-17 15:36:31 +00:00
David Vossel 6722251986 Merged revisions 259858 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r259858 | dvossel | 2010-04-28 16:16:03 -0500 (Wed, 28 Apr 2010) | 33 lines
  
  resolves deadlocks in chan_local
  
  Issue_1.
  In the local_hangup() 3 locks must be held at the same time... pvt, pvt->chan,
  and pvt->owner.  Proper deadlock avoidance is done when the channel to hangup
  is the outbound chan_local channel, but when it is not the outbound channel we
  have an issue... We attempt to do deadlock avoidance only on the tech pvt, when
  both the tech pvt and the pvt->owner are locked coming into that loop.  By
  never giving up the pvt->owner channel deadlock avoidance is not entirely possible.
  This patch resolves that by doing deadlock avoidance on both the pvt->owner and the pvt
  when trying to get the pvt->chan lock.
  
  Issue_2.
  ast_prod() is used in ast_activate_generator() to queue a frame on the channel
  and make the channel's read function get called.  This function is used in
  ast_activate_generator() while the channel is locked, which mean's the channel
  will have a lock both from the generator code and the frame_queue code by the
  time it gets to chan_local.c's local_queue_frame code... local_queue_frame
  contains some of the same crazy deadlock avoidance that local_hangup requires,
  and this recursive lock prevents that deadlock avoidance from happening correctly.
  This patch removes ast_prod() from the channel lock so only one lock is held during
  the local_queue_frame function.
  
  (closes issue #17185)
  Reported by: schmoozecom
  Patches:
        issue_17185_v1.diff uploaded by dvossel (license 671)
        issue_17185_v2.diff uploaded by dvossel (license 671)
  Tested by: schmoozecom, GameGamer43
  
  Review: https://reviewboard.asterisk.org/r/631/
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@259870 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-28 21:20:03 +00:00