asterisk/asterisk.git
5 years agoMerge "test_sorcery_memory_cache_thrash: Add unit tests for thrashing the memory...
Matt Jordan [Fri, 5 Jun 2015 23:04:24 +0000 (18:04 -0500)]
Merge "test_sorcery_memory_cache_thrash: Add unit tests for thrashing the memory cache."

5 years agoMerge "res_sorcery_memory_cache: Implement expire_on_reload option."
Matt Jordan [Fri, 5 Jun 2015 23:04:17 +0000 (18:04 -0500)]
Merge "res_sorcery_memory_cache: Implement expire_on_reload option."

5 years agoFixes for OS X
David M. Lee [Tue, 2 Jun 2015 20:07:08 +0000 (15:07 -0500)]
Fixes for OS X

 * Add some type casting so tv_usec can really be a long, instead of
   some strange platform specific type.

 * Add some .dylib style files to .gitignore.

 * Switch from using -Xlinker to -Wl,. For [reasons unknown][], newer
   versions of GCC, when compiling the Homebrew formula for Asterisk,
   are not properly passing the -Xlinker options to the linker. Given
   that -Wl, does exactly the [same thing][], and does it properly, this
   patch changes the -Xlinker options to use -Wl, instead.

 [reasons unknown]: http://bit.ly/1SUbEYx
 [same thing]: https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html

Change-Id: Id5e6b3c6cc86282ea5fca630dc3991137c5bf4dd

5 years agoCLI: Cosmetic issue - core show uptime
ibercom [Thu, 4 Jun 2015 12:14:13 +0000 (14:14 +0200)]
CLI: Cosmetic issue - core show uptime

Show uptime information ends with an unnecessary space.

Now NEEDCOMMA is better defined.

Change-Id: I11b360504a0703309ff51772ff8f672287f3c5a1

5 years agores_sorcery_memory_cache: Implement expire_on_reload option.
Joshua Colp [Thu, 4 Jun 2015 18:11:44 +0000 (15:11 -0300)]
res_sorcery_memory_cache: Implement expire_on_reload option.

This change implements the expire_on_reload option for memory caches.
If enabled and a reload is performed all objects within the cache
will be expired and the cache emptied.

ASTERISK-25067
Reported by: Matt Jordan

Change-Id: Id46aa1957d660556700e689e195eed57c989b85e

5 years agotest_sorcery_memory_cache_thrash: Add unit tests for thrashing the memory cache.
Joshua Colp [Tue, 2 Jun 2015 15:20:00 +0000 (12:20 -0300)]
test_sorcery_memory_cache_thrash: Add unit tests for thrashing the memory cache.

This change adds a CLI command which can perform memory cache thrashing as well
as unit tests which perform thrashing under the following configurations:

1. Low number of unique objects that go stale after 1 second
2. Low number of unique objects that expire after 1 second
3. Low number of unique objects which are constantly updated
4. Large number of unique objects which exceed a defined cache size
5. Large number of unique objects which exceed a defined cache size
   that also expire and go stale rapidly
6. Large number of unique objects which expire and go stale rapidly
7. Large number of unique objects

For all of the above there are a large number of threads constantly
attempting to retrieve random objects and each test runs for a few
seconds.

ASTERISK-25067
Reported by: Matt Jordan

Change-Id: I8c8ceff977332c80ed4a31f10d694d48552b2f78

5 years agoMerge "res_sorcery_memory_cache: Add test event when a refresh occurs."
Mark Michelson [Thu, 4 Jun 2015 14:48:09 +0000 (09:48 -0500)]
Merge "res_sorcery_memory_cache: Add test event when a refresh occurs."

5 years agoMerge "Remove const cast from leaf functions."
Matt Jordan [Thu, 4 Jun 2015 11:42:30 +0000 (06:42 -0500)]
Merge "Remove const cast from leaf functions."

5 years agores_sorcery_memory_cache: Add test event when a refresh occurs.
Joshua Colp [Thu, 4 Jun 2015 10:33:30 +0000 (07:33 -0300)]
res_sorcery_memory_cache: Add test event when a refresh occurs.

This change adds a testsuite event for when a refresh occurs.
This is useful as it provides a guaranteed mechanism of knowing when
it has occurred instead of waiting an arbitrary amount of time.

ASTERISK-25067
Reported by: Matt Jordan

Change-Id: Iaa6b8d2d6bab7f99ee08e1c8908b8272a8987e65

5 years agores_pjsip: Prevent access of NULL channels.
Mark Michelson [Wed, 3 Jun 2015 22:41:23 +0000 (17:41 -0500)]
res_pjsip: Prevent access of NULL channels.

It is possible to receive incoming requests or responses after the channel
on an ast_sip_session has been destroyed and NULLed out. Handlers of these
sorts of requests or responses need to be prepared for the possibility
that the channel is NULL or else they could cause a crash.

While several places have been amended to deal with NULL channels, there
were still a couple of places that needed updating.

res_pjsip_dtmf_info.c: When handling incoming INFO requests, we need to
return early if there is no channel on the session.

res_pjsip_session.c: When handling a 302 response, we need to stop the
redirecting attempt if there is no channel on the session.

ASTERISK-25148 #close
reported by Mark Michelson

Change-Id: Id1a75ffc3d0eaa168b0b28188fb54d6cf9fc47a9

5 years agores_pjsip/location: Fix ref leak in contact_apply_handler
George Joseph [Wed, 3 Jun 2015 18:17:58 +0000 (12:17 -0600)]
res_pjsip/location: Fix ref leak in contact_apply_handler

contact_apply_handler calls ast_res_pjsip_find_or_create_contact_status
to force the creation of a contact_status object whenever a new
contact is added but it didn't unref the returned object.

Added an ao2_cleanup(status) to plug the leak.

ASTERISK-25141

Change-Id: Icc1401cae142855a1abc86ab5179dfb3ee861c40
Reported-by: Corey Farrell

5 years agores_pjsip: Remove outgoing authentication code no longer needed.
Richard Mudgett [Tue, 2 Jun 2015 18:02:26 +0000 (13:02 -0500)]
res_pjsip: Remove outgoing authentication code no longer needed.

Associated with ASTERISK-25131

Change-Id: Iefa3b2066cfd8b108a90d2dd4a64d92c3a195d33

5 years agores_pjsip_session: Fix cherry pick to master compile error.
Richard Mudgett [Tue, 2 Jun 2015 17:55:57 +0000 (12:55 -0500)]
res_pjsip_session: Fix cherry pick to master compile error.

