summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2015-09-28Merge "app_dial.c: Factor out a connected line update routine." into 13Joshua Colp
2015-09-28Merge "res/res_stasis: Fix accidental subscription to 'all' bridge topic" ↵Matt Jordan
into 13
2015-09-28Merge "app_dial.c: Remove some no-op code." into 13Joshua Colp
2015-09-27res/res_stasis: Fix accidental subscription to 'all' bridge topicMatt Jordan
When b99a7052621700a1aa641a1c24308f5873275fc8 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-25Scripts: check file versions of Asterisk and dependenciesScott Griepentrog
To help in diagnosing mismatched modules and libraries, this script scans for version, repository, and source information and reports what is found. ASTERISK-25376 #close Reported by: Ashley Sanders Change-Id: Ib0642d0fb96712476f59760d6d137a24633fe2d6
2015-09-25app_dial.c: Factor out a connected line update routine.Richard Mudgett
Replace inlined code with update_connected_line_from_peer(). ASTERISK-25423 Reported by: John Hardin Change-Id: Ia14f18def417645cd7fb453e1bdac682630a5091
2015-09-25app_dial.c: Remove some no-op code.Richard Mudgett
Change-Id: Ice1884a94315d3cb7e3bbd47a9fba76a27276c54
2015-09-25Merge "logger: Prevent duplicate dynamic channels from being added." into 13Joshua Colp
2015-09-24logger: Prevent duplicate dynamic channels from being added.Mark Michelson
There was a problem observed where the "logger add channel" CLI command would allow for a channel with the same name to be added multiple times. This would result in each message being written out to the same file multiple times. The problem was due to the difference in how logger channel filenames are stored versus the format they are allowed to be presented when they are added. For instance, if adding the logger channel "foo" through the CLI, the result would be a logger channel with the file name /var/log/asterisk/foo being stored. So when trying to add another "foo" channel, "foo" would not match "/var/log/asterisk/foo" so we'd happily add the duplicate channel. The fix presented here is to introduce two new methods in the logger code: * make_filename(): given a logger channel name, this creates the filename for that logger channel. * find_logchannel(): given a logger channel name, this calls make_filename() and then traverses the list of logchannels in order to find a match. This change has made use of make_filename() and find_logchannel() throughout to more consistently behave. ASTERISK-25305 #close Reported by Mark Michelson Change-Id: I892d52954d6007d8bc453c3cbdd9235dec9c4a36
2015-09-24Do not swallow frames on channels leaving bridges.Mark Michelson
When leaving a bridge, indications on a channel could be swallowed by the internal indication logic because it appears that the channel is on its way to be hung up anyway. One such situation where this is detrimental is when channels on hold are redirected out of a bridge. The AST_CONTROL_UNHOLD indication from the bridging code is swallowed, leaving the channel in question to still appear to be on hold. The fix here is to modify the logic inside ast_indicate_data() to not drop the indication if the channel is simply leaving a bridge. This way, channels on hold redirected out of a bridge revert to their expected "in use" state after the redirection. ASTERISK-25418 #close Reported by Mark Michelson Change-Id: If6115204dfa0551c050974ee138fabd15f978949
2015-09-23Merge "ARI: Add events for Contact and Peer Status changes" into 13Matt Jordan
2015-09-22app_page.c: Fix crash when forwarding with a predial handler.Richard Mudgett
Page uses the async method of dialing with the dial API. When a call gets forwarded there is no calling channel available. If the predial handler was set then the calling channel could not be put into auto-service for the forwarded call because it doesn't exist. A crash is the result. * Moved the callee predial parameter string processing to before the string is passed to the dial API rather than having the dial API do it. There are a few benefits do doing this. The first is the predial parameter string processing doesn't need to be done for each channel called by the dial API. The second is in async mode and the forwarded channel is to have the predial handler executed on it then the non-existent calling channel does not need to be present to process the predial parameter string. * Don't start auto-service on a non-existent calling channel to execute the predial handler when the dial API is in async mode and forwarding a call. ASTERISK-25384 #close Reported by: Chet Stevens Change-Id: If53892b286d29f6cf955e2545b03dcffa2610981
2015-09-22ARI: Add events for Contact and Peer Status changesMatt Jordan
This patch adds support for receiving events regarding Peer status changes and Contact status changes. This is particularly useful in scenarios where we are subscribed to all endpoints and channels, where we often want to know more about the state of channel technology specific items than a single endpoint's state. ASTERISK-24870 Change-Id: I6137459cdc25ce27efc134ad58abf065653da4e9
2015-09-22res/res_stasis_device_state: Allow for subscribing to 'all' device stateMatt Jordan
This patch adds support for subscribing to all device state changes. This is done either by subscribing to an empty device, e.g., 'eventSource=deviceState:', or by the WebSocket connection specifying that it wants all state in the system. ASTERISK-24870 Change-Id: I9cfeca1c9e2231bd7ea73e45919111d44d2eda32
2015-09-22ARI: Add the ability to subscribe to all eventsMatt Jordan
This patch adds the ability to subscribe to all events. There are two possible ways to accomplish this: (1) On initial WebSocket connection. This patch adds a new query parameter, 'subscribeAll'. If present and True, Asterisk will subscribe the applications to all ARI events. (2) Via the applications resource. When subscribing in this manner, an ARI client should merely specify a blank resource name, i.e., 'channels:' instead of 'channels:12354'. This will subscribe the application to all resources of the 'channels' type. ASTERISK-24870 #close Change-Id: I4a943b4db24442cf28bc64b24bfd541249790ad6
2015-09-22core/logging: Fix logging to more than one syslog channelElazar Broad
Currently, Asterisk will log to the last configured syslog channel in logger.conf. This is due to the fact that the final call to openlog() supersedes all of the previous calls. This commit removes the call to openlog() and passes the facility to ast_log_vsyslog(), along with utilizing the LOG_MAKEPRI macro to ensure that the message is routed to the correct facility and with the correct priority. ASTERISK-25407 #close Reported by: Elazar Broad Tested by: Elazar Broad Change-Id: Ie2a2416bc00cce1b04e99ef40917c2011953ddd2
2015-09-22Merge "app_record: RECORDED_FILE variable not being populated" into 13Matt Jordan
2015-09-22Merge "pbx: Update device and presence state when changing a hint ↵Joshua Colp
extension." into 13
2015-09-21app_record: RECORDED_FILE variable not being populatedKevin Harwell
The RECORDED_FILE variable is empty unless a '%d' is specified in the filename. This patch makes it so the variable is always set to the filename. ASTERISK-25410 #close Change-Id: I4ec826d8eb582ae2ad184e717be8668b74d37653
2015-09-21Merge "main/config_options: Check for existance of internal object before ↵Matt Jordan
derefing" into 13
2015-09-19Merge "app_queue: AgentComplete event has wrong reason" into 13Matt Jordan
2015-09-19Merge "app_queue: Crash when transferring" into 13Matt Jordan
2015-09-19Merge "CHAOS: res_pjsip_diversion avoid crash if allocation fails" into 13Matt Jordan
2015-09-19Merge "chan_sip: Fix From header truncation for extremely long ↵Joshua Colp
CALLERID(name)." into 13
2015-09-19Merge "CHAOS: avoid crash if string create fails" into 13Joshua Colp
2015-09-19pbx: Update device and presence state when changing a hint extension.Joshua Colp
When changing a hint extension without removing the hint first the device state and presence state is not updated. This causes the state of the hint to be that of the previous extension and not the current one. This state is kept until a state change occurs as a result of something (presence state change, device state change). This change updates the hint with the current device and presence state of the new extension when it is changed. Any state callbacks which may have been added before the hint extension is changed are also informed of the new device and presence state if either have changed. ASTERISK-25394 #close Change-Id: If268f1110290e502c73dd289c9e7e7b27bc8432f
2015-09-18CHAOS: avoid crash if string create failsScott Griepentrog
Validate string buffer allocation before using them. ASTERISK-25323 Change-Id: Ib9c338bdc1e53fb8b81366f0b39482b83ef56ce0
2015-09-18chan_sip: Fix From header truncation for extremely long CALLERID(name).Walter Doekes
The CALLERID(num) and CALLERID(name) and other info are placed into the `char from[256]` in initreqprep. If the name was too long, the addr-spec and params wouldn't fit. Code is moved around so the addr-spec with params is placed there first, and then fitting in as much of the display-name as possible. ASTERISK-25396 #close Change-Id: I33632baf024f01b6a00f8c7f35c91e5f68c40260
2015-09-17CHAOS: res_pjsip_diversion avoid crash if allocation failsRichard Mudgett
Validate ast_malloc buffer returned before using it in set_redirecting_value(). ASTERISK-25323 Change-Id: I15d2ed7cb0546818264c0bf251aa40adeae83253
2015-09-17app_queue: AgentComplete event has wrong reasonKevin Harwell
When a queued caller transfers an agent to another extension sometimes the raised AgentComplete event has a reason of "caller" and sometimes "transfer". Since a transfer has taken place this should always be transfer. This occurs because sometimes the stasis hangup event arrives before the transfer event thus writing a different reason out. With this patch, when a hangup event is received during a transfer it will check to see if the channel that is hanging up is part of a transfer. If so it will return and let the subsequently received transfer event handler take care of the cleanup. ASTERISK-25399 #close Change-Id: Ic63c49bd9a5ed463ea7a032fd2ea3d63bc81a50d
2015-09-17PJSIP: avoid crash when getting rtp peerScott Griepentrog
Although unlikely, if the tech private is returned as a NULL, chan_pjsip_get_rtp_peer() would crash. ASTERISK-25323 Change-Id: Ie231369bfa7da926fb2b9fdaac228261a3152e6a
2015-09-17Merge "res_pjsip_pubsub: Eliminate race during initial NOTIFY." into 13Joshua Colp
2015-09-17app_queue: Crash when transferringKevin Harwell
During some transfer scenarios involving queues Asterisk would sometimes crash when trying to obtain a channel snapshot (could happen on caller or member channels). This occurred because the underlying channel had already disappeared when trying to obtain the latest snapshot. This patch adds a reference to both the member and caller channels that extends to the lifetime of the queue'd call, thus making sure the channels will always exist when retrieving the latest snapshots. ASTERISK-25185 #close Reported by: Etienne Lessard Change-Id: Ic397fa68fb4ff35fbc378e745da9246a7b552128
2015-09-17res_pjsip_pubsub: Eliminate race during initial NOTIFY.Mark Michelson
There is a slim chance of a race condition occurring where two threads can both attempt to manipulate the same area. Thread A can be handling an incoming initial SUBSCRIBE request. Thread A lets the specific subscription handler know that the subscription has been established. At this point, Thread B may detect a state change on the subscribed resource and queue up a notification task on Thread C, the subscription serializer thread. Now Thread A attempts to generate the initial NOTIFY request to send to the subscriber at the same time that Thread C attempts to generate a state change NOTIFY request to send to the subscriber. The result is that Threads A and C can step on the same memory area, resulting in a crash. The crash has been observed as happening when attempting to allocate more space to hold the body for the NOTIFY. The solution presented here is to queue the subscription establishment and initial NOTIFY generation onto the subscription serializer thread (Thread C in the above scenario). This way, there is no way that a state change notification can occur before the initial NOTIFY is sent, and if there is a quick succession of NOTIFYs, we can guarantee that the two NOTIFY requests will be sent in succession. Change-Id: I5a89a77b5f2717928c54d6efb9955e5f6f5cf815
2015-09-15scheduler: Use queue for allocating sched IDs.Mark Michelson
It has been observed that on long-running busy systems, a scheduler context can eventually hit INT_MAX for its assigned IDs and end up overflowing into a very low negative number. When this occurs, this can result in odd behaviors, because a negative return is interpreted by callers as being a failure. However, the item actually was successfully scheduled. The result may be that a freed item remains in the scheduler, resulting in a crash at some point in the future. The scheduler can overflow because every time that an item is added to the scheduler, a counter is bumped and that counter's current value is assigned as the new item's ID. This patch introduces a new method for assigning scheduler IDs. Instead of assigning from a counter, a queue of available IDs is maintained. When assigning a new ID, an ID is pulled from the queue. When a scheduler item is released, its ID is pushed back onto the queue. This way, IDs may be reused when they become available, and the growth of ID numbers is directly related to concurrent activity within a scheduler context rather than the uptime of the system. Change-Id: I532708eef8f669d823457d7fefdad9a6078b99b2
2015-09-11Merge "res/res_pjsip_nat: Ignore REGISTER requests when looking for a ↵Matt Jordan
Record-Route" into 13
2015-09-11chan_sip.c: Validation on module reloadRodrigo Ramírez Norambuena
Change validation on reload module because now used the cli function for reload. The sip_reload() function never fail and ever return NULL for this reason on reload() now use the call the sip_reload() and return AST_MODULE_LOAD_SUCCESS. This problem is dectected on reload by PUT method on ARI, getting always 404 http code when the module is reloaded. ASTERISK-25325 #close Reporte by: Rodrigo Ramírez Norambuena Change-Id: I41215877fb2cfc589e0d4d464000cf6825f4d7fb
2015-09-10res_pjsip_pubsub.c: Mark ast_sip_create_subscription() as not used.Richard Mudgett
Change-Id: I2b8db18eac36c01a5c7eb9467699124e203fd093
2015-09-10res_pjsip_pubsub.c: Add some notification comments.Richard Mudgett
Change-Id: Ie62ff1f4b7adc1a12fa0303f53926af249b25e20
2015-09-10res_pjsip_pubsub.c: Set dlg_status code instead of sending SIP response.Richard Mudgett
We should not try to send a SIP response message because we may be restoring a persistent subscription where we are not responding to a SIP request. Change-Id: Id89167ef90320c5563f37e632db0dda6cb9e7dec
2015-09-10res_pjsip_pubsub.c: Fix off-nominal memory leak.Richard Mudgett
Fix off-nominal visited vector leak in build_resource_tree(). Change-Id: If0399c7941c9c0b1038bcfb7b9a371760977831c
2015-09-10res_pjsip_pubsub.c: Fix one byte buffer overrun error.Richard Mudgett
ast_sip_pubsub_register_body_generator() did not account for the null terminator set by sprintf() in the allocated output buffer. Change-Id: I388688a132e479bca6ad1c19275eae0070969ae2
2015-09-10res_pjsip_pubsub.c: Use ast_alloca() instead of alloca().Richard Mudgett
Change-Id: Ia396096b4fedc2874649ca11137612c3f55e83e3
2015-09-10res_pjsip_pubsub.c: Add missing error return in load_module().Richard Mudgett
Change-Id: I15debd0f717f16ee2f78e7f56151c3b3b97b72fc
2015-09-10res_pjsip/location.c: Use the builtin ao2_callback() match function instead.Richard Mudgett
Change-Id: I364906d6d2bad3472929986704a0286b9a2cbe3f
2015-09-10res_pjsip: Copy default_from_user to avoid crash.Mark Michelson
The default_from_user retrieval function was pulling the default_from_user from the global configuration struct in an unsafe way. If using a database as a backend configuration store, the global configuration struct is short-lived, so grabbing a pointer from it results in referencing freed memory. The fix here is to copy the default_from_user value out of the global configuration struct. Thanks go to John Hardin for discovering this problem and proposing the patch on which this fix is based. ASTERISK-25390 #close Reported by Mark Michelson Change-Id: I6b96067a495c1259da768f4012d44e03e7c6148c
2015-09-10res/res_pjsip_nat: Ignore REGISTER requests when looking for a Record-RouteMatt Jordan
We will only rewrite the Contact header if there is no Record-Route header in the received request. If a malfunctioning proxy places a Record-Route header into a REGISTER request, we will decide that we shouldn't update the IP/port in the Contact header, and we will end up storing a contact with an AoR that contains the NAT'd IP address. While it is nice to have the proxy *not* send a Record-Route in a REGISTER request, it's also a good idea to not process the header in a non-dialog message. This patch updates the code to explicitly ignore the Record-Route header in REGISTER requests. ASTERISK-25387 #close Change-Id: I4bd3bcccc4003d460cc354d986b0dea2e433ef3f
2015-09-10Merge "ParkAndAnnounce: Add variable inheritance" into 13Joshua Colp
2015-09-09main/config_options: Check for existance of internal object before derefingMatt Jordan
Asterisk can load and register an object type while still having an invalid sorcery mapping. This can cause an issue when a creation call is invoked. For example, mis-configuring PJSIP's endpoint identifier by IP address mapping in sorcery.conf will cause the sorcery mechanism to be invalidated; however, a subsequent ARI invocation to create the object will cause a crash, as the internal type may not be registered as sorcery expects. Merely checking for a NULL pointer here solves the issue. Change-Id: I54079fb94a1440992f4735a9a1bbf1abb1c601ac
2015-09-09Merge "chan_ooh323: Add ProgressIndicator IE with inband info available" into 13Matt Jordan