Commit Graph

87 Commits

Author SHA1 Message Date
Corey Farrell a6e5bae3ef Remove ASTERISK_REGISTER_FILE.
ASTERISK_REGISTER_FILE no longer has any purpose so this commit removes
all traces of it.

Previously exported symbols removed:
* __ast_register_file
* __ast_unregister_file
* ast_complete_source_filename

This also removes the mtx_prof static variable that was declared when
MTX_PROFILE was enabled.  This variable was only used in lock.c so it
is now initialized in that file only.

ASTERISK-26480 #close

Change-Id: I1074af07d71f9e159c48ef36631aa432c86f9966
2016-10-27 09:53:55 -04: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
Richard Mudgett 18c2cfa7b7 PickupChan: Add ability to specify channel uniqueids as well as channel names.
* Made PickupChan() search by channel uniqueids if the search could not
find a channel by name.

* Ensured PickupChan() never considers the picking channel for pickup.

* Made PickupChan() option p use a common search by name routine.  The
original search was erroneously case sensitive.

(issue AFS-42)

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@403013 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-11-22 16:43:21 +00:00
Richard Mudgett 9cea557f6c Pickup: Pickup() and PickupChan() parameter parsing improvements.
* Made Pickup() and PickupChan() tollerate empty pickup values.  i.e., You
can now have Pickup(&&exten@context).

* Made PickupChan() use the standard option flag parsing code.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@402829 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-11-14 21:36:25 +00:00
Richard Mudgett d79a795259 Pickup: Ensure using PICKUPMARK never considers the picking channel.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@402820 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-11-14 20:53:52 +00:00
Matthew Jordan 38236e54a8 Remove dead code from features.c; refactor pickup code into pickup.c
This patch does the following:
 * It moves the pickup code out of features.c and into pickup.c
 * It removes the vast majority of dead code out of features.c. In particular,
   this includes the parking code.

(issue ASTERISK-22134)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396060 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-02 02:32:44 +00:00
Kinsey Moore 684c83b29b Add transfer support to CEL
This adds CEL support for blind and attended transfers and call pickup.
During the course of adding this functionality I noticed that
CONF_ENTER, CONF_EXIT, and BRIDGE_TO_CONF events are particularly
useless without a bridge identifier, so I added that as well.

This adds tests for blind transfers, several types of attended
transfers, and call pickup.

The extra field in CEL records now consists of a JSON blob whose fields
are defined on a per-event basis.

Review: https://reviewboard.asterisk.org/r/2658/
(closes issue ASTERISK-21565)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394858 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-07-20 13:10:22 +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
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
Richard Mudgett 238640dc1b Update Pickup application documentation. (With feeling this time.)
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@364110 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-26 21:11:25 +00:00
Richard Mudgett 9d655bd0e8 Update Pickup application documentation. (Even better)
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@363877 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-26 03:12:44 +00:00
Richard Mudgett e736a4fed3 * Put more information in pickup_exec() LOG_NOTICE.
* Delay duplicating a string on the stack in pickup_exec().


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@363839 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-26 01:29:09 +00:00
Richard Mudgett 0986873128 Update Pickup application documentation.
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@363790 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-25 23:00:26 +00:00
Terry Wilson 0e5c761c28 Opaquify ast_channel typedefs, fd arrays, and softhangup flag
Review: https://reviewboard.asterisk.org/r/1784/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@357721 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-01 22:09:18 +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
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 7afdbcf957 Merged revisions 335721 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10

................
  r335721 | rmudgett | 2011-09-13 17:10:44 -0500 (Tue, 13 Sep 2011) | 9 lines
  
  Merged revisions 335720 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.8
  
  ........
    r335720 | rmudgett | 2011-09-13 17:10:15 -0500 (Tue, 13 Sep 2011) | 1 line
    
    Remove obsolete todo comment about PICKUPRESULT.
  ........
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@335722 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-09-13 22:11:20 +00:00
Richard Mudgett a2e30b1908 Merged revisions 329200 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10