ASTERISK-25131
Reported by: Richard Mudgett

Change-Id: I87c9c96ae4a8fe2bc8a0ddea6958a2ad9cefd8e3

5 years agoRemove const cast from leaf functions.
Joerg Sonnenberger [Tue, 2 Jun 2015 17:27:28 +0000 (19:27 +0200)]
Remove const cast from leaf functions.

app_control_register_rule and app_control_unregister_rule lock/unlock
the queue, which is a mutating operation according to the
ao2_lock/_unlock prototype. Depending on the specific (implicit) casts
in SCOPED_LOCK and RAII_VAR, the compiler may warn or not. As the only
callers of those functions do not have the const, get consistent results
by just dropping it.

Change-Id: Ib9e6296155a39bc5d627142a3828180c3cfe8fbb

5 years agoMerge "tcptls.c: Don't use OpenSSL functions when no SSL support is present."
Matt Jordan [Tue, 2 Jun 2015 17:04:16 +0000 (12:04 -0500)]
Merge "tcptls.c: Don't use OpenSSL functions when no SSL support is present."

5 years agoMerge "cdr/cdr_csv.c: Set file name for csv master to the module when (re)loaded."
Matt Jordan [Tue, 2 Jun 2015 17:02:01 +0000 (12:02 -0500)]
Merge "cdr/cdr_csv.c: Set file name for csv master to the module when (re)loaded."

5 years agotcptls.c: Don't use OpenSSL functions when no SSL support is present.
Joerg Sonnenberger [Tue, 2 Jun 2015 16:35:39 +0000 (18:35 +0200)]
tcptls.c: Don't use OpenSSL functions when no SSL support is present.

Change-Id: I68a85a7fcbdb282140ff333c6274b6763d5f82a3

5 years agoMerge "res_pjsip_session: Fix in-dialog authentication."
Matt Jordan [Tue, 2 Jun 2015 14:29:46 +0000 (09:29 -0500)]
Merge "res_pjsip_session: Fix in-dialog authentication."

5 years agoMerge "Fix buffer overflow in slin sample frames generation."
Mark Michelson [Mon, 1 Jun 2015 21:08:30 +0000 (16:08 -0500)]
Merge "Fix buffer overflow in slin sample frames generation."

5 years agocdr/cdr_csv.c: Set file name for csv master to the module when (re)loaded.
Rodrigo Ramírez Norambuena [Mon, 1 Jun 2015 17:08:22 +0000 (13:08 -0400)]
cdr/cdr_csv.c: Set file name for csv master to the module when (re)loaded.

Compute the location for the csv master file when the module is
loaded or reload.  Before it was calculated every time a log
entry was written.

Change-Id: I3ed9f6a8f965308099db70b71128f43d4d3f5585

5 years agoMerge "res_sorcery_memory_cache: Add CLI commands and AMI actions."
Mark Michelson [Mon, 1 Jun 2015 18:04:10 +0000 (13:04 -0500)]
Merge "res_sorcery_memory_cache: Add CLI commands and AMI actions."

5 years agoMerge "res_sorcery_memory_cache: Add support for refreshing stale objects."
Joshua Colp [Mon, 1 Jun 2015 18:01:17 +0000 (13:01 -0500)]
Merge "res_sorcery_memory_cache: Add support for refreshing stale objects."

5 years agores_pjsip_session: Fix in-dialog authentication.
Richard Mudgett [Tue, 26 May 2015 18:56:42 +0000 (13:56 -0500)]
res_pjsip_session: Fix in-dialog authentication.

When the remote peer requires authentication for in-dialog requests then
re-INVITEs to the peer cause the call to be disconnected and other
in-dialog requests to the peer like MESSAGE just don't go through.

* Made session_inv_on_tsx_state_changed() handle in-dialog authentication
for re-INVITEs and other methods.  Initial INVITEs cannot be handled here
because the INVITE transaction must be restarted earlier.

* Pulled needed code from res/res_pjsip/pjsip_outbound_auth.c in
preparation for removing the file.  The generic outbound authentication
code did not work as well as anticipated.

* Created outbound_invite_auth() to only handle initial outbound INVITEs.
Re-INVITEs cannot be handled here.  The re-INVITE transaction is still in
progress and the PJSIP library cannot handle the overlapping INVITE
transactions.  Other method types should not be handled here as this code
only works on outgoing calls and we need to handle incoming and outgoing
calls.

ASTERISK-25131 #close
Reported by: Richard Mudgett

Change-Id: I12bdd7ddccc819b4ce4b091e826d1e26334601b0

5 years agopjsip_configuration: Fix leak in persistent_endpoint_update_state.
Corey Farrell [Sun, 31 May 2015 01:22:00 +0000 (21:22 -0400)]
pjsip_configuration: Fix leak in persistent_endpoint_update_state.

The loop to find the first available contact of an endpoint grabbed
contact from the iterator, then checked for offline state.  This
caused the first contact after the state was found to leak a reference.

ASTERISK-25141

Change-Id: Id0f1d87410fc63742db0594eb4b18b36e99aec08

5 years agoFix buffer overflow in slin sample frames generation.
Ivan Poddubny [Sun, 31 May 2015 16:33:37 +0000 (19:33 +0300)]
Fix buffer overflow in slin sample frames generation.

The length of frames retured by sample functions was twice as large as
real, what caused global buffer overflow caught by AddressSanitizer.

ASTERISK-24717 #close
Reported by: Badalian Vyacheslav

Change-Id: Iec2fe682aef13e556684912f906bedf7c18229c6

5 years agores_pjsip/location: Fix memory leak in permanent_uri_handler
George Joseph [Fri, 29 May 2015 21:19:26 +0000 (15:19 -0600)]
res_pjsip/location:  Fix memory leak in permanent_uri_handler

When permanent_uri_handler was creating the contact status
object for each contact, it wasn't unreffing it at the
end of the loop.

ASTERISK-25141 #close
Reported-by: Corey Farrell

Change-Id: I7bb127994677bb3d459f87952f8425c9b9967b12

5 years agoMerge "Revert "endpoint/stasis: Eliminate duplicate events on endpoint status change""
Joshua Colp [Fri, 29 May 2015 19:55:22 +0000 (14:55 -0500)]
Merge "Revert "endpoint/stasis: Eliminate duplicate events on endpoint status change""

5 years agoRevert "endpoint/stasis: Eliminate duplicate events on endpoint status change"
George Joseph [Fri, 29 May 2015 19:52:41 +0000 (14:52 -0500)]
Revert "endpoint/stasis: Eliminate duplicate events on endpoint status change"

