Commit Graph

340 Commits

Author SHA1 Message Date
Mark Michelson 94d8d0468f Remove remaining traces of remove_on_pull from hooks and hook APIs.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@390550 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-06-05 19:19:48 +00:00
Mark Michelson fac3839e68 Adds support for a core attended transfer function plus adds some hiding of masquerades.
The attended transfer API call can complete the attended transfer in a number of ways
depending on the current bridged states of the channels involved.

The hiding of masquerades is done in some bridging-related functions, such as the manager
Bridge action and the Bridge dialplan application. In addition, call pickup was edited
to "move" a channel rather than masquerade it.

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

(closes issue ASTERISK-21334)
Reported by Matt Jordan

(closes issue Asterisk-21336)
Reported by Matt Jordan



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@389848 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-28 14:45:31 +00:00
Richard Mudgett 3464e0919a Fix inverted test preventing DTMF disconnect from working.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@389569 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-23 18:40:50 +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
Matthew Jordan e51b6a37e9 Fix CDR not being created during an externally initiated blind transfer
Way back when in the dark days of Asterisk 1.8.9, blind transferring a call
in a context that included the 'h' extension would inadvertently execute the
hangup code logic on the transferred channel. This was a "bad thing". The fix
was to properly check for the softhangup flags on the channel and only execute
the 'h' extension logic (and, in later versions, hangup handler logic) if the
channel was well and truly dead (Jim).

Unfortunately, CDRs are fickle. Setting the softhangup flag when we detected
that the channel was leaving the bridge (but not to die) caused some crucial
snippet of CDR code, lying in ambush in the middle of the bridging code, to
not get executed. This had the effect of blowing away one of the CDRs that is
typically created during a blind transfer.

While we live and die by the adage "don't touch CDRs in release branches", this
was our bad. The attached patch restores the CDR behavior, and still manages to
not run the 'h' extension during a blind transfer (at least not when it's
supposed to).

Thanks to Steve Davies for diagnosing this and providing a fix.

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

(closes issue ASTERISK-21394)
Reported by: Ishfaq Malik
Tested by: Ishfaq Malik, mjordan
patches:
  fix_missing_blindXfer_cdr2 uploaded by one47 (License 5012)
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@387039 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-04-30 22:50:40 +00:00
Matthew Jordan b3e3dfa51c Clean up resources in features on exit
This patch cleans up two things features:
* It properly unregisters the CLI commands that features registered
* It cancels and performs a pthread_join on the created parking thread. This
  not only properly joins a non-detached thread, but also prevents disposing
  of the parking lots prior to the parking thread completely exiting.

(closes issue ASTERISK-21407)
Reported by: Corey Farrell
patches:
  features_shutdown-r2.patch uploaded by Corey Farrell (License 5909)
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@386676 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-04-26 21:27:24 +00:00
Richard Mudgett 3afeac5e3b Eliminated dial_features_destroy() since it is equivalent to ast_free_ptr()
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@385278 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-04-10 23:08:02 +00:00
Richard Mudgett eb2d144195 * Fix unlocked accesses to feature_list. The feature_list is now also
protected by the features_lock.

* Made all calls to ast_find_call_feature() have the features_lock held.

* Fixed set_config_flags() to actually use find_group() to look for
feature groups in DYNAMIC_FEATURES.  The code originally assumed all
feature groups were listed in DYNAMIC_FEATURES.

* Make everyone use ast_rdlock_call_features(),
ast_unlock_call_features(), and new ast_wrlock_call_features() instead of
directly calling the rwlock API on features_lock.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@385277 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-04-10 23:03:30 +00:00
Richard Mudgett d09eeaa8eb Rename struct feature_ds to struct feature_datastore.
Because "struct feature_ds *feature_ds" is not a good thing.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@385142 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-04-09 19:58:35 +00:00
Russell Bryant ee05bdec92 Add inheritance support to FEATURE()/FEATUREMAP().
The settings saved on the channel for FEATURE()/FEATUREMAP() were only
for that channel.  This patch adds the ability to have these settings
inherited to child channels if you set FEATURE(inherit)=yes.

