Commit Graph

4449 Commits

Author SHA1 Message Date
Kevin Harwell
b2db8672c5 app_meetme: compiler warning
Fixed a compiler warning (errors in 'dev-mode') given by gcc version 4.8.1.
The one in app_meetme involved the 'sizeof-pointer-memaccess'
(see: http://gcc.gnu.org/gcc-4.8/porting_to.html) warning. Fixed so
it would no longer issue a warning and can compile again in 'dev-mode'.

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@404781 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-03 18:29:46 +00:00
Richard Mudgett
a624ee8afe Voicemail: Remove mailbox identifier format (box@context) assumptions in the system.
This change is in preparation for external MWI support.

Removed code from the system for normal mailbox handling that appends
@default to the mailbox identifier if it does not have a context.  The
only exception is the legacy hasvoicemail users.conf option.  The legacy
option will only work for app_voicemail mailboxes.  The system cannot make
any assumptions about the format of the mailbox identifer used by
app_voicemail.

chan_sip and chan_dahdi/sig_pri had the most changes because they both
tried to interpret the mailbox identifier.  chan_sip just stored and
compared the two components.  chan_dahdi actually used the box
information.

The ISDN MWI support configuration options had to be reworked because
chan_dahdi was parsing the box@context format to get the box number.  As a
result the mwi_vm_boxes chan_dahdi.conf option was added and is documented
in the chan_dahdi.conf.sample file.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@404348 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-19 16:37:56 +00:00
Matthew Jordan
655decc57e app_cdr,app_forkcdr,func_cdr: Synchronize with engine when manipulating state
When doing the rework of the CDR engine that pushed all of the logic into cdr.c
and made it respond to changes in channel state over Stasis, we knew that
accessing the CDR engine from the dialplan would be "slightly"
non-deterministic. Dialplan threads would be accessing CDRs while Stasis
threads would be updating the state of said CDRs - whereas in the past,
everything happened on the dialplan threads. Tests have shown that "slightly"
is in reality "very".

This patch synchronizes things by making the dialplan applications/functions
that manipulate CDRs do so over Stasis. ForkCDR, NoCDR, ResetCDR, CDR, and
CDR_PROP now all use Stasis to send their requests over to the CDR engine,
and synchronize on the channel Stasis topic via a subscription so that they
return their values/control to the dialplan at the appropriate time.

While going through this, the following changes were also made:
 * DISA, which can reset the CDR when a user successfully authenticates, now
   just uses the ResetCDR app to do this. This prevents having to duplicate
   the same Stasis synchronization logic in that application.
 * Answer no longer disables CDRs. It actually didn't work anyway - calling
   DISABLE on the channel's CDR doesn't stop the CDR from getting the Answer
   time - it just kills all CDRs on that channel, which isn't what the caller
   would intend.

(closes issue ASTERISK-22884)
(closes issue ASTERISK-22886)

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@404294 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-19 00:47:01 +00:00
Kevin Harwell
d1b70b8e43 channel locking: Add locking for channel snapshot creation
Original commit message by mmichelson (asterisk 12 r403311):

"This adds channel locks around calls to create channel snapshots as well
as other functions which operate on a channel and then end up
creating a channel snapshot. Functions that expect the channel to be
locked prior to being called have had their documentation updated to
indicate such."

The above was initially committed and then reverted at r403398.  The problem
was found to be in core_local.c in the publish_local_bridge_message function.
The ast_unreal_lock_all function locks and adds a reference to the returned
channels and while they were being unlocked they were not being unreffed when
no longer needed.  Fixed by unreffing the channels.

Also in bridge.c a lock was obtained on "other->chan", but then an attempt was
made to unlock "other" and not the previously locked channel.  Fixed by
unlocking "other->chan"

(closes issue ASTERISK-22709)
Reported by: John Bigelow






git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@404237 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-18 20:25:39 +00:00
Joshua Colp
f4d662add6 channels: Return allocated channels locked.
This change makes ast_channel_alloc return allocated channels
locked. By doing so no other thread can acquire, lock, and manipulate
the channel before it is completely set up.

(closes issue AST-1256)

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@404204 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-18 19:20:02 +00:00
Rusty Newton
1703d1e1fd Several components: fixing Typos in comments and code, "avaliable" instead of "available"
(issue ASTERISK-23021)
(closes issue ASTERISK-23021)
Reported by: Jeremy Lainé
Tested by: Rusty Newton
Patches:
   available.patch uploaded by Jeremy Lainé (license 6561)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@404046 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-17 23:36:56 +00:00
Jonathan Rose
93a096fe9f bridging: Give bridges a name and a known creator
Bridges have two new optional properties, a creator and a name.
Certain consumers of bridges will automatically provide bridges that
they create with these properties. Examples include app_bridgewait,
res_parking, app_confbridge, and app_agent_pool. In addition, a name
may now be provided as an argument to the POST function for creating
new bridges via ARI.

(closes issue AFS-47)
Review: https://reviewboard.asterisk.org/r/3070/


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@404042 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-17 23:17:32 +00:00
Scott Griepentrog
dc188ae39d app_sms: BufferOverflow when receiving odd length 16 bit message
This patch prevents an infinite loop overwriting memory when
a message is received into the unpacksms16() function, where
the length of the message is an odd number of bytes.

(closes issue ASTERISK-22590)
Reported by: Jan Juergens
Tested by: Jan Juergens


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@403856 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-16 15:29:30 +00:00
Joshua Colp
6e7d64c79d res_stasis: Expose event for call forwarding and follow forwarded channel.
This change adds an event for when an originated call is redirected to
another target. This event contains the original channel and the newly
created channel. If a stasis subscription exists on the original originated
channel for a stasis application then a new subscription will also be
created on the stasis application to the redirected channel. This allows
the application to follow the call path completely.

(closes issue ASTERISK-22719)
Reported by: Joshua Colp

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@403808 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-14 17:15:54 +00:00
Richard Mudgett
5f0d590b2e app_voicemail: Voicemail callback registration/unregistration function improvements.
* The voicemail registration/unregistration functions now take a struct of
callbacks instead of a lengthy parameter list of callbacks.

* The voicemail registration/unregistration functions now prevent a
competing module from interfering with an already registered callback
supplying module.
........

Merged revisions 403643 from http://svn.asterisk.org/svn/asterisk/trunk


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@403779 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-13 19:48:05 +00:00
David M. Lee
c0b4e18900 Reverting r403311. It's causing ARI tests to hang.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@403398 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-05 20:49:52 +00:00
Mark Michelson
4b7ba33125 Add channel locking for channel snapshot creation.
This adds channel locks around calls to create channel snapshots as well
as other functions which operate on a channel and then end up
creating a channel snapshot. Functions that expect the channel to be
locked prior to being called have had their documentation updated to
indicate such.



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@403311 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-03 16:33:49 +00:00
Kinsey Moore
22801822bc CELGenUserEvent: Fix error message from ast_json_pack
This prevents NULL from being passed into an ast_json_pack call when no
extra information is passed to the application which prevents an error
message about NULL arguments from being generated.


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@402755 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-11-12 16:33:24 +00:00
Mark Michelson
8d1527fd7a Get rid of some inaccurate comments.
I'm doing some unrelated work in app_confbridge and finding
these "invalid pin" comments to be annoying. Get out!
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@402687 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-11-11 19:26:48 +00:00
Kinsey Moore
33a9e71b7e app_queue: Honor penalty limits of 0
In the current app_queue code from 1.8 up to trunk the upper and lower
penalties can be set to 0 but the value is interpreted to be disabled
instead of actually setting limits. This is especially evident if min
and max limits are set to 0 and members with penalties of 0 and 1 are
in the queue since the member with penalty 1 will still receive calls.
This patch adjusts the special disabled value to be INT_MAX instead of
0.

(closes issue ASTERISK-20862)
Review: https://reviewboard.asterisk.org/r/2995/
Reported by: Schmooze Com
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@402647 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-11-11 15:36:23 +00:00
Kevin Harwell
e327b401da app_queue: crash if first agent is "busy"
If the first agent/member (via CLI "queue show") in a queue is "busy" (dnd,
circuit busy, etc...) and no agents answered then app_queue would crash.
This occurred because while the calling of agent(s) remained valid the channel
on "busy" agent would be set to NULL and then later dereferenced upon a second
"rna" function call.  The original intention of the code is to have only valid
"call attempt" objects (channels != NULL) checked while attempting to call
agent(s).  It does this by building a "call_next" list of valid "call attempt"
objects.  In the case of the "busy" agent subsequent builds of the valid "call
attempt" list would sometimes include (the case mentioned above) an invalid
"call attempt" object.

The fix was to make sure the "call attempt" list was appropriately built on
every iteration.  A NULL sanity check was also added at the original offending
spot of the crash just in case another one slipped by somehow.

(closes issue ASTERISK-22644)
Reported by: Marco Signorini
Review: https://reviewboard.asterisk.org/r/2983/


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@402517 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-11-06 21:57:04 +00:00
Richard Mudgett
55da2b319d confbridge: Separate user muting from system muting overrides.
The system overrides the user muting requests when MOH is playing or a
waitmarked user is waiting for a marked user to join.  System muting
overrides interfere with what the user may wish the muting to be when the
system override ends.

* User muting requests are now independent of the system muting overrides.
The effective muting is now the logical or of the user request and system
override.

* Added a Muted flag to the CLI "confbridge list <conference>" command.

* Added a Muted header to the AMI ConfbridgeList action ConfbridgeList
event.

(closes issue AST-1102)
Reported by: John Bigelow

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@402427 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-11-02 03:21:17 +00:00
Richard Mudgett
ff9809c0a8 config: Allow ConfBridge DTMF menus to have '#' as the first digit.
ConfBridge allows custom DTMF menus to be created in the confbridge.conf
file by assigning a DTMF key sequence to a sequence of actions as follows:

DTMF-sequence = action,action...

Unfortunately, the normal config file processing code interprets an
initial '#' character as starting a directive such as #include.

* Add the ability to escape the first non-blank character in a config line
so the '#' character can be used without triggering the directive
processing code.

(closes issue AFS-2)
(closes issue ASTERISK-22478)
Reported by: Nicolas Tanski
Patches:
      jira_asterisk_22478_v11.patch (license #5621) patch uploaded by rmudgett (modified)

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@402416 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-11-02 01:11:16 +00:00
Jonathan Rose
b2ea7c51ed app_voicemail: Memory Leaks against tests
(issue ASTERISK-22467)
Reported by: Corey Farrell
Patches:
    app_voicemail-1.8.patch uploaded by coreyfarrell (license 5909)
    app_voicemail-11up.patch uploaded by coreyfarrell (license 5909)
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@401745 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-10-24 18:45:52 +00:00
Richard Mudgett
5d783eff54 app_queue: Fix CLI "queue remove member" queue_log entry.
The queue_log entry resulting from CLI "queue remove member" when
log_membername_as_agent is enabled is wrong.  It always uses the interface
name instead of the member name in the queue_log entry.

* Get the queue member before removing it from the queue so the member
name is available for the queue_log entry.

(closes issue ASTERISK-21826)
Reported by: Oscar Esteve
Patches:
      fix_membername.diff (license #6505) patch uploaded by Oscar Esteve
         (modified to fix potential ref leak)
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@401434 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-10-22 19:03:02 +00:00
Richard Mudgett
aa4e8c4ab3 Add channel lock protection around translation path setup.
Most callers of ast_channel_make_compatible() happen before the channels
enter a two party bridge.  With the new bridging framework, two party
bridging technologies may also call ast_channel_make_compatible() when
there is more than one thread involved with the two channels.

* Added channel lock protection in set_format() and
ast_channel_make_compatible_helper() when dealing with the channel's
native formats while setting up a translation path.

* Fixed best_src_fmt and best_dst_fmt usage consistency in
ast_channel_make_compatible_helper().  The call to
ast_translator_best_choice() got them backwards.

* Updated some callers of ast_channel_make_compatible() and the function
documentation.  There is actually a difference between the two channels
passed in.

* Fixed the deadlock potential in res_fax.c dealing with
ast_channel_make_compatible().  The deadlock potential was already there
anyway because res_fax called ast_channel_make_compatible() with chan
locked.

(closes issue ASTERISK-22542)
Reported by: Matt Jordan

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@401239 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-10-18 16:52:32 +00:00
Walter Doekes
ec1c707121 Don't check all realtime queues when doing "queue show some_queue".
When using realtime queues, queues have to be fetched from the database
every now and then to see if any info has been changed or to see if the
queue has been removed. When fetching info for an individual queue, the
pruning of other queues is unnecessarily costly.

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@401077 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-10-16 12:12:42 +00:00
Richard Mudgett
3e1485af09 app_agent_pool: Fix AMI/CLI AgentLogoff soft preventing agents from logging back in.
* Clear the deferred_logoff flag when an agent logs in.

(closes issue ASTERISK-22669)
Reported by: John Bigelow


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@400754 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-10-08 21:19:17 +00:00
Richard Mudgett
25f54f1fe2 app_confbridge: Can now set the language used for announcements to the conference.
ConfBridge now has the ability to set the language of announcements to the
conference.  The language can be set on a bridge profile in
confbridge.conf or by the dialplan function
CONFBRIDGE(bridge,language)=en.

(closes issue ASTERISK-19983)
Reported by: Jonathan White
Patches:
      M19983_rev2.diff (license #5138) patch uploaded by junky (modified)
Tested by: rmudgett
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@400742 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-10-08 20:16:55 +00:00
Richard Mudgett
ea5a8334c6 app_confbridge: Fix duplicate default_user profile.
* Fixed looking in the wrong profiles container to see if the default_user
profile is already created in verify_default_profiles().  The bridge
profile container is never going to hold user profiles. :)
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@400724 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-10-08 19:12:03 +00:00
Richard Mudgett
e57deaec33 Make app_queue and res_agi independent of AMI being enabled.
The https://reviewboard.asterisk.org/r/2888/ review changes manager to not
subscribe to stasis when it is disabled for performance reasons.  When
manager is disabled app_queue and res_agi decline to load and fail to
clean up what they have already allocated.

* Made app_queue and res_agi clean up allocated resources when they
decline to load.

* Made app_queue and res_agi use their own subscriptions to the stasis
topics instead of borrowing manager's message router structure
inappropriately.

(closes issue ASTERISK-22604)
Reported by: rmudgett

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@400671 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-10-08 15:11:04 +00:00
Richard Mudgett
1d72d481a7 Miscellaneous stand alone comment cleanups.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@400661 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-10-07 15:37:16 +00:00
Michael L. Young
74320e6955 app_queue: Fix Queuelog EXITWITHKEY only logging two of four fields
Commit r62462 added two extra fields for logging "the original position the
caller entered the queue at, and the amount of time the caller was waiting in
the queue."  But when r75969 was merged from 1.4 into trunk (r75977), these two
fields disappeared. Those two extra fields were not logged in 1.4 and when the
patch was merged, those fields went away.

Therefore, this is a regression and was caught by the reporter because he was
reading the awesome "Asterisk: The Definitive Guide" book.

(closes issue ASTERISK-22197)
Reported by: Dalius M.
Tested by: Dalius M.
Patches:
    asterisk-22197-q-log-exitwithkey.diff
				     uploaded by Michael L. Young (license 5026)

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@400624 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-10-06 17:11:24 +00:00
Mark Michelson
23cea9e44b Cache string values of formats on ast_format_cap() to save processing.
Channel snapshots have string representations of the channel's native formats.
Prior to this change, the format strings were re-created on ever channel snapshot
creation. Since channel native formats rarely change, this was very wasteful.
Now, string representations of formats may optionally be stored on the ast_format_cap
for cases where string representations may be requested frequently. When formats
are altered, the string cache is marked as invalid. When strings are requested, the
cache validity is checked. If the cache is valid, then the cached strings are copied.
If the cache is invalid, then the string cache is rebuilt and copied, and the cache
is marked as being valid again.

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@400356 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-10-02 22:34:05 +00:00
Richard Mudgett
1a7783c7f8 MALLOC_DEBUG: Fix some misuses of free() when MALLOC_DEBUG is enabled.
* There were several places in ARI where an external library was mallocing
memory that must always be released with free().  When MALLOC_DEBUG is
enabled, free() is redirected to the MALLOC_DEBUG version.  Since the
external library call still uses the normal malloc(), MALLOC_DEBUG
complains that the freed memory block is not registered and will not free
it.  These cases must use ast_std_free().

* Changed calls to asprintf() and vasprintf() to the equivalent
ast_asprintf() and ast_vasprintf() versions respectively.


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@400270 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-10-02 17:11:42 +00:00
Joshua Colp
1dd63fbdfa Reduce channel snapshot creation and publishing by up to 50%.
This change introduces the ability to stage channel snapshot
creation and publishing by suppressing the implicit creation
and publishing that some functions have. Once all operations
are executed the staging is marked as done and a single snapshot
is created and published.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@400265 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-10-02 16:20:25 +00:00
David M. Lee
516dbe86a0 Remove dispatch object allocation from Stasis publishing
While looking for areas for performance improvement, I realized that an
unused feature in Stasis was negatively impacting performance.

When a message is sent to a subscriber, a dispatch object is allocated
for the dispatch, containing the topic the message was published to, the
subscriber the message is being sent to, and the message itself.

The topic is actually unused by any subscriber in Asterisk today. And
the subscriber is associated with the taskprocessor the message is being
dispatched to.

First, this patch removes the unused topic parameter from Stasis
subscription callbacks.

Second, this patch introduces the concept of taskprocessor local data,
data that may be set on a taskprocessor and provided along with the data
pointer when a task is pushed using the ast_taskprocessor_push_local()
call. This allows the task to have both data specific to that
taskprocessor, in addition to data specific to that invocation.

With those two changes, the dispatch object can be removed completely,
and the message is simply refcounted and sent directly to the
taskprocessor.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@400181 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-09-30 18:48:57 +00:00
David M. Lee
9d21631aee Optimize how Stasis forwards are dispatched
This patch optimizes how forwards are dispatched in Stasis.

Originally, forwards were dispatched as subscriptions that are invoked
on the publishing thread. This did not account for the vast number of
forwards we would end up having in the system, and the amount of work it
would take to walk though the forward subscriptions.

This patch modifies Stasis so that rather than walking the tree of
forwards on every dispatch, when forwards and subscriptions are changed,
the subscriber list for every topic in the tree is changed.

This has a couple of benefits. First, this reduces the workload of
dispatching messages. It also reduces contention when dispatching to
different topics that happen to forward to the same aggregation topic
(as happens with all of the channel, bridge and endpoint topics).

Since forwards are no longer subscriptions, the bulk of this patch is
simply changing stasis_subscription objects to stasis_forward objects
(which, admittedly, I should have done in the first place.)

Since this required me to yet again put in a growing array, I finally
abstracted that out into a set of ast_vector macros in
asterisk/vector.h.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@400180 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-09-30 18:39:34 +00:00
Matthew Jordan
d4bce93552 app_queue: Make manager events tolerant of Local channel shenanigans
app_queue currently attempts to handle Local channel optimizations in an effort
to provide accurate information in Stasis messages (and their corresponding
AMI events) as well as the Queue log. Sometimes, however, things don't go as
planned.

Consider the following scenario:
 SIP/foo <-> L;1 <-> L;2 <-> SIP/agent

SIP/agent answers, triggering a Local channel optimization. app_queue will
normally do the following:
 * Listen for the Local optimization events and update our agent accordingly
   to SIP/agent in the queue log and messages
 * When we get a hangup, publish the AgentComplete event based on our
   information (SIP/foo and SIP/agent)

However, as with all things that depend on sanity from something as capricious
as Local channels, things can go wrong:
 (1) SIP/agent immediately hangs up upon answering. This triggers a race
     condition between termination messages coming from SIP/agent and the
     ongoing Local channel optimization messages. (Note that this can also
     occur with SIP/foo)
 (2) In a race condition, Asterisk can (rarely) deliver the hangup messages
     prior to the Local channel optimization.

In that case, the messages *may* arrive to app_queue in the following order:
 * Hangup SIP/Agent
 * Hangup SIP/foo
 * Optimize L;1/L;2
 * Hangup L;2
 * Hangup L;1

When app_queue receives the hangup of the agent or the caller, it will attempt
to publish the AgentComplete event. However, it now has a problem - it thinks
its agent is the ;1 side of the Local channel, as it never received the
optimization event. At the same time, that channel is already gone. This
results in getting NULL from the Stasis cache. What's more, we can't really
wait for the optimization message, as we are currently handling the hangup
of the channel that the optimization event would tell us to use.

This patch modifies the behavior in app_queue such that, since we still have a
lot of pertinent queue information (interface, queue name, etc.), we now raise
the event with what information we know. The channels involved now may or may
not be present. Users will still at least get the "AgentComplete" event, which
"completes" the known Agent information.

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

(closes issue ASTERISK-22507)
Reported by: Richard Mudgett


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@400060 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-09-28 20:38:07 +00:00
Richard Mudgett
8a41aa9bf5 app_cdr and res_parking: Fix some resource leaks.
* app_cdr left the ResetCDR application registered.

* res_parking leaked a ref to config global.

(closes issue ASTERISK-22566)
Reported by: Corey Farrell
Patches:
      ASTERISK-22566-r2.patch (license #5909) patch uploaded by Corey Farrell


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@400020 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-09-27 21:56:15 +00:00
Rusty Newton
fa6f45f35a Adding a few words to the Dial option 'r' help text to clarify its tone argument description
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@399874 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-09-26 14:12:29 +00:00
Matthew Jordan
a99bc28c30 app_queue: Don't be quite so aggressive in initializing the array
We only need the first character.


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@399695 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-09-24 19:22:13 +00:00
Matthew Jordan
576b9b982f app_queue: Initialize array holding MixMonitor exec options
If the channel variable MONITOR_EXEC is set, app_queue will pass the specified
execution parameters to the MixMonitor application when a queue is recorded.
If that channel variable is not set, the buffer that holds the escaped value
was not being initialized to NULL, and so would be passed to the MixMonitor
application with garbage. Hilarity ensued as app_mixmonitor attempted to
execute gobeldy-gook.



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@399681 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-09-24 18:58:46 +00:00
Richard Mudgett
5de3863884 app_queue: Fix json blob ref leak.
The json ref from queue_member_blob_create() was never released.


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@399583 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-09-21 00:22:30 +00:00
Kevin Harwell
a7527fc783 Confbridge: empty conference not being torn down
Confbridge would not properly tear down an empty conference bridge when all
users were kicked via end_marked=yes and at least one user was also set to
wait_marked.  This occurred because while end_marked users were being kicked
and at least one was also set to wait_marked then the leave wait_marked handler
would be called on that user, but there would be no waiting user (still
considered active).  The waiting users would decrement and now be negative.  The
conference would remain, but be put into an inactive state.  The solution was
to move from the active list to the wait list, those users with wait_marked set
right before kicking.  This allows both the active and wait users to decrement
correctly and the confbridge to tear down properly.

A crashed also occurred when trying to list the specific conference from the CLI.
This happened because the conference specified was invalid.  Since the
conference properly tears down now there is no way to reference it thus
alleviating the crash as well.

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@399225 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-09-17 14:48:06 +00:00
Richard Mudgett
44f24f6c0f app_speech_utils: Fix unresolved symbol ast_speech_get_setting().
Fixes regression introduced by -r374096.

* Made res_speech.export.in export ast_* symbols instead of specific
functions.

* Made app_speech_utils.c declare that it is dependent upon res_speech.

(issue ASTERISK-17136)
Reported by: Richard Kenner


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@399197 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-09-16 17:53:47 +00:00
Richard Mudgett
74c9781273 Restore Dial, Queue, and FollowMe 'I' option support.
The Dial, Queue, and FollowMe applications need to inhibit the bridging
initial connected line exchange in order to support the 'I' option.

* Replaced the pass_reference flag on ast_bridge_join() with a flags
parameter to pass other flags defined by enum ast_bridge_join_flags.

* Replaced the independent flag on ast_bridge_impart() with a flags
parameter to pass other flags defined by enum ast_bridge_impart_flags.

* Since the Dial, Queue, and FollowMe applications are now the only
callers of ast_bridge_call() and ast_bridge_call_with_flags(), changed the
calling contract to require the initial COLP exchange to already have been
done by the caller.

* Made all callers of ast_bridge_impart() check the return value.  It is
important.  As a precaution, I also made the compiler complain now if it
is not checked.

* Did some cleanup in parking_tests.c as a result of checking the
ast_bridge_impart() return value.

An independent, but associated change is:
* Reduce stack usage in ast_indicate_data() and add a dropping redundant
connected line verbose message.

(closes issue ASTERISK-22072)
Reported by: Joshua Colp

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@399136 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-09-13 22:05:07 +00:00
Kinsey Moore
58f4d05287 Fix several crashes in MeetMeAdmin
This change ensures that MeetMeAdmin commands requiring a user actually
get a user and fixes another issue where an extra dereference could
occur for a last-entered user being ejected if a user identifier was
also provided.

(closes issue ASTERISK-21907)
Reported by: Alex Epshteyn
Review: https://reviewboard.asterisk.org/r/2844/
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@399035 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-09-13 13:54:41 +00:00
Rusty Newton
f2f8770494 'queue add member' help text correction
You are adding dial strings to the queue, not channels. An aribitrary string
could be used, but you are typically referencing a channel. Correcting the
command help text.

(issue ASTERISK-22263)
(closes issue ASTERISK-22263)
Reported By: Rusty Newton
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@398886 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-09-12 00:04:08 +00:00
Richard Mudgett
994a0da4d9 astobj2: Add warn unused attribute to some functions.
* Fixed resulting warnings with improper use of ao2_global_obj_replace().

* Made a couple uses of ao2_global_obj_replace_unref(x, NULL) into the
equivalent and more appropriate ao2_global_obj_release() call.


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@398533 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-09-06 19:20:06 +00:00
Jonathan Rose
1d9a74a900 app_voicemail: Fix leaking config objects when msg_id doesn't match
(issues ASTERISK-22414)
Reported by: Corey Farrell
Patch:
    test_voicemail_api-leaks-11.patch uploaded by coreyfarrell (license 5909)
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@398283 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-09-04 21:19:08 +00:00
Kevin Harwell
e68bf7187d Fix memory leaks
(closes issue ASTERISK-22368)
Reported by: Corey Farrell
Patches:
     issueA22368_mixmonitor_free_filename.patch uploaded by wdoekes (license 5674)
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@398016 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-30 16:26:32 +00:00
Kevin Harwell
e7dcc5494f Verbose logging discrepancies
Refactored cases where a combination of ast_verbose/options_verbose were
present.  Also in general tried to eliminate, in as many places as possible,
where the options_verbose global variable was being used.  Refactored the way
local and remote consoles handle verbose message logging in an attempt to
solve the various discrepancies that sometimes would show between the two.

(closes issue AST-1193)
Reported by: Guenther Kelleter
Review: https://reviewboard.asterisk.org/r/2798/
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@397958 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-29 22:45:15 +00:00
Mark Michelson
70ffc1550c Resolve assumptions that bridge snapshots would be non-NULL for transfer stasis events.
Attempting to transfer an unbridged call would result in crashes in either CEL code or
in the conversion to AMI messages.



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@397921 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-29 15:42:10 +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