summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
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-04res_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-04Merge "pjsip_configuration: On delete, remove the persistent version of an ↵Matt Jordan
endpoint" into 13
2015-11-03Merge "main/stasis_endpoints: Fix ContactStatusChange JSON for ↵Matt Jordan
roundtrip_usec field" into 13
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-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 ↵Joshua Colp
creation/destruction" into 13
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-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." into 13Matt Jordan
2015-10-28Merge "res_pjsip: Add "like" processing to pjsip list and show commands" ↵Joshua Colp
into 13
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" into 13
2015-10-26Merge "format: Update the maximum packetization time for iLBC 30." into 13Matt Jordan
2015-10-25Merge "res_pjsip_pubsub: Prevent sending NOTIFY on destroyed dialog." into 13Matt Jordan
2015-10-25Merge "res_pjsip_pubsub: Ensure dialog lock balance." into 13Matt Jordan
2015-10-25Merge "res_pjsip_pubsub: Prevent crashes on final NOTIFY." into 13Matt Jordan
2015-10-25Merge "res_pjsip_pubsub: Remove serializer when sending final NOTIFY." into 13Matt Jordan
2015-10-25Merge "res_pjsip_pubsub: Fix crash on destruction of empty subscription ↵Matt Jordan
tree." into 13
2015-10-25Merge "res_pjsip_pubsub: Solidify lifetime and ownership of objects." into 13Matt 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" into 13
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." into 13Joshua Colp
2015-10-23Merge topic 'fix_oom_crash' into 13Joshua 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." into 13Joshua 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
2015-10-21Merge "funcs/func_holdintercept: Actually add the HOLD_INTERCEPT function" ↵Joshua Colp
into 13
2015-10-21res_pjsip: Move URI validation to use time.Joshua Colp
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-21format: Update the maximum packetization time for iLBC 30.Alexander Traud
In September 2006, the maximum packetization time (ptime) were set to such a low value, packetization was disabled for many codecs actually. This was fixed for many codecs but not for iLBC 30. This enables packetization for iLBC which can be enabled for example via allow=ilbc:60,gsm,alaw,ulaw in the file sip.conf. ASTERISK-7803 Change-Id: I2ef90023d35efb7cb8fe96ed74f53f6846ffad12
2015-10-21chan_sip: Fix autoframing=yes.Alexander Traud
With Asterisk 13, the structures ast_format and ast_codec changed. Because of that, the paketization timing (framing) of the RTP channel moved away from the formats/codecs. In the course of that change, the ptime of the callee was not honored anymore, when the optional autoframing was enabled. ASTERISK-25484 #close Change-Id: Ic600ccaa125e705922f89c72212c698215d239b4
2015-10-20rest-api-templates: Wikify error code response reasonsMatt Jordan
Error response code descriptions may contain wiki markup that need to be escaped. Without this patch, Confluence will reject the document being sent and the responsible script will raise an exception. Change-Id: I21fcb66fee7f6332381f2b99b1b0195dff215ee5
2015-10-20funcs/func_holdintercept: Actually add the HOLD_INTERCEPT functionMatt Jordan
When ab803ec342 was committed, it accidentally forgot to actually *add* the HOLD_INTERCEPT function. This highlights two interesting points: * Gerrit forces you to put the patch as it is going to into the repo up for review, which Review Board did not. Yay Gerrit. * No one apparently bothered to use this feature, or else they don't know about it. I'm going to go with the latter explanation. ASTERISK-24922 Change-Id: Ida38278f259dd07c334a36f9b7d5475b5db72396
2015-10-20Merge "contrib/scripts/autosupport: Update for Asterisk 13" into 13Joshua Colp
2015-10-19contrib/scripts/autosupport: Update for Asterisk 13Matt Jordan
This patch adds some minor tweaks for autosupport to update it for Asterisk 13. This includes: * Finally removing most references to Zaptel * Adding support for some additional 'core' commands, and fixing nomenclature that generally hasn't been used for some time * Adding some PJSIP/SIP commands to gather endpoints/peers and active channels Change-Id: Ic997b418cbd9313588b6608e50f47b0ce6f4f1f1
2015-10-16Merge topic 'ASTERISK-25461' into 13Matt Jordan
* changes: config.c: Fix off-nominal memory leak. config.c: Fix potential memory corruption after [section](+). config.c: Fix #include after [section](+).
2015-10-15Merge "res_config_pgsql.c: Fix deadlock loading realtime configuration." into 13Joshua Colp
2015-10-15Merge "Build: Add menuselect options for using compiler sanitizers" into 13Joshua Colp