Commit Graph

123 Commits

Author SHA1 Message Date
Mark Michelson aae45acbda Detect potential forwarding loops based on count.
A potential problem that can arise is the following:

* Bob's phone is programmed to automatically forward to Carol.
* Carol's phone is programmed to automatically forward to Bob.
* Alice calls Bob.

If left unchecked, this results in an endless loops of call forwards
that would eventually result in some sort of fiery crash.

Asterisk's method of solving this issue was to track which interfaces
had been dialed. If a destination were dialed a second time, then
the attempt to call that destination would fail since a loop was
detected.

The problem with this method is that call forwarding has evolved. Some
SIP phones allow for a user to manually forward an incoming call to an
ad-hoc destination. This can mean that:

* There are legitimate use cases where a device may be dialed multiple
times, or
* There can be human error when forwarding calls.

This change removes the old method of detecting forwarding loops in
favor of keeping a count of the number of destinations a channel has
dialed on a particular branch of a call. If the number exceeds the
set number of max forwards, then the call fails. This approach has
the following advantages over the old:

* It is much simpler.
* It can detect loops involving local channels.
* It is user configurable.

The only disadvantage it has is that in the case where there is a
legitimate forwarding loop present, it takes longer to detect it.
However, the forwarding loop is still properly detected and the
call is cleaned up as it should be.

Address review feedback on gerrit.

* Correct "mfgium" to "Digium"
* Decrement max forwards by one in the case where allocation of the
  max forwards datastore is required.
* Remove irrelevant code change from pjsip_global_headers.c

ASTERISK-24958 #close

Change-Id: Ia7e4b7cd3bccfbd34d9a859838356931bba56c23
2015-04-17 15:58:07 -05:00
Matt Jordan 4a58261694 git migration: Refactor the ASTERISK_FILE_VERSION macro
Git does not support the ability to replace a token with a version
string during check-in. While it does have support for replacing a
token on clone, this is somewhat sub-optimal: the token is replaced
with the object hash, which is not particularly easy for human
consumption. What's more, in practice, the source file version was often
not terribly useful. Generally, when triaging bugs, the overall version
of Asterisk is far more useful than an individual SVN version of a file. As a
result, this patch removes Asterisk's support for showing source file
versions.

Specifically, it does the following:

* Rename ASTERISK_FILE_VERSION macro to ASTERISK_REGISTER_FILE, and
  remove passing the version in with the macro. Other facilities
  than 'core show file version' make use of the file names, such as
  setting a debug level only on a specific file. As such, the act of
  registering source files with the Asterisk core still has use. The
  macro rename now reflects the new macro purpose.

* main/asterisk:
  - Refactor the file_version structure to reflect that it no longer
    tracks a version field.
  - Remove the "core show file version" CLI command. Without the file
    version, it is no longer useful.
  - Remove the ast_file_version_find function. The file version is no
    longer tracked.
  - Rename ast_register_file_version/ast_unregister_file_version to
    ast_register_file/ast_unregister_file, respectively.

* main/manager: Remove value from the Version key of the ModuleCheck
  Action. The actual key itself has not been removed, as doing so would
  absolutely constitute a backwards incompatible change. However, since
  the file version is no longer tracked, there is no need to attempt to
  include it in the Version key.

* UPGRADE: Add notes for:
  - Modification to the ModuleCheck AMI Action
  - Removal of the "core show file version" CLI command

Change-Id: I6cf0ff280e1668bf4957dc21f32a5ff43444a40e
2015-04-13 03:48:57 -04:00
Mark Michelson dcf1ad14da Add module support level to ast_module_info structure. Print it in CLI "module show" .
ASTERISK-23919 #close
Reported by Malcolm Davenport

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@419592 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-25 16:47:17 +00:00
Richard Mudgett a2ce95d9d2 accountcode: Slightly change accountcode propagation.
The previous behavior was to simply set the accountcode of an outgoing
channel to the accountcode of the channel initiating the call.  It was
done this way a long time ago to allow the accountcode set on the SIP/100
channel to be propagated to a local channel so the dialplan execution on
the Local;2 channel would have the SIP/100 accountcode available.