Closes issue ASTERISK-21306.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@385088 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-04-09 06:16:42 +00:00
Matthew Jordan b8d4e573f1 Add multi-channel Stasis messages; refactor Dial AMI events to Stasis
This patch does the following:
 * A new Stasis payload has been defined for multi-channel messages. This
   payload can store multiple ast_channel_snapshot objects along with a single
   JSON blob. The payload object itself is opaque; the snapshots are stored
   in a container keyed by roles. APIs have been provided to query for and
   retrieve the snapshots from the payload object.
 * The Dial AMI events have been refactored onto Stasis. This includes dial
   messages in app_dial, as well as the core dialing framework. The AMI events
   have been modified to send out a DialBegin/DialEnd events, as opposed to
   the subevent type that was previously used.
 * Stasis messages, types, and other objects related to channels have been
   placed in their own file, stasis_channels. Unit tests for some of these
   objects/messages have also been written.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@384910 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-04-08 14:26:37 +00:00
Kevin Harwell 5e9994ed9c Write the correct callid to the data1 field in queue_log for transfer events.
The incorrect callid was being written to the "data1" field in queue_log table
for transfer events.  The callid of the queue was being written instead of the
transfer target's callid.  This now gets the correct "transfer to" number and
places that in the "data1" field of the queue_log table when a transfer event
is triggered.

(closes issue ASTERISK-19960)
Reported by: vladimir shmagin
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@381792 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-02-19 19:47:42 +00:00
Richard Mudgett d3811a2352 End stuck DTMF if AST_SOFTHANGUP_ASYNCGOTO because it isn't a real hangup.
It doesn't hurt to check AST_SOFTHANGUP_UNBRIDGE either, but it should not
be set outside of a bridge.

(issue ASTERISK-20492)
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@381469 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-02-14 19:52:14 +00:00
Richard Mudgett 3d91f97cf9 features: Don't cache a struct ast_app pointer.
Caching a struct ast_app pointer is not a good idea because someone could
unload the application.  After the applicaiton unload the cached ast_app
pointer is no longer valid.  Only pbx.c can cache the pointer because it
knows when the application is unloaded and removes the pointer.

* Fixed one-touch Monitor and MixMonitor to not cache the ast_app pointer
and not use the silly monitor_ok/mixmonitor_ok/stopmixmonitor_ok flags.

* Extracted bridge_check_monitor() from ast_bridge_call() and use propper
locking.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@381177 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-02-11 18:00:05 +00:00
Jonathan Rose 1a70d513f1 Call Parking: Set PARKINGLOT and PARKINGSLOT variables on all parked calls
These two variables were previously not being set when comebacktoorigin=yes
and the example configs seemed to imply that they should be. Since there
is no harm in this and since calls that are sent back to origin are capable
of continuing in the dialplan, this seemed like a no-brainer. Also it
supports some bridging tests I've been working on.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@381068 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-02-08 17:36:23 +00:00
Jonathan Rose 80021f220c call_parking: Make sure fallbacks are used when lacking a flat channel exten
A regression was introduced which removed automatic fallback behavior from
the PBX. This behavior was used by call parking (or at least documented as
how the feature works) in order to select an extension when the flat channel
extension wasn't available from the comebackcontext. Parking now handles
the fallbacks internally in order to keep behavior matching with how it is
documented.

(closes issue ASTERISK-20716)
Reported by: Chris Gentle
Review: https://reviewboard.asterisk.org/r/2296/
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@380349 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-29 17:06:17 +00:00
Richard Mudgett 5601f3be43 Fix AMI redirect action with two channels failing to redirect both channels.
The AMI redirect action can fail to redirect two channels that are bridged
together.  There is a race between the AMI thread redirecting the two
channels and the bridge thread noticing that a channel is hungup from the
redirects.

* Made the bridge wait for both channels to be redirected before exiting.

* Made the AMI redirect check that all required headers are present before
proceeding with the redirection.

* Made the AMI redirect require that any supplied ExtraChannel exist
before proceeding.  Previously the code fell back to a single channel
redirect operation.

