summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2015-11-06xmldoc: Improve xmldoc wrapping of 'core show ...' output.Walter Doekes
Previously, the wrapping did both lookahead and lookback, which, together with color escape sequences, caused some lines to be wrapped way earlier than other lines. This led to inconsistent output. This simplifies the wrapping code and makes it more sane: if maxcolumns is hit, we simply jump back to the last space and wrap there. ASTERISK-25527 #close Change-Id: I56d01c6f9a812642b1b05535c98d4db48d17c957
2015-11-04Merge "StatsD: Add res_statsd compatibility"Joshua Colp
2015-11-04StatsD: Add res_statsd compatibilitytcambron
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-04main/dial: Protect access to the format_cap structure of the requesting channelMatt Jordan
When a dial attempt is made that involves a requesting channel, we previously were not: a) Protecting access to the native format capabilities structure on the requesting channel. That is inherently unsafe. b) Reference bumping the lifetime of the format capabilities structure. In both cases, something else could sneak in, blow away the format capabilities, and we'd be holding onto an invalid format_cap structure. When the newly created channel attempts to construct its format capabilities, things go poorly. This patch: a) Ensures that we get a reference to the native format capabilities while the requesting channel is locked b) Holds a reference to the native format capabilities during the creation of the new channel. ASTERISK-25522 #close Change-Id: I0bfb7ba8b9711f4158cbeaae96edf9626e88a54f
2015-11-04Fix cli display of build options.Corey Farrell
A previous commit reduced the AST_BUILDOPTS compiler define to only include options that affected ABI. This included some options that were previously displayed by cli "core show settings". This change corrects the CLI display while still restricting buildopts.h to ABI effecting options only. ASTERISK-25434 #close Reported by: Rusty Newton Change-Id: Id07af6bedd1d7d325878023e403fbd9d3607e325
2015-11-04Merge "res_pjsip/location: Destroy contact_status objects on contact deletion"Matt Jordan
2015-11-04Merge "pjsip_configuration: On delete, remove the persistent version of an ↵Matt Jordan
endpoint"
2015-11-03pjsip_configuration: On delete, remove the persistent version of an endpointMatt Jordan
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-03res_pjsip/location: Destroy contact_status objects on contact deletionMatt Jordan
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-03main/stasis_endpoints: Fix ContactStatusChange JSON for roundtrip_usec fieldMatt Jordan
The JSON packing for the ContactStatusChange event forgot to include the roundtrip_usec field. As a result, the field never showed up in any event, even when the data was available. This patch corrects that error by properly packing the JSON blob with the data. Change-Id: I8df80da659a44010afbd48f645967518ff5daa17
2015-11-03chan_sip: Allow websockets to be disabled.Corey Farrell
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
2015-11-02res_pjsip: Set threadpool max size default to 50.Mark Michelson
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-02Merge "pjsip_options: Schedule/unschedule qualifies on AoR creation/destruction"Joshua Colp
2015-11-02Merge "StatsD: Send stuff to the StatsD server and test"Joshua Colp
2015-11-02StatsD: Send stuff to the StatsD server and testtcambron
Added code to allow the StatsD dialplan application to send data to the server specified in statsd.conf. ASTERISK-25419 Change-Id: I400db2f37c6ddf61515ff5a019646e36dcd0f922
2015-11-02pjsip_options: Schedule/unschedule qualifies on AoR creation/destructionMatt Jordan
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-02Merge "app_queue: Added reason pause of member"Matt Jordan
2015-10-31Makefile: Add a rule 'basic-pbx' that installs the Basic PBX configsMatt Jordan
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
2015-10-29res_pjsip_pubsub: Fix assertion when UAS dialog creation fails.Joshua Colp
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-29Merge "chan_sip: Do not send all codecs on INVITE."Matt Jordan
2015-10-28Merge "StatsD: Add user input validation to the application"Joshua Colp
2015-10-28StatsD: Add user input validation to the applicationtcambron
Added code to accept user input and validate it before allowing it to be sent to the StatsD server. ASTERISK-25419 Reported By: Ashley Sanders Change-Id: I55c7ce44326a68ad6c5c1514b9575ac50f25bbc3
2015-10-28Merge "res_pjsip: Add "like" processing to pjsip list and show commands"Joshua Colp
2015-10-26Merge "install_prereq: Update repositories before install on Debian systems"Joshua Colp
2015-10-26chan_sip: Do not send all codecs on INVITE.Alexander Traud
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
2015-10-26Merge "build: GCC 5.1.x catches some new const, array bounds and missing ↵Joshua Colp
paren issues"
2015-10-26Merge "format: Update the maximum packetization time for iLBC 30."Matt Jordan
2015-10-26install_prereq: Update repositories before install on Debian systemsRodrigo Ramírez Norambuena
When to install packages the indexed local is more old of the version of software on the repository they have been upgraded by security update then get the package will give 404 not found. The patch prevent by update local index to repository for aptitude before install. ASTERISK-25495 #close Reporte by: Rodrigo Ramírez Norambuena Change-Id: I645959e553aac542805ced394cac2dca964051fa
2015-10-25Merge "res_pjsip_pubsub: Prevent sending NOTIFY on destroyed dialog."Matt Jordan
2015-10-25Merge "res_pjsip_pubsub: Ensure dialog lock balance."Matt Jordan
2015-10-25Merge "res_pjsip_pubsub: Prevent crashes on final NOTIFY."Matt Jordan
2015-10-25Merge "res_pjsip_pubsub: Remove serializer when sending final NOTIFY."Matt Jordan
2015-10-25Merge "res_pjsip_pubsub: Fix crash on destruction of empty subscription tree."Matt Jordan
2015-10-25Merge "res_pjsip_pubsub: Solidify lifetime and ownership of objects."Matt Jordan
2015-10-24build: GCC 5.1.x catches some new const, array bounds and missing paren issuesGeorge Joseph
Fixed 1 issue in each of the affected files. ASTERISK-25494 #close Reported-by: George Joseph Tested-by: George Joseph Change-Id: I818f149cd66a93b062df421e1c73c7942f5a4a77
2015-10-24res_pjsip: Add "like" processing to pjsip list and show commandsGeorge Joseph
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-23Merge "res_pjsip_outbound_registration: registration stops due to fatal 4xx ↵Joshua Colp
response"
2015-10-23res_pjsip_outbound_registration: registration stops due to fatal 4xx responseKevin Harwell
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-23Merge "chan_sip: Fix autoframing=yes."Joshua Colp
2015-10-23Merge topic 'fix_oom_crash'Joshua Colp
* changes: strings.c: Fix __ast_str_helper() to always return a terminated string. Add missing failure checks to ast_str_set_va() callers.
2015-10-23Merge "res_pjsip: Move URI validation to use time."Joshua Colp
2015-10-22format_cap: Detect vector allocation failures.Mark Michelson
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
2015-10-22res_pjsip_pubsub: Prevent sending NOTIFY on destroyed dialog.Mark Michelson
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-22res_pjsip_pubsub: Ensure dialog lock balance.Mark Michelson
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-22res_pjsip_pubsub: Prevent crashes on final NOTIFY.Mark Michelson
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-22res_pjsip_pubsub: Remove serializer when sending final NOTIFY.Mark Michelson
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-22res_pjsip_pubsub: Fix crash on destruction of empty subscription tree.Mark Michelson
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-22res_pjsip_pubsub: Solidify lifetime and ownership of objects.Mark Michelson
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-21strings.c: Fix __ast_str_helper() to always return a terminated string.Richard Mudgett
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
2015-10-21Add missing failure checks to ast_str_set_va() callers.Richard Mudgett
Change-Id: I0c2cdcd53727bdc6634095c61294807255bd278f