]> git.ipfire.org Git - thirdparty/asterisk.git/log
thirdparty/asterisk.git
9 years agochan_sip: Allow websockets to be disabled. 53/1553/2
Corey Farrell [Tue, 3 Nov 2015 02:24:58 +0000 (21:24 -0500)] 
chan_sip: Allow websockets to be disabled.

This patch adds a new setting "websockets_enabled" to sip.conf.
Setting this to false allows chan_sip to be used without causing
conflicts with res_pjsip_transport_websocket.

ASTERISK-24106 #close
Reported by: Andrew Nagy

Change-Id: I04fe8c4f2d57b2d7375e0e25826c91a72e93bea7

9 years agores_pjsip: Set threadpool max size default to 50. 49/1549/1
Mark Michelson [Mon, 2 Nov 2015 23:19:21 +0000 (17:19 -0600)] 
res_pjsip: Set threadpool max size default to 50.

During a stress test of subscriptions, a huge blast of
subscription-related traffic resulted in the threadpool expanding to a
ridiculous number of threads. The balooning of threads resulted in an
increase of memory, which led to a crash due to being out of memory.

An easy fix for the particular test was to limit the size of the
threadpool, thus reining in the amount of memory that would be used. It
was decided that there really is no downside to having a non-infinite
default value for the maximum size of the threadpool, so this change
introduces 50 threads as the maximum threadpool size for the SIP
threadpool.

ASTERISK-25513 #close
Reported by John Bigelow

Change-Id: If0b9514f1d9b172540ce1a6e2f2ffa1f2b6119be

9 years agoMerge "pjsip_options: Schedule/unschedule qualifies on AoR creation/destruction"...
Joshua Colp [Mon, 2 Nov 2015 22:02:18 +0000 (16:02 -0600)] 
Merge "pjsip_options: Schedule/unschedule qualifies on AoR creation/destruction" into 13

9 years agopjsip_options: Schedule/unschedule qualifies on AoR creation/destruction 47/1547/2
Matt Jordan [Mon, 2 Nov 2015 12:57:22 +0000 (06:57 -0600)] 
pjsip_options: Schedule/unschedule qualifies on AoR creation/destruction

When an AoR is created or destroyed dynamically, the scheduled OPTIONS
requests that qualify the contacts on the AoR are not necessarily started
or destroyed, particularly for persistent contacts created for that AoR.
This patch adds create/update/delete sorcery observers for an AoR, which
schedule/unschedule the qualifies as expected.

Change-Id: Ic287ed2e2952a7808ee068776fe966f9554bdf7d

9 years agoMakefile: Add a rule 'basic-pbx' that installs the Basic PBX configs 43/1543/4
Matt Jordan [Fri, 30 Oct 2015 18:22:23 +0000 (13:22 -0500)] 
Makefile: Add a rule 'basic-pbx' that installs the Basic PBX configs

This patch adds a rule for installing the Super Awesome Company based 'Basic
PBX' configuration files. As part of adding this rule, a bit of the content
that makes up installing the configuration files under the 'samples' target
was refactored into a make subroutine for usage by additional later config
make targets.

Change-Id: I6c2e27906f73e2919a2b691da0be20ae70302404

9 years agores_pjsip_pubsub: Fix assertion when UAS dialog creation fails. 40/1540/1
Joshua Colp [Thu, 29 Oct 2015 13:28:33 +0000 (10:28 -0300)] 
res_pjsip_pubsub: Fix assertion when UAS dialog creation fails.

When compiled with assertions enabled one will occur when destroying
the subscription tree when UAS dialog creation fails. This is because
the code assumes that a dialog will always exist on a subscription
tree when in reality during this specific scenario it won't.

This change makes it so a dialog is not removed from the subscription
tree if it is not present.

ASTERISK-25505 #close

Change-Id: Id5c182b055aacc5e66c80546c64804ce19218dee

9 years agoMerge "chan_sip: Do not send all codecs on INVITE." into 13
Matt Jordan [Thu, 29 Oct 2015 13:26:45 +0000 (08:26 -0500)] 
Merge "chan_sip: Do not send all codecs on INVITE." into 13

9 years agoMerge "res_pjsip: Add "like" processing to pjsip list and show commands" into 13
Joshua Colp [Wed, 28 Oct 2015 11:30:56 +0000 (06:30 -0500)] 
Merge "res_pjsip:  Add "like" processing to pjsip list and show commands" into 13

9 years agochan_sip: Do not send all codecs on INVITE. 33/1533/1
Alexander Traud [Mon, 26 Oct 2015 16:42:03 +0000 (17:42 +0100)] 
chan_sip: Do not send all codecs on INVITE.

Since version 13, Asterisk sent all allowed codecs as callee, even when the
caller did not request/support them. In case of dynamic RTP payloads, this led
to the same ID for different codecs, which is not allowed by SIP/SDP. Now, the
intersection between the requested and the supported codecs is send again.

ASTERISK-24543 #close

Change-Id: Ie90cb8bf893b0895f8d505e77343de3ba152a287

9 years agoMerge "build: GCC 5.1.x catches some new const, array bounds and missing paren issues...
Joshua Colp [Mon, 26 Oct 2015 16:32:22 +0000 (11:32 -0500)] 
Merge "build: GCC 5.1.x catches some new const, array bounds and missing paren issues" into 13

9 years agoMerge "format: Update the maximum packetization time for iLBC 30." into 13
Matt Jordan [Mon, 26 Oct 2015 15:50:08 +0000 (10:50 -0500)] 
Merge "format: Update the maximum packetization time for iLBC 30." into 13

9 years agoMerge "res_pjsip_pubsub: Prevent sending NOTIFY on destroyed dialog." into 13
Matt Jordan [Sun, 25 Oct 2015 15:14:55 +0000 (10:14 -0500)] 
Merge "res_pjsip_pubsub: Prevent sending NOTIFY on destroyed dialog." into 13

9 years agoMerge "res_pjsip_pubsub: Ensure dialog lock balance." into 13
Matt Jordan [Sun, 25 Oct 2015 15:14:24 +0000 (10:14 -0500)] 
Merge "res_pjsip_pubsub: Ensure dialog lock balance." into 13

9 years agoMerge "res_pjsip_pubsub: Prevent crashes on final NOTIFY." into 13
Matt Jordan [Sun, 25 Oct 2015 15:12:58 +0000 (10:12 -0500)] 
Merge "res_pjsip_pubsub: Prevent crashes on final NOTIFY." into 13

9 years agoMerge "res_pjsip_pubsub: Remove serializer when sending final NOTIFY." into 13
Matt Jordan [Sun, 25 Oct 2015 15:12:36 +0000 (10:12 -0500)] 
Merge "res_pjsip_pubsub: Remove serializer when sending final NOTIFY." into 13

9 years agoMerge "res_pjsip_pubsub: Fix crash on destruction of empty subscription tree." into 13
Matt Jordan [Sun, 25 Oct 2015 15:12:03 +0000 (10:12 -0500)] 
Merge "res_pjsip_pubsub: Fix crash on destruction of empty subscription tree." into 13