SIP/100 -> Local;1/Local;2 -> SIP/200

Propagating the SIP/100 accountcode to the local channels is very useful.
Without any dialplan manipulation, all channels in this call would have
the same accountcode.

Using dialplan, you can set a different accountcode on the SIP/200 channel
either by setting the accountcode on the Local;2 channel or by the Dial
application's b(pre-dial), M(macro) or U(gosub) options, or by the
FollowMe application's b(pre-dial) option, or by the Queue application's
macro or gosub options.  Before Asterisk v12, the altered accountcode on
SIP/200 will remain until the local channels optimize out and the
accountcode would change to the SIP/100 accountcode.

Asterisk v1.8 attempted to add peeraccount support but ultimately had to
punt on the support.  The peeraccount support was rendered useless because
of how the CDR code needed to unconditionally force the caller's
accountcode onto the peer channel's accountcode.  The CEL events were thus
intentionally made to always use the channel's accountcode as the
peeraccount value.

With the arrival of Asterisk v12, the situation has improved somewhat so
peeraccount support can be made to work.  Using the indicated example, the
the accountcode values become as follows when the peeraccount is set on
SIP/100 before calling SIP/200:

SIP/100 ---> Local;1 ---- Local;2 ---> SIP/200
acct: 100 \/ acct: 200 \/ acct: 100 \/ acct: 200
peer: 200 /\ peer: 100 /\ peer: 200 /\ peer: 100

If a channel already has an accountcode it can only change by the
following explicit user actions:

1) A channel originate method that can specify an accountcode to use.

2) The calling channel propagating its non-empty peeraccount or its
non-empty accountcode if the peeraccount was empty to the outgoing
channel's accountcode before initiating the dial.  e.g., Dial and
FollowMe.  The exception to this propagation method is Queue.  Queue will
only propagate peeraccounts this way only if the outgoing channel does not
have an accountcode.

3) Dialplan using CHANNEL(accountcode).

4) Dialplan using CHANNEL(peeraccount) on the other end of a local
channel pair.

If a channel does not have an accountcode it can get one from the
following places:

1) The channel driver's configuration at channel creation.

2) Explicit user action as already indicated.

3) Entering a basic or stasis-mixing bridge from a peer channel's
peeraccount value.

You can specify the accountcode for an outgoing channel by setting the
CHANNEL(peeraccount) before using the Dial, FollowMe, and Queue
applications.  Queue adds the wrinkle that it will not overwrite an
existing accountcode on the outgoing channel with the calling channels
values.

Accountcode and peeraccount values propagate to an outgoing channel before
dialing.  Accountcodes also propagate when channels enter or leave a basic
or stasis-mixing bridge.  The peeraccount value only makes sense for
mixing bridges with two channels; it is meaningless otherwise.

* Made peeraccount functional by changing accountcode propagation as
described above.

* Fixed CEL extracting the wrong ie value for the peeraccount.  This was
done intentionally in Asterisk v1.8 when that version had to punt on
peeraccount.

* Fixed a few places dealing with accountcodes that were reading from
channels without the lock held.

AFS-65 #close

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@419520 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-24 22:48:38 +00:00
Scott Griepentrog 80ef9a21b9 uniqueid: channel linkedid, ami, ari object creation with id's
Much needed was a way to assign id to objects on creation, and
much change was necessary to accomplish it.  Channel uniqueids
and linkedids are split into separate string and creation time
components without breaking linkedid propgation.  This allowed
the uniqueid to be specified by the user interface - and those
values are now carried through to channel creation, adding the
assignedids value to every function in the chain including the
channel drivers. For local channels, the second channel can be
specified or left to default to a ;2 suffix of first.  In ARI,
bridge, playback, and snoop objects can also be created with a
specified uniqueid.

Along the way, the args order to allocating channels was fixed
in chan_mgcp and chan_gtalk, and linkedid is no longer lost as
masquerade occurs.

