Commit Graph

3245 Commits

Author SHA1 Message Date
Mark Michelson e8881e1770 Taskprocessors: Increase high-water mark
In practical tests, we have seen certain taskprocessors, specifically
Stasis subscription taskprocessors, cross the recently-added high-water
mark and emit a warning. This high-water mark warning is only intended
to be emitted when things have tanked on the system and things are
heading south quickly. In the practical tests, the Stasis taskprocessors
sometimes had a max depth of 180 tasks in them, and Asterisk wasn't in
any danger at all.

As such, this ups the high-water mark to 500 tasks instead. It also
redefines the SIP threadpool request denial number to be a multiple of
the taskprocessor high-water mark.

Change-Id: Ic8d3e9497452fecd768ac427bb6f58aa616eebce
2015-11-13 14:19:35 -06:00
Mark Michelson 40b58a5d2b res_pjsip distributor: Don't send 503 response to responses.
When the SIP threadpool is backed up with tasks, we send 503 responses
to ensure that we don't try to overload ourselves. The problem is that
we were not insuring that we were not trying to send a 503 to an
incoming SIP response.

This change makes it so that we only send the 503 on incoming requests.

Change-Id: Ie2b418d89c0e453cc6c2b5c7d543651c981e1404
2015-11-12 11:17:51 -06:00
Mark Michelson 264c74aa22 res_pjsip: Deny requests when threadpool queue is backed up.
We have observed situations where the SIP threadpool may become
deadlocked. However, because incoming traffic is still arriving, the SIP
threadpool's queue can continue to grow, eventually running the system
out of memory.

This change makes it so that incoming traffic gets rejected with a 503
response if the queue is backed up too much.

Change-Id: I4e736d48a2ba79fd1f8056c0dcd330e38e6a3816
2015-11-12 11:39:41 -05:00
Steve Davies d982b99e71 Further fixes to improper usage of scheduler
When ASTERISK-25449 was closed, a number of scheduler issues mentioned in
the comments were missed. These have since beed raised in ASTERISK-25476
and elsewhere.

This patch attempts to collect all of the scheduler issues discovered so
far and address them sensibly.

ASTERISK-25476 #close

Change-Id: I87a77d581e2e0d91d33b4b2fbff80f64a566d05b
2015-11-12 11:46:43 +00:00
Matt Jordan d77bba4326 Merge "res_pjsip_sdp_rtp: Enable Opus to be negotiated via SIP/SDP." 2015-11-11 08:08:55 -06:00
Alexander Traud cf79b62778 ast_format_cap_get_names: To display all formats, the buffer was increased.
ASTERISK-25533 #close

Change-Id: Ie1a9d1a6511b3f1a56b93d04475fbf8a4e40010a
2015-11-09 16:58:52 +01:00
Alexander Traud 9d6e917349 res_pjsip_sdp_rtp: Enable Opus to be negotiated via SIP/SDP.
In SIP/SDP, Opus has two channels always (see RFC 7587 section 7). The actual
amount of channels is negotiated in-band. Therefore now, the Opus codec and its
attribute rtpmap are registered with two channels.