9 years agoMerge "res_pjsip_pubsub: Solidify lifetime and ownership of objects." into 13
Matt Jordan [Sun, 25 Oct 2015 15:10:55 +0000 (10:10 -0500)] 
Merge "res_pjsip_pubsub: Solidify lifetime and ownership of objects." into 13

9 years agobuild: GCC 5.1.x catches some new const, array bounds and missing paren issues 23/1523/1
George Joseph [Sat, 24 Oct 2015 18:08:41 +0000 (12:08 -0600)] 
build: GCC 5.1.x catches some new const, array bounds and missing paren issues

Fixed 1 issue in each of the affected files.

ASTERISK-25494 #close
Reported-by: George Joseph
Tested-by: George Joseph
Change-Id: I818f149cd66a93b062df421e1c73c7942f5a4a77

9 years agores_pjsip: Add "like" processing to pjsip list and show commands 57/1457/7
George Joseph [Tue, 20 Oct 2015 21:02:30 +0000 (15:02 -0600)] 
res_pjsip:  Add "like" processing to pjsip list and show commands

Add the ability to filter output from pjsip list and show commands
using the "like" predicate like chan_sip.

For endpoints, aors, auths, registrations, identifyies and transports,
the modification was a simple change of an ast_sorcery_retrieve_by_fields
call to ast_sorcery_retrieve_by_regex.  For channels and contacts a
little more work had to be done because neither of those objects are
true sorcery objects.  That was just removing the non-matching object
from the final container.  Of course, a little extra plumbing in the
common pjsip_cli code was needed to parse the "like" and pass the regex
to the get_container callbacks.

Some of the get_container code in res_pjsip_endpoint_identifier was also
refactored for simplicity.

ASTERISK-25477 #close
Reported by: Bryant Zimmerman
Tested by: George Joseph

Change-Id: I646d9326b778aac26bb3e2bcd7fa1346d24434f1

9 years agoMerge "res_pjsip_outbound_registration: registration stops due to fatal 4xx response...
Joshua Colp [Fri, 23 Oct 2015 20:35:18 +0000 (15:35 -0500)] 
Merge "res_pjsip_outbound_registration: registration stops due to fatal 4xx response" into 13

9 years agores_pjsip_outbound_registration: registration stops due to fatal 4xx response 72/1472/6
Kevin Harwell [Wed, 21 Oct 2015 16:51:13 +0000 (11:51 -0500)] 
res_pjsip_outbound_registration: registration stops due to fatal 4xx response

During outbound registration it is possible to receive a fatal (any permanent/
non-temporary 4xx, 5xx, 6xx) response from the registrar that is simply due
to a problem with the registrar itself. Upon receiving the failure response
Asterisk terminates outbound registration for the given endpoint.

This patch adds an option, 'fatal_retry_interval', that when set continues
outbound registration at the given interval up to 'max_retries' upon receiving
a fatal response.

ASTERISK-25485 #close

Change-Id: Ibc2c7b47164ac89cc803433c0bbe7063bfa143a2

9 years agoMerge "chan_sip: Fix autoframing=yes." into 13
Joshua Colp [Fri, 23 Oct 2015 11:51:54 +0000 (06:51 -0500)] 
Merge "chan_sip: Fix autoframing=yes." into 13

9 years agoMerge topic 'fix_oom_crash' into 13
Joshua Colp [Fri, 23 Oct 2015 11:51:32 +0000 (06:51 -0500)] 
Merge topic 'fix_oom_crash' into 13

* changes:
  strings.c: Fix __ast_str_helper() to always return a terminated string.
  Add missing failure checks to ast_str_set_va() callers.

9 years agoMerge "res_pjsip: Move URI validation to use time." into 13
Joshua Colp [Fri, 23 Oct 2015 11:48:48 +0000 (06:48 -0500)] 
Merge "res_pjsip: Move URI validation to use time." into 13

9 years agoformat_cap: Detect vector allocation failures. 13/1513/1
Mark Michelson [Thu, 22 Oct 2015 22:07:55 +0000 (17:07 -0500)] 
format_cap: Detect vector allocation failures.

A crash was seen on a system that ran out of memory due to Asterisk not
checking for vector allocation failures in format_cap.c. With this
change, if either of the AST_VECTOR_INIT calls fail, we will return a
value indicating failure.

Change-Id: Ieb9c59f39dfde6d11797a92b45e0cf8ac5722bc8

9 years agores_pjsip_pubsub: Prevent sending NOTIFY on destroyed dialog. 99/1499/1
Mark Michelson [Fri, 2 Oct 2015 20:32:09 +0000 (15:32 -0500)] 
res_pjsip_pubsub: Prevent sending NOTIFY on destroyed dialog.

A certain situation can result in our attempting to send a NOTIFY on a
destroyed dialog. Say we attempt to send a NOTIFY to a subscriber, but
that subscriber has dropped off the network. We end up retransmitting
that NOTIFY until the appropriate SIP timer says to destroy the NOTIFY
transaction. When the pjsip evsub code is told that the transaction has
been terminated, it responds in kind by alerting us that the
subscription has been terminated, destroying the subscription, and then
removing its reference to the dialog, thus destroying the dialog.

The problem is that when we get told that the subscription is being
terminated, we detect that we have not sent a terminating NOTIFY
request, so we queue up such a NOTIFY to be sent out. By the time that
queued NOTIFY gets sent, the dialog has been destroyed, so attempting to
send that NOTIFY can result in a crash.

The fix being introduced here is actually a reintroduction of something
the pubsub code used to employ. We hold a reference to the dialog and
wait to decrement our reference to the dialog until our subscription
tree object is destroyed. This way, we can send messages on the dialog
even if the PJSIP evsub code wants to terminate earlier than we would
like.

In doing this, some NULL checks for subscription tree dialogs have been
removed since NULL dialogs are no longer actually possible.

Change-Id: I013f43cddd9408bb2a31b77f5db87a7972bfe1e5

9 years agores_pjsip_pubsub: Ensure dialog lock balance. 98/1498/1
Mark Michelson [Tue, 29 Sep 2015 19:53:22 +0000 (14:53 -0500)] 
res_pjsip_pubsub: Ensure dialog lock balance.

When sending a NOTIFY, we lock the dialog and then unlock the dialog
when finished. A recent change made it so that the subscription tree's
dialog pointer will be set NULL when sending the final NOTIFY request
out. This means that when we attempt to unlock the dialog, we pass a
NULL pointer to pjsip_dlg_dec_lock(). The result is that the dialog
remains locked after we think we have unlocked it. When a response to
the NOTIFY arrives, the monitor thread attempts to lock the dialog, but
it cannot because we never released the dialog lock. This results in
Asterisk being unable to process incoming SIP traffic any longer.

The fix in this patch is to use a local pointer to save off the pointer
value of the subscription tree's dialog when locking and unlocking the
dialog. This way, if the subscription tree's dialog pointer is NULLed
out, the local pointer will still have point to the proper place and the
dialog lock will be unlocked as we expect.

