summaryrefslogtreecommitdiff
path: root/channels/chan_iax2.c
AgeCommit message (Collapse)Author
2013-10-02Cast Integer Argument To Unsigned CharMichael L. Young
The member reg in the peercnt structure is an unsigned char and peercnt_modify() is expecting an unsigned char argument which gets assigned to peercnt->reg. This patch fixes that by casting the integer argument being passed to peercnt_modify to unsigned char. ........ Merged revisions 400314 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 400315 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 400316 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@400317 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-10-02Reduce channel snapshot creation and publishing by up to 50%.Joshua Colp
This change introduces the ability to stage channel snapshot creation and publishing by suppressing the implicit creation and publishing that some functions have. Once all operations are executed the staging is marked as done and a single snapshot is created and published. Review: https://reviewboard.asterisk.org/r/2889/ ........ Merged revisions 400265 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@400266 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-09-30Multiple revisions 399887,400138,400178,400180-400181David M. Lee
........ r399887 | dlee | 2013-09-26 10:41:47 -0500 (Thu, 26 Sep 2013) | 1 line Minor performance bump by not allocate manager variable struct if we don't need it ........ r400138 | dlee | 2013-09-30 10:24:00 -0500 (Mon, 30 Sep 2013) | 23 lines Stasis performance improvements This patch addresses several performance problems that were found in the initial performance testing of Asterisk 12. The Stasis dispatch object was allocated as an AO2 object, even though it has a very confined lifecycle. This was replaced with a straight ast_malloc(). The Stasis message router was spending an inordinate amount of time searching hash tables. In this case, most of our routers had 6 or fewer routes in them to begin with. This was replaced with an array that's searched linearly for the route. We more heavily rely on AO2 objects in Asterisk 12, and the memset() in ao2_ref() actually became noticeable on the profile. This was #ifdef'ed to only run when AO2_DEBUG was enabled. After being misled by an erroneous comment in taskprocessor.c during profiling, the wrong comment was removed. Review: https://reviewboard.asterisk.org/r/2873/ ........ r400178 | dlee | 2013-09-30 13:26:27 -0500 (Mon, 30 Sep 2013) | 24 lines Taskprocessor optimization; switch Stasis to use taskprocessors This patch optimizes taskprocessor to use a semaphore for signaling, which the OS can do a better job at managing contention and waiting that we can with a mutex and condition. The taskprocessor execution was also slightly optimized to reduce the number of locks taken. The only observable difference in the taskprocessor implementation is that when the final reference to the taskprocessor goes away, it will execute all tasks to completion instead of discarding the unexecuted tasks. For systems where unnamed semaphores are not supported, a really simple semaphore implementation is provided. (Which gives identical performance as the original taskprocessor implementation). The way we ended up implementing Stasis caused the threadpool to be a burden instead of a boost to performance. This was switched to just use taskprocessors directly for subscriptions. Review: https://reviewboard.asterisk.org/r/2881/ ........ r400180 | dlee | 2013-09-30 13:39:34 -0500 (Mon, 30 Sep 2013) | 28 lines Optimize how Stasis forwards are dispatched This patch optimizes how forwards are dispatched in Stasis. Originally, forwards were dispatched as subscriptions that are invoked on the publishing thread. This did not account for the vast number of forwards we would end up having in the system, and the amount of work it would take to walk though the forward subscriptions. This patch modifies Stasis so that rather than walking the tree of forwards on every dispatch, when forwards and subscriptions are changed, the subscriber list for every topic in the tree is changed. This has a couple of benefits. First, this reduces the workload of dispatching messages. It also reduces contention when dispatching to different topics that happen to forward to the same aggregation topic (as happens with all of the channel, bridge and endpoint topics). Since forwards are no longer subscriptions, the bulk of this patch is simply changing stasis_subscription objects to stasis_forward objects (which, admittedly, I should have done in the first place.) Since this required me to yet again put in a growing array, I finally abstracted that out into a set of ast_vector macros in asterisk/vector.h. Review: https://reviewboard.asterisk.org/r/2883/ ........ r400181 | dlee | 2013-09-30 13:48:57 -0500 (Mon, 30 Sep 2013) | 28 lines Remove dispatch object allocation from Stasis publishing While looking for areas for performance improvement, I realized that an unused feature in Stasis was negatively impacting performance. When a message is sent to a subscriber, a dispatch object is allocated for the dispatch, containing the topic the message was published to, the subscriber the message is being sent to, and the message itself. The topic is actually unused by any subscriber in Asterisk today. And the subscriber is associated with the taskprocessor the message is being dispatched to. First, this patch removes the unused topic parameter from Stasis subscription callbacks. Second, this patch introduces the concept of taskprocessor local data, data that may be set on a taskprocessor and provided along with the data pointer when a task is pushed using the ast_taskprocessor_push_local() call. This allows the task to have both data specific to that taskprocessor, in addition to data specific to that invocation. With those two changes, the dispatch object can be removed completely, and the message is simply refcounted and sent directly to the taskprocessor. Review: https://reviewboard.asterisk.org/r/2884/ ........ Merged revisions 399887,400138,400178,400180-400181 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@400186 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-09-24chan_iax2: Prevent some needless breaking of the native IAX2 bridge.Richard Mudgett
* Clean up some twisted code in the iax2_bridge() loop. * Add AST_CONTROL_VIDUPDATE and AST_CONTROL_SRCCHANGE to a list of frames to prevent the native bridge loop from breaking. * Passing the AST_CONTROL_T38_PARAMETERS frame should also allow FAX over a native IAX2 bridge. (issue ABE-2912) Review: https://reviewboard.asterisk.org/r/2870/ ........ Merged revisions 399697 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 399708 from http://svn.asterisk.org/svn/asterisk/branches/11 For v12 and above this is really just documentation until IAX2 native bridging is restored. ........ Merged revisions 399736 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@399737 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-09-16chan_iax2: Fix saving the wrong expiry time in astdb.Richard Mudgett
When a new IAX2 client registers, the astdb database is updated with the value of minregexpire defined in iax.conf instead of using the expiry time that is provided by the client. The provided expiry time of the client is updated after inserting the astdb entry. As a consequence, restarting or reloading asterisk creates clients whose registration may expire before they reregister. The clients are therefore unavailable after minregexpire seconds until they reregister. * Move updating of the expiry time to before inserting into the astdb. (closes issue ASTERISK-22504) Reported by: Stefan Wachtler Patches: chan_iax2.c.patch (license #6533) patch uploaded by Stefan Wachtler ........ Merged revisions 399158 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 399159 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 399160 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@399161 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-09-05chan_iax2: Reduce indentation in __attempt_transmit().Richard Mudgett
* Reduce indentation in __attempt_transmit(). * Don't update the static last error time variable every time in __schedule_action() and socket_read(). ........ Merged revisions 398456 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 398457 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 398458 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@398462 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-09-05chan_iax2: Fix stray reference to worker thread idle_list.Richard Mudgett
* Fix stray reference to idle_list in cleanup_thread_list(). This may be the reason for the note in iax2_process_thread() about threads not being removed from the task lists. * Move cleanup_thread_list(&idle_list) to after the other lists are cleaned up. ........ Merged revisions 398416 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 398417 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 398418 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@398419 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-09-05chan_iax2: Fix bridgecallno deadlock avoidance.Richard Mudgett
* Fix bridgecallno deadlock avoidance. When doing deadlock avoidance, you need to retest the status of values for each loop to see if you still need the lock for bridgecallno. * As a safety check, after acquiring the bridgecallno lock you should check if iaxs[bridgecallno] is NULL just like the current callno checks. * Move setting thread->iostate to IAX_IOSTATE_IDLE to after processing any deferred frames to ensure that the iostate is IDLE when it is placed back into the idle list. defer_full_frame() tries to ensure iax2_process_thread() wakes up to process the frame. ........ Merged revisions 398379 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 398380 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 398381 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@398384 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-27Fix uninitialized value in struct ast_control_pvt_cause_code usage.Richard Mudgett
........ Merged revisions 397744 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 397745 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397746 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-17Strip down the old event systemKinsey Moore
This removes unused code, event types, IE pltypes, and event IE types where possible and makes several functions private that were once public. This includes a renumbering of the remaining event and IE types which breaks binary compatibility with previous versions. The last remaining consumers of the old event system (or parts thereof) are main/security_events.c, res/res_security_log.c, tests/test_cel.c, tests/test_event.c, main/cel.c, and the CEL backends. Review: https://reviewboard.asterisk.org/r/2703/ (closes issue ASTERISK-22139) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396887 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-15Remove some dead code dealing with: AST_BRIDGE_REC_CHANNEL_0, ↵Richard Mudgett
AST_BRIDGE_REC_CHANNEL_1, and AST_BRIDGE_IGNORE_SIGS. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396734 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-14chan_iax2: Conditionally remove native support for now.Richard Mudgett
(issue ASTERISK-21944) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396710 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-02Get rid of ast_bridged_channel() and the bridged_channel field on ast_channels.Mark Michelson
This commit is smaller than the initial review placed on review board. This is because a change to allow for channel drivers to access parking functionality externally was committed and invalidated quite a few of the changes initially made. (closes issue ASTERISK-22039) reported by Matt Jordan Review: https://reviewboard.asterisk.org/r/2717 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396103 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-01Support externally initiated parking requests; remove some dead codeMatthew Jordan
This patch does the following: * It adds support for externally initiated parking requests. In particular, chan_skinny has a protocol level message that initiates a call park. This patch now supports that option, as well as the protocol specific mechanisms in chan_dahdi/sig_analog and chan_mgcp. * A parking bridge features virtual table has been added that provides access to the parking functionality that the Bridging API needs. This includes requests to park an entire 'call' (with little or no additional information, thank you chan_skinny), perform a blind transfer to a parking extension, determine if an extension is a parking extension, as well as the actual "do the parking" request from the Bridging API. * Refactoring in chan_mgcp, chan_skinny, and chan_dahdi to make use of the new functions * The removal of some - but not all - dead parking code from features.c This also fixed blind transferring a multi-party bridge to a parking lot (which was implemented, but had at least one code path where using the parking features kK might not have worked) Review: https://reviewboard.asterisk.org/r/2710 (closes issue ASTERISK-22134) Reported by: Matt Jordan git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396028 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-01Split caching out from the stasis_caching_topic.David M. Lee
In working with res_stasis, I discovered a significant limitation to the current structure of stasis_caching_topics: you cannot subscribe to cache updates for a single channel/bridge/endpoint/etc. To address this, this patch splits the cache away from the stasis_caching_topic, making it a first class object. The stasis_cache object is shared amongst individual stasis_caching_topics that are created per channel/endpoint/etc. These are still forwarded to global whatever_all_cached topics, so their use from most of the code does not change. In making these changes, I noticed that we frequently used a similar pattern for bridges, endpoints and channels: single_topic ----------------> all_topic ^ | single_topic_cached ----+----> all_topic_cached | +----> cache This pattern was extracted as the 'Stasis Caching Pattern', defined in stasis_caching_pattern.h. This avoids a lot of duplicate code between the different domain objects. Since the cache is now disassociated from its upstream caching topics, this also necessitated a change to how the 'guaranteed' flag worked for retrieving from a cache. The code for handling the caching guarantee was extracted into a 'stasis_topic_wait' function, which works for any stasis_topic. (closes issue ASTERISK-22002) Review: https://reviewboard.asterisk.org/r/2672/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@395954 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-07-25A great big renaming patchMatthew Jordan
This patch renames the bridging* files to bridge*. This may seem pedantic and silly, but it fits better in line with current Asterisk naming conventions: * channel is not "channeling" * monitor is not "monitoring" etc. A bridge is an object. It is a first class citizen in Asterisk. "Bridging" is the act of using a bridge on a set of channels - and the API that fulfills that role is more than just the action. (closes issue ASTERISK-22130) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@395378 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-07-08Move channel driver Registry manager events to core.Jason Parker
This also shuffles the stasis system topic and related handling. (closes issue ASTERISK-21488) Review: https://reviewboard.asterisk.org/r/2631/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393804 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-07-01Refactor extraneous channel eventsKinsey Moore
This change removes JitterBufStats, ChannelReload, and ChannelUpdate and refactors the following events to travel over Stasis-Core: * LocalBridge * DAHDIChannel * AlarmClear * SpanAlarmClear * Alarm * SpanAlarm * DNDState * MCID * SIPQualifyPeerDone * SessionTimeout Review: https://reviewboard.asterisk.org/r/2627/ (closes issue ASTERISK-21476) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393284 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-06-28Add stasis publications for blind and attended transfers.Mark Michelson
This creates stasis messages that are sent during a blind or attended transfer. The stasis messages also are converted to AMI events. Review: https://reviewboard.asterisk.org/r/2619 (closes issue ASTERISK-21337) Reported by Matt Jordan git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393182 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-06-22Migrate PeerStatus events to stasis, add stasis endpoints, and add ↵Joshua Colp
chan_pjsip device state. (closes issue ASTERISK-21489) (closes issue ASTERISK-21503) Review: https://reviewboard.asterisk.org/r/2601/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392538 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-06-17Update Asterisk's CDRs for the new bridging frameworkMatthew Jordan
This patch is the initial push to update Asterisk's CDR engine for the new bridging framework. This patch guts the existing CDR engine and builds the new on top of messages coming across Stasis. As changes in channel state and bridge state are detected, CDRs are built and dispatched accordingly. This fundamentally changes CDRs in a few ways. (1) CDRs are now *very* reflective of the actual state of channels and bridges. This means CDRs track well with what an actual channel is doing - which is useful in transfer scenarios (which were previously difficult to pin down). It does, however, mean that CDRs cannot be 'fooled'. Previous behavior in Asterisk allowed for CDR applications, channels, and other properties to be spoofed in parts of the code - this no longer works. (2) CDRs have defined behavior in multi-party scenarios. This behavior will not be what everyone wants, but it is a defined behavior and as such, it is predictable. (3) The CDR manipulation functions and applications have been overhauled. Major changes have been made to ResetCDR and ForkCDR in particular. Many of the options for these two applications no longer made any sense with the new framework and the (slightly) more immutable nature of CDRs. There are a plethora of other changes. For a full description of CDR behavior, see the CDR specification on the Asterisk wiki. (closes issue ASTERISK-21196) Review: https://reviewboard.asterisk.org/r/2486/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391947 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-06-11IAX2: Transfer Reject: Lock bridgecallno before touching it, refactorAlec L Davis
1). When touching the bridgecallno, we need to lock it. 2). Remove magic number '0' and replace with TRANSFER_NONE. 3). Exit early if no bridgecallno. 4). Reduce indentation. Reported by: alecdavis Tested by: alecdavis alecdavis (license 585) Review https://reviewboard.asterisk.org/r/2613/ ........ Merged revisions 391333 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 391334 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391335 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-06-10chan_iax2: nativebridge refactor, missed unlock bridgecallnoAlec L Davis
........ Merged revisions 391143 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 391148 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391154 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-06-10fix bad edit after conflict resolutionAlec L Davis
........ Merged revisions 391107 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 391111 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391112 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-06-10IAX2: refactor nativebridge transferAlec L Davis
remove triple checking of iaxs[fr->callno]->transferring reduce indentation. Reported by: alecdavis Tested by: alecdavis alecdavis (license 585) Review https://reviewboard.asterisk.org/r/2602/ ........ Merged revisions 391065 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 391084 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391102 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-06-10IAX2: fix race condition with nativebridge transfers.Alec L Davis
1). When touching the bridgecallno, we need to lock it. 2). stop_stuff() which calls iax2_destroy_helper() Assumes the lock on the pvt is already held, when iax2_destroy_helper() is called. Thus we need to lock the bridgecallno pvt before we call stop_stuff(iaxs[fr->callno]->bridgecallno); 3). When evaluating the state of 'callno->transferring' of the current leg, we can't change it to READY unless the bridgecallno is locked. Why, if we are interrupted by the other call leg before 'transferring = TRANSFER_RELEASED', the interrupt will find that it is READY and that the bridgecallno is also READY so Releases the legs. (closes issue ASTERISK-21409) Reported by: alecdavis Tested by: alecdavis alecdavis (license 585) Review https://reviewboard.asterisk.org/r/2594/ ........ Merged revisions 391062 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 391063 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391064 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-24Split Hold event into Hold/Unhold, and move it into core.Jason Parker
(closes issue ASTERISK-21487) Review: https://reviewboard.asterisk.org/r/2565/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@389746 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-24Migrate a large number of AMI events over to Stasis-CoreMatthew Jordan
This patch moves a number of AMI events over to the Stasis-Core message bus. This includes: * ChanSpyStart/Stop * MonitorStart/Stop * MusicOnHoldStart/Stop * FullyBooted/Reload * All Voicemail/MWI related events In addition, it adds some Stasis-Core and AMI support for generic AMI messages, refactors the message router in AMI to use a single router with topic forwarding for the topics that AMI cares about, and refactors MWI message types and topics to be more name compliant. Review: https://reviewboard.asterisk.org/r/2532 (closes issue ASTERISK-21462) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@389733 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-21Merge in the bridge_construction branch to make the system use the Bridging API.Richard Mudgett
Breaks many things until they can be reworked. A partial list: chan_agent chan_dahdi, chan_misdn, chan_iax2 native bridging app_queue COLP updates DTMF attended transfers Protocol attended transfers git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@389378 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-17Fix shutdown assertions in stasis-coreDavid M. Lee
In r388005, macros were introduced to consistently define message types. This added an assert if a message type was used either before it was initialized or after it had been cleaned up. It turns out that this assertion fires during shutdown. This actually exposed a hidden shutdown ordering problem. Since unsubscribing is asynchronous, it's possible that the message types used by the subscription could be freed before the final message of the subscription was processed. This patch adds stasis_subscription_join(), which blocks until the last message has been processed by the subscription. Since joining was most commonly done right after an unsubscribe, a stasis_unsubscribe_and_join() convenience function was also added. Similar functions were also added to the stasis_caching_topic and stasis_message_router, since they wrap subscriptions and have similar problems. Other code in trunk was refactored to join() where appropriate, or at least verify that the subscription was complete before being destroyed. Review: https://reviewboard.asterisk.org/r/2540 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@389011 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-17Remove Character Limit On "inkeys" For IAX2Michael L. Young
Currently, the buffer for processing "inkeys" is limited to 256 characters. If the user has many keys and the names of those key files are long, the 256 character limit is not enough. * Change inkeys buffer to be dynamic (closes issue ASTERISK-21398) Reported by: Pavel Kopchyk Tested by: Pavel Kopchyk, Michael L. Young Patches: asterisk-21398-iax2-inkeys-dynamic-buffer_v3.diff by Michael L. Young (license 5026) Review: https://reviewboard.asterisk.org/r/2501/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@389009 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-17Stasis: Update security events to use StasisJonathan Rose
Also moves ACL messages to the security topic and gets rid of the ACL topic (closes issue ASTERISK-21103) Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/2496/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@388975 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-03Stasis: Convert network change events into network change stasis messagesJonathan Rose
(issue ASTERISK-21103) Review: https://reviewboard.asterisk.org/r/2490/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@387594 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-01Remove some unnecessary calls to ast_bridged_channel() in chan_iax2.cRichard Mudgett
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@387182 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-04-30Stasis Core: Refactor ACL Change events to go out over the stasis core msg busJonathan Rose
(issue ASTERISK-21103) Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/2481/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@387037 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-04-12IAX2 defer_full_frames fail to get sentAlec L Davis
Ensure iax2_process_thread is signalled when a deferred frame is queued to it. (closes issue ASTERISK-18827) Reported by: alecdavis Tested by: alecdavis alecdavis (license 585) Review https://reviewboard.asterisk.org/r/2426/ ........ Merged revisions 385429 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 385430 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@385431 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-04-12IAX2, prevent network thread starting before all helper threads are readyAlec L Davis
On startup, it's possible for a frame to arrive before the processing threads were ready. In iax2_process_thread() the first pass through falls into ast_cond_wait, should a frame arrive before we are at ast_cond_wait, the signal will be ignored. The result iax2_process_thread stays at ast_cond_wait forever, with deferred frames being queued. Fix: When creating initial idle iax2_process_threads, wait for init_cond to be signalled after each thread is started. (issue ASTERISK-18827) Reported by: alecdavis Tested by: alecdavis alecdavis (license 585) Review https://reviewboard.asterisk.org/r/2427/ ........ Merged revisions 385402 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 385403 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@385406 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-03-27Convert MWI state message type to the new stasis naming conventionKinsey Moore
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@384219 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-03-16Transition MWI to Stasis-coreKinsey Moore
Remove MWI's dependency on the event system by moving it to Stasis-core. This also introduces forwarding topic pools in Stasis-core which aggregate many dynamically allocated topics into a single primary topic. Review: https://reviewboard.asterisk.org/r/2368/ (closes issue ASTERISK-21097) Patch-by: Kinsey Moore git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@383284 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-02-28Prevent deadlock in chan_iax2 when attempting to set caller IDMatthew Jordan
A deadlock can occur in chan_iax2 when it attempts to set the caller ID, as it already holds the iax2 private lock and improperly fails to obtain the channel lock before calling ast_set_callerid. By not safely obtaining the channel lock, a locking inversion can take place, causing a deadlock. This patch solves this by calling the required deadlock avoidance functions that obtain the channel lock before setting the caller ID. Thanks to Pavel for fixing my syntax errors and testing this patch out. (closes issue ASTERISK-21128) Reported by: Pavel Troller Tested by: Pavel Troller patches: ASTERISK-21128-1.8.diff uploaded by mjordan (license 6283) ASTERISK-21128-modified-1.8.diff uploaded by Pavel Troller (license 6302) ........ Merged revisions 382233 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 382234 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@382236 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-02-14Use a shuffling algorithm to find unused IAX2 call numbers.Sean Bright
While adding red-black tree containers to astobj2 in r376575, Richard pointed out the way chan_iax2 finds unused call numbers will prevent ao2_container integrity checks at runtime. This patch removes the ao2_container and instead uses fixed sized arrays and a modified Fisher-Yates-Durstenfeld shuffle to maintain the call number list. While the locking semantics are similar to the ao2_container implementation, this implementation should be faster and more memory efficient. Review: https://reviewboard.asterisk.org/r/2288/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@381427 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-31Move IAX firmware related functionality into separate files.Sean Bright
This patch is mostly a reorganization of existing code with a few exceptions: * Added doxygen comments to all of the extracted functions. * Split reload_firmware(int unload) into iax_firmware_reload() and iax_firmware_unload() for readability. * Create iax_firmware_traverse() to support the 'iax2 show firmware' CLI command. * Renamed iax_check_version() to iax_firmware_get_version() and change its arguments and return value so that it returns a success/failure value and sets the selected version into an out parameter to avoid confusion with failure and version 0. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@380695 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-29Move the ancillary iax2 source files into a separate sub-directory.Sean Bright
This patch just moves the IAX2 source and header files into a separate iax2 sub-directory in the channels directory, similar to how the sip source files are structured. The only thing that was added was an #ifndef to protect provision.h from multiple inclusion. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@380433 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-28Correct the number of available call numbers in IAX2.Sean Bright
There is currently an edge case where call number 32768 might be allocated for a call, even though the IAX2 protocol requires call numbers be only 15 bits. This resulted in some unpredictable behavior when call number 32678 is chosen. This patch was mostly written by Richard Mudgett via ReviewBoard. I'm just committing it. Review: https://reviewboard.asterisk.org/r/2293/ ........ Merged revisions 380254 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 380255 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@380256 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-22Remove a large block of commented out code from chan_iax2.Sean Bright
During the conversion to the newer CLI command structure the old definitions were commented out. I think it's safe to remove them completely now. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@379936 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-02Prevent exhaustion of system resources through exploitation of event cacheMatthew Jordan
Asterisk maintains an internal cache for devices in the event subsystem. The device state cache holds the state of each device known to Asterisk, such that consumers of device state information can query for the last known state for a particular device, even if it is not part of an active call. The concept of a device in Asterisk can include entities that do not have a physical representation. One way that this occurred was when anonymous calls are allowed in Asterisk. A device was automatically created and stored in the cache for each anonymous call that occurred; this was possible in the SIP and IAX2 channel drivers and through channel drivers that utilized the res_jabber/res_xmpp resource modules (Gtalk, Jingle, and Motif). These devices are never removed from the system, allowing anonymous calls to potentially exhaust a system's resources. This patch changes the event cache subsystem and device state management to no longer cache devices that are not associated with a physical entity. (issue ASTERISK-20175) Reported by: Russell Bryant, Leif Madsen, Joshua Colp Tested by: kmoore patches: event-cachability-3.diff uploaded by jcolp (license 5000) ........ Merged revisions 378303 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 378320 from http://svn.asterisk.org/svn/asterisk/branches/10 ........ Merged revisions 378321 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@378322 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-21Add red-black tree container type to astobj2.Richard Mudgett
* Add red-black tree container type. * Add CLI command "astobj2 container dump <name>" * Added ao2_container_dump() so the container could be dumped by other modules for debugging purposes. * Changed ao2_container_stats() so it can be used by other modules like ao2_container_check() for debugging purposes. * Updated the unit tests to check red-black tree containers. (closes issue ASTERISK-19970) Reported by: rmudgett Tested by: rmudgett Review: https://reviewboard.asterisk.org/r/2110/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@376575 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-07Multiple revisions 375993-375994Mark Michelson
........ r375993 | mmichelson | 2012-11-07 11:01:13 -0600 (Wed, 07 Nov 2012) | 30 lines Fix misuses of timeouts throughout the code. Prior to this change, a common method for determining if a timeout was reached was to call a function such as ast_waitfor_n() and inspect the out parameter that told how many milliseconds were left, then use that as the input to ast_waitfor_n() on the next go-around. The problem with this is that in some cases, submillisecond timeouts can occur, resulting in the out parameter not decreasing any. When this happens thousands of times, the result is that the timeout takes much longer than intended to be reached. As an example, I had a situation where a 3 second timeout took multiple days to finally end since most wakeups from ast_waitfor_n() were under a millisecond. This patch seeks to fix this pattern throughout the code. Now we log the time when an operation began and find the difference in wall clock time between now and when the event started. This means that sub-millisecond timeouts now cannot play havoc when trying to determine if something has timed out. Part of this fix also includes changing the function ast_waitfor() so that it is possible for it to return less than zero when a negative timeout is given to it. This makes it actually possible to detect errors in ast_waitfor() when there is no timeout. (closes issue ASTERISK-20414) reported by David M. Lee Review: https://reviewboard.asterisk.org/r/2135/ ........ r375994 | mmichelson | 2012-11-07 11:08:44 -0600 (Wed, 07 Nov 2012) | 3 lines Remove some debugging that accidentally made it in the last commit. ........ Merged revisions 375993-375994 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 375995 from http://svn.asterisk.org/svn/asterisk/branches/10 ........ Merged revisions 376014 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@376015 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-05Refactor ast_timer_ack to return an error and handle the error in timer usersMatthew Jordan
Currently, if an acknowledgement of a timer fails Asterisk will not realize that a serious error occurred and will continue attempting to use the timer's file descriptor. This can lead to situations where errors stream to the CLI/log file. This consumes significant resources, masks the actual problem that occurred (whatever caused the timer to fail in the first place), and can leave channels in odd states. This patch propagates the errors in the timing resource modules up through the timer core, and makes users of these timers handle acknowledgement failures. It also adds some defensive coding around the use of timers to prevent using bad file descriptors in off nominal code paths. Note that the patch created by the issue reporter was modified slightly for this commit and backported to 1.8, as it was originally written for Asterisk 10. Review: https://reviewboard.asterisk.org/r/2178/ (issue ASTERISK-20032) Reported by: Jeremiah Gowdy patches: jgowdy-timerfd-6-22-2012.diff uploaded by Jeremiah Gowdy (license 6358) ........ Merged revisions 375893 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 375894 from http://svn.asterisk.org/svn/asterisk/branches/10 ........ Merged revisions 375895 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@375896 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-16Remove a log message that was left in accidentally from call-id logging ↵Joshua Colp
development. ........ Merged revisions 375051 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@375052 65c4cc65-6c06-0410-ace0-fbb531ad65f3