summaryrefslogtreecommitdiff
path: root/res/res_agi.c
AgeCommit message (Collapse)Author
2013-12-18channel locking: Add locking for channel snapshot creationKevin Harwell
Original commit message by mmichelson (asterisk 12 r403311): "This adds channel locks around calls to create channel snapshots as well as other functions which operate on a channel and then end up creating a channel snapshot. Functions that expect the channel to be locked prior to being called have had their documentation updated to indicate such." The above was initially committed and then reverted at r403398. The problem was found to be in core_local.c in the publish_local_bridge_message function. The ast_unreal_lock_all function locks and adds a reference to the returned channels and while they were being unlocked they were not being unreffed when no longer needed. Fixed by unreffing the channels. Also in bridge.c a lock was obtained on "other->chan", but then an attempt was made to unlock "other" and not the previously locked channel. Fixed by unlocking "other->chan" (closes issue ASTERISK-22709) Reported by: John Bigelow ........ Merged revisions 404237 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404260 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-05Reverting r403311. It's causing ARI tests to hang.David M. Lee
........ Merged revisions 403398 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@403404 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-03Add channel locking for channel snapshot creation.Mark Michelson
This adds channel locks around calls to create channel snapshots as well as other functions which operate on a channel and then end up creating a channel snapshot. Functions that expect the channel to be locked prior to being called have had their documentation updated to indicate such. ........ Merged revisions 403311 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@403314 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-10-08Make app_queue and res_agi independent of AMI being enabled.Richard Mudgett
The https://reviewboard.asterisk.org/r/2888/ review changes manager to not subscribe to stasis when it is disabled for performance reasons. When manager is disabled app_queue and res_agi decline to load and fail to clean up what they have already allocated. * Made app_queue and res_agi clean up allocated resources when they decline to load. * Made app_queue and res_agi use their own subscriptions to the stasis topics instead of borrowing manager's message router structure inappropriately. (closes issue ASTERISK-22604) Reported by: rmudgett Review: https://reviewboard.asterisk.org/r/2902/ ........ Merged revisions 400671 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@400672 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-10-03Cache string values of formats on ast_format_cap() to save processing.Mark Michelson
Channel snapshots have string representations of the channel's native formats. Prior to this change, the format strings were re-created on ever channel snapshot creation. Since channel native formats rarely change, this was very wasteful. Now, string representations of formats may optionally be stored on the ast_format_cap for cases where string representations may be requested frequently. When formats are altered, the string cache is marked as invalid. When strings are requested, the cache validity is checked. If the cache is valid, then the cached strings are copied. If the cache is invalid, then the string cache is rebuilt and copied, and the cache is marked as being valid again. Review: https://reviewboard.asterisk.org/r/2879 ........ Merged revisions 400356 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@400363 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-08-30Memory leak fixKevin Harwell
ast_xmldoc_printable returns an allocated block that must be freed by the caller. Fixed manager.c and res_agi.c to stop leaking these results. (closes issue ASTERISK-22395) Reported by: Corey Farrell Patches: manager-leaks-12.patch uploaded by coreyfarrell (license 5909) res_agi-xmldoc-leaks.patch uploaded by coreyfarrell (license 5909) ........ Merged revisions 398060 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 398061 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 398062 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@398063 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-22Add SayAlphaCase and similar functionality for AGIKinsey Moore
This adds a new dialplan application, SayAlphaCase, that performs much the same function as SayAlpha except that it takes additional options which allow the user to specify whether the case of each letter should be announced for uppercase, lowercase, or all letters. Similar functionality has been added to the SAY ALPHA AGI command via an optional parameter. Original Patch by: Kevin Scott Adams Reported by: Kevin Scott Adams Review: https://reviewboard.asterisk.org/r/2725/ (closes issue ASTERISK-20782) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397493 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-01Fix documentation replication issuesKinsey Moore
This prevents XML documentation duplication by expanding channel and bridge snapshot tags into channel and bridge snapshot parameter sets with a given prefix or defaulting to no prefix. This also prevents documentation from becoming fractured and out of date by keeping all variations of the documentation in template form such that it only needs to be updated once and keeps maintenance to a minimum. Review: https://reviewboard.asterisk.org/r/2708/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@395985 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-31Update CONTROL STREAM FILE to accept an 'offsetms' parameterMatthew Jordan
This patch allows starting playback of audio through the CONTROL STREAM FILE AGI command to start at a particular offset. It will also return the final position of the file in the 'endpos' attribute. (closes issue ASTERISK-17803) Reported by: Murray Melvin patches: res_agi.c.r316293.diff uploaded by murraytm (license 6221) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@395906 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-07-18Properly indicate failure to open an audio stream in res_agiMichael L. Young
If there is an error streaming an audio file, the current return status makes it difficult for an AGI script to determine that there was an error with the audio file. This patches changes the result to return -1 and the function returns RESULT_FAILURE instead of RESULT_SUCCESS. From looking at other parts of res_agi, this would appear to be the proper way to handle an error. (closes issue ASTERISK-21903) Reported by: Ariel Wainer Tested by: Ariel Wainer Patches: asterisk-21903-return-stream-res_1.8.diff by Michael L. Young (license 5026) Review: https://reviewboard.asterisk.org/r/2625/ ........ Merged revisions 394640 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 394641 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394642 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-07-08Refactor operations to access the stasis cache instead of objects directly ↵Joshua Colp
when retrieving information. (closes issue ASTERISK-21883) Review: https://reviewboard.asterisk.org/r/2645/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393831 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-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-10Add AGI command arguments to AsyncAGI eventKinsey Moore
This makes the AGI AsyncAGI event put provided AGI command arguments in the event's environment. (closes issue ASTERISK-21304) Patch-By: Dirk Wendland git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391271 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-06-06Fix documentation generationKinsey Moore
Regression from r390701 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@390730 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-06-06Split AGI manager events, to remove SubEvent field.Jason Parker
This moves them to stasis, in the process. (closes issue ASTERISK-21470) Review: https://reviewboard.asterisk.org/r/2587/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@390701 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-02-22Fix FastAGI To Properly Check For A ConnectionMichael L. Young
When IPv6 support was added to FastAGI, the intent was to have the ability to check all addresses resolved for a host since we might receive an IPv4 address and an IPv6 address. The problem with the current code, is that, since we are doing O_NONBLOCK, we get EINPROGRESS when calling ast_connect() but are ignoring this instead of handling it. We break out of the loop and continue on. When we later call ast_poll(), it succeeds but we never check if we have a connection or not on the socket level. We then attempt to send data to the host address that we think is setup and it fails. We then check the errno and see that we have "connection refused" and then return with agi failed. This patch does the following: * Handles EINPROGRESS by creating the function handle_connection() - ast_poll() was moved into this function - This function checks the results of the connection on the socket level after calling ast_poll() * Continues to the next address if the above fails to create a connection * Once all addresses resolved are tried and we still are unable to establish a connection, then we return that the FastAGI call failed (closes issue ASTERISK-21065) Reported by: Jeremy Kister Tested by: Jeremy Kister, Michael L. Young Patches: asterisk-21065_poll_correctly_v4.diff Michael L. Young (license 5026) Review: https://reviewboard.asterisk.org/r/2330/ ........ Merged revisions 381893 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@381894 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-22Add ControlPlayback manager actionMatthew Jordan
This patch adds the capability for asynchronous manipulation of audio being played back to a channel though a new AMI action "ControlPlayback". The ControlPlayback action supports a number of operations, the availability of which depend on the application being used to send audio to the channel. When the audio playback was initiated using the ControlPlayback application or CONTROL STREAM FILE AGI command, the audio can be paused, stopped, restarted, reversed, or skipped forward. When initiated by other mechanisms (such as the Playback application), the audio can be stopped, reversed, or skipped forward. Review: https://reviewboard.asterisk.org/r/2265/ (closes issue ASTERISK-20882) Reported by: mjordan git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@379830 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-04Fix DBDelTree error codes for AMI, CLI and AGIDavid M. Lee
The AMI DBDelTree command will return Success/Key tree deleted successfully even if the given key does not exist. The CLI command 'database deltree' had a similar problem, but was saved because it actually responded with '0 database entries removed'. AGI had a slightly different error, where it would return success if the database was unavailable. This came from confusion about the ast_db_deltree retval, which is -1 in the event of a database error, or number of entries deleted (including 0 for deleting nothing). * Changed some poorly named res variables to num_deleted * Specified specific errors when calling ast_db_deltree (database unavailable vs. entry not found vs. success) * Fixed similar bug in AGI database deltree, where 'Database unavailable' results in successful result (closes issue AST-967) Reported by: John Bigelow Review: https://reviewboard.asterisk.org/r/2138/ ........ Merged revisions 374426 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 374427 from http://svn.asterisk.org/svn/asterisk/branches/10 ........ Merged revisions 374428 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374429 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-09-28Include channel uniqueid in "AsyncAGI" and "AGIExec" events.Richard Mudgett
* Added AMI event documentation for AsyncAGI and AGIExec events. (closes issue ASTERISK-20318) Reported by: Dan Cropp Patches: res_agi_patch.txt (license #6422) patch uploaded by Dan Cropp modified for trunk. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374075 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-09-28Update documentation to make it explicit that "stream file" will not restart ↵Joshua Colp
musiconhold. (issue ASTERISK-17367) Reported by: oej ........ Merged revisions 373989 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 373990 from http://svn.asterisk.org/svn/asterisk/branches/10 ........ Merged revisions 373991 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@373992 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-09-25res_agi: async_agi responsiveness improvement on datastore problemsJonathan Rose
This patch changes get_agi_cmd so that the return can be checked to differentiate between an empty list success and something that triggered an error. This in turn allows launch_asyncagi to detect these errors and break free from the command processing loop so that the async agi can be ended more cleanly (closes issue ASTERISK-20109) Reported by: Jeremiah Gowdy Patches: jgowdy-7-9-2012.diff uploaded by Jeremiah Gowdy (license 6358) (Modified by me to fix some logical issues and apply to trunk) Review: https://reviewboard.asterisk.org/r/2117/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@373608 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-07-31Clean up and ensure proper usage of alloca()Kinsey Moore
This replaces all calls to alloca() with ast_alloca() which calls gcc's __builtin_alloca() to avoid BSD semantics and removes all NULL checks on memory allocated via ast_alloca() and ast_strdupa(). (closes issue ASTERISK-20125) Review: https://reviewboard.asterisk.org/r/2032/ Patch-by: Walter Doekes (wdoekes) ........ Merged revisions 370642 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 370643 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370655 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-07-25res_agi: Add message indicating need for \n character in verbose messageJonathan Rose
The while loop responsible for reading AGI messages from a fastAGI service can end up looping indefinitely when an AGI script fails to indicate the end of a message with a \n character. This patch adds an indication that we are expecting a \n character to end the message to make it more clear to users that this is necessary if they are receiving this warning over and over. (issue ASTERISK-20061) Reported by: Eike Kuiper ........ Merged revisions 370494 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 370495 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370510 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-17Fix places in resources where a negative return value could impact executionMatthew Jordan
This patch addresses a number of modules in resources that did not handle the negative return value from function calls adequately. This includes: * res_agi.c: if the result of the read function is a negative number, indicating some failure, the result would instead be treated as the number of bytes read. This patch now treats negative results in the same manner as an end of file condition, with the exception that it also logs the error code indicated by the return. * res_musiconhold.c: if spawn_mp3 fails to assign a file descriptor to srcfd, and instead assigns a negative value, that file descriptor could later be passed to functions that require a valid file descriptor. If spawn_mp3 fails, we now immediately retry instead of continuing in the logic. * res_rtp_asterisk.c: if no codec can be matched between two RTP instances in a peer to peer bridge, we immediately return instead of attempting to use the codec payload type as an index to determine the appropriate negotiated codec. (issue ASTERISK-19655) Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/1863/ ........ Merged revisions 362362 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 362364 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@362365 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-13Finalize ast_channel opaquificationTerry Wilson
Review: https://reviewboard.asterisk.org/r/1786/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@358907 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-29Add IPv6 support to FastAGI.Sean Bright
Review: https://reviewboard.asterisk.org/r/1774/ Reviewed by: Simon Perreault, Mark Michelson git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@357610 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-29Opaquify ast_channel structs and listsTerry Wilson
Review: https://reviewboard.asterisk.org/r/1773/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@357542 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-24Opaquification for ast_format structs in struct ast_channelTerry Wilson
Review: https://reviewboard.asterisk.org/r/1770/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@356573 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-20ast_channel opaquification of pointers and integral typesTerry Wilson
Review: https://reviewboard.asterisk.org/r/1753/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@356042 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-14res_agi: Add AGIEXITONHANGUP variable.Russell Bryant
This patch adds a variable AGIEXITONHANGUP for res_agi. If this variable is set to "yes" on a channel, AGI() will exit immediately once a channel hangup has been detected. This was the behavior of AGI() in Asterisk 1.4 and earlier and is still desired by some people. Review: https://reviewboard.asterisk.org/r/1734/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@355102 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-13Opaquify char * and char[] in ast_channelTerry Wilson
Review: https://reviewboard.asterisk.org/r/1733/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@354968 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-24Opaquify channel stringfieldsTerry Wilson
Continue channel opaque-ification by wrapping all of the stringfields. Eventually, we will restrict what can actually set these variables, but the purpose for now is to hide the implementation and keep people from adding code that directly accesses the channel structure. Semantic changes will follow afterward. Review: https://reviewboard.asterisk.org/r/1661/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@352348 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-01-09Replace direct access to channel name with accessor functionsTerry Wilson
There are many benefits to making the ast_channel an opaque handle, from increasing maintainability to presenting ways to kill masquerades. This patch kicks things off by taking things a field at a time, renaming the field to '__do_not_use_${fieldname}' and then writing setters/getters and converting the existing code to using them. When all fields are done, we can move ast_channel to a C file from channel.h and lop off the '__do_not_use_'. This patch sets up main/channel_interal_api.c to be the only file that actually accesses the ast_channel's fields directly. The intent would be for any API functions in channel.c to use the accessor functions. No more monkeying around with channel internals. We should use our own APIs. The interesting changes in this patch are the addition of channel_internal_api.c, the moving of the AST_DATA stuff from channel.c to channel_internal_api.c (note: the AST_DATA stuff will have to be reworked to use accessor functions when ast_channel is really opaque), and some re-working of the way channel iterators/callbacks are handled so as to avoid creating fake ast_channels on the stack to pass in matching data by directly accessing fields (since "name" is a stringfield and the fake channel doesn't init the stringfields, you can't use the ast_channel_name_set() function). I went with ast_channel_name(chan) for a getter, and ast_channel_name_set(chan, name) for a setter. The majority of the grunt-work for this change was done by writing a semantic patch using Coccinelle ( http://coccinelle.lip6.fr/ ). Review: https://reviewboard.asterisk.org/r/1655/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@350223 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-11-15Make FastAGI HANGUP show up in AGI debug output.Richard Mudgett
* Change from using send() to ast_agi_send() so the HANGUP shows up in the AGI debug output. (closes issue ASTERISK-18723) Reported by: James Van Vleet Patches: jira_asterisk_18723_v1.8.patch (license #5621) patch uploaded by rmudgett ........ Merged revisions 345431 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 345432 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@345433 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-10-20Fix AGI exec Park to honor the Park application parameters.Richard Mudgett
The fix for ASTERISK-12715 and ASTERISK-12685 added a check for the Park application because the channel needed to be masqueraded to prevent a crash. Since the Park application now always masquerades the channel into the parking lot, the special check is no longer needed. The fix also resulted in AGI exec Park attempting to double park the call and not honor the Park application parameters. * Removed no longer necessary call to ast_masq_park_call() by AGI exec for the Park application. (Reverts -r146923) * Fix Park application to only return 0 or -1. The AGI exec Park was causing broken pipe error messages because the Park application returned 1 on successful park. (closes issue ASTERISK-18737) ........ Merged revisions 341717 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 341718 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@341719 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-10-10Merged revisions 340109 via svnmerge from Matthew Nicholson
https://origsvn.digium.com/svn/asterisk/branches/10 ................ r340109 | mnicholson | 2011-10-10 09:15:41 -0500 (Mon, 10 Oct 2011) | 18 lines Merged revisions 340108 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r340108 | mnicholson | 2011-10-10 09:14:48 -0500 (Mon, 10 Oct 2011) | 11 lines Load the proper XML documentation when multiple modules document the same application. This patch adds an optional "module" attribute to the XML documentation spec that allows the documentation processor to match apps with identical names from different modules to their documentation. This patch also fixes a number of bugs with the documentation processor and should make it a little more efficient. Support for multiple languages has also been properly implemented. ASTERISK-18130 Review: https://reviewboard.asterisk.org/r/1485/ ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@340110 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-09-29Just formatting.Olle Johansson
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@338377 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-07-14Merged revisions 328247 via svnmerge from Leif Madsen
https://origsvn.digium.com/svn/asterisk/branches/1.10 ................ r328247 | lmadsen | 2011-07-14 16:25:31 -0400 (Thu, 14 Jul 2011) | 14 lines Merged revisions 328209 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r328209 | lmadsen | 2011-07-14 16:13:06 -0400 (Thu, 14 Jul 2011) | 6 lines Introduce <support_level> tags in MODULEINFO. This change introduces MODULEINFO into many modules in Asterisk in order to show the community support level for those modules. This is used by changes committed to menuselect by Russell Bryant recently (r917 in menuselect). More information about the support level types and what they mean is available on the wiki at https://wiki.asterisk.org/wiki/display/AST/Asterisk+Module+Support+States ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@328259 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-06-13Merged revisions 323154 via svnmerge from Leif Madsen
https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r323154 | lmadsen | 2011-06-13 15:00:41 -0400 (Mon, 13 Jun 2011) | 6 lines Tweak documentation for AGI Hangup command. (closes issue ASTERISK-17999) Reported by: Ben Klang Patches: hangup-doc.diff - uploaded by Ben Klang (License #5876) ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@323155 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-05-28Merged revisions 321436 via svnmerge from Richard Mudgett
https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r321436 | rmudgett | 2011-05-27 19:27:52 -0500 (Fri, 27 May 2011) | 4 lines Some hagi launch cleanup. Inspired by issue 19256. This patch would also fix the crash. ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@321445 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-05-03Merged revisions 316265 via svnmerge from Russell Bryant
https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r316265 | russell | 2011-05-03 14:55:49 -0500 (Tue, 03 May 2011) | 5 lines Fix a bunch of compiler warnings generated by gcc 4.6.0. Most of these are -Wunused-but-set-variable, but there were a few others mixed in here, as well. ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@316293 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-04-22Merged revisions 314780 via svnmerge from Russell Bryant
https://origsvn.digium.com/svn/asterisk/branches/1.8 ................ r314780 | russell | 2011-04-22 09:02:23 -0500 (Fri, 22 Apr 2011) | 18 lines Merged revisions 314778 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.6.2 ........ r314778 | russell | 2011-04-22 08:58:03 -0500 (Fri, 22 Apr 2011) | 11 lines Initialize buffers in getvar and getvarfull. Initialize the buffers used to hold the result from GET VARIABLE or GET VARIABLE FULL. The bug report shows func_read returning garbage in the result. It assumed that the buffer passed in was initialized, like many other functions do. In the more common code path (through the dialplan), it is initialized, so just initialize it here too. (closes issue #19050) Reported by: johnz ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@314781 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-04-18Merged revisions 314069 via svnmerge from Richard Mudgett
https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r314069 | rmudgett | 2011-04-18 11:10:10 -0500 (Mon, 18 Apr 2011) | 22 lines The AsyncAGI command loop is lax in the value it returns for the return status. * Return correct status: SUCCESS/FAILED/HANGUP. Previously, abnormal exits from the command loop such as hangup would return SUCCESS. * The "asyncagi break" command now returns SUCCESS and is now the only way to break the command loop with that status. Previously, it returned FAILED. * The AMI event AsyncAGI End is no longer sent if the AsyncAGI Start event is not sent. Previously, this happened because of an error setting up the AGI pipes. * All executed AGI commands now get an AsyncAGI Exec result event. Previously, if the command returned failure (because of hangup), the command loop just exited with FAILURE and did not send the AsyncAGI Exec result event. * Makes sure that the channel frame queue is empty on hangup. Review: https://reviewboard.asterisk.org/r/1183/ ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@314080 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-04-13Merged revisions 313700 via svnmerge from Richard Mudgett
https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r313700 | rmudgett | 2011-04-13 17:52:47 -0500 (Wed, 13 Apr 2011) | 5 lines Revert flushing stale AsyncAGI commands from -r313615. It looks like it was intentional to leave any commands or in-flight commands in the queue in case Async AGI is run again on the call. ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@313701 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-04-13Merged revisions 313658 via svnmerge from Richard Mudgett
https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r313658 | rmudgett | 2011-04-13 12:47:43 -0500 (Wed, 13 Apr 2011) | 2 lines Miscellaneous AGI diagnostic message cleanup and code optimization. ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@313659 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-04-13Merged revisions 313615 via svnmerge from Richard Mudgett
https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r313615 | rmudgett | 2011-04-13 12:18:49 -0500 (Wed, 13 Apr 2011) | 5 lines * Add missing channel lock to handle_cli_agi_add_cmd(). * Flush any Async AGI commands left over from earlier Async AGI control of the call. ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@313629 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-04-13Merged revisions 313588 via svnmerge from Richard Mudgett
https://origsvn.digium.com/svn/asterisk/branches/1.8 ................ r313588 | rmudgett | 2011-04-13 11:31:50 -0500 (Wed, 13 Apr 2011) | 55 lines Merged revisions 313579 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.6.2 ................ r313579 | rmudgett | 2011-04-13 11:29:49 -0500 (Wed, 13 Apr 2011) | 48 lines Merged revisions 313545 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r313545 | rmudgett | 2011-04-13 11:21:24 -0500 (Wed, 13 Apr 2011) | 41 lines Asterisk does not hangup a channel after endpoint hangs up. If the call that the dialplan started an AGI script for is hungup while the AGI script is in the middle of a command then the AGI script is not notified of the hangup. There are many AGI Exec commands that this can happen with. The reported applications have been: Background, Wait, Read, and Dial. Also the AGI Get Data command. * Don't wait on the Asterisk channel after it has hung up. The channel is likely to never need servicing again. * Restored the AGI script's ability to return the AGI_RESULT_HANGUP value in run_agi(). It previously only could return AGI_RESULT_SUCCESS or AGI_RESULT_FAILURE after the DeadAGI and AGI applications were merged. (closes issue #17954) Reported by: mn3250 Patches: issue17954_v1.8.patch uploaded by rmudgett (license 664) issue17954_v1.6.2.patch uploaded by rmudgett (license 664) issue17954_v1.4.patch uploaded by rmudgett (license 664) Tested by: rmudgett JIRA SWP-2171 (closes issue #18492) Reported by: devmod Tested by: rmudgett JIRA SWP-2761 (closes issue #18935) Reported by: nvitaly Tested by: astmiv, rmudgett JIRA SWP-3216 (closes issue #17393) Reported by: siby Tested by: rmudgett JIRA SWP-2727 Review: https://reviewboard.asterisk.org/r/1165/ ........ ................ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@313606 65c4cc65-6c06-0410-ace0-fbb531ad65f3