Change-Id: I7ddb3eaed7276cceb9a65daca701c3d5e728e63a

9 years agores_pjsip_pubsub: Prevent crashes on final NOTIFY. 97/1497/1
Mark Michelson [Mon, 28 Sep 2015 21:36:25 +0000 (16:36 -0500)] 
res_pjsip_pubsub: Prevent crashes on final NOTIFY.

The SIP dialog is removed from the subscription tree when the final
NOTIFY is sent. However, after the final NOTIFY is sent, the persistence
update function still attempts to access the cseq from the dialog,
resulting in a crash.

This fix removes the subscription persistence at the same time that the
dialog is removed from the subscription tree. This way, there is no
attempt to update persistence when the subscription is being destroyed.

Change-Id: Ibb46977a6cef9c51dc95f40f43446e3d11eed5bb

9 years agores_pjsip_pubsub: Remove serializer when sending final NOTIFY. 96/1496/1
Mark Michelson [Thu, 17 Sep 2015 22:28:30 +0000 (17:28 -0500)] 
res_pjsip_pubsub: Remove serializer when sending final NOTIFY.

There have been crashes seen where a taskprocessor's listener is NULL
unexpectedly.

Looking at backtraces, the problem was specifically seen in PJSIP
serializers.

Subscriptions make the mistake of removing a serializer from a dialog
during subscription tree destruction. Since subscription trees are
reference-counted, guaranteeing the circumstances behind the destruction
are not possible. This makes it so that the dialog serializer can be
removed while not holding the dialog lock. This makes it possible for
the distributor to get a pointer to the dialog serializer and have that
serializer get freed out from under it.

The fix for this is to remove the serializer from a subscription dialog
when sending the final NOTIFY. This guarantees that the serializer is
removed with the dialog lock held. By doing this, we guarantee that if
the distributor gains access to the dialog's serializer, it will not be
possible for the serializer to get freed by another thread.

Change-Id: I21f5dac33529f65cec45679bdace60670800ff66

9 years agores_pjsip_pubsub: Fix crash on destruction of empty subscription tree. 95/1495/1
Mark Michelson [Wed, 2 Sep 2015 14:14:19 +0000 (09:14 -0500)] 
res_pjsip_pubsub: Fix crash on destruction of empty subscription tree.

If an old persistent subscription is recreated but then immediately
destroyed because it is out of date, the subscription tree will have no
leaf subscriptions on it. This was resulting in a crash when attempting
to destroy the subscription tree.

A simple NULL check fixes this problem.

Change-Id: I85570b9e2bcc7260a3fe0ad85904b2a9bf36d2ac

9 years agores_pjsip_pubsub: Solidify lifetime and ownership of objects. 94/1494/1
Mark Michelson [Tue, 1 Sep 2015 20:47:19 +0000 (15:47 -0500)] 
res_pjsip_pubsub: Solidify lifetime and ownership of objects.

There have been crashes and general instability seen in the pubsub code,
so this patch introduces three changes to increase the stability.

First, the ownership model for subscriptions has been modified. Due to
RLS, subscriptions are stored in memory as a tree structure. Prior to my
patch, the PJSIP subscription was the owner of the subscription tree.
When the PJSIP subscription told us that it was terminating, we started
destroying the subscription tree along with all of the individual leaf
subscriptions that belong to the tree. The problem with this model is
that the two actors in play here, the PJSIP subscription and the
individual leaf subscriptions, need to have joint ownership of the
subscription tree. So now, the PJSIP subscription and the individual
leaf subscriptions each have a reference to the subscription tree. This
way, we will not actually free memory until no players are left that
care. The PJSIP subscription is a bigger stakeholder, in that if the
PJSIP subscription's reference to the subscription tree is removed, the
subscription tree instructs the leaf subscriptions to shut down and drop
their references to the subscription tree when possible. The individual
leaf subscriptions, upon being told to shut down, can drop their stasis
subscriptions or whatever they use to learn of new state, and then drop
their reference to the subscription tree once they are ready to die.

Second, the lifetime of a PJSIP subscription's reference to our
subscription tree has been altered. As I learned from doing a deep dive,
the PJSIP evsub code can tell Asterisk multiple times that the
subscription has been terminated, and not all of these times
are especially helpful. I have altered the message flow that we use for
SIP subscriptions such that we will always drop the PJSIP subscription's
reference to the subscription tree when we send the NOTIFY that
terminates a SIP subscription. This also means that we will now queue
NOTIFY requests to be sent after responding to incoming SUBSCRIBEs so
that we can have predictable state changes from the PJSIP evsub code.

Third, the synchronization of operations has been improved. PJSIP can
call into our code from a serializer thread (e.g. upon receiving an
incoming request) or from the monitor thread (e.g. when a subscription
times out). Because of this, there is the possibility of competing
threads stepping on each other. PJSIP attempts to do some
synchronization on its own by always keeping the dialog lock held when
it calls into us. However, since we end up pushing tasks into the
serializer, the result was that serialized operations were not grabbing
the dialog lock and could, as a result, step on something that was being
attempted by a different thread. Now we ensure that serialized
operations grab the dialog lock, then check for extenuating
circumstances, then proceed with their operation if they can.

Change-Id: Iff2990c40178dad9cc5f6a5c7f76932ec644b2e5

9 years agostrings.c: Fix __ast_str_helper() to always return a terminated string. 78/1478/1
Richard Mudgett [Mon, 19 Oct 2015 20:28:46 +0000 (15:28 -0500)] 
strings.c: Fix __ast_str_helper() to always return a terminated string.

Users of functions which call __ast_str_helper() such as the ones listed
below are likely to not check the return value for failure so ensuring
that the string is always nil terminated is a good safety measure.

ast_str_set_va()
ast_str_append_va()
ast_str_set()
ast_str_append()

Change-Id: I36ab2d14bb6015868b49329dda8639d70fbcae07

9 years agoAdd missing failure checks to ast_str_set_va() callers. 77/1477/1
Richard Mudgett [Mon, 19 Oct 2015 20:27:40 +0000 (15:27 -0500)] 
Add missing failure checks to ast_str_set_va() callers.

Change-Id: I0c2cdcd53727bdc6634095c61294807255bd278f

9 years agoMerge "funcs/func_holdintercept: Actually add the HOLD_INTERCEPT function" into 13
Joshua Colp [Wed, 21 Oct 2015 21:47:03 +0000 (16:47 -0500)] 
Merge "funcs/func_holdintercept: Actually add the HOLD_INTERCEPT function" into 13

9 years agores_pjsip: Move URI validation to use time. 69/1469/1
Joshua Colp [Wed, 21 Oct 2015 16:44:17 +0000 (13:44 -0300)] 
res_pjsip: Move URI validation to use time.