This reverts commit 6fca75bb628dfff2ab112e80b0228cf3ac0b8a05.

Change-Id: Ifee026cc63e22c5ac5717c37867a9f036373ae5a

5 years agores_sorcery_memory_cache: Add CLI commands and AMI actions.
Joshua Colp [Tue, 26 May 2015 12:34:47 +0000 (09:34 -0300)]
res_sorcery_memory_cache: Add CLI commands and AMI actions.

This change adds the following CLI commands and AMI actions:

sorcery memory cache show
sorcery memory cache dump
sorcery memory cache expire
sorcery memory cache stale

SorceryMemoryCacheExpire
SorceryMemoryCacheExpireObject
SorceryMemoryCacheStale
SorceryMemoryCacheStaleObject

These allow both examination and manipulation of sorcery memory
caches from external sources.

Cached objects can be explicitly expired from a cache or marked
as stale. If expired they are immediately removed. If marked as
stale they will be background refreshed when next retrieved.

ASTERISK-25067
Reported by Matt Jordan

Change-Id: I68e03cfd8c34b5e07f4b6ee4fd93a3f4a00a3d9e

5 years agoMerge "res/res_config_pgsql.c: Use PQescapeStringConn for escaping names."
Matt Jordan [Fri, 29 May 2015 09:41:45 +0000 (04:41 -0500)]
Merge "res/res_config_pgsql.c: Use PQescapeStringConn for escaping names."

5 years agoendpoint/stasis: Eliminate duplicate events on endpoint status change
George Joseph [Wed, 27 May 2015 18:22:39 +0000 (12:22 -0600)]
endpoint/stasis: Eliminate duplicate events on endpoint status change

When an endpoint was created, it's messages were being forwarded to
both the tech endpoint topic and the all endpoints topic.  Since
the tech topic was also forwarded to all, this was resulting in
duplicate messages whenever an endpoint published.  This patch
causes the endpoint to only forward to the tech topic and lets
the tech topic forward to all.

To accomplish this, the existing stasis_cp_single_create function
(which both creates and forwards) was cloned and split into 2
functions, one that creates the topic and one that sets up the
forwarding.  This allows endpoint_internal_create to create
the topic from the endpoint_all cache without forwarding it there,
then allows it to do the forward to the tech's topic.

ASTERISK-25137 #close
Reported-by: Vitezslav Novy
ASTERISK-25116 #close
Reported-by: George Joseph <george.joseph@fairview5.com>
Tested-by: George Joseph <george.joseph@fairview5.com>

Change-Id: I26d7d4926a0861748fd3bdffe316b75b549a801c

5 years agores_sorcery_memory_cache: Add support for refreshing stale objects.
Mark Michelson [Tue, 26 May 2015 18:01:24 +0000 (13:01 -0500)]
res_sorcery_memory_cache: Add support for refreshing stale objects.

This change introduces a check of object_lifetime_stale when retrieving
cached objects. If the amount of time the object has been in the cache
exceeds the lifetime, then a task is scheduled to update the cached
object based on an object retrieved from other sorcery wizards instead.

To prevent the cached object from being retrieved during a refresh,
thread-local storage is used to mark the thread as being a stale object
update. This results in the cache returning no object, leading to
sorcery querying other wizards for the object instead.

A test has been added for stale objects as well. This test ensures that
stale objects are retrieved the same as freshly-cached objects. The test
also ensures that after an object is stale, changes in the backend are
reflected in the cache, to include if the object has been deleted from
the backend.

ASTERISK-25067
Reported by Matt Jordan

Change-Id: I9bd7c049adf6939bfe2899f393c2bfbbf412d217

5 years agores_pjsip: Add AMI events for chan_pjsip contact lifecycle changes
George Joseph [Thu, 21 May 2015 22:21:01 +0000 (16:21 -0600)]
res_pjsip: Add AMI events for chan_pjsip contact lifecycle changes

Add a new ContactStatus AMI event.
Publish the following status/state changes:
Created
Removed
Reachable
Unreachable
Unknown

Contact URI, new status/state, aor and endpoint names, and the
last qualify rtt result are included in the event.

ASTERISK-25114 #close

Change-Id: Id25aae5f7122facba183273efb3e8f36c20fb61e
Reported-by: George Joseph <george.joseph@fairview5.com>
Tested-by: George Joseph <george.joseph@fairview5.com>

5 years agoMerge "Astobj2: Correctly treat hash_fn returning INT_MIN"
Joshua Colp [Tue, 26 May 2015 21:07:21 +0000 (16:07 -0500)]
Merge "Astobj2: Correctly treat hash_fn returning INT_MIN"

5 years agores/res_config_pgsql.c: Use PQescapeStringConn for escaping names.
Rodrigo Ramírez Norambuena [Thu, 7 May 2015 16:18:34 +0000 (12:18 -0400)]
res/res_config_pgsql.c: Use PQescapeStringConn for escaping names.

Use function PQescapeStringConn for escaping the name of the table and
schema instead of doing it manually.

ASTERISK-25132 #close
Reported By: Rodrigo Ramírez Norambuena <decipher.hk@gmail.com>

Change-Id: I302a263f7210d20925f14716b508b081998b7608

5 years agosorcery: Fix cache creation callback.
Joshua Colp [Tue, 26 May 2015 12:44:18 +0000 (09:44 -0300)]
sorcery: Fix cache creation callback.

The cache creation callback function expects to receive a sorcery_details
structure and not just a standalone object.

Change-Id: I3e4a5a137cb25292eb52d7a14cbb6daa09213450

5 years agoAstobj2: Correctly treat hash_fn returning INT_MIN
Ivan Poddubny [Sun, 24 May 2015 18:47:16 +0000 (21:47 +0300)]
Astobj2: Correctly treat hash_fn returning INT_MIN

The code in astobj2_hash.c wrongly assumed that abs(int) is always > 0.
However, abs(INT_MIN) = INT_MIN and is still negative, as well as
abs(INT_MIN) % num_buckets, and as a result this led to a crash.

One way to trigger the bug is using host=::80 or 0.0.0.128 in peer
configuration section in chan_sip or chan_iax.

This patch takes the remainder before applying abs, so that bucket
number is always in range.

ASTERISK-25100 #close
Reported by: Mark Petersen

Change-Id: Id6981400ad526f47e10bcf7b847b62bd2785e899