................
  r329200 | rmudgett | 2011-07-21 12:32:02 -0500 (Thu, 21 Jul 2011) | 24 lines
  
  Merged revisions 329199 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.8
  
  ........
    r329199 | rmudgett | 2011-07-21 12:30:57 -0500 (Thu, 21 Jul 2011) | 17 lines
    
    Update PickupChan documentation.
    
    The PickupChan uses the ampersand as the argument separator.
    Was documented as:
    PickupChan(channel[,channel2[,...][,options]])
    
    Fixed documentation to:
    PickupChan(Technology/Resource[&Technology2/Resource2[&...]][,options])
    
    This is a continuation of ASTERISK-17494 for v1.8 and later.
    
    (closes issue ASTERISK-18144)
    Reported by: Erik Smith
    Patches:
          pickupchan_ducumentation-v2.patch (License #6263) patch uploaded by Erik Smith
    Tested by: Erik Smith
  ........
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@329201 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-07-21 17:33:06 +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
Richard Mudgett 0a8f9d2cf0 Merged revisions 322749 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r322749 | rmudgett | 2011-06-09 11:31:53 -0500 (Thu, 09 Jun 2011) | 15 lines
  
  Remove potential deadlock in call pickup race.
  
  Deadlock is possible in ast_do_pickup() when holding the target channel
  lock and trying to get the chan channel lock.  Also, holding the target
  lock when calling ast_channel_masquerade() is not a good idea because that
  routine does deadlock avoidance.
  
  * Removed the need to hold the target lock after marking the target with a
  datastore and getting the connected line data off of the target channel.
  
  * Moved can_pickup() to ast_can_pickup() in features.c.  Now all the call
  pickup methods use the same basic call pickup availability check.
  
  Review: https://reviewboard.asterisk.org/r/1234/
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@322750 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-06-09 16:47:07 +00:00
Richard Mudgett b1cfd0e059 Merged revisions 320007 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r320007 | rmudgett | 2011-05-20 11:19:01 -0500 (Fri, 20 May 2011) | 2 lines
  
  Change some variable names to make pickup code easier to understand.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@320013 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-05-20 16:20:25 +00:00
Richard Mudgett 0436c501c9 Merged revisions 319997 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r319997 | rmudgett | 2011-05-20 10:48:25 -0500 (Fri, 20 May 2011) | 25 lines
  
  Crash when using directed pickup applications.
  
  The directed pickup applications can cause a crash if the pickup was
  successful because the dialplan keeps executing.
  
  This patch does the following:
  
  * Completes the channel masquerade on a successful pickup before the
  application returns.  The channel is now guaranteed a zombie and must not
  continue executing the dialplan.
  
  * Changes the return value of the directed pickup applications to return
  zero if the pickup failed and nonzero(-1) if the pickup succeeded.
  
  * Made some code optimizations that no longer require re-checking the
  pickup channel to see if it is still available to pickup.
  
  (closes issue #19310)
  Reported by: remiq
  Patches:
        issue19310_v1.8_v2.patch uploaded by rmudgett (license 664)
  Tested by: alecdavis, remiq, rmudgett
  
  Review: https://reviewboard.asterisk.org/r/1221/
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@319998 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-05-20 15:52:20 +00:00
Alec L Davis 892b7a2efd Merged revisions 318671 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r318671 | alecdavis | 2011-05-13 10:52:08 +1200 (Fri, 13 May 2011) | 30 lines
  
  Fix directed group pickup feature code *8 with pickupsounds enabled 
  
  Since 1.6.2, the new pickupsound and pickupfailsound in features.conf cause many issues.
  
  1). chan_sip:handle_request_invite() shouldn't be playing out the fail/success audio, as it has 'netlock' locked.
  2). dialplan applications for directed_pickups shouldn't beep.
  3). feature code for directed pickup should beep on success/failure if configured.
  
  Created a sip_pickup() thread to handle the pickup and playout the audio, spawned from handle_request_invite.
  
  Moved app_directed:pickup_do() to features:ast_do_pickup().
  
  Functions below, all now use the new ast_do_pickup()
  app_directed_pickup.c:
     pickup_by_channel()
     pickup_by_exten()
     pickup_by_mark()
     pickup_by_part()
  features.c:
     ast_pickup_call()
  
  (closes issue #18654)
  Reported by: Docent
  Patches: 
        ast_do_pickup_1.8_trunk.diff.txt uploaded by alecdavis (license 585)
  Tested by: lmadsen, francesco_r, amilcar, isis242, alecdavis, irroot, rymkus, loloski, rmudgett
  
  Review: https://reviewboard.asterisk.org/r/1185/
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@318672 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-05-12 22:56:43 +00:00
David Vossel de22aaa413 Merged revisions 290376 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

................
  r290376 | dvossel | 2010-10-05 14:56:29 -0500 (Tue, 05 Oct 2010) | 16 lines
  
  Merged revisions 290375 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.6.2
  
  ........
    r290375 | dvossel | 2010-10-05 14:54:50 -0500 (Tue, 05 Oct 2010) | 10 lines
    
    Fixes PickupChan() not working with full channel name.
    
    (closes issue #18011)
    Reported by: schern
    Patches:
          app_directed_pickup.c.2.patch uploaded by schern (license 995)
          app_directed_pickup.c.trunk.patch uploaded by schern (license 995)
    Tested by: schern, dvossel
  ........
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@290377 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-10-05 19:57:31 +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
David Vossel 62067caaab fixes PickupChan application
(closes issue #16863)
Reported by: schern
Patches:
      app_directed_pickup.c.patch uploaded by schern (license 995)
      for_trunk.diff uploaded by cjacobsen (license 1029)
Tested by: Graber, cjacobsen, lathama, rickead2000, dvossel


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@262240 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-10 19:06:08 +00:00
David Vossel b5c98d640a adds 'p' option to PickupChan
The 'p' option allows the PickupChan app to pickup
a ringing phone by looking for the first match to a
partial channel name rather than requiring a full match.

(closes issue #16613)
Reported by: syspert
Patches:
      pickipbycallid.patch uploaded by syspert (license 938)
      pickupbycallerid_v2.patch uploaded by dvossel (license 671)
Tested by: dvossel, syspert




git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@250141 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-02 21:58:03 +00:00
Tilghman Lesher e8a6d2995e Add pickup event to AMI. Also, fix AMI documentation.
(closes issue #16431)
 Reported by: syspert
 Patches: 
       20100112__issue16431.diff.txt uploaded by tilghman (license 14)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@240421 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-15 21:04:34 +00:00
Kevin P. Fleming cdd1f9e296 Finish implementaton of astobj2 OBJ_MULTIPLE, and convert ast_channel_iterator to use it.
This patch finishes the implementation of OBJ_MULTIPLE in astobj2 (the
case where multiple results need to be returned; OBJ_NODATA mode
already was supported). In addition, it converts ast_channel_iterators
(only the targeted versions, not the ones that iterate over all
channels) to use this method.

During this work, I removed the 'ao2_flags' arguments to the
ast_channel_iterator constructor functions; there were no uses of that
argument yet, there is only one possible flag to pass, and it made the
iterators less 'opaque'. If at some point in the future someone really
needs an ast_channel_iterator that does not lock the container, we can
provide constructor(s) for that purpose.

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@225244 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-10-21 21:08:47 +00:00
Matthew Nicholson 3b2023290f Merged revisions 218223 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r218223 | mnicholson | 2009-09-14 09:53:57 -0500 (Mon, 14 Sep 2009) | 8 lines
  
  Ensure we don't pickup ourselves when doing pickup by exten.
  
  (closes issue #15100)
  Reported by: lmsteffan
  Patches:
        (modified) pickup.patch uploaded by lmsteffan (license 779)
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@218224 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-09-14 14:57:23 +00:00
Mark Michelson 33852cfaf6 Fix the crash in directed pickups. For real this time.
A shallow pointer copy was causing an ast_party_connected_line
structure to be freed multiple times, thus causing a crash.

(closes issue #15441)
Reported by: lmsteffan
Patches:
      15441.patch uploaded by mmichelson (license 60)
Tested by: lmsteffan	  



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@208017 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-07-22 14:35:01 +00:00
Mark Michelson d040266a17 Okay, that didn't fix the crash. It didn't really do anything useful.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@207551 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-07-20 23:08:56 +00:00
Mark Michelson b276189912 Initialize connected line instance when doing a directed pickup.
This helps to prevent a crash which may occur due to our freeing
garbage due to a struct being uninitialized.




git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@207522 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-07-20 22:13:34 +00:00
Russell Bryant 0264eef115 Merge the new Channel Event Logging (CEL) subsystem.
CEL is the new system for logging channel events.  This was inspired after
facing many problems trying to represent what is possible to happen to a call
in Asterisk using CDR records.  For more information on CEL, see the built in
HTML or PDF documentation generated from the files in doc/tex/.

Many thanks to Steve Murphy (murf) and Brian Degenhardt (bmd) for their hard
work developing this code.  Also, thanks to Matt Nicholson (mnicholson) and
Sean Bright (seanbright) for their assistance in the final push to get this
code ready for Asterisk trunk.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@203638 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-26 15:28:53 +00:00
Russell Bryant 12ff77f975 Global var cleanup - constification and removing unused vars.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@199479 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-07 14:55:51 +00:00
Mark Michelson 298d745fb4 Add the ability to execute connected line interception macros.
When connected line updates are received or generated in the middle
of an application call, it is now possible to execute a macro to
manipulate the connected line data. This way, phone numbers may be
manipulated to be more presentable to users, names may be changed 
for...whatever reason, or whatever else needs to be done may be.

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

AST-165



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@198727 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-01 20:57:31 +00:00
Mark Michelson 83500e9b06 Remove some redundant or unnecessary connected line-related function calls.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@196893 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-26 19:50:07 +00:00
Kevin P. Fleming e6b2e9a750 Const-ify the world (or at least a good part of it)
This patch adds 'const' tags to a number of Asterisk APIs where they are appropriate (where the API already demanded that the function argument not be modified, but the compiler was not informed of that fact). The list includes:

- CLI command handlers
- CLI command handler arguments
- AGI command handlers
- AGI command handler arguments
- Dialplan application handler arguments
- Speech engine API function arguments

In addition, various file-scope and function-scope constant arrays got 'const' and/or 'static' qualifiers where they were missing.

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@196072 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-21 21:13:09 +00:00
Kevin P. Fleming 1c988d8996 add 'const' qualifiers in various places where they should have been
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@193832 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-12 13:59:35 +00:00
Richard Mudgett 7019ff68db Fixed crashes from issue8824 review board channel locking changes.
The local struct ast_party_connected_line connected_caller variable
was uninitialized when the copy function was called.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@192590 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-05 20:54:07 +00:00
Russell Bryant cba19c8a67 Convert the ast_channel data structure over to the astobj2 framework.
There is a lot that could be said about this, but the patch is a big 
improvement for performance, stability, code maintainability, 
and ease of future code development.

The channel list is no longer an unsorted linked list.  The main container 
for channels is an astobj2 hash table.  All of the code related to searching 
for channels or iterating active channels has been rewritten.  Let n be 
the number of active channels.  Iterating the channel list has gone from 
O(n^2) to O(n).  Searching for a channel by name went from O(n) to O(1).  
Searching for a channel by extension is still O(n), but uses a new method 
for doing so, which is more efficient.

The ast_channel object is now a reference counted object.  The benefits 
here are plentiful.  Some benefits directly related to issues in the 
previous code include:

1) When threads other than the channel thread owning a channel wanted 
   access to a channel, it had to hold the lock on it to ensure that it didn't 
   go away.  This is no longer a requirement.  Holding a reference is 
   sufficient.

2) There are places that now require less dealing with channel locks.

3) There are places where channel locks are held for much shorter periods 
   of time.

4) There are places where dealing with more than one channel at a time becomes 
   _MUCH_ easier.  ChanSpy is a great example of this.  Writing code in the 
   future that deals with multiple channels will be much easier.

Some additional information regarding channel locking and reference count 
handling can be found in channel.h, where a new section has been added that 
discusses some of the rules associated with it.

Mark Michelson also assisted with the development of this patch.  He did the 
conversion of ChanSpy and introduced a new API, ast_autochan, which makes it 
much easier to deal with holding on to a channel pointer for an extended period 
of time and having it get automatically updated if the channel gets masqueraded.
Mark was also a huge help in the code review process.

Thanks to David Vossel for his assistance with this branch, as well.  David 
did the conversion of the DAHDIScan application by making it become a wrapper 
for ChanSpy internally.

The changes come from the svn/asterisk/team/russell/ast_channel_ao2 branch.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@190423 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-24 14:04:26 +00:00
Joshua Colp ada8ae56e1 Fix a double free issue with the Pickup dialplan application.
As part of the pickup process the connected line information is updated.
Part of this process does a shallow copy of the target channel's connected line
information to a local structure. Once complete the structure contents are freed.
As a result any information in the target channel's connected line information
structure is no longer valid. This change will now set the contents back to a clean
state so that the freeing of the target channel's connected line information structure
when the channel is destroyed will no longer try to double free things.

(closes issue #14839)
Reported by: lmsteffan


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@190217 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-23 16:55:48 +00:00
Mark Michelson 6f53ed4c67 This commit introduces COLP/CONP and Redirecting party information into Asterisk.
The channel drivers which have been most heavily tested with these enhancements are
chan_sip and chan_misdn. Further work is being done to add Q.SIG support and will be
introduced in a later commit. chan_skinny has code added to it here, but according
to user pj, the support on chan_skinny is not working as of now. This will be fixed in
a later commit.

A special thanks goes out to bugtracker user gareth for getting the ball rolling and
providing the initial support for this work. Without his initial work on this, this would
not have been nearly as painless as it was.

This functionality has been tested by Digium's product quality department, as well as a
customer site running thousands of calls every day. In addition, many many many many bugtracker
users have tested this, too.

(closes issue #8824)
Reported by: gareth

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@186525 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-03 22:41:46 +00:00
Brian Degenhardt a7092f0acc fix a leaked channel lock (and future deadlock) when we try to pick up our own channel
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@179903 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-03 20:02:20 +00:00
Joshua Colp f56edec570 Merged revisions 162341 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r162341 | file | 2008-12-09 17:14:29 -0400 (Tue, 09 Dec 2008) | 4 lines
  
  Add 'down' as a valid state for directed call pickup. This creeps up when we receive session progress when dialing a device and not ringing.
  (closes issue #14005)
  Reported by: ddl
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@162342 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-09 21:16:37 +00:00
Sean Bright 48522988ab In order to move away from nested function use, some changes to the recently introduced
ast_channel_search_locked need to be made.  Specifically, the caller needs to be able to
pass arbitrary data which in turn is passed to the callback.  This patch addresses all
of the nested functions currently in asterisk trunk.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@155590 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-09 01:59:59 +00:00
Sean Bright 8a25d59bf8 Fix some whitespace.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@154926 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-05 22:22:37 +00:00
Sean Bright 6ac794074e Update a couple places to use the new ast_channel_search_locked API call.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@154923 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-05 22:19:22 +00:00
Russell Bryant ad533bc62b Instead of doing a couple of strlen() calls each iteration of the loop, only do it once
at the beginning of the function


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@153435 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-02 02:14:19 +00:00
Russell Bryant 5b168ee34b Merge changes from team/group/appdocsxml
This commit introduces the first phase of an effort to manage documentation of the
interfaces in Asterisk in an XML format.  Currently, a new format is available for
applications and dialplan functions.  A good number of conversions to the new format
are also included.

For more information, see the following message to asterisk-dev:

http://lists.digium.com/pipermail/asterisk-dev/2008-October/034968.html


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@153365 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-01 21:10:07 +00:00