In a realtime based system with a limited number of threadpool threads
it is possible for a deadlock to occur. This happens when permanent
endpoint state is updated, which will cause database queries to be done.
These queries may result in URI validation being done which is done
synchronously using a PJSIP thread. If all PJSIP threads are in use
processing traffic they themselves may be blocked waiting to get the
permanent endpoint container lock when identifying an endpoint.

This change moves URI validation to occur at use time instead of
configuration time. While this comes at a cost of not seeing a problem
until you use it it does solve the underlying deadlock problem.

ASTERISK-25486 #close

Change-Id: I2d7d167af987d23b3e8199e4a68f3359eba4c76a

9 years agoformat: Update the maximum packetization time for iLBC 30. 65/1465/2
Alexander Traud [Wed, 21 Oct 2015 13:08:51 +0000 (15:08 +0200)] 
format: Update the maximum packetization time for iLBC 30.

In September 2006, the maximum packetization time (ptime) were set to such a
low value, packetization was disabled for many codecs actually. This was fixed
for many codecs but not for iLBC 30. This enables packetization for iLBC which
can be enabled for example via allow=ilbc:60,gsm,alaw,ulaw in the file sip.conf.

ASTERISK-7803

Change-Id: I2ef90023d35efb7cb8fe96ed74f53f6846ffad12

9 years agochan_sip: Fix autoframing=yes. 68/1468/1
Alexander Traud [Wed, 21 Oct 2015 14:51:11 +0000 (16:51 +0200)] 
chan_sip: Fix autoframing=yes.

With Asterisk 13, the structures ast_format and ast_codec changed. Because of
that, the paketization timing (framing) of the RTP channel moved away from the
formats/codecs. In the course of that change, the ptime of the callee was not
honored anymore, when the optional autoframing was enabled.

ASTERISK-25484 #close

Change-Id: Ic600ccaa125e705922f89c72212c698215d239b4

9 years agorest-api-templates: Wikify error code response reasons 58/1458/1
Matt Jordan [Wed, 21 Oct 2015 03:24:36 +0000 (22:24 -0500)] 
rest-api-templates: Wikify error code response reasons

Error response code descriptions may contain wiki markup that need to be
escaped. Without this patch, Confluence will reject the document being sent
and the responsible script will raise an exception.

Change-Id: I21fcb66fee7f6332381f2b99b1b0195dff215ee5

9 years agofuncs/func_holdintercept: Actually add the HOLD_INTERCEPT function 53/1453/2
Matt Jordan [Tue, 20 Oct 2015 17:06:52 +0000 (12:06 -0500)] 
funcs/func_holdintercept: Actually add the HOLD_INTERCEPT function

When ab803ec342 was committed, it accidentally forgot to actually *add* the
HOLD_INTERCEPT function. This highlights two interesting points:
* Gerrit forces you to put the patch as it is going to into the repo up for
  review, which Review Board did not. Yay Gerrit.
* No one apparently bothered to use this feature, or else they don't know about
  it. I'm going to go with the latter explanation.

ASTERISK-24922

Change-Id: Ida38278f259dd07c334a36f9b7d5475b5db72396

9 years agoMerge "contrib/scripts/autosupport: Update for Asterisk 13" into 13
Joshua Colp [Tue, 20 Oct 2015 16:21:40 +0000 (11:21 -0500)] 
Merge "contrib/scripts/autosupport: Update for Asterisk 13" into 13

9 years agocontrib/scripts/autosupport: Update for Asterisk 13 49/1449/2
Matt Jordan [Tue, 20 Oct 2015 00:59:50 +0000 (19:59 -0500)] 
contrib/scripts/autosupport: Update for Asterisk 13

This patch adds some minor tweaks for autosupport to update it for Asterisk 13.
This includes:
* Finally removing most references to Zaptel
* Adding support for some additional 'core' commands, and fixing nomenclature
  that generally hasn't been used for some time
* Adding some PJSIP/SIP commands to gather endpoints/peers and active channels

Change-Id: Ic997b418cbd9313588b6608e50f47b0ce6f4f1f1

9 years agoMerge topic 'ASTERISK-25461' into 13
Matt Jordan [Fri, 16 Oct 2015 15:35:59 +0000 (10:35 -0500)] 
Merge topic 'ASTERISK-25461' into 13

* changes:
  config.c: Fix off-nominal memory leak.
  config.c: Fix potential memory corruption after [section](+).
  config.c: Fix #include after [section](+).

9 years agoMerge "res_config_pgsql.c: Fix deadlock loading realtime configuration." into 13
Joshua Colp [Thu, 15 Oct 2015 19:41:30 +0000 (14:41 -0500)] 
Merge "res_config_pgsql.c: Fix deadlock loading realtime configuration." into 13

9 years agoMerge "Build: Add menuselect options for using compiler sanitizers" into 13
Joshua Colp [Thu, 15 Oct 2015 19:40:51 +0000 (14:40 -0500)] 
Merge "Build: Add menuselect options for using compiler sanitizers" into 13

9 years agores_config_pgsql.c: Fix deadlock loading realtime configuration. 40/1440/1
Richard Mudgett [Wed, 14 Oct 2015 19:15:53 +0000 (14:15 -0500)] 
res_config_pgsql.c: Fix deadlock loading realtime configuration.

On v13, loading several thousand PJSIP endpoints on Asterisk start causes
a deadlock most of the time.

Thanks to mdu113 for discovering that there was a call to pgsql_exec() not
protected by the pgsql_lock reentrancy lock.

{quote}
I believe a code path exists that attempts to use pgsql connection without
locking pgsql_lock.  I believe what happens during that deadlock that I
see is two concurrent threads are both attempting to send query to pgsql,
one of the thread is using a code path without locking pgsql_lock.  If
they managed to send queries at the same time, it seems postgres ignores
one of the queries and replies only to the one of them.  If it happens so
that the thread holding the lock didn't receive the reply it will wait for
it (and hold the lock) forever (or at least for very long time), thus
completely blocking all access to db.
{quote}

* Added missing reentrancy locking around pgsql_exec() in find_table().

* Moved unlock of pgsql_lock in unload_module() to avoid locking inversion
between the psql_tables list lock and the pgsql_lock.