5 years agoMerge "Stasis: Fix unsafe use of stasis_unsubscribe in modules."
Matt Jordan [Sun, 24 May 2015 18:56:20 +0000 (13:56 -0500)]
Merge "Stasis: Fix unsafe use of stasis_unsubscribe in modules."

5 years agoMerge "res_pjsip_transport_websocket: Fix crash on receiving large SIP packets"
Matt Jordan [Sun, 24 May 2015 18:55:34 +0000 (13:55 -0500)]
Merge "res_pjsip_transport_websocket: Fix crash on receiving large SIP packets"

5 years agores_pjsip_transport_websocket: Fix crash on receiving large SIP packets
Ivan Poddubny [Sat, 23 May 2015 09:36:18 +0000 (12:36 +0300)]
res_pjsip_transport_websocket: Fix crash on receiving large SIP packets

Incoming SIP packets larger than PJSIP_MAX_PKT_LEN were themselves
truncated before passing to pjsip_tpmgr_receive_packet, but the length
was passed unaltered, thus causing memory corruption and segfault.

ASTERISK-25122 #close

Change-Id: I608a6b6b7f229eacc33a0a7d771d18e27e5b08ab

5 years agoStasis: Fix unsafe use of stasis_unsubscribe in modules.
Corey Farrell [Sat, 23 May 2015 02:50:43 +0000 (22:50 -0400)]
Stasis: Fix unsafe use of stasis_unsubscribe in modules.

Many uses of stasis_unsubscribe in modules can be reached through unload.
These have been switched to stasis_unsubscribe_and_join.

Some subscription callbacks do nothing, for these I've created a noop
callback function in stasis.c.  This is used by some modules that monitor
MWI topics in order to enable cache, since the callback does not become
invalid after dlclose it is safe to use stasis_unsubscribe on these, even
during module unload.

ASTERISK-25121 #close

Change-Id: Ifc2549fbd8eef7d703c222978e8f452e2972189c

5 years agoAstobj2: Run weakproxy subscription callbacks in reverse order.
Corey Farrell [Fri, 22 May 2015 21:52:29 +0000 (17:52 -0400)]
Astobj2: Run weakproxy subscription callbacks in reverse order.

Modify ao2_weakproxy_subscribe so each new subscription is added
to the head of the list.  This ensures that when other objects
are allocated and use a subscription to the weakproxy for cleanup,
cleanup will occur in the correct order.

ASTERISK-25120 #close

Change-Id: Ie0476f08ec21330de1b3f5a2dd3d9eb683df3d3d

5 years agores/res_pjsip_pubsub: Note that 'dialog' is also a valid event type for RLS
Matt Jordan [Fri, 22 May 2015 17:22:39 +0000 (12:22 -0500)]
res/res_pjsip_pubsub: Note that 'dialog' is also a valid event type for RLS

In addition to specifying lists of 'presence' and 'message-summary',
users can also create lists of type 'dialog'. These should be treated in
the same fashion as 'presence'.

Change-Id: I583bb69cd9f88b0b29bf09ddaddeac4e84189f6e

5 years agores/res_pjsip_exten_state: Fix confusing NOTICE message
Matt Jordan [Fri, 22 May 2015 17:18:31 +0000 (12:18 -0500)]
res/res_pjsip_exten_state: Fix confusing NOTICE message

When a SUBSCRIBE request is made to a dialplan hint that doesn't exist,
the current NOTICE message informing users of this swaps the context and
extension parameters. This can cause a bit of confusion.

Thanks to CptBurger in #asterisk for helping to point this out.

Change-Id: Ie584d1a58ae217385c87a450ca25b55ca0e36e43

5 years agoMerge "res_sorcery_memory_cache: Add support for object_lifetime_maximum."
Mark Michelson [Fri, 22 May 2015 16:55:24 +0000 (11:55 -0500)]
Merge "res_sorcery_memory_cache: Add support for object_lifetime_maximum."

5 years agores/ari: Register Stasis application on WebSocket attempt
Matt Jordan [Mon, 18 May 2015 01:36:41 +0000 (20:36 -0500)]
res/ari: Register Stasis application on WebSocket attempt

Prior to this patch, when a WebSocket connection is made, ARI would not
be informed of the connection until after the WebSocket layer had
accepted the connection. This created a brief race condition where the
ARI client would be notified that it was connected, a channel would be
sent into the Stasis dialplan application, but ARI would not yet have
registered the Stasis application presented in the HTTP request that
established the WebSocket.

This patch resolves this issue by doing the following:
 * When a WebSocket attempt is made, a callback is made into the ARI
   application layer, which verifies and registers the apps presented in
   the HTTP request. Because we do not yet have a WebSocket, we cannot
   have an event session for the corresponding applications. Some
   defensive checks were thus added to make the application objects
   tolerant to a NULL event session.
 * When a WebSocket connection is made, the registered application is
   updated with the newly created event session that wraps the WebSocket
   connection.

ASTERISK-24988 #close
Reported by: Joshua Colp

Change-Id: Ia5dc60dc2b6bee76cd5aff0f69dd53b36e83f636

5 years agoMerge "res_sorcery_memory_cache: Add support for maximum_objects."
Matt Jordan [Fri, 22 May 2015 15:57:03 +0000 (10:57 -0500)]
Merge "res_sorcery_memory_cache: Add support for maximum_objects."

5 years agoMerge "res_pjsip: Refactor endpt_send_transaction (qualify_timeout)"
Joshua Colp [Fri, 22 May 2015 15:40:54 +0000 (10:40 -0500)]
Merge "res_pjsip: Refactor endpt_send_transaction (qualify_timeout)"

5 years agoMerge "res_pjsip_outbound_registration: Check request URI for line."
Mark Michelson [Fri, 22 May 2015 15:38:19 +0000 (10:38 -0500)]
Merge "res_pjsip_outbound_registration: Check request URI for line."

5 years agores_pjsip: Refactor endpt_send_transaction (qualify_timeout)
George Joseph [Wed, 20 May 2015 16:11:20 +0000 (10:11 -0600)]
res_pjsip: Refactor endpt_send_transaction (qualify_timeout)

This patch refactors the transaction timeout processing to eliminate
calling the lower level public pjsip functions and reverts to calling
pjsip_endpt_send_request again.  This is the result of me noticing
a possible incompatibility with pjproject-2.4 which was causing
contact status flapping.