(closes issue ASTERISK-18975)
Reported by: Ben Klang

(closes issue ASTERISK-19948)
Reported by: Brent Dalgleish
Patches:
      jira_asterisk_19948_v11.patch (license #5621) patch uploaded by rmudgett
Tested by: rmudgett, Thomas Sevestre, Deepak Lohani, Kayode

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@378374 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-02 21:23:16 +00:00
Matthew Jordan 8fb5bdce9a Prevent exhaustion of system resources through exploitation of event cache
Asterisk maintains an internal cache for devices in the event subsystem. The
device state cache holds the state of each device known to Asterisk, such that
consumers of device state information can query for the last known state for
a particular device, even if it is not part of an active call. The concept of
a device in Asterisk can include entities that do not have a physical
representation. One way that this occurred was when anonymous calls are allowed
in Asterisk. A device was automatically created and stored in the cache for
each anonymous call that occurred; this was possible in the SIP and IAX2
channel drivers and through channel drivers that utilized the
res_jabber/res_xmpp resource modules (Gtalk, Jingle, and Motif). These devices
are never removed from the system, allowing anonymous calls to potentially
exhaust a system's resources.

This patch changes the event cache subsystem and device state management to
no longer cache devices that are not associated with a physical entity.

(issue ASTERISK-20175)
Reported by: Russell Bryant, Leif Madsen, Joshua Colp
Tested by: kmoore
patches:
  event-cachability-3.diff uploaded by jcolp (license 5000)
........

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@378322 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-02 18:11:59 +00:00
Jonathan Rose ae655031b9 Features: BRIDGE_FEATURES variable automixmonitor support and use proper party
BRIDGE_FEATURES did not previously support the automixmonitor feature. Now it
does. In addition, the BRIDGE_FEATURES variable would not apply features to
the proper party based on whether the feature option letter was in caps or
in lowercase (both ways would apply it to the caller). Now uppercase applies
to the caller while lowercase applies to the callee (like with the dial option)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@378063 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-12-14 22:34:18 +00:00
Michael L. Young ff2414ce86 Convert Dynamic Features Buffer To Use ast_str
Currently, the buffer for the dynamic features list is set to a fixed size of
128.  If the list is bigger than that, it results in the dynamic feature(s) not
being recognized.

This patch changes the buffer from a fixed size to a dynamic one.

(closes issue ASTERISK-20680)
Reported by: Clod Patry
Tested by: Michael L. Young
Patches: 
    asterisk-20680-dynamic-features-v2.diff 
                                     uploaded by Michael L. Young (license 5026)

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@377915 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-12-12 04:43:18 +00:00
Mark Michelson 9c74a60ba5 Add test events necessary for bridging tests to be able to properly run.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@377906 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-12-11 22:42:11 +00:00
Richard Mudgett 6ad0126425 Fix stuck DTMF when bridge is broken.
When a bridge is broken by an AMI Redirect action or the ChannelRedirect
application, an in progress DTMF digit could be stuck sending forever.

* Made simulate a DTMF end event when a bridge is broken and a DTMF digit
was in progress.

(closes issue ASTERISK-20492)
Reported by: Jeremiah Gowdy
Patches:
      bridge_end_dtmf-v3.patch.txt (license #6358) patch uploaded by Jeremiah Gowdy
      Modified to jira_asterisk_20492_v1.8.patch
      jira_asterisk_20492_v1.8.patch (license #5621) patch uploaded by rmudgett
Tested by: rmudgett

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

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@375967 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-06 19:05:11 +00:00
Richard Mudgett 8d65c777c8 Fix the Park 'r' option when a channel parks itself.
When a channel uses the Park appliation to park itself with the 'r'
option, the channel hears music-on-hold instead of the requested ringing.

* Added a missing check for the 'r' option when a channel parks itself.

(closes issue ASTERISK-19382)
Reported by: James Stocks
Patches by: dsessions

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

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@375391 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-29 19:31:36 +00:00
Andrew Latham 6c20cf2d8a Doxygen Updates - Title update
Update and extend the configuration_file group and enable linking. Commit other cleanups from multi-version Doxygen testing.  Update title that was left behind many years ago.

(issue ASTERISK-20259)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@375182 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-18 14:17:40 +00:00
Matthew Jordan a094707d51 Fix a variety of ref counting issues
This patch resolves a number of ref leaks that occur primarily on Asterisk
shutdown.  It adds a variety of shutdown routines to core portions of
Asterisk such that they can reclaim resources allocate duringd initialization.

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

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374197 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-02 01:47:16 +00:00
Richard Mudgett da5944fc56 Named call pickup groups. Fixes, missing functionality, and improvements.
* ASTERISK-20383
Missing named call pickup group features:

CHANNEL(callgroup) - Need CHANNEL(namedcallgroup)
CHANNEL(pickupgroup) - Need CHANNEL(namedpickupgroup)
Pickup() - Needs to also select from named pickup groups.

* ASTERISK-20384
Using the pickupexten, the pickup channel selection could fail even though
there was a call it could have picked up.  In a call pickup race when
there are multiple calls to pickup and two extensions try to pickup a
call, it is conceivable that the loser will not pick up any call even
though it could have picked up the next oldest matching call.

Regression because of the named call pickup group feature.

* See ASTERISK-20386 for the implementation improvements.  These are the
changes in channel.c and channel.h.

* Fixed some locking issues in CHANNEL().

(closes issue ASTERISK-20383)
Reported by: rmudgett
(closes issue ASTERISK-20384)
Reported by: rmudgett
(closes issue ASTERISK-20386)
Reported by: rmudgett
Tested by: rmudgett

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@373221 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-09-20 17:22:41 +00:00
Mark Michelson ae5aaefd88 Fix bad channel application data reference.
When channels get bridged due to an AMI bridge action
or a DTMF attended transfer, the two channels that
get bridged have their application data pointing to
the other channel's name. This means that if one channel
is hung up but the other moves on, it means that the
channel that moves on will have its application data
pointing at freed memory.

(issue ASTERISK-20335)
Reported by: aragon
........

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@372887 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-09-11 21:13:26 +00:00
Richard Mudgett fb6238899b Add private representation of caller, connected and redirecting party ids.
This patch adds the feature "Private representation of caller, connected
and redirecting party ids", as previously discussed with us (DATUS) and
Digium.

1. Feature motivation

Until now it is quite difficult to modify a party number or name which can
only be seen by exactly one particular instantiated technology channel
subscriber.  One example where a modified party number or name on one
channel is spread over several channels are supplementary services like
call transfer or pickup.  To implement these features Asterisk internally
copies caller and connected ids from one channel to another.  Another
example are extension subscriptions.  The monitoring entities (watchers)
are notified of state changes and - if desired - of party numbers or names
which represent the involving call parties.  One major feature where a
private representation of party names is essentially needed, i.e.  where a
party name shall be exclusively signaled to only one particular user, is a
private user-specific name resolution for party numbers.  A lookup in a
private destination-dependent telephone book shall provide party names
which cannot be seen by any other user at any time.

2. Feature Description

This feature comes along with the implementation of additional private
party id elements for caller id, connected id and redirecting ids inside
Asterisk channels.

The private party id elements can be read or set by the user using
Asterisk dialplan functions.

When a technology channel is initiating a call, receives an internal
connected-line update event, or receives an internal redirecting update
event, it merges the corresponding public id with the private id to create
an effective party id.  The effective party id is then used for protocol
signaling.

The channel technologies which initially support the private id
representation with this patch are SIP (chan_sip), mISDN (chan_misdn) and
PRI (chan_dahdi).

Once a private name or number on a channel is set and (implicitly) made
valid, it is generally used for any further protocol signaling until it is
rewritten or invalidated.

To simplify the invalidation of private ids all internally generated
connected/redirecting update events and also all connected/redirecting
update events which are generated by technology channels -- receiving
regarding protocol information - automatically trigger the invalidation of
private ids.

If not using the private party id representation feature at all, i.e.  if
using only the 'regular' caller-id, connected and redirecting related
functions, the current characteristic of Asterisk is not affected by the
new extended functionality.

3. User interface Description

To grant access to the private name and number representation from the
Asterisk dialplan, the CALLERID, CONNECTEDLINE and REDIRECTING dialplan
functions are extended by the following data types.  The formats of these
data types are equal to the corresponding regular 'non-private' already
existing data types:

CALLERID:
priv-all
priv-name priv-name-valid priv-name-charset priv-name-pres
priv-num priv-num-valid priv-num-plan priv-num-pres
priv-subaddr priv-subaddr-valid priv-subaddr-type priv-subaddr-odd
priv-tag

CONNECTEDLINE:
priv-name priv-name-valid priv-name-pres priv-name-charset
priv-num priv-num-valid priv-num-pres priv-num-plan
priv-subaddr priv-subaddr-valid priv-subaddr-type priv-subaddr-odd
priv-tag

REDIRECTING:
priv-orig-name priv-orig-name-valid priv-orig-name-pres priv-orig-name-charset
priv-orig-num priv-orig-num-valid priv-orig-num-pres priv-orig-num-plan
priv-orig-subaddr priv-orig-subaddr-valid priv-orig-subaddr-type priv-orig-subaddr-odd
priv-orig-tag

priv-from-name priv-from-name-valid priv-from-name-pres priv-from-name-charset
priv-from-num priv-from-num-valid priv-from-num-pres priv-from-num-plan
priv-from-subaddr priv-from-subaddr-valid priv-from-subaddr-type priv-from-subaddr-odd
priv-from-tag

priv-to-name priv-to-name-valid priv-to-name-pres priv-to-name-charset
priv-to-num priv-to-num-valid priv-to-num-pres priv-to-num-plan
priv-to-subaddr priv-to-subaddr-valid priv-to-subaddr-type priv-to-subaddr-odd
priv-to-tag

Reported by: Thomas Arimont

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@371120 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-08-10 19:54:55 +00:00
Richard Mudgett ca481359b9 Fix pickup extension channel reference error.
You cannot unref a pointer and then expect to ref it again later.

* Fix potential NULL pointer deref if the call pickup search fails.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@371052 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-08-10 02:07:55 +00:00
Matthew Jordan 5c4578f4ad Add named callgroups/pickupgroups
This patch adds named calledgroups/pickupgroups to Asterisk.  Named groups are
implemented in parallel to the existing numbered callgroup/pickupgroup
implementation.  However, unlike the existing implementation, which is limited
to a maximum of 64 defined groups, the number of defined groups allowed for
named callgroups/pickupgroups is effectively unlimited.

Named groups are configured with the keywords "namedcallgroup" and
"namedpickupgroup".  This corresponds to the numbered group definitions of
"callgroup" and "pickupgroup".  Note that as the implementation of named groups
coexists with the existing numbered implementation, a defined named group of
"4" does not equate to numbered group 4.

Support for the named groups has been added to the SIP, DAHDI, and mISDN channel
drivers.

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

Uploaded by:
	Guenther Kelleter(license #6372)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370831 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-08-07 12:46:36 +00:00
Kinsey Moore 9b16c8b0f6 Clean up and ensure proper usage of alloca()
This replaces all calls to alloca() with ast_alloca() which calls gcc's
__builtin_alloca() to avoid BSD semantics and removes all NULL checks
on memory allocated via ast_alloca() and ast_strdupa().

(closes issue ASTERISK-20125)
Review: https://reviewboard.asterisk.org/r/2032/
Patch-by: Walter Doekes (wdoekes)
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370655 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-07-31 20:21:43 +00:00
Matthew Jordan 92a65de048 Don't perform an XInclude to a document node that may not always be present
Because some of the manager events are defined in the top of the source, due
to the macro calls not containing all necessary information to have the
documentation colocated with the call itself, several include statements were
failing when built with 'make'.  While this did not cause any problems in
compilation or validation, it did result in a number of warnings being dumped
to stderr.

This patch changes those references such that they always resolve, regardless
of the documentation build options.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369939 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-07-11 17:14:45 +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
Richard Mudgett d0fda07d74 Fix Bridge application occasionally returning to the wrong location.
* Fix do_bridge_masquerade() getting the resume location from the zombie
channel.  The code must not touch a clone channel after it has masqueraded
it.  The clone channel has become a zombie and is starting to hangup.

(closes issue ASTERISK-19985)
Reported by: jamicque
Patches:
      jira_asterisk_19985_v1.8.patch (license #5621) patch uploaded by rmudgett
Tested by: jamicque
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369329 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-25 16:07:02 +00:00
Richard Mudgett b78d79c203 Fix F and F(x) action logic in Bridge application.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369296 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-23 00:33:41 +00:00
Richard Mudgett b857a633e0 Fix Bridge application and AMI Bridge action error handling.
* Fix AMI Bridge action disconnecting the AMI link on error.

* Fix AMI Bridge action and Bridge application not checking if their
masquerades were successful.

* Fix Bridge application running the h-exten when it should not.

* Made do_bridge_masquerade() return if the masquerade was successful so
the Bridge application and AMI Bridge action could deal with it correctly.

* Made bridge_call_thread_launch() hangup the passed in channels if the
bridge_call_thread fails to start.  Those channels would have been
orphaned.

* Made builtin_atxfer() check the success of the transfer masquerade
setup.
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369295 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-23 00:29:18 +00:00
Kinsey Moore d73a1de0b1 Fix AST_CONTROL_PVT_CAUSE_CODE handling
When the IAX2 Who Hung Up? changes were added, they uncovered a bug in
the way AST_CONTROL_PVT_CAUSE_CODE was handled in
feature_request_and_dial().  This particular frame subtype was being
treated like more terminal control frames causing the function to be
exited prematurely.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369061 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-18 22:56:01 +00:00
Richard Mudgett c30cc8fbd5 Fix monitoring calls put in a parking lot.
* Fix a regression that was introduced by -r366167 which effectively
disabled monitoring parked calls.

(closes issue ASTERISK-20012)
Reported by: sdolloff
Tested by: rmudgett
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369057 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-18 18:25:22 +00:00
Richard Mudgett a2402dbe25 Fix parked call performing a DTMF blind transfer after being retrieved.
When a parked call was retrieved from the parking lot, it could not do a
blind transfer because it caused the involved calls to be hung up
unconditionally.

* Made the ParkedCall application return the ast_bridge_call() return
value.

(closes issue ABE-2862)
Reported by: Vlad Povorozniuc
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368569 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-06 01:11:12 +00:00
Richard Mudgett faacb8ba52 Make builtin_blindtransfer() fully use ast_async_goto() abilities.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368566 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-06 00:54:20 +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
Mark Michelson 14a985560e Merge changes dealing with support for Digium phones.
Presence support has been added. This is accomplished by
allowing for presence hints in addition to device state
hints. A dialplan function called PRESENCE_STATE has been
added to allow for setting and reading presence. Presence
can be transmitted to Digium phones using custom XML
elements in a PIDF presence document.

Voicemail has new APIs that allow for moving, removing,
forwarding, and playing messages. Messages have had a new
unique message ID added to them so that the APIs will work
reliably. The state of a voicemail mailbox can be obtained
using an API that allows one to get a snapshot of the mailbox.
A voicemail Dialplan App called VoiceMailPlayMsg has been
added to be able to play back a specific message.

Configuration hooks have been added. Configuration hooks
allow for a piece of code to be executed when a specific
configuration file is loaded by a specific module. This is
useful for modules that are dependent on the configuration
of other modules.

chan_sip now has a public method that allows for a custom
SIP INFO request to be sent mid-dialog. Digium phones use
this in order to display progress bars when files are played.

Messaging support has been expanded a bit. The main
visible difference is the addition of an AMI action
MessageSend.

Finally, a ParkingLots manager action has been added in order
to get a list of parking lots.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368435 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-04 20:26:12 +00:00
Richard Mudgett dd2427c141 Coverity Report: Fix issues for error type REVERSE_INULL (core modules)
* Fixes findings: 0-2,5,7-15,24-26,28-31

(issue ASTERISK-19648)
Reported by: Matt Jordan
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368052 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-31 18:39:30 +00:00
Matthew Jordan 7b51320642 Fix a variety of memory leaks
This patch addresses a number of memory leaks in a variety of modules that were
found by a static analysis tool.  A brief summary of the changes:

* app_minivm:       free ast_str objects on off nominal paths
* app_page:         free the ast_dial object if the requested channel technology
                    cannot be appended to the dialing structure
* app_queue:        if a penalty rule failed to match any existing rule list
                    names, the created rule would not be inserted and its memory
                    would be leaked
* app_read:         dispose of the created silence detector in the presence of
                    off nominal circumstances
* app_voicemail:    dispose of an allocated unique ID field for MWI event
                    un-subscribe requests in off nominal paths; dispose of
                    configuration objects when using the secret.conf option
* chan_dahdi:       dispose of the allocated frame produced by ast_dsp_process
* chan_iax2:        properly unref peer in CLI command "iax2 unregister"
* chan_sip:         dispose of the allocated frame produced by sip_rtp_read's
                    call of ast_dsp_process; free memory in parse unit tests
* func_dialgroup:   properly deref ao2 object grhead in nominal path of
                    dialgroup_read
* func_odbc:        free resultset in off nominal paths of odbc_read
* cli:              free match_list in off nominal paths of CLI match completion
* config:           free comment_buffer/list_buffer when configuration file load
                    is unchanged; free the same buffers any time they were
                    created and config files were processed
* data:             free XML nodes in various places
* enum:             free context buffer in off nominal paths
* features:         free ast_call_feature in off nominal paths of applicationmap
                    config processing
* netsock2:         users of ast_sockaddr_resolve pass in an ast_sockaddr struct
                    that is allocated by the method.  Failures in
                    ast_sockaddr_resolve could result in the users of the method
                    not knowing whether or not the buffer was allocated.  The
                    method will now not allocate the ast_sockaddr struct if it
                    will return failure.
* pbx:              cleanup hash table traversals in off nominal paths; free
                    ignore pattern buffer if it already exists for the specified
                    context
* xmldoc:           cleanup various nodes when we no longer need them
* main/editline:    various cleanup of pointers not being freed before being
                    assigned to other memory, cleanup along off nominal paths
* menuselect/mxml:  cleanup of value buffer for an attribute when that attribute
                    did not specify a value
* res_calendar*:    responses are allocated via the various *_request method
                    returns and should not be allocated in the various
                    write_event methods; ensure attendee buffer is freed if no
                    data exists in the parsed node; ensure that calendar objects
                    are de-ref'd appropriately
* res_jabber:       free buffer in off nominal path
* res_musiconhold:  close the DIR* object in off nominal paths
* res_rtp_asterisk: if we run out of ports, close the rtp socket object and free
                    the rtp object
* res_srtp:         if we fail to create the session in libsrtp, destroy the
                    temporary ast_srtp object

(issue ASTERISK-19665)
Reported by: Matt Jordan

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366917 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-18 14:43:44 +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
Kinsey Moore dd81b047db Resolve FORWARD_NULL static analysis warnings
This resolves core findings from ASTERISK-19650 numbers 0-2, 6, 7, 9-11, 14-20,
22-24, 28, 30-32, 34-36, 42-56, 82-84, 87, 89-90, 93-102, 104, 105, 109-111,
and 115. Finding numbers 26, 33, and 29 were already resolved.  Those skipped
were either extended/deprecated or in areas of code that shouldn't be
disturbed.

(Closes issue ASTERISK-19650)
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366169 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-10 20:56:09 +00:00
Jonathan Rose 8227f70cd7 Coverity Report: Fix issues for error type CHECKED_RETURN for core
(issue ASTERISK-19658)
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/1905/
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366126 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-10 18:35:14 +00:00
Jonathan Rose d1e7473649 Coverity Report: Fix issues for error type UNINIT in Core supported modules
(issue ASTERISK-19652)
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/1909/
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366051 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-10 15:57:26 +00:00