ASTERISK-24779 #close
Reported by: PowerPBX
Tested by: Alexander Traud
patches:
  asterisk-24779.patch submitted by Sean Bright (license #5060)

Change-Id: Ic7ac13cafa1d3450b4fa4987350924b42cbb657b
2015-11-06 13:59:30 +01:00
Joshua Colp f12ebe3584 Merge "StatsD: Add res_statsd compatibility" 2015-11-04 17:47:09 -06:00
tcambron 379c041038 StatsD: Add res_statsd compatibility
Added a new api to res_statsd.c to allow it to receive a
character pointer for the value argument. This allows for a
'+' and a '-' to easily be sent with the value.

ASTERISK-25419
Reported By: Ashley Sanders

Change-Id: Id6bb53600943d27347d2bcae26c0bd5643567611
2015-11-04 14:59:12 -06:00
Matt Jordan 0aef8e058f Merge "res_pjsip/location: Destroy contact_status objects on contact deletion" 2015-11-04 07:44:26 -06:00
Matt Jordan 63e02b45c6 pjsip_configuration: On delete, remove the persistent version of an endpoint
When an endpoint is deleted (such as through an API), the persistent endpoint
currently continues to lurk around. While this isn't harmful from a memory
consumption perspective - as all persistent endpoints are reclaimed on
shutdown - it does cause Stasis endpoint related operations to continue
to believe that the endpoint may or may not exist.

This patch causes the persistent endpoint related to a PJSIP endpoint to be
destroyed if the PJSIP endpoint is deleted.

Change-Id: I85ac707b4d5e6aad882ac275b0c2e2154affa5bb
2015-11-03 12:21:06 -05:00
Matt Jordan d33a1682e3 res_pjsip/location: Destroy contact_status objects on contact deletion
The contact_status Sorcery objects are currently not destroyed when a contact
is deleted. This causes the contact's last known RTT/status to be 'sticky'
when the contact itself may no longer exist. This patch causes the
contact_status objects associated with both dynamic and static contacts to
be destroyed if the AoR holding those contacts is also destroyed (or via
other paths where a contact may be deleted.)

Change-Id: I7feec8b9278cac3c5263a4c0483f4a0f3b62426e
2015-11-03 12:19:16 -05:00
Mark Michelson f80a0ae49b 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
2015-11-02 18:24:09 -05:00
Matt Jordan 014e3d426b 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
2015-11-02 09:11:52 -05:00
Joshua Colp b522a5e30f 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
2015-10-29 08:33:08 -05:00
Joshua Colp df3aa29100 Merge "res_pjsip: Add "like" processing to pjsip list and show commands" 2015-10-28 06:31:02 -05:00
Matt Jordan b5e5b89e16 Merge "res_pjsip_pubsub: Prevent sending NOTIFY on destroyed dialog." 2015-10-25 10:15:01 -05:00
Matt Jordan b1fdc6c415 Merge "res_pjsip_pubsub: Ensure dialog lock balance." 2015-10-25 10:14:36 -05:00
Matt Jordan d1441dfff7 Merge "res_pjsip_pubsub: Prevent crashes on final NOTIFY." 2015-10-25 10:13:03 -05:00
Matt Jordan d93d4bcc0b Merge "res_pjsip_pubsub: Remove serializer when sending final NOTIFY." 2015-10-25 10:12:43 -05:00
Matt Jordan cde1f9728e Merge "res_pjsip_pubsub: Fix crash on destruction of empty subscription tree." 2015-10-25 10:12:10 -05:00
Matt Jordan fe52fa5cc3 Merge "res_pjsip_pubsub: Solidify lifetime and ownership of objects." 2015-10-25 10:11:06 -05:00
George Joseph a8aee0bbdb 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
2015-10-24 11:02:43 -05:00
Joshua Colp 08fe5256a9 Merge "res_pjsip_outbound_registration: registration stops due to fatal 4xx response" 2015-10-23 15:35:34 -05:00
Kevin Harwell 691c0e0b31 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
2015-10-23 09:42:46 -05:00
Mark Michelson 7f9823ff57 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
2015-10-22 16:18:08 -05:00
Mark Michelson e9e4bc9ece 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
2015-10-22 16:18:08 -05:00
Mark Michelson b96267f7a3 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
2015-10-22 16:18:08 -05:00
Mark Michelson 386cd7b2b0 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
2015-10-22 16:17:47 -05:00
Mark Michelson 0b63d011c9 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
2015-10-22 15:39:58 -05:00
Mark Michelson ac0194dad6 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
2015-10-22 15:39:58 -05:00
Joshua Colp 64c172deba 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
2015-10-21 12:36:06 -05:00
Richard Mudgett d799bcf361 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
2015-10-14 14:18:56 -05:00
Joshua Colp 38519aeadf Merge "chan_pjsip: Fix crash on reINVITE before initial INVITE completes." 2015-10-08 13:48:33 -05:00
Richard Mudgett 34d7fa6c4a 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
2015-10-07 12:40:09 -05:00
Joshua Colp 7cbb091110 Merge "res/res_rtp_asterisk.c: Fix incorrect assignment of frame->subclass.frame_ending" 2015-10-07 11:58:58 -05:00
StefanEng86 cc131832aa 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
2015-10-07 15:49:33 +02:00
Matt Jordan 4bf395e81e 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 60a9172d7e 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
2015-10-06 20:51:48 -05:00
Richard Mudgett 8fe9350b68 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
2015-10-06 16:10:29 -05:00
Matt Jordan 8cb614fe20 Fix improper usage of scheduler exposed by 5c713fdf18
When 5c713fdf18 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
2015-10-06 07:40:29 -05:00
Richard Mudgett 1b80dbeb60 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
2015-10-01 17:28:24 -05:00
Richard Mudgett 9c1ca287a4 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
2015-10-01 17:28:24 -05:00
Richard Mudgett 6554a3b25e 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
2015-10-01 17:28:23 -05:00
Richard Mudgett 359394cc29 res_sorcery_memory_cache.c: Misc tweaks.
Change-Id: I8cd32dffbb4f33bb0c39518d6e4c991e73573160
2015-10-01 17:28:23 -05:00
Richard Mudgett 7942d1c2ff res_sorcery_memory_cache.c: Made use OBJ_SEARCH_MASK.
Change-Id: Ibca6574dc3c213b29cc93486e01ccd51f5caa46c
2015-10-01 17:28:23 -05:00
Joshua Colp 9f229d6a49 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
2015-09-30 13:46:00 -05:00
Richard Mudgett 12feec0bf7 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
2015-09-29 12:10:45 -05:00
Richard Mudgett 3f4fa245e5 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
2015-09-29 12:10:45 -05:00
Richard Mudgett aa00df62ee 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
2015-09-29 12:10:45 -05:00
Matt Jordan 9402f80726 res/res_stasis: Fix accidental subscription to 'all' bridge topic
When b99a705262 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
2015-09-27 20:45:50 -05:00