The original version of this feature used the lower level calls to
get access to the tsx structure in order to cancel the transaction
when our own timer expires. Since we no longer have that access,
if our own timer expires before the pjsip timer, we call the callbacks
and just let the pjsip transaction take it's own course.  When the
transaction ends, it discovers the callbacks have already been run
and just cleans itself up.

A few messages in pjsip_configuration were also added/cleaned up.

ASTERISK-25105 #close

Change-Id: I0810f3999cf63f3a72607bbecac36af0a957f33e
Reported-by: George Joseph <george.joseph@fairview5.com>
Tested-by: George Joseph <george.joseph@fairview5.com>

5 years agores_sorcery_memory_cache: Add support for object_lifetime_maximum.
Joshua Colp [Wed, 20 May 2015 22:35:54 +0000 (19:35 -0300)]
res_sorcery_memory_cache: Add support for object_lifetime_maximum.

This makes the "object_lifetime_maximum" option operational.

On the addition of an object to an empty memory cache a scheduled
task is created which, when invoked, expires objects from the cache
which have exceeded their lifetime. If more objects have been added
the remaining life of the oldest object is used to schedule the
next invocation of the scheduled task.

If the oldest object is removed from the cache before it can be
expired automatically the scheduled task is cancelled, if possible,
and the lifetime of the next oldest is used to schedule the task.

If during these two operations no additional objects exist in the
cache then no task is scheduled.

An additional unit test has been added which verifies this
functionality.

ASTERISK-25067
Reported by: Matt Jordan

Change-Id: I87409674674a508e7717ee20739ca15cec6ba7b6

5 years agores_pjsip_outbound_registration: Check request URI for line.
demon-ru [Wed, 20 May 2015 05:45:13 +0000 (08:45 +0300)]
res_pjsip_outbound_registration: Check request URI for line.

When an inbound call is received the To header is checked
for the "line" option. Some remote servers will place this
in the request URI instead. This adds an additional check for
the option in the request URI.

ASTERISK-25072 #close
Reported by: Dmitriy Serov

Change-Id: Id4e44debbb80baad623b914a88574371575353c8

5 years agores_sorcery_memory_cache: Add support for maximum_objects.
Mark Michelson [Wed, 20 May 2015 20:19:27 +0000 (15:19 -0500)]
res_sorcery_memory_cache: Add support for maximum_objects.

This makes the "maximum_objects" option operational.

A heap has been added alongside the hash table in the cache. When
objects are added to the cache, they are also added to the heap.
Similarly, when objects are removed from the cache, they are removed
from the heap.

The heap's use comes into play when an item is to be added to a "full"
cache. When the cache is full, the oldest item is removed from the
cache, using the heap to determine the oldest item.

A unit test has been added that verifies that the maximum_objects option
works as expected and that the oldest object is removed from the cache
when an object beyond the maximum is added.

ASTERISK-25067 #close
Reported by Matt Jordan

Change-Id: I490658830e9c4cbf0b3051e4cdc4913cf9f1b73a

5 years agores_sorcery_memory_cache: Add basic module implementation.
Joshua Colp [Sat, 16 May 2015 22:02:50 +0000 (19:02 -0300)]
res_sorcery_memory_cache: Add basic module implementation.

This change adds a basic res_sorcery_memory_cache module which implements
configuration option parsing, configuration file parsing for threading,
sorcery interface implementation, and unit tests.

Objects can be added, updated, deleted, and retrieved from the memory
cache. Automatic expiration and stale handling will be added in the
future.

Note that unit tests exist within the module itself in case the
threading done as a result of expiration results in asynchronous
actions (which it likely will). Providing access and a notification
mechanism for an external test module would be complicated and
not worth it.

ASTERISK-25067 #close
Reported by: Matt Jordan

Change-Id: Id8a6a357ef5a83d466f81eee56a67d13eeb118b9

5 years agoMerge "cel, cdr: Assigned separator for column name and values."
Joshua Colp [Fri, 22 May 2015 10:16:30 +0000 (05:16 -0500)]
Merge "cel, cdr: Assigned separator for column name and values."

5 years agores_mwi_external_ami: Use module version of AMI registration.
Corey Farrell [Thu, 21 May 2015 22:51:18 +0000 (18:51 -0400)]
res_mwi_external_ami: Use module version of AMI registration.

Use ast_manager_register_xml for res_mwi_external_ami manager
actions.  This ensures the module is held open while any of
the actions are being run.

ASTERISK-25117 #close
Reported by: Corey Farrell

Change-Id: Iececfdc2da498b2c32b9e09042f5f12292007ac7

5 years agoARI: Update version to 1.7.0
Matt Jordan [Thu, 21 May 2015 18:05:08 +0000 (13:05 -0500)]
ARI: Update version to 1.7.0

This patch updates the version of ARI to 1.7.0 to reflect the backwards
compatible changes that will be introduced in 13.4.0.

Change-Id: I6c36e6144da426412f25828a868e4df916bff60a
(cherry picked from commit 9d8a462356a938eea82e8424242d89a682495b57)

5 years agoMerge "audiohook.c: Difference in read/write rates caused continuous buffer resets"
Matt Jordan [Thu, 21 May 2015 12:22:21 +0000 (07:22 -0500)]
Merge "audiohook.c: Difference in read/write rates caused continuous buffer resets"

5 years agoMerge "Logger: Reset defaults before processing config."
Matt Jordan [Thu, 21 May 2015 12:21:36 +0000 (07:21 -0500)]
Merge "Logger: Reset defaults before processing config."

5 years agoMerge "res/res_http_websocket: Add a pre-session established callback"
Matt Jordan [Thu, 21 May 2015 12:21:04 +0000 (07:21 -0500)]
Merge "res/res_http_websocket: Add a pre-session established callback"

5 years agoMerge "main/sdp_srtp.c: allow SDP crypto tag to be up to 9 digits"
Joshua Colp [Thu, 21 May 2015 10:15:41 +0000 (05:15 -0500)]
Merge "main/sdp_srtp.c: allow SDP crypto tag to be up to 9 digits"

5 years agoLogger: Reset defaults before processing config.
Corey Farrell [Thu, 21 May 2015 01:53:46 +0000 (21:53 -0400)]
Logger: Reset defaults before processing config.

Reset options to default values before reloading config.  This ensures
that if a setting is removed or commented out of the configuration file
it is unset on reload.

ASTERISK-25112 #close
Reported by: Corey Farrell

Change-Id: Id24bb1fb0885c2c14cf8bd6f69a0c2ee7cd6c5bd