(closes issue ASTERISK-23120)
Review: https://reviewboard.asterisk.org/r/3191/
........

Merged revisions 410157 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410158 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-07 15:47:55 +00:00
Richard Mudgett c25c093c67 Minor tweaks with ast_moh_start() callers.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397494 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-22 23:15:14 +00:00
Matthew Jordan 6258bbe7bd Update Asterisk's CDRs for the new bridging framework
This patch is the initial push to update Asterisk's CDR engine for the new
bridging framework. This patch guts the existing CDR engine and builds the new
on top of messages coming across Stasis. As changes in channel state and bridge
state are detected, CDRs are built and dispatched accordingly. This
fundamentally changes CDRs in a few ways.
(1) CDRs are now *very* reflective of the actual state of channels and bridges.
    This means CDRs track well with what an actual channel is doing - which
    is useful in transfer scenarios (which were previously difficult to pin
    down). It does, however, mean that CDRs cannot be 'fooled'. Previous
    behavior in Asterisk allowed for CDR applications, channels, and other
    properties to be spoofed in parts of the code - this no longer works.
(2) CDRs have defined behavior in multi-party scenarios. This behavior will not
    be what everyone wants, but it is a defined behavior and as such, it is
    predictable.
(3) The CDR manipulation functions and applications have been overhauled. Major
    changes have been made to ResetCDR and ForkCDR in particular. Many of the
    options for these two applications no longer made any sense with the new
    framework and the (slightly) more immutable nature of CDRs.

There are a plethora of other changes. For a full description of CDR behavior,
see the CDR specification on the Asterisk wiki.

(closes issue ASTERISK-21196)

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391947 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-06-17 03:00:38 +00:00
Jason Parker b6aac885be Add dial events to app_queue and app_followme.
Also fixes an issue in app_dial, where the channels were swapped on dial events.

(closes issue ASTERISK-21551)
(closes issue ASTERISK-21550)

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@389492 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-22 18:11:57 +00:00
Richard Mudgett 3d63833bd6 Merge in the bridge_construction branch to make the system use the Bridging API.
Breaks many things until they can be reworked.  A partial list:
chan_agent
chan_dahdi, chan_misdn, chan_iax2 native bridging
app_queue
COLP updates
DTMF attended transfers
Protocol attended transfers


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@389378 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-21 18:00:22 +00:00
Andrew Latham cfc6f60ca3 Doxygen Updates - Title update
Update and extend the configuration_file group and enable linking to the application.  Update title that was left behind many years ago.

(issue ASTERISK-20259)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@375004 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-14 21:45:16 +00:00
Andrew Latham 14be2a5514 Doxygen Cleanup
Start adding configuration file linking and pages.  Add module loading doxygen block.

(issue ASTERISK-20259)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374164 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-01 23:22:50 +00:00
Matthew Jordan 4058ea15ab Allow configured numbers for FollowMe to be greater than 90 characters
When parsing a 'number' defined in followme.conf, FollowMe previously parsed
the number in the configuration file into a buffer with a length of 90
characters.  This can artificially limit some parallel dial scenarios.  This
patch allows for numbers of any length to be defined in the configuration
file.

Note that Clod Patry originally wrote a patch to fix this problem and received
a Ship It! on the JIRA issue.  The patch originally expanded the buffer to 256
characters.  Instead, the patch being committed duplicates the string in the
config file on the stack before parsing it for consumption by the application.