ASTERISK-25455 #close
Reported by:  mdu113
Patches:
      res_config_pgsql.c-connlock2.diff (license #5543) patch uploaded by mdu113

Change-Id: Id9e7cdf8a3b65ff19964b0cf942ace567938c4e2

9 years agochannels/chan_sip: Set cause code to 44 on RTP timeout 33/1433/1
Matt Jordan [Tue, 13 Oct 2015 19:13:54 +0000 (14:13 -0500)] 
channels/chan_sip: Set cause code to 44 on RTP timeout

To quote Olle:

"When issuing a hangup due to RTP timeouts the cause code is not set. I have
selected 44 based on Cisco's implementation..."

ASTERISK-25135 #close
Reported by: Olle Johansson
patches:
  rtp-timeout-cause-1.8.diff uploaded by Olle Johansson (License 5267)

Change-Id: Ia62100c55077d77901caee0bcae299f8dc7375fc

9 years agoBuild: Add menuselect options for using compiler sanitizers 18/1418/1
Ivan Poddubny [Sat, 10 Oct 2015 20:20:55 +0000 (23:20 +0300)] 
Build: Add menuselect options for using compiler sanitizers

This patch adds menuselect options for building Asterisk with
various sanitizers provided by gcc and clang.

When one of *SANITIZER flags is set in menuselect, the appropriate
option is added to CFLAGS ad LDFLAGS for the build.

Information on sanitizers in the project wiki:
https://github.com/google/sanitizers/wiki

GCC Manual:
https://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html

Clang Compiler User's Manual:
http://clang.llvm.org/docs/UsersManual.html#controlling-code-generation

ASTERISK-24718 #close
Reported by: Badalian Vyacheslav

Change-Id: Iafa51b792b7bcb20e848b99d16cf362d08590fa0

9 years agoconfig.c: Fix off-nominal memory leak. 24/1424/1
Richard Mudgett [Mon, 12 Oct 2015 16:21:39 +0000 (11:21 -0500)] 
config.c: Fix off-nominal memory leak.

Change-Id: I06e346e9a5c63cc5071e7eda537310c4b43bffe0

9 years agoconfig.c: Fix potential memory corruption after [section](+). 23/1423/1
Richard Mudgett [Mon, 12 Oct 2015 16:20:29 +0000 (11:20 -0500)] 
config.c: Fix potential memory corruption after [section](+).

The memory corruption could happen if the [section](+) is the last section
in the file with trailing comments.  In this case process_text_line() has
left *last_cat is set to newcat and newcat is destroyed.

Change-Id: I0d1d999f553986f591becd000e7cc6ddfb978d93

9 years agoconfig.c: Fix #include after [section](+). 22/1422/1
Richard Mudgett [Mon, 12 Oct 2015 16:21:55 +0000 (11:21 -0500)] 
config.c: Fix #include after [section](+).

An #include right after a [section](+) would associate any variable
assignments before a new section in the #include with the wrong section.

* Fix section association by setting the current section to the appended
section.

* Fix '+' and '!' section flag interaction corner case depending upon
which flag came first.  If the '!' came first then it would be ignored.
If the '!' came after then it would affect the appended section.  The '!'
will now no longer be ignored.

ASTERISK-25461 #close
Reported by: Sean Pimental

Change-Id: Ic9d3191c8758048e2cbce6432f854b32531731c3

9 years agoMerge "chan_pjsip: Fix crash on reINVITE before initial INVITE completes." into 13
Joshua Colp [Thu, 8 Oct 2015 18:48:14 +0000 (13:48 -0500)] 
Merge "chan_pjsip: Fix crash on reINVITE before initial INVITE completes." into 13

9 years agores_pjsip: Fix deadlock when sending out-of-dialog requests. 12/1412/1
Richard Mudgett [Tue, 6 Oct 2015 23:01:37 +0000 (18:01 -0500)] 
res_pjsip: Fix deadlock when sending out-of-dialog requests.

The struct send_request_wrapper has a pjsip lock associated with it that
is created non-recursive.  There is a code path for the struct
send_request_wrapper lock that will attempt to lock it recursively.  The
reporter's deadlock showed that the thread calling endpt_send_request()
deadlocked itself right after the wrapper object got created.

Out-of-dialog requests such as MESSAGE, qualify OPTIONS, and unsolicited
MWI NOTIFY messages can hit this deadlock.

* Replaced the struct send_request_wrapper pjsip lock with the mutex lock
that can come with an ao2 object since all of Asterisk's mutexes are
recursive.  Benefits include removal of code maintaining the pjsip
non-recursive lock since ao2 objects already know how to maintain their
own lock and the lock will show up in the CLI "core show locks" output.

ASTERISK-25435 #close
Reported by: Dmitriy Serov

Change-Id: I458e131dd1b9816f9e963f796c54136e9e84322d

9 years agores/res_rtp_asterisk.c: Fix incorrect assignment of frame->subclass.frame_ending 11/1411/1
StefanEng86 [Tue, 6 Oct 2015 16:05:00 +0000 (18:05 +0200)] 
res/res_rtp_asterisk.c: Fix incorrect assignment of frame->subclass.frame_ending

In ast_rtp_read, the value of the variable 'mark' which we try to assign to a
frame->subclass.frame_ending may be 0, 1 or (1<<23), but we should translate
it to 0 or 1.

ASTERISK-25451 #close
Change-Id: I53bdf5c026041730184a6a809009c028549ce626

9 years agofunc_presencestate: Return "not_set" when no data is set in AstDB 09/1409/1
Ivan Poddubny [Wed, 7 Oct 2015 06:24:31 +0000 (09:24 +0300)] 
func_presencestate: Return "not_set" when no data is set in AstDB

Return AST_PRESENCE_NOT_SET when CustomPresence AstDB key does not
exist, i.e. when a new CustomPresence is added in the dialplan.

ASTERISK-25400 #close
Reported by: Andrew Nagy

Change-Id: I6fb17b16591b5a55fbffe96f3994ec26b1b1723a

9 years agores/res_rtp_asterisk: Fix assignment after ao2 decrement 03/1403/1
Matt Jordan [Wed, 7 Oct 2015 01:43:58 +0000 (20:43 -0500)] 
res/res_rtp_asterisk: Fix assignment after ao2 decrement

When we decide we will no longer schedule an RTCP write, we remove the
reference to the RTP instance, then assign -1 to the stored scheduler ID
in case something else comes along and wants to see if anything is scheduled.

That scheduler ID is on the RTP instance. After 60a9172d7ef2 was merged to
fix the regression introduced by 3cf0f29310, this improper assignment on a
potentially destroyed object started getting tripped on the build agents.

Frankly, this should have been crashing a lot more often earlier. I can only
assume that the timing was changed just enough by both changes to start
actually hitting this problem.

As it is, simply moving the assignment prior to the ao2 deference is sufficient
to keep the RTP instance from being referenced when it is very, truly,
aboslutely dead.

(Note that it is still good practice to assign -1 to the scheduler ID when we
know we won't be scheduling it again, as the ao2 deref *may* not always destroy
the ao2 object.)

ASTERISK-25449

Change-Id: Ie6d3cb4adc7b1a6c078b1c38c19fc84cf787cda7

9 years agochan_sip: Fix port parsing for IPv6 addresses in SIP Via headers. 99/1399/1
Florian Sauerteig [Tue, 6 Oct 2015 17:40:22 +0000 (19:40 +0200)] 
chan_sip: Fix port parsing for IPv6 addresses in SIP Via headers.

If a Via header containes an IPv6 address and a port number is ommitted,
as it is the standard port, we now leave the port empty and to not set it
to the value after the first colon of the IPv6 address.

ASTERISK-25443 #close

Change-Id: Ie3c2f05471cd006bf04ed15598589c09577b1e70

9 years agochan_pjsip: Fix crash on reINVITE before initial INVITE completes. 94/1394/1
Richard Mudgett [Mon, 5 Oct 2015 21:53:44 +0000 (16:53 -0500)] 
chan_pjsip: Fix crash on reINVITE before initial INVITE completes.

Apparently some endpoints attempt to send a reINVITE before completing the
initial INVITE transaction.  In this case PJSIP responds appropriately to
the reINVITE with a 491 INVITE request pending.  Unfortunately chan_pjsip
is using the initial INVITE transaction state to determine if an INVITE is
the initial INVITE or a reINVITE.  Since the initial INVITE transaction
has not been confirmed yet chan_pjsip thinks the reINVITE is an initial
INVITE and starts another PBX thread on the channel.  The extra PBX thread
ensures that hilarity ensues.

* Fix checks for a reINVITE on incoming requests to look for the presence
of a to-tag instead of the initial INVITE transaction state.

* Made caller_id_incoming_request() determine what to do if there is a
channel on the session or not.  After a channel is created it is too late
to just store the new party id on the session because the session's party
id has already been copied to the channel's caller id.

ASTERISK-25404 #close
Reported by: Chet Stevens

Change-Id: Ie78201c304a2b13226f3a4ce59908beecc2c68be

9 years agoMerge "Fix improper usage of scheduler exposed by 5c713fdf18f" into 13
Matt Jordan [Tue, 6 Oct 2015 13:30:02 +0000 (08:30 -0500)] 
Merge "Fix improper usage of scheduler exposed by 5c713fdf18f" into 13

9 years agoFix improper usage of scheduler exposed by 5c713fdf18f 79/1379/2
Matt Jordan [Tue, 6 Oct 2015 02:34:41 +0000 (21:34 -0500)] 
Fix improper usage of scheduler exposed by 5c713fdf18f

When 5c713fdf18f was merged, it allowed for scheduled items to have an ID of
'0' returned. While this was valid per the documentation for the API, it was
apparently never returned previously. As a result, several users of the
scheduler API viewed the result as being invalid, causing them to reschedule
already scheduled items or otherwise fail in interesting ways.

This patch corrects the users such that they view '0' as valid, and a returned
ID of -1 as being invalid.

Note that the failing HEP RTCP tests now pass with this patch. These tests
failed due to a duplicate scheduling of the RTCP transmissions.

ASTERISK-25449 #close

Change-Id: I019a9aa8b6997584f66876331675981ac9e07e39

9 years agochan_pjsip: Add Referred-By header to the PJSIP REFER packet. 77/1377/2
Debian Amtelco [Wed, 26 Aug 2015 21:58:04 +0000 (21:58 +0000)] 
chan_pjsip: Add Referred-By header to the PJSIP REFER packet.

Some systems require the REFER packet to include a Referred-By header.
If the channel variable SIPREFERREDBYHDR is set, it passes that value as the
Referred-By header value.  Otherwise, it adds the current dialog’s local info.

Reported by: Dan Cropp
Tested by: Dan Cropp

Change-Id: I3d17912ce548667edf53cb549e88a25475eda245

9 years agomanager: Fix GetConfigJSON returning invalid JSON 71/1371/1
Ivan Poddubny [Sat, 3 Oct 2015 11:27:27 +0000 (14:27 +0300)] 
manager: Fix GetConfigJSON returning invalid JSON

When GetConfigJSON was introduced back in 1.6, it returned each
section as an array of strings: ["key=value", "key2=value2"].
Afterwards, it was changed a few times and became
["key": "value", "key2": "value2"], which is not a correct JSON.
This patch fixes that by constructing a JSON object {} instead of
an array [].

Also, the keys "istemplate" and "tempates" that are used to
indicate templates and their inherited categories are now wrapped in
quotes.

ASTERISK-25391 #close
Reported by: Bojan Nemčić

Change-Id: Ibbe93c6a227dff14d4a54b0d152341857bcf6ad8

9 years agoMerge "res_sorcery_memory_cache.c: Fix deadlock with scheduler." into 13
Joshua Colp [Fri, 2 Oct 2015 21:28:39 +0000 (16:28 -0500)] 
Merge "res_sorcery_memory_cache.c: Fix deadlock with scheduler." into 13

9 years agoMerge "res_sorcery_memory_cache.c: Replace inline code with function." into 13
Joshua Colp [Fri, 2 Oct 2015 21:28:34 +0000 (16:28 -0500)] 
Merge "res_sorcery_memory_cache.c: Replace inline code with function." into 13

9 years agoMerge "res_sorcery_memory_cache.c: Shutdown in a less crash potential order." into 13
Joshua Colp [Fri, 2 Oct 2015 21:28:28 +0000 (16:28 -0500)] 
Merge "res_sorcery_memory_cache.c: Shutdown in a less crash potential order." into 13

9 years agoMerge "res_sorcery_memory_cache.c: Misc tweaks." into 13
Joshua Colp [Fri, 2 Oct 2015 21:28:22 +0000 (16:28 -0500)] 
Merge "res_sorcery_memory_cache.c: Misc tweaks." into 13

9 years agoMerge "res_sorcery_memory_cache.c: Made use OBJ_SEARCH_MASK." into 13
Joshua Colp [Fri, 2 Oct 2015 21:28:15 +0000 (16:28 -0500)] 
Merge "res_sorcery_memory_cache.c: Made use OBJ_SEARCH_MASK." into 13

9 years agoMerge "sched.c: Add warning about negative time interval request." into 13
Joshua Colp [Fri, 2 Oct 2015 21:27:13 +0000 (16:27 -0500)] 
Merge "sched.c: Add warning about negative time interval request." into 13

9 years agores_sorcery_memory_cache.c: Fix deadlock with scheduler. 55/1355/1
Richard Mudgett [Wed, 30 Sep 2015 22:28:19 +0000 (17:28 -0500)] 
res_sorcery_memory_cache.c: Fix deadlock with scheduler.

A deadlock can happen when a sorcery object is being expired from the
memory cache when at the same time another object is being placed into the
memory cache.  There are a couple other variations on this theme that
could cause the deadlock.  Basically if an object is being expired from
the sorcery memory cache at the same time as another thread tries to
update the next object expiration timer the deadlock can happen.

* Add a deadlock avoidance loop in expire_objects_from_cache() to check if
someone is trying to remove the scheduler callback from the scheduler.

ASTERISK-25441 #close

Change-Id: Iec7b0bdb81a72b39477727b1535b2539ad0cf4dc

9 years agores_sorcery_memory_cache.c: Replace inline code with function. 54/1354/1
Richard Mudgett [Thu, 1 Oct 2015 19:30:06 +0000 (14:30 -0500)] 
res_sorcery_memory_cache.c: Replace inline code with function.

Make sorcery_memory_cache_close() call remove_all_from_cache() instead of
partially inlining it.

ASTERISK-25441

Change-Id: I1aa6cb425b1a4307096f3f914d17af8ec179a74c

9 years agores_sorcery_memory_cache.c: Shutdown in a less crash potential order. 53/1353/1
Richard Mudgett [Thu, 1 Oct 2015 19:27:34 +0000 (14:27 -0500)] 
res_sorcery_memory_cache.c: Shutdown in a less crash potential order.

Basically you should shutdown in the opposite order of how you setup since
later setup pieces likely depend on earlier setup pieces.  e.g.,
Registering your external API with the rest of the system should be the
last thing setup and the first thing unregistered during shutdown.

Change-Id: I5715765b723100c8d3c2642e9e72cc7ad5ad115e

9 years agores_sorcery_memory_cache.c: Misc tweaks. 52/1352/1
Richard Mudgett [Wed, 30 Sep 2015 22:27:54 +0000 (17:27 -0500)] 
res_sorcery_memory_cache.c: Misc tweaks.

Change-Id: I8cd32dffbb4f33bb0c39518d6e4c991e73573160

9 years agores_sorcery_memory_cache.c: Made use OBJ_SEARCH_MASK. 51/1351/1
Richard Mudgett [Wed, 30 Sep 2015 22:27:23 +0000 (17:27 -0500)] 
res_sorcery_memory_cache.c: Made use OBJ_SEARCH_MASK.

Change-Id: Ibca6574dc3c213b29cc93486e01ccd51f5caa46c

9 years agores_rtp_asterisk: Move "Set role" warning to be debug. 47/1347/1
Joshua Colp [Wed, 30 Sep 2015 18:42:40 +0000 (15:42 -0300)] 
res_rtp_asterisk: Move "Set role" warning to be debug.

In practice the set_role API callback can be invoked even
when no ICE is present on an RTP instance. This can occur
if ICE has not been enabled on it.

ASTERISK-25438 #close

Change-Id: I0e17e4316f0f0d7f095c78c3d4fd73a913b6ba69

9 years agosched.c: Add warning about negative time interval request. 44/1344/2
Richard Mudgett [Mon, 28 Sep 2015 20:31:38 +0000 (15:31 -0500)] 
sched.c: Add warning about negative time interval request.

Change-Id: Ib91435fb45b7f5f7c0fc83d0eec20b88098707bc

9 years agoMerge "res/ari/config.c: Fix user sort compare function." into 13
Matt Jordan [Tue, 29 Sep 2015 20:58:12 +0000 (15:58 -0500)] 
Merge "res/ari/config.c: Fix user sort compare function." into 13

9 years agoMerge "res/ari/config.c: Optimize conf_alloc() object init." into 13
Matt Jordan [Tue, 29 Sep 2015 20:58:06 +0000 (15:58 -0500)] 
Merge "res/ari/config.c: Optimize conf_alloc() object init." into 13

9 years agoARI: Changed version from 1.8.0 to 1.9.0 43/1343/1
Kevin Harwell [Tue, 29 Sep 2015 19:53:58 +0000 (14:53 -0500)] 
ARI: Changed version from 1.8.0 to 1.9.0

Change-Id: I510991c60d28d171f47c4b58bba4947f7fc71b13

9 years agores/ari/config.c: Fix user sort compare function. 39/1339/1
Richard Mudgett [Fri, 25 Sep 2015 23:37:04 +0000 (18:37 -0500)] 
res/ari/config.c: Fix user sort compare function.

Made use the ao2 sort compare template function and OBJ_SEARCH_xxx
identifiers.

Change-Id: Ic53005dc5aafa7a36c72300dd89b75fb63c92f4c

9 years agores/ari/config.c: Optimize conf_alloc() object init. 38/1338/1
Richard Mudgett [Fri, 25 Sep 2015 22:26:08 +0000 (17:26 -0500)] 
res/ari/config.c: Optimize conf_alloc() object init.

* Now conf_alloc() has more off nominal error checking.

* Eliminated RAII_VAR() use in conf_alloc().

* Eliminated a dubius shortcut when destroying cfg->general in
conf_destructor() that would cause a crash if cfg->general failed to get
allocated.

* Add some ACO registration section comments.

Change-Id: Ia40c2b1b2d0777d641605118ae019c5a73865e1a

9 years agores/ari/config.c: Fix conf_alloc() object init. 37/1337/1
Richard Mudgett [Fri, 25 Sep 2015 21:48:10 +0000 (16:48 -0500)] 
res/ari/config.c: Fix conf_alloc() object init.

Need to finish initializing the string fields in the ao2 object before
putting any default strings into them.

ASTERISK-25383 #close
Reported by:  yaron nahum

Change-Id: I9f7f3a03f0c4991a01593abf8697b9a587c0ea84

9 years agoMerge "app_queue.c: Force COLP update if outgoing channel name changed." into 13
Matt Jordan [Tue, 29 Sep 2015 12:27:45 +0000 (07:27 -0500)] 
Merge "app_queue.c: Force COLP update if outgoing channel name changed." into 13

9 years agoMerge "app_queue.c: Factor out a connected line update routine." into 13
Matt Jordan [Tue, 29 Sep 2015 12:27:22 +0000 (07:27 -0500)] 
Merge "app_queue.c: Factor out a connected line update routine." into 13

9 years agoMerge "app_dial.c: Make 'A' option pass COLP updates." into 13
Matt Jordan [Tue, 29 Sep 2015 12:26:58 +0000 (07:26 -0500)] 
Merge "app_dial.c: Make 'A' option pass COLP updates." into 13

9 years agoMerge "app_dial.c: Force COLP update if outgoing channel name changed." into 13
Matt Jordan [Tue, 29 Sep 2015 12:26:08 +0000 (07:26 -0500)] 
Merge "app_dial.c: Force COLP update if outgoing channel name changed." into 13

9 years agoMerge "translate: Fix transcoding while different in frame size." into 13
Joshua Colp [Mon, 28 Sep 2015 19:12:57 +0000 (14:12 -0500)] 
Merge "translate: Fix transcoding while different in frame size." into 13

9 years agoMerge "app_dial.c: Factor out a connected line update routine." into 13
Joshua Colp [Mon, 28 Sep 2015 19:06:55 +0000 (14:06 -0500)] 
Merge "app_dial.c: Factor out a connected line update routine." into 13

9 years agoMerge "res/res_stasis: Fix accidental subscription to 'all' bridge topic" into 13
Matt Jordan [Mon, 28 Sep 2015 13:36:04 +0000 (08:36 -0500)] 
Merge "res/res_stasis: Fix accidental subscription to 'all' bridge topic" into 13

9 years agoMerge "app_dial.c: Remove some no-op code." into 13
Joshua Colp [Mon, 28 Sep 2015 11:49:41 +0000 (06:49 -0500)] 
Merge "app_dial.c: Remove some no-op code." into 13

9 years agores/res_stasis: Fix accidental subscription to 'all' bridge topic 32/1332/1
Matt Jordan [Mon, 28 Sep 2015 01:45:50 +0000 (20:45 -0500)] 
res/res_stasis: Fix accidental subscription to 'all' bridge topic

When b99a7052621700a1aa641a1c24308f5873275fc8 was merged, subscribing to a
NULL bridge will now cause app_subscribe_bridge to implicitly subscribe to
all bridges. Unfortunately, the res_stasis control loop did not check that
a bridge changing on a channel's control object was actually also non-NULL.
As a result, app_subscribe_bridge will be called with a NULL bridge when a
channel leaves a bridge. This causes a new subscription to be made to the
bridge. If an application has also subscribed to the bridge, the application
will now have two subscriptions:
(1) The explicit one created by the app
(2) The implicit one accidentally created by the control structure

As a result, the 'BridgeDestroyed' event can be sent multiple times. This
patch corrects the control loop such that it only subscribes an application
to a new bridge if the bridge pointer is non-NULL.

ASTERISK-24870

Change-Id: I3510e55f6bc36517c10597ead857b964463c9f4f

9 years agoScripts: check file versions of Asterisk and dependencies 97/1197/7
Scott Griepentrog [Fri, 4 Sep 2015 18:51:46 +0000 (13:51 -0500)] 
Scripts: check file versions of Asterisk and dependencies

To help in diagnosing mismatched modules and libraries, this
script scans for version, repository, and source information
and reports what is found.

ASTERISK-25376 #close
Reported by: Ashley Sanders

Change-Id: Ib0642d0fb96712476f59760d6d137a24633fe2d6

9 years agoapp_queue.c: Force COLP update if outgoing channel name changed. 19/1319/1
Richard Mudgett [Thu, 24 Sep 2015 19:56:24 +0000 (14:56 -0500)] 
app_queue.c: Force COLP update if outgoing channel name changed.

* When a call is answered and the outgoing channel name has changed then
force a connected line update because the channel is no longer the same.
The channel was masqueraded into by another channel.  This is usually
because of a call pickup.

Note: Forwarded calls are handled in a controlled manner so the original
channel name is replaced with the forwarded channel.

ASTERISK-25423 #close
Reported by: John Hardin

Change-Id: Ie275ea9e99c092ad369db23e0feb08c44498c172

9 years agoapp_queue.c: Factor out a connected line update routine. 18/1318/1
Richard Mudgett [Thu, 24 Sep 2015 19:20:24 +0000 (14:20 -0500)] 
app_queue.c: Factor out a connected line update routine.

Replace inlined code with update_connected_line_from_peer().

ASTERISK-25423
Reported by: John Hardin

Change-Id: I33bbd033596fcb0208d41d8970369b4e87b806f3

9 years agoapp_dial.c: Make 'A' option pass COLP updates. 17/1317/1
Richard Mudgett [Thu, 24 Sep 2015 18:27:44 +0000 (13:27 -0500)] 
app_dial.c: Make 'A' option pass COLP updates.

While the 'A' option is playing the announcement file allow the caller and
peer to exchange COLP update frames.

ASTERISK-25423
Reported by: John Hardin

Change-Id: Iac6cf89b56d26452c6bb88e9363622bbf23895f9

9 years agoapp_dial.c: Force COLP update if outgoing channel name changed. 16/1316/1
Richard Mudgett [Thu, 24 Sep 2015 17:59:08 +0000 (12:59 -0500)] 
app_dial.c: Force COLP update if outgoing channel name changed.

* When a call is answered and the outgoing channel name has changed then
force a connected line update because the channel is no longer the same.
The channel was masqueraded into by another channel.  This is usually
because of a call pickup.

Note: Forwarded calls are handled in a controlled manner so the original
channel name is replaced with the forwarded channel.

ASTERISK-25423
Reported by: John Hardin

Change-Id: I2e01f7a698fbbc8c26344a59c2be40c6cd98b00c

9 years agoapp_dial.c: Factor out a connected line update routine. 15/1315/1
Richard Mudgett [Thu, 24 Sep 2015 17:37:07 +0000 (12:37 -0500)] 
app_dial.c: Factor out a connected line update routine.

Replace inlined code with update_connected_line_from_peer().

ASTERISK-25423
Reported by: John Hardin

Change-Id: Ia14f18def417645cd7fb453e1bdac682630a5091

9 years agoapp_dial.c: Remove some no-op code. 11/1311/1
Richard Mudgett [Wed, 23 Sep 2015 22:41:35 +0000 (17:41 -0500)] 
app_dial.c: Remove some no-op code.

Change-Id: Ice1884a94315d3cb7e3bbd47a9fba76a27276c54

9 years agoMerge "logger: Prevent duplicate dynamic channels from being added." into 13
Joshua Colp [Fri, 25 Sep 2015 15:57:33 +0000 (10:57 -0500)] 
Merge "logger: Prevent duplicate dynamic channels from being added." into 13

9 years agologger: Prevent duplicate dynamic channels from being added. 03/1303/2
Mark Michelson [Wed, 23 Sep 2015 19:02:15 +0000 (14:02 -0500)] 
logger: Prevent duplicate dynamic channels from being added.

There was a problem observed where the "logger add channel" CLI command
would allow for a channel with the same name to be added multiple times.
This would result in each message being written out to the same file
multiple times.

The problem was due to the difference in how logger channel filenames
are stored versus the format they are allowed to be presented when they
are added. For instance, if adding the logger channel "foo" through the
CLI, the result would be a logger channel with the file name
/var/log/asterisk/foo being stored. So when trying to add another "foo"
channel, "foo" would not match "/var/log/asterisk/foo" so we'd happily
add the duplicate channel.

The fix presented here is to introduce two new methods in the logger
code:
 * make_filename(): given a logger channel name, this creates the
   filename for that logger channel.
 * find_logchannel(): given a logger channel name, this calls
   make_filename() and then traverses the list of logchannels in order
   to find a match.

This change has made use of make_filename() and find_logchannel()
throughout to more consistently behave.

ASTERISK-25305 #close
Reported by Mark Michelson

Change-Id: I892d52954d6007d8bc453c3cbdd9235dec9c4a36

9 years agoDo not swallow frames on channels leaving bridges. 05/1305/1
Mark Michelson [Thu, 24 Sep 2015 19:49:46 +0000 (14:49 -0500)] 
Do not swallow frames on channels leaving bridges.

When leaving a bridge, indications on a channel could be swallowed by
the internal indication logic because it appears that the channel is on
its way to be hung up anyway. One such situation where this is
detrimental is when channels on hold are redirected out of a bridge. The
AST_CONTROL_UNHOLD indication from the bridging code is swallowed,
leaving the channel in question to still appear to be on hold.

The fix here is to modify the logic inside ast_indicate_data() to not
drop the indication if the channel is simply leaving a bridge. This way,
channels on hold redirected out of a bridge revert to their expected "in
use" state after the redirection.

ASTERISK-25418 #close
Reported by Mark Michelson

Change-Id: If6115204dfa0551c050974ee138fabd15f978949

9 years agoMerge "ARI: Add events for Contact and Peer Status changes" into 13
Matt Jordan [Wed, 23 Sep 2015 17:56:07 +0000 (12:56 -0500)] 
Merge "ARI: Add events for Contact and Peer Status changes" into 13