5 years agoapp_playback: Suppress warnings on playback if channel hung up
George Joseph [Thu, 21 May 2015 00:05:20 +0000 (18:05 -0600)]
app_playback: Suppress warnings on playback if channel hung up

If a channel hangs up while an audio file is playing, there's
no need to clutter up the logs with a warning so suppress it
if ast_check_hangup returns true.

Also, change warning to debug/2 in file.c if writing a frame
fails.  Same reasoning.

Change-Id: I2e66191af3c5b6e951c98e8f1c3fe3cf2cf7ed89
Reported-by: George Joseph <george.joseph@fairview5.com>
Tested-by: George Joseph <george.joseph@fairview5.com>

5 years agoaudiohook.c: Difference in read/write rates caused continuous buffer resets
Kevin Harwell [Thu, 14 May 2015 20:21:30 +0000 (15:21 -0500)]
audiohook.c: Difference in read/write rates caused continuous buffer resets

Currently, everytime a sample rate change occurs (on read or write) the
associated factory buffers are reset. If the requested sample rate on a
read differed from that of a write then the buffers are continually reset
on every read and write. This has the side effect of emptying the buffer,
thus there being no data to read and then write to a file in the case of
call recording.

This patch fixes it so that an audiohook_list's rate always maintains the
maximum sample rate among hooks and formats. Audiohook sample rates are
only overwritten by this value when slin native compatibility is turned on.
Also, the audiohook sample rate can only overwrite the list's sample rate
when its rate is greater than that of the list or if compatibility is
turned off. This keeps the rate from constantly switching/resetting.

ASTERISK-24944 #close
Reported by: Ronald Raikes

Change-Id: Idab4dfef068a7922c09cc631dda27bc920a6c76f

5 years agoMerge "Fix potential crash after unload of func_periodic_hook or test_message."
Matt Jordan [Wed, 20 May 2015 20:23:04 +0000 (15:23 -0500)]
Merge "Fix potential crash after unload of func_periodic_hook or test_message."

5 years agores/res_http_websocket: Add a pre-session established callback
Matt Jordan [Wed, 13 May 2015 14:55:58 +0000 (09:55 -0500)]
res/res_http_websocket: Add a pre-session established callback

This patch updates http_websocket and its corresponding implementation
with a pre-session established callback. This callback allows for
WebSocket server consumers to be notified when a WebSocket connection is
attempted, but before we accept it. Consumers can choose to reject the
connection, if their application specific logic allows for it.

As a result, this patch pulls out the previously private
websocket_protocol struct and makes it public, as
ast_websocket_protocol. In order to preserve backwards compatibility
with existing modules, the existing APIs were left as-is, and new APIs
were added for the creation of the ast_websocket_protocol as well as for
adding a sub-protocol to a WebSocket server.

In particular, the following new API calls were added:
* ast_websocket_add_protocol2 - add a protocol to the core WebSocket
  server
* ast_websocket_server_add_protocol2 - add a protocol to a specific
  WebSocket server
* ast_websocket_sub_protocol_alloc - allocate a sub-protocol object.
  Consumers can populate this with whatever callbacks they wish to
  support, then add it to the core server or a specified server.

ASTERISK-24988
Reported by: Joshua Colp

Change-Id: Ibe0bbb30c17eec6b578071bdbd197c911b620ab2

5 years agores/res_resolver_unbound.c: Add missing include of signal.h
John Bigelow [Wed, 20 May 2015 17:55:40 +0000 (12:55 -0500)]
res/res_resolver_unbound.c: Add missing include of signal.h

ASTERISK-25110 #close
Reported by: John Bigelow

Change-Id: I99a9d93f066f265357b647b8e99a75e45da5a39f

5 years agocel, cdr: Assigned separator for column name and values.
Rodrigo Ramírez Norambuena [Thu, 7 May 2015 02:18:28 +0000 (22:18 -0400)]
cel, cdr: Assigned separator for column name and values.

Use a separator string between column names and values for SQL sentences
instead of evaluating the separator to use each time.

This change adds a space after the comma in constructing SQL sentences.
Before the SQL was created like "INSERT INTO cdr(calldate,clid,dst"
without spaces between column name and values.

The files applied this change are cdr/cdr_adaptive_odbc.c, cdr/cdr_pgsql.c,
cel/cel_odbc.c

ASTERISK-25109 #close
Reported By: Rodrigo Ramírez Norambuena <decipher.hk@gmail.com>

Change-Id: Ia5a1a161f5e26e1643703b30f8cc9cf0860cc7ea

5 years agodoxygen: Fix doxygen errors
Matt Jordan [Sun, 17 May 2015 12:15:15 +0000 (07:15 -0500)]
doxygen: Fix doxygen errors

This patch fixes a number of errors and warning messages in the doxygen
log. Specifically, it addresses:
* A number of files incorrectly places a '\brief' tag immediately after
  a '\file' tag. Doing so emits a warning, as '\file' takes an optional
  argument specifying which file the doxygen comment is for. As '\brief'
  is not a file, doxygen was unamused.
* A grouping of Stasis Topics and Messages in rtp_engine.h was
  incorrectly terminated. We now correctly terminate the grouping, which
  prevents members of rtp_engine.h from showing up in the wrong group.
* Group indicators which are not part of the Stasis Topics and Messages
  group were removed. Group indicators without an \addtogroup or
  \ingroup have no meaning.

Change-Id: Ia1415ffec6767e27233ae1cae5ed5970de5656d4

5 years agomain/sdp_srtp.c: allow SDP crypto tag to be up to 9 digits
Corey Edwards [Tue, 19 May 2015 18:01:36 +0000 (12:01 -0600)]
main/sdp_srtp.c: allow SDP crypto tag to be up to 9 digits

ASTERISK-24887 #close
Reported by: Makoto Dei
Tested by: tensai

Change-Id: I6a96f572adb17f76b3acafe503a01c48eb5dd9bf

5 years agoMerge "chan_pjsip: Fix crash during off-nominal when no endpoint specified."
Matt Jordan [Mon, 18 May 2015 12:34:01 +0000 (07:34 -0500)]
Merge "chan_pjsip: Fix crash during off-nominal when no endpoint specified."

5 years agochan_pjsip: Fix crash during off-nominal when no endpoint specified.
snuffy [Fri, 15 May 2015 03:05:52 +0000 (13:05 +1000)]
chan_pjsip: Fix crash during off-nominal when no endpoint specified.

Add missing return -1 when no endpoint name is specified.

ASTERISK-25086 #close
Reported by: snuffy

Change-Id: I9de76c2935a1f4e3f0cffe97a670106f5605e89e

5 years agores_pjsip_config_wizard/config: Fix template processing
George Joseph [Thu, 14 May 2015 23:01:56 +0000 (17:01 -0600)]
res_pjsip_config_wizard/config: Fix template processing

The config wizard was always pulling the first occurrence of
a variable from an ast_variable list but this gets the template
value from the list instead of any overridden value.  This patch
creates ast_variable_find_last_in_list() in config.c and updates
res_pjsip_config_wizard to use it instead of
ast_variable_find_in_list.  Now the overridden values, where they
exist, are used instead of template variables.

Updated test_config to test the new API.

ASTERISK-25089 #close

Reported-by: George Joseph <george.joseph@fairview5.com>
Tested-by: George Joseph <george.joseph@fairview5.com>
Change-Id: Ifa7ddefc956a463923ee6839dd1ebe021c299de4

5 years agoMerge "Add X.509 subject alternative name support to TLS certificate verification."
Joshua Colp [Fri, 15 May 2015 15:37:58 +0000 (10:37 -0500)]
Merge "Add X.509 subject alternative name support to TLS certificate verification."

5 years agoMerge "cdr: Fix 'core show channel' CDR variable truncation."
Joshua Colp [Fri, 15 May 2015 15:20:51 +0000 (10:20 -0500)]
Merge "cdr: Fix 'core show channel' CDR variable truncation."

5 years agocdr: Fix 'core show channel' CDR variable truncation.
snuffy [Fri, 15 May 2015 06:54:26 +0000 (16:54 +1000)]
cdr: Fix 'core show channel' CDR variable truncation.

When the new Bridging API was implemented, the workspace variable
changed to a malloc'd string, causing sizeof() to always be 8 (char).

Revert back to stored on stack string for workspace.

ASTERISK-25090 #close

Change-Id: I51e610ae87371df771ce7693a955510efb90f8f7

5 years agoMerge "tcptls: Enable multiple TLS certificate chains (RSA+ECC+DSA) for server socket."
Joshua Colp [Fri, 15 May 2015 14:38:56 +0000 (09:38 -0500)]
Merge "tcptls: Enable multiple TLS certificate chains (RSA+ECC+DSA) for server socket."

5 years agotcptls: Enable multiple TLS certificate chains (RSA+ECC+DSA) for server socket.
Alexander Traud [Sun, 10 May 2015 14:55:24 +0000 (16:55 +0200)]
tcptls: Enable multiple TLS certificate chains (RSA+ECC+DSA) for server socket.

When a client connects to a server via SSL/TLS, the server commonly utilizes an
RSA key-pair. However, other such algorithms exist (i.e. DSA and ECDSA), and if
the server socket is configured with a certificate for either one of those, it
would lose its compatibility with RSA-only clients.

Now, the server socket can be configured with up to one RSA, ECDSA and DSA key
each. For example, if a client is not compatible with SHA-2 hashed certificates
like Nokia mobile phones, the server socket still can use RSA/SHA-1 for legacy
clients and ECDSA/SHA-2 for everyone else.

ASTERISK-24815 #close
Reported by: Alexander Traud
patches:
  tls_rsa_ecc_dsa.patch uploaded by Alexander Traud (License 6520)

Change-Id: Iada5e00d326db5ef86e0af7069b4dfa1b979da9a

5 years agoAdd X.509 subject alternative name support to TLS certificate
Maciej Szmigiero [Thu, 14 May 2015 22:12:41 +0000 (00:12 +0200)]
Add X.509 subject alternative name support to TLS certificate
verification.

This way one X.509 certificate can be used for hosts that
can be reached under multiple DNS names or for multiple hosts.

Signed-off-by: Maciej Szmigiero <mail@maciej.szmigiero.name>

ASTERISK-25063 #close

Change-Id: I13302c80490a0b44c43f1b45376c9bd7b15a538f

5 years agoMerge "sorcery: Add API to insert/remove a wizard to/from an object type's list"
Joshua Colp [Thu, 14 May 2015 20:20:32 +0000 (15:20 -0500)]
Merge "sorcery: Add API to insert/remove a wizard to/from an object type's list"

5 years agoMessage.c: Clear message channel frames on cleanup
Jonathan Rose [Wed, 13 May 2015 20:41:07 +0000 (15:41 -0500)]
Message.c: Clear message channel frames on cleanup

The message channel is a special channel that doesn't actually process frames.
However, certain actions can cause frames to be placed in the channel's read
queue including the Hangup application which is called on the channel after
each message is processed. Since the channel will continually be reused for
many messages, it's necessary to flush these frames at some point.

ASTERISK-25083 #close
Reported by: Jonathan Rose

Change-Id: Idf18df73ccd8c220be38743335b5c79c2a4c0d0f

5 years agoMerge "MALLOC_DEBUG: Replace WRAP_LIBC_MALLOC with ASTMM_LIBC."
Joshua Colp [Thu, 14 May 2015 15:57:04 +0000 (10:57 -0500)]
Merge "MALLOC_DEBUG: Replace WRAP_LIBC_MALLOC with ASTMM_LIBC."

5 years agoFix potential crash after unload of func_periodic_hook or test_message.
Corey Farrell [Thu, 14 May 2015 05:06:53 +0000 (01:06 -0400)]
Fix potential crash after unload of func_periodic_hook or test_message.

These modules save a pointer to the context they create on load, and
use that pointer to destroy the context at unload.  It is not safe
to save this pointer, it is replaced during load of pbx_config,
pbx_lua or pbx_ael.

This change causes the modules to pass NULL to ast_context_destroy,
a safer way to perform the unregistration since it does not use
a pointer that could become invalid.

ASTERISK-25085 #close
Reported by: Corey Farrell

Change-Id: I6a00ec8e38046058f97dc703e1adcde9bf517835

5 years agoMerge "cdr_adaptive_odbc: Add ability to set character for quoted identifiers."
Joshua Colp [Thu, 14 May 2015 10:28:16 +0000 (05:28 -0500)]
Merge "cdr_adaptive_odbc: Add ability to set character for quoted identifiers."

5 years agoMerge "AST_MODULE_INFO: Format corrections to the usages of AST_MODULE_INFO macro."
Joshua Colp [Thu, 14 May 2015 10:03:43 +0000 (05:03 -0500)]
Merge "AST_MODULE_INFO: Format corrections to the usages of AST_MODULE_INFO macro."

5 years agoMerge "main/manager.c: Bugfix sort action_manager by alphabetically"
Joshua Colp [Thu, 14 May 2015 10:03:07 +0000 (05:03 -0500)]
Merge "main/manager.c: Bugfix sort action_manager by alphabetically"

5 years agoMerge "cel/cel_pgsql.c: Use the 'SEP' macro when appending a column name"
Joshua Colp [Thu, 14 May 2015 10:02:13 +0000 (05:02 -0500)]
Merge "cel/cel_pgsql.c: Use the 'SEP' macro when appending a column name"

5 years agoMALLOC_DEBUG: Replace WRAP_LIBC_MALLOC with ASTMM_LIBC.
Corey Farrell [Tue, 12 May 2015 13:58:52 +0000 (09:58 -0400)]
MALLOC_DEBUG: Replace WRAP_LIBC_MALLOC with ASTMM_LIBC.

There are 3 ways that calls directly to standard allocator functions can
be dealt with:
1. Block their use, cause them to generate an error.  This is the default.
2. Replace them with the Asterisk equivalent function calls.
3. Leave them alone.

This change allows one of these 3 options to be selected by any source.
The source just needs to define ASTMM_LIBC to ASTMM_BLOCK, ASTMM_REDIRECT,
or ASTMM_IGNORE to use option 1, 2 or 3 respectively.  Normally ASTMM_BLOCK
is the correct option, so it is default when ASTMM_LIBC is not defined.
In some cases when building 3rd party code it is desirable to have it use
Asterisk functions, without changing the whole source - ASTMM_REDIRECT
accomplishes this.  When using 3rd party libraries sometimes a static
inline function will make use of malloc or free.  In these cases it may
be unsafe to replace the allocator in the header, as it's possible the
memory could be freed by the library using standard allocators.  For
those cases ASTMM_IGNORE is needed.

Change-Id: I8afef4bc7f3b93914263ae27d3a5858b69663fc7

5 years agoAST_MODULE_INFO: Format corrections to the usages of AST_MODULE_INFO macro.
Rodrigo Ramírez Norambuena [Wed, 6 May 2015 00:49:04 +0000 (20:49 -0400)]
AST_MODULE_INFO: Format corrections to the usages of AST_MODULE_INFO macro.

Change-Id: Icf88f9f861c6b2a16e5f626ff25795218a6f2723

5 years agocel/cel_pgsql.c: Use the 'SEP' macro when appending a column name
Rodrigo Ramírez Norambuena [Wed, 6 May 2015 10:28:28 +0000 (06:28 -0400)]
cel/cel_pgsql.c: Use the 'SEP' macro when appending a column name

When appending a column name to the sql buffer, the predicate, "if first is
non-null, use empty string; else, use comma", is identical to the 'SEP' macro
definition. Since they are the same, this patch replaces the redundant
predicate statement with the 'SEP' macro.

Change-Id: Ib8b6138b06a48381723108a05ab8752cb8700509

5 years agoMerge "app_voicemail: fix moving when old messages full"
Joshua Colp [Wed, 13 May 2015 20:44:30 +0000 (15:44 -0500)]
Merge "app_voicemail: fix moving when old messages full"

5 years agoapp_voicemail: fix moving when old messages full
Jonathan Rose [Tue, 12 May 2015 22:45:09 +0000 (17:45 -0500)]
app_voicemail: fix moving when old messages full

When completing voicemail playback of a message in the 'INBOX', the
message gets moved to the 'Old' messages folder. Without this patch, if
the 'Old' folder is already at its set limit, then the 'INBOX' message will
simply be deleted. With this patch, the flag to delete the message will be
removed if the save_to_folder function indicates that the message could
not be moved due to a full folder.

ASTERISK-25082 #close
Reported by: Jonathan Rose
Review: https://gerrit.asterisk.org/#/c/448/

Change-Id: I2be440a09f42e2d06d50975c40d1ad7f836ecb3f

5 years agoMerge "cdr_pgsql, cel_pgsql: Store maximum buffer size to prevent reallocation"
Joshua Colp [Wed, 13 May 2015 20:17:48 +0000 (15:17 -0500)]
Merge "cdr_pgsql, cel_pgsql: Store maximum buffer size to prevent reallocation"

5 years agoMerge "cel_pgsql: Add support for setting schema"
Joshua Colp [Wed, 13 May 2015 20:17:18 +0000 (15:17 -0500)]
Merge "cel_pgsql: Add support for setting schema"

5 years agoMerge "General: Fix recent menuselect-related cross compile regression"
Joshua Colp [Wed, 13 May 2015 19:20:35 +0000 (14:20 -0500)]
Merge "General: Fix recent menuselect-related cross compile regression"

5 years agoMerge "res_config_mysql: Fix broken column type checking"
Joshua Colp [Wed, 13 May 2015 17:25:58 +0000 (12:25 -0500)]
Merge "res_config_mysql: Fix broken column type checking"

5 years agoMerge "chan_dahdi/sig_pri: Fix crash on ISDN call hangup collision."
Joshua Colp [Wed, 13 May 2015 17:24:44 +0000 (12:24 -0500)]
Merge "chan_dahdi/sig_pri: Fix crash on ISDN call hangup collision."

5 years agoMerge "res_rtp_asterisk: Correction for the limit which detects that a packet is...
Joshua Colp [Wed, 13 May 2015 15:38:23 +0000 (10:38 -0500)]
Merge "res_rtp_asterisk: Correction for the limit which detects that a packet is DTLS."

5 years agoMerge "cdr_pgsql: Use PQescapeStringConn for escaping names."
Joshua Colp [Wed, 13 May 2015 09:35:55 +0000 (04:35 -0500)]
Merge "cdr_pgsql: Use PQescapeStringConn for escaping names."

5 years agochan_dahdi/sig_pri: Fix crash on ISDN call hangup collision.
Richard Mudgett [Tue, 12 May 2015 22:34:45 +0000 (17:34 -0500)]
chan_dahdi/sig_pri: Fix crash on ISDN call hangup collision.

If an ISDN call is hungup by both sides at the same time a crash could
happen.

* Added missing NULL checks for the owner channel after calling
pri_queue_pvt_cause_data() in two places.  Code after those calls need to
check the owner channel pointer for NULL before use because
pri_queue_pvt_cause_data() needs to do deadlock avoidance to lock the
owner and the owner may get hung up.

ASTERISK-21893 #close
Reported by:  Alexandr Gordeev

Change-Id: Ica3e266ebc7a894b41d762326f08653e1904bb9a