(closes issue ASTERISK-16879)
Reported by: Clod Patry
Tested by: mjordan
patches:
  followme_no_limit.diff uploaded by Clod Patry (license #5138)

Slightly modified for this commit.
........

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@372393 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-09-06 01:02:17 +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
Richard Mudgett f8746d0009 Allow non-normal execution routines to be able to run on hungup channels.
* Make non-normal dialplan execution routines be able to run on a hung up
channel.  This is preparation work for hangup handler routines.

* Fixed ability to support relative non-normal dialplan execution
routines.  (i.e., The context and exten are optional for the specified
dialplan location.) Predial routines are the only non-normal routines that
it makes sense to optionally omit the context and exten.  Setting a hangup
handler also needs this ability.

* Fix Return application being able to restore a dialplan location
exactly.  Channels without a PBX may not have context or exten set.

* Fixes non-normal execution routines like connected line interception and
predial leaving the dialplan execution stack unbalanced.  Errors like
missing Return statements, popping too many stack frames using StackPop,
or an application returning non-zero could leave the dialplan stack
unbalanced.

* Fixed the AGI gosub application so it cleans up the dialplan execution
stack and handles the autoloop priority increments correctly.

* Eliminated the need for the gosub_virtual_context return location.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368985 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-14 23:22:53 +00:00
Richard Mudgett 1ae31fd2a9 Add predial support to FollowMe.
Like the new predial feature for Dial.  This adds the same b/B options to
FollowMe.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366507 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-15 16:53:09 +00:00
Kinsey Moore b5a6de76fc Commit framework for HANGUPCAUSE (replacement for SIP_CAUSE)
This is the starting point for the Asterisk 11: Who Hung Up work and provides
a framework which will allow channel drivers to report the types of hangup
cause information available in SIP_CAUSE without incurring the overhead of the
MASTER_CHANNEL dialplan function. The initial implementation only includes
cause generation for chan_sip and does not include cause code translation
utilities.

This change deprecates SIP_CAUSE and replaces its method of reporting cause
codes with the new framework. This change also deprecates the 'storesipcause'
option in sip.conf.

Review: https://reviewboard.asterisk.org/r/1822/
(Closes issue SWP-4221)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366408 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-14 19:44:27 +00:00
Richard Mudgett 108f5fafd7 Improve FollowMe accept/decline DTMF string matching.
If you hit the wrong DTMF digit trying to accept/decline a FollowMe call,
you had to wait for the prompt to repeat to try again.

* Make FollowMe compare the last DTMF digits received to the
accept/decline matching strings.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@365951 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-09 17:58:11 +00:00
Richard Mudgett d71d8ed995 Keep answered FollowMe calls until call accepted or last step times out.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@365856 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-09 02:35:29 +00:00
Richard Mudgett a689a5776e Put winning FollowMe outgoing call on hold if the caller put it on hold.
The FollowMe caller call leg is usually answered and listening to MOH.
The caller could put the call on hold while FollowMe is looking for a
winner.  The winning outgoing call is now immediately placed on hold if
the caller has put the call on hold before the winning call was selected.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@365829 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-09 01:59:14 +00:00
Richard Mudgett 708cadf1b1 Restructure how the FollowMe outgoing channel list is handled.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@365828 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-09 01:36:07 +00:00
Richard Mudgett bb5e2c48d1 Addendum to -r365766. Since it is no longer allocated.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@365790 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-08 22:46:14 +00:00
Richard Mudgett b888b6bf23 Make FollowMe findmeexec() put the list head on the stack instead of mallocing it.
Why this tiny struct was malloced instead of the 28k struct in the last
change is beyond me.  Just doing my part to help stamp out sillyness.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@365766 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-08 22:25:42 +00:00
Richard Mudgett b1a94ddcdd Make FollowMe app_exec() not declare a 28k struct on the stack.
Helping to stamp out stack abuse.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@365749 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-08 21:41:58 +00:00
Richard Mudgett db4fb48f58 Simplify findmeexec() parameter passing.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@365711 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-08 21:15:58 +00:00
Richard Mudgett 9cd0236f61 * Fix FollowMe memory leak on error paths in app_exec().
* Fix FollowMe leaving recorded caller name file on error paths in
app_exec().

* Use correct buffer dimension define in struct fm_args.namerecloc[].
This fixes unexpected namerecloc filename length restriction.
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@365707 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-08 20:32:11 +00:00
Richard Mudgett 1b0428ac7d * Fix accept/decline DTMF buffer overwrite in FollowMe.
* Made use MAX_YN_STRING define to make all accept/decline DTMF buffers
the same size.  Just using 20 isn't good enough when someone didn't get
the memo.

* Fix stupid use of a global variable in FollowMe.  (ynlongest)

* Fix bit field declarations in FollowMe.
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@365633 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-08 18:16:04 +00:00
Kinsey Moore 781f4657b9 Fix many issues from the NULL_RETURNS Coverity report
Most of the changes here are trivial NULL checks.  There are a couple
optimizations to remove the need to check for NULL and outboundproxy parsing
in chan_sip.c was rewritten to avoid use of strtok.  Additionally, a bug was
found and fixed with the parsing of outboundproxy when "outboundproxy=," was
set.

(Closes issue ASTERISK-19654)
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@365400 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-04 22:17:38 +00:00
Olle Johansson a8e755700e Use the DEFINED value for musicclass length.
For some reason, features.c has it's own definition. Should propably be fixed too.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@363595 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-25 10:49:13 +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
Kinsey Moore 1fac2fba4b Deprecated macro usage for connected line, redirecting, and CCSS
This commit adds GoSub alternatives to connected line, redirecting, and CCSS
macro hooks so that macro can finally be deprecated.  This also adds
deprecation warnings for those features when used and in documentation.

Review: https://reviewboard.asterisk.org/r/1760/
(closes issue SWP-4256)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@357013 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-27 16:50:19 +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 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
Richard Mudgett edf466012f Make FollowMe optionally update connected line information when the accepting endpoint is bridged.
Like Dial and Queue, FollowMe needs to deal with
AST_CONTROL_CONNECTED_LINE information so when the parties are initially
bridged, the connected line information will be correct.

* Added the 'I' option just like the app_dial and app_queue 'I' option.

* Made 'N' option ignored if the call is already answered.

(closes issue ASTERISK-18969)
Reported by: rmudgett
Tested by: rmudgett

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@350416 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-11 21:56:12 +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
Richard Mudgett d7005bf8ad Fix memory leaks in app_followme find_realtime().
(closes issue ASTERISK-19055)
Reported by: Matt Jordan
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@349874 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-06 16:50:08 +00:00
Richard Mudgett b05d4603c4 Fix crash during CDR update.
The ast_cdr_setcid() and ast_cdr_update() were shown in ASTERISK-18836 to
be called by different threads for the same channel.  The channel driver
thread and the PBX thread running dialplan.

* Add lock protection around CDR API calls that access an ast_channel
pointer.

(closes issue ASTERISK-18836)
Reported by: gpluser

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@348364 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-12-16 21:10:19 +00:00
Richard Mudgett 090f9d83a5 Fix FollowMe CallerID on outgoing calls.
The addition of the Connected Line support changed how CallerID is passed
to outgoing calls.  The FollowMe application was not updated to pass
CallerID to the outgoing calls.

* Fix FollowMe CallerID on outgoing calls.

* Restructured findmeexec() to fix several memory leaks and eliminate some
duplicated code.

* Made check the return value of create_followme_number().  Putting a NULL
into the numbers list is bad if create_followme_number() fails.

* Fixed a couple uses of ast_strdupa() inside loops.

* The changes to bridge_builtin_features.c fix a similar CallerID issue
with the bridging API attended and blind transfers.  (Not used at this
time.)

(closes issue ASTERISK-17557)
Reported by: hamlet505a
Tested by: rmudgett

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@348103 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-12-13 23:10:42 +00:00
Matthew Jordan e218748ac1 Merged revisions 337120 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10

................
  r337120 | mjordan | 2011-09-20 17:49:36 -0500 (Tue, 20 Sep 2011) | 28 lines
  
  Merged revisions 337118 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.8
  
  ........
    r337118 | mjordan | 2011-09-20 17:38:54 -0500 (Tue, 20 Sep 2011) | 21 lines
    
    Fix for incorrect voicemail duration in external notifications
    
    This patch fixes an issue where the voicemail duration was being reported
    with a duration significantly less than the actual sound file duration.
    Voicemails that contained mostly silence were reporting the duration of
    only the sound in the file, as opposed to the duration of the file with
    the silence.  This patch fixes this by having two durations reported in
    the __ast_play_and_record family of functions - the sound_duration and the
    actual duration of the file.  The sound_duration, which is optional, now
    reports the duration of the sound in the file, while the actual full duration
    of the file is reported in the duration parameter.  This allows the voicemail
    applications to use the sound_duration for minimum duration checking, while
    reporting the full duration to external parties if the voicemail is kept.
    
    (issue ASTERISK-2234)
    (closes issue ASTERISK-16981)
    Reported by: Mary Ciuciu, Byron Clark, Brad House, Karsten Wemheuer, KevinH
    Tested by: Matt Jordan
    
    Review: https://reviewboard.asterisk.org/r/1443
  ........
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@337124 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-09-20 23:02:25 +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
Russell Bryant 37aa52fd78 Merged revisions 316265 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r316265 | russell | 2011-05-03 14:55:49 -0500 (Tue, 03 May 2011) | 5 lines
  
  Fix a bunch of compiler warnings generated by gcc 4.6.0.
  
  Most of these are -Wunused-but-set-variable, but there were a few others
  mixed in here, as well.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@316293 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-05-03 20:45:32 +00:00
Jonathan Rose 18a6c3a415 Adds an option to FollowMe that isn't useful for the bug it was made to solve. Still, due to the nature of FollowMe, it makes sense to have this option since it keeps apps bound to channels that would otherwise go away from being lost.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@311427 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-03-18 19:05:20 +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
Jeff Peeler 1c60cead78 Add option to followme to delay answer until ready to bridge call.
Followme answers an incoming call if it hasn't already been answered and starts
MOH. Some poorly designed autodialers see the answer and start playing their
message to the hold music. The 'N' option has been added to indicate ringing and
not answer until the call is accepted.

(closes issue #18479)
Reported by: ianc
Patches: 
      trunk_followme.diff uploaded by ianc (license 998)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@304384 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-01-26 23:41:55 +00:00
Tilghman Lesher 997816819b Merged revisions 297733 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

................
  r297733 | tilghman | 2010-12-06 18:29:26 -0600 (Mon, 06 Dec 2010) | 22 lines
  
  Merged revisions 297713 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.6.2
  
  ................
    r297713 | tilghman | 2010-12-06 18:21:50 -0600 (Mon, 06 Dec 2010) | 15 lines
    
    Merged revisions 297689 via svnmerge from 
    https://origsvn.digium.com/svn/asterisk/branches/1.4
    
    ........
      r297689 | tilghman | 2010-12-06 18:07:37 -0600 (Mon, 06 Dec 2010) | 8 lines
      
      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/trunk@297734 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-12-07 00:31:20 +00:00
Tilghman Lesher 8190e96fad Merged revisions 284610 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r284610 | tilghman | 2010-09-02 00:20:59 -0500 (Thu, 02 Sep 2010) | 10 lines
  
  When optional_api is non-optional, force dependent modules to be loaded.
  
  (closes issue #17707)
   Reported by: ira
   Patches: 
         20100819__issue17707__asterisk1.8.diff.txt uploaded by tilghman (license 14)
   Tested by: tilghman
   
  Review: https://reviewboard.asterisk.org/r/876/
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@284628 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-09-02 05:27:53 +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
Russell Bryant 33aa72d592 Resolve compiler warnings on FreeBSD.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@253538 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-20 11:43:08 +00:00
Jeff Peeler 976400a61e Fix app_followme playing wrong sound files.
Fixes regression introduced in 140167 that uses the wrong variable names.

(closes issue #16930)
Reported by: ianc
Patches: 
      fix_reload_followme.diff uploaded by ianc (license 998)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@250979 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-05 19:10:47 +00:00
Matthew Nicholson 606276ec48 Add an option to app_followme to disable the "please hold" announcement.
(closes issue #14155)
Reported by: junky
Patches:
      M14555-trunk.diff uploaded by junky (license 177) (modified)
Tested by: junky


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@230964 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-11-23 22:37:39 +00:00