summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2015-06-01Merge "Fix buffer overflow in slin sample frames generation."Mark Michelson
2015-06-01cdr/cdr_csv.c: Set file name for csv master to the module when (re)loaded.Rodrigo Ramírez Norambuena
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
2015-06-01Merge "res_sorcery_memory_cache: Add CLI commands and AMI actions."Mark Michelson
2015-06-01Merge "res_sorcery_memory_cache: Add support for refreshing stale objects."Joshua Colp
2015-06-01res_pjsip_session: Fix in-dialog authentication.Richard Mudgett
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
2015-06-01pjsip_configuration: Fix leak in persistent_endpoint_update_state.Corey Farrell
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
2015-05-31Fix buffer overflow in slin sample frames generation.Ivan Poddubny
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
2015-05-29res_pjsip/location: Fix memory leak in permanent_uri_handlerGeorge Joseph
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
2015-05-29Merge "Revert "endpoint/stasis: Eliminate duplicate events on endpoint ↵Joshua Colp
status change""
2015-05-29Revert "endpoint/stasis: Eliminate duplicate events on endpoint status change"George Joseph
This reverts commit 6fca75bb628dfff2ab112e80b0228cf3ac0b8a05. Change-Id: Ifee026cc63e22c5ac5717c37867a9f036373ae5a
2015-05-29res_sorcery_memory_cache: Add CLI commands and AMI actions.Joshua Colp
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
2015-05-29Merge "res/res_config_pgsql.c: Use PQescapeStringConn for escaping names."Matt Jordan
2015-05-27endpoint/stasis: Eliminate duplicate events on endpoint status changeGeorge Joseph
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
2015-05-27res_sorcery_memory_cache: Add support for refreshing stale objects.Mark Michelson
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
2015-05-26res_pjsip: Add AMI events for chan_pjsip contact lifecycle changesGeorge Joseph
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>
2015-05-26Merge "Astobj2: Correctly treat hash_fn returning INT_MIN"Joshua Colp
2015-05-26res/res_config_pgsql.c: Use PQescapeStringConn for escaping names.Rodrigo Ramírez Norambuena
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
2015-05-26sorcery: Fix cache creation callback.Joshua Colp
The cache creation callback function expects to receive a sorcery_details structure and not just a standalone object. Change-Id: I3e4a5a137cb25292eb52d7a14cbb6daa09213450
2015-05-25Astobj2: Correctly treat hash_fn returning INT_MINIvan Poddubny
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
2015-05-24Merge "Stasis: Fix unsafe use of stasis_unsubscribe in modules."Matt Jordan
2015-05-24Merge "res_pjsip_transport_websocket: Fix crash on receiving large SIP packets"Matt Jordan
2015-05-23res_pjsip_transport_websocket: Fix crash on receiving large SIP packetsIvan Poddubny
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
2015-05-22Stasis: Fix unsafe use of stasis_unsubscribe in modules.Corey Farrell
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
2015-05-22Astobj2: Run weakproxy subscription callbacks in reverse order.Corey Farrell
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
2015-05-22res/res_pjsip_pubsub: Note that 'dialog' is also a valid event type for RLSMatt Jordan
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
2015-05-22res/res_pjsip_exten_state: Fix confusing NOTICE messageMatt Jordan
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
2015-05-22Merge "res_sorcery_memory_cache: Add support for object_lifetime_maximum."Mark Michelson
2015-05-22res/ari: Register Stasis application on WebSocket attemptMatt Jordan
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
2015-05-22Merge "res_sorcery_memory_cache: Add support for maximum_objects."Matt Jordan
2015-05-22Merge "res_pjsip: Refactor endpt_send_transaction (qualify_timeout)"Joshua Colp
2015-05-22Merge "res_pjsip_outbound_registration: Check request URI for line."Mark Michelson
2015-05-22res_pjsip: Refactor endpt_send_transaction (qualify_timeout)George Joseph
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>
2015-05-22res_sorcery_memory_cache: Add support for object_lifetime_maximum.Joshua Colp
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
2015-05-22res_pjsip_outbound_registration: Check request URI for line.demon-ru
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
2015-05-22res_sorcery_memory_cache: Add support for maximum_objects.Mark Michelson
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
2015-05-22res_sorcery_memory_cache: Add basic module implementation.Joshua Colp
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
2015-05-22Merge "cel, cdr: Assigned separator for column name and values."Joshua Colp
2015-05-21res_mwi_external_ami: Use module version of AMI registration.Corey Farrell
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
2015-05-21ARI: Update version to 1.7.0Matt Jordan
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)
2015-05-21Merge "audiohook.c: Difference in read/write rates caused continuous buffer ↵Matt Jordan
resets"
2015-05-21Merge "Logger: Reset defaults before processing config."Matt Jordan
2015-05-21Merge "res/res_http_websocket: Add a pre-session established callback"Matt Jordan
2015-05-21Merge "main/sdp_srtp.c: allow SDP crypto tag to be up to 9 digits"Joshua Colp
2015-05-20Logger: Reset defaults before processing config.Corey Farrell
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
2015-05-20app_playback: Suppress warnings on playback if channel hung upGeorge Joseph
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>
2015-05-20chan_iax2: Prevent deadlock between hangup and sending lagrq/pingYousf Ateya
channels/chan_iax.c: Prevent the deadlock between iax2_hangup and send_lagrq/ send_ping. This deadlock happens because the scheduled task send_lagrq(or send_ping) starts execution after the call hangup procedure starts but before it deletes the tasks in the scheduler. The solution is to delete scheduled lagrq (and ping) task asynchronously (i.e. schedule AST_SCHED_DEL for these tasks); By this, AST_SCHED_DEL will be called in a new context (doesn't have callno locked). This commit also cleans up the procedure of sending LAGRQ and PING. main/sched.c: Do not assert when deleting non existant entry from scheduler. This assert seems to be the reason for a lot of awkward code to avoid it. ASTERISK-24983 #close Reported by: Y Ateya Change-Id: I03bec1fc8faacb89630269e935fa667c6d6c080c
2015-05-20audiohook.c: Difference in read/write rates caused continuous buffer resetsKevin Harwell
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
2015-05-20Merge "Fix potential crash after unload of func_periodic_hook or test_message."Matt Jordan
2015-05-20res/res_http_websocket: Add a pre-session established callbackMatt Jordan
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
2015-05-20res/res_resolver_unbound.c: Add missing include of signal.hJohn Bigelow
ASTERISK-25110 #close Reported by: John Bigelow Change-Id: I99a9d93f066f265357b647b8e99a75e45da5a39f