summaryrefslogtreecommitdiff
path: root/main/app.c
AgeCommit message (Collapse)Author
2016-01-13app: Queue hangup if channel is hung up during sub or macro execution.Joshua Colp
This issue was exposed when executing a connected line subroutine. When connected or redirected subroutines or macros are executed it is expected that the underlying applications and logic invoked are fast and do not consume frames. In practice this constraint is not enforced and if not adhered to will cause channels to continue when they shouldn't. This is because each caller of the connected or redirected logic does not check whether the channel has been hung up on return. As a result the the hung up channel continues. This change makes it so when the API to execute a subroutine or macro is invoked the channel is checked to determine if it has hung up. If it has then a hangup is queued again so the caller will see it and stop. ASTERISK-25690 #close Change-Id: I1f9a8ceb1487df0389f0d346ce0f6dcbcaf476ea
2016-01-04voicemail: Move app_voicemail / res_mwi_external conflict to runtimeGeorge Joseph
The menuselect conflict between app_voicemail and res_mwi_external makes it hard to package 1 version of Asterisk. There no actual build dependencies between the 2 so moving this check to runtime seems like a better solution. The ast_vm_register and ast_vm_greeter_register functions in app.c were modified to return AST_MODULE_LOAD_DECLINE instead of -1 if there is already a voicemail module registered. The modules' load_module functions were then modified to return DECLINE instead of -1 to the loader. Since -1 is interpreted by the loader as AST_MODULE_LOAD_FAILURE, the modules were incorrectly causing Asterisk to stop so this needed to be cleaned up anyway. Now you can build both and use modules.conf to decide which voicemail implementation to load. The default menuselect options still build app_voicemail and not res_mwi_external but if both ARE built, res_mwi_external will load first and become the voicemail provider unless modules.conf rules prevent it. This is noted in CHANGES. Change-Id: I7d98d4e8a3b87b8df9e51c2608f0da6ddfb89247
2015-04-09clang compiler warnings: Fix autological comparisonsMatthew Jordan
This fixes autological comparison warnings in the following: * chan_skinny: letohl may return a signed or unsigned value, depending on the macro chosen * func_curl: Provide a specific cast to CURLoption to prevent mismatch * cel: Fix enum comparisons where the enum can never be negative * enum: Fix comparison of return result of dn_expand, which returns a signed int value * event: Fix enum comparisons where the enum can never be negative * indications: tone_data.freq1 and freq2 are unsigned, and hence can never be negative * presencestate: Use the actual enum value for INVALID state * security_events: Fix enum comparisons where the enum can never be negative * udptl: Don't bother to check if the return value from encode_length is less than 0, as it returns an unsigned int * translate: Since the parameters are unsigned int, don't bother checking to see if they are negative. The cast to unsigned int would already blow past the matrix bounds. * res_pjsip_exten_state: Use a temporary value to cache the return of ast_hint_presence_state * res_stasis_playback: Fix enum comparisons where the enum can never be negative * res_stasis_recording: Add an enum value for the case where the recording operation is in error; fix enum comparisons * resource_bridges: Use enum value as opposed to -1 * resource_channels: Use enum value as opposed to -1 Review: https://reviewboard.asterisk.org/r/4533 ASTERISK-24917 Reported by: dkdegroot patches: rb4533.patch submitted by dkdegroot (License 6600) ........ Merged revisions 434469 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@434470 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-06app: Add functions to swap voicemail function table for testing purposesJonathan Rose
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@432556 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-26Various fixes for OS XDavid M. Lee
This patch addresses compilation errors on OS X. It's been a while, so there's quite a few things. * Fixed __attribute__ decls in route.h to be portable. * Fixed htonll and ntohll to work when they are defined as macros. * Replaced sem_t usage with our ast_sem wrapper. * Added ast_sem_timedwait to our ast_sem wrapper. * Fixed some GCC 4.9 warnings using sig*set() functions. * Fixed some format strings for portability. * Fixed compilation issues with res_timing_kqueue (although tests still fail on OS X). * Fixed menuconfig /sbin/launchd detection, which disables res_timing_kqueue on OS X). ASTERISK-24539 #close Reported by: George Joseph ASTERISK-24544 #close Reported by: George Joseph Review: https://reviewboard.asterisk.org/r/4327/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@431092 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-11-04Fix crash caused by merge error on review 4138Corey Farrell
When merging from 12 to 13 there were conflicts, I mistakenly had the loop run ast_closestream(others[0]) when it should be ast_closestream(others[x]). git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@427181 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-11-02Fix ast_writestream leaksCorey Farrell
Fix cleanup in __ast_play_and_record where others[x] may be leaked. This was caught where prepend != NULL && outmsg != NULL, once realfile[x] == NULL any further others[x] would be leaked. A cleanup block was also added for prepend != NULL && outmsg == NULL. 11+: Fix leak of ast_writestream recording_fs in app_voicemail:leave_voicemail. ASTERISK-24476 #close Reported by: Corey Farrell Review: https://reviewboard.asterisk.org/r/4138/ ........ Merged revisions 427023 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 427024 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 427025 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@427026 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-09-11Remove undocumented default behavior of ast_play_and_record_full acceptdtmf.Mark Michelson
ast_play_and_record_full() has a parameter called "acceptdtmf" that is a string of acceptable DTMF digits that may be pressed by a caller to end and accept the recording. ARI uses this function in order to perform recording, and it provides options for what is passed as acceptdtmf to ast_play_and_record_full(). By default, ARI passes an empty string, with the intention that no DTMF can be used to end the recording. The problem is that ast_play_and_record_full() attempts to be "helpful" by setting "#" as the acceptdtmf if an empty string or NULL pointer has been passed in. With ARI, this results in unexpected behavior occurring if you have attempted to intercept "#" yourself in order to perform some other manipulation of the live recording. This change removes the "helpful" behavior by no longer accepting "#" as a default acceptdtmf if none is specified by the caller of ast_play_and_record_full(). This makes the ARI scenario work as expected. The other callers of ast_play_and_record_full() are app_voicemail and app_minivm, and in both cases, they pass an explicit "#" to ast_play_and_record_full() as acceptdtmf, so they are unaffected by this change. ........ Merged revisions 422964 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@422965 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-21ARI: Fix implicit answer when playback is initiated on unanswered channelMatthew Jordan
When issuing a POST /channels/{channel_id}/play on a channel that is not yet answered, ARI is supposed to: * Queue up an AST_CONTROL_PROGRESS on the channel * Start up the playback of the media Instead, we sneak an answer on the channel right before starting playing media. This is due to ARI's usage of control_streamfile. This function implicitly answers the channel (and doesn't give ARI the option to stop it). The answering of the channel here is probably unnecessary: * app_voicemail, by far the biggest consumer of this function, always answers the channels anyway * control stream file (in res_agi) and ControlPlayback probably shouldn't be implicitly answering the channel. Answering should not be tied directly to playing back media. As it turns out, the answering of the channel here is pretty old: 356042 twilson if (ast_channel_state(chan) != AST_STATE_UP) { 3087 anthm res = ast_answer(chan); 180259 tilghman } (As in, ancient?) Note that others ran into this problem and commented about it on various mailing lists. Review: https://reviewboard.asterisk.org/r/3907/ ASTERISK-24229 #close Reported by: Matt Jordan ........ Merged revisions 421695 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@421696 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-15app_voicemail/app: Remove test events that were duplicated by r421059Matthew Jordan
Moving the test event raised when a file is played back (which occurred in r421059) broke the ever loving snot out of the voicemail tests. This caused duplicate test events to get raised, as app_voicemail and main/app were raising events prior to call ast_streamfile. The voicemail tests did not enjoy getting multiple events. Since raising the playback event in ast_streamfile is far more useful to the vast majority of tests, this patch keeps the call there and simply removes the extraneous calls that duplicated the event. ........ Merged revisions 421125 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 421164 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 421165 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@421166 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-14main/file: Move test event to emit PLAYBACK event more consistentlyMatthew Jordan
This is being done in advance of the test for ASTERISK-23953 ........ Merged revisions 421059 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 421060 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 421061 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@421062 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-06Stasis: Allow message types to be blockedKinsey Moore
This introduces stasis.conf and a mechanism to prevent certain message types from being published. Internally, this works by preventing the chosen message types from being created which ensures that those message types can never be published. This patch also adjusts message publishers such that message payloads are not created if the related message type is not available. ASTERISK-23943 #close Review: https://reviewboard.asterisk.org/r/3823/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@420124 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-20media formats: re-architect handling of media for performance improvementsMatthew Jordan
In the old times media formats were represented using a bit field. This was fast but had a few limitations. 1. Asterisk was limited in how many formats it could handle. 2. Formats, being a bit field, could not include any attribute information. A format was strictly its type, e.g., "this is ulaw". This was changed in Asterisk 10 (see https://wiki.asterisk.org/wiki/display/AST/Media+Architecture+Proposal for notes on that work) which led to the creation of the ast_format structure. This structure allowed Asterisk to handle attributes and bundle information with a format. Additionally, ast_format_cap was created to act as a container for multiple formats that, together, formed the capability of some entity. Another mechanism was added to allow logic to be registered which performed format attribute negotiation. Everywhere throughout the codebase Asterisk was changed to use this strategy. Unfortunately, in software, there is no free lunch. These new capabilities came at a cost. Performance analysis and profiling showed that we spend an inordinate amount of time comparing, copying, and generally manipulating formats and their related structures. Basic prototyping has shown that a reasonably large performance improvement could be made in this area. This patch is the result of that project, which overhauled the media format architecture and its usage in Asterisk to improve performance. Generally, the new philosophy for handling formats is as follows: * The ast_format structure is reference counted. This removed a large amount of the memory allocations and copying that was done in prior versions. * In order to prevent race conditions while keeping things performant, the ast_format structure is immutable by convention and lock-free. Violate this tenet at your peril! * Because formats are reference counted, codecs are also reference counted. The Asterisk core generally provides built-in codecs and caches the ast_format structures created to represent them. Generally, to prevent inordinate amounts of module reference bumping, codecs and formats can be added at run-time but cannot be removed. * All compatibility with the bit field representation of codecs/formats has been moved to a compatibility API. The primary user of this representation is chan_iax2, which must continue to maintain its bit-field usage of formats for interoperability concerns. * When a format is negotiated with attributes, or when a format cannot be represented by one of the cached formats, a new format object is created or cloned from an existing format. That format may have the same codec underlying it, but is a different format than a version of the format with different attributes or without attributes. * While formats are reference counted objects, the reference count maintained on the format should be manipulated with care. Formats are generally cached and will persist for the lifetime of Asterisk and do not explicitly need to have their lifetime modified. An exception to this is when the user of a format does not know where the format came from *and* the user may outlive the provider of the format. This occurs, for example, when a format is read from a channel: the channel may have a format with attributes (hence, non-cached) and the user of the format may last longer than the channel (if the reference to the channel is released prior to the format's reference). For more information on this work, see the API design notes: https://wiki.asterisk.org/wiki/display/AST/Media+Format+Rewrite Finally, this work was the culmination of a large number of developer's efforts. Extra thanks goes to Corey Farrell, who took on a large amount of the work in the Asterisk core, chan_sip, and was an invaluable resource in peer reviews throughout this project. There were a substantial number of patches contributed during this work; the following issues/patch names simply reflect some of the work (and will cause the release scripts to give attribution to the individuals who work on them). Reviews: https://reviewboard.asterisk.org/r/3814 https://reviewboard.asterisk.org/r/3808 https://reviewboard.asterisk.org/r/3805 https://reviewboard.asterisk.org/r/3803 https://reviewboard.asterisk.org/r/3801 https://reviewboard.asterisk.org/r/3798 https://reviewboard.asterisk.org/r/3800 https://reviewboard.asterisk.org/r/3794 https://reviewboard.asterisk.org/r/3793 https://reviewboard.asterisk.org/r/3792 https://reviewboard.asterisk.org/r/3791 https://reviewboard.asterisk.org/r/3790 https://reviewboard.asterisk.org/r/3789 https://reviewboard.asterisk.org/r/3788 https://reviewboard.asterisk.org/r/3787 https://reviewboard.asterisk.org/r/3786 https://reviewboard.asterisk.org/r/3784 https://reviewboard.asterisk.org/r/3783 https://reviewboard.asterisk.org/r/3778 https://reviewboard.asterisk.org/r/3774 https://reviewboard.asterisk.org/r/3775 https://reviewboard.asterisk.org/r/3772 https://reviewboard.asterisk.org/r/3761 https://reviewboard.asterisk.org/r/3754 https://reviewboard.asterisk.org/r/3753 https://reviewboard.asterisk.org/r/3751 https://reviewboard.asterisk.org/r/3750 https://reviewboard.asterisk.org/r/3748 https://reviewboard.asterisk.org/r/3747 https://reviewboard.asterisk.org/r/3746 https://reviewboard.asterisk.org/r/3742 https://reviewboard.asterisk.org/r/3740 https://reviewboard.asterisk.org/r/3739 https://reviewboard.asterisk.org/r/3738 https://reviewboard.asterisk.org/r/3737 https://reviewboard.asterisk.org/r/3736 https://reviewboard.asterisk.org/r/3734 https://reviewboard.asterisk.org/r/3722 https://reviewboard.asterisk.org/r/3713 https://reviewboard.asterisk.org/r/3703 https://reviewboard.asterisk.org/r/3689 https://reviewboard.asterisk.org/r/3687 https://reviewboard.asterisk.org/r/3674 https://reviewboard.asterisk.org/r/3671 https://reviewboard.asterisk.org/r/3667 https://reviewboard.asterisk.org/r/3665 https://reviewboard.asterisk.org/r/3625 https://reviewboard.asterisk.org/r/3602 https://reviewboard.asterisk.org/r/3519 https://reviewboard.asterisk.org/r/3518 https://reviewboard.asterisk.org/r/3516 https://reviewboard.asterisk.org/r/3515 https://reviewboard.asterisk.org/r/3512 https://reviewboard.asterisk.org/r/3506 https://reviewboard.asterisk.org/r/3413 https://reviewboard.asterisk.org/r/3410 https://reviewboard.asterisk.org/r/3387 https://reviewboard.asterisk.org/r/3388 https://reviewboard.asterisk.org/r/3389 https://reviewboard.asterisk.org/r/3390 https://reviewboard.asterisk.org/r/3321 https://reviewboard.asterisk.org/r/3320 https://reviewboard.asterisk.org/r/3319 https://reviewboard.asterisk.org/r/3318 https://reviewboard.asterisk.org/r/3266 https://reviewboard.asterisk.org/r/3265 https://reviewboard.asterisk.org/r/3234 https://reviewboard.asterisk.org/r/3178 ASTERISK-23114 #close Reported by: mjordan media_formats_translation_core.diff uploaded by kharwell (License 6464) rb3506.diff uploaded by mjordan (License 6283) media_format_app_file.diff uploaded by kharwell (License 6464) misc-2.diff uploaded by file (License 5000) chan_mild-3.diff uploaded by file (License 5000) chan_obscure.diff uploaded by file (License 5000) jingle.diff uploaded by file (License 5000) funcs.diff uploaded by file (License 5000) formats.diff uploaded by file (License 5000) core.diff uploaded by file (License 5000) bridges.diff uploaded by file (License 5000) mf-codecs-2.diff uploaded by file (License 5000) mf-app_fax.diff uploaded by file (License 5000) mf-apps-3.diff uploaded by file (License 5000) media-formats-3.diff uploaded by file (License 5000) ASTERISK-23715 rb3713.patch uploaded by coreyfarrell (License 5909) rb3689.patch uploaded by mjordan (License 6283) ASTERISK-23957 rb3722.patch uploaded by mjordan (License 6283) mf-attributes-3.diff uploaded by file (License 5000) ASTERISK-23958 Tested by: jrose rb3822.patch uploaded by coreyfarrell (License 5909) rb3800.patch uploaded by jrose (License 6182) chan_sip.diff uploaded by mjordan (License 6283) rb3747.patch uploaded by jrose (License 6182) ASTERISK-23959 #close Tested by: sgriepentrog, mjordan, coreyfarrell sip_cleanup.diff uploaded by opticron (License 6273) chan_sip_caps.diff uploaded by mjordan (License 6283) rb3751.patch uploaded by coreyfarrell (License 5909) chan_sip-3.diff uploaded by file (License 5000) ASTERISK-23960 #close Tested by: opticron direct_media.diff uploaded by opticron (License 6273) pjsip-direct-media.diff uploaded by file (License 5000) format_cap_remove.diff uploaded by opticron (License 6273) media_format_fixes.diff uploaded by opticron (License 6273) chan_pjsip-2.diff uploaded by file (License 5000) ASTERISK-23966 #close Tested by: rmudgett rb3803.patch uploaded by rmudgetti (License 5621) chan_dahdi.diff uploaded by file (License 5000) ASTERISK-24064 #close Tested by: coreyfarrell, mjordan, opticron, file, rmudgett, sgriepentrog, jrose rb3814.patch uploaded by rmudgett (License 5621) moh_cleanup.diff uploaded by opticron (License 6273) bridge_leak.diff uploaded by opticron (License 6273) translate.diff uploaded by file (License 5000) rb3795.patch uploaded by rmudgett (License 5621) tls_fix.diff uploaded by mjordan (License 6283) fax-mf-fix-2.diff uploaded by file (License 5000) rtp_transfer_stuff uploaded by mjordan (License 6283) rb3787.patch uploaded by rmudgett (License 5621) media-formats-explicit-translate-format-3.diff uploaded by file (License 5000) format_cache_case_fix.diff uploaded by opticron (License 6273) rb3774.patch uploaded by rmudgett (License 5621) rb3775.patch uploaded by rmudgett (License 5621) rtp_engine_fix.diff uploaded by opticron (License 6273) rtp_crash_fix.diff uploaded by opticron (License 6273) rb3753.patch uploaded by mjordan (License 6283) rb3750.patch uploaded by mjordan (License 6283) rb3748.patch uploaded by rmudgett (License 5621) media_format_fixes.diff uploaded by opticron (License 6273) rb3740.patch uploaded by mjordan (License 6283) rb3739.patch uploaded by mjordan (License 6283) rb3734.patch uploaded by mjordan (License 6283) rb3689.patch uploaded by mjordan (License 6283) rb3674.patch uploaded by coreyfarrell (License 5909) rb3671.patch uploaded by coreyfarrell (License 5909) rb3667.patch uploaded by coreyfarrell (License 5909) rb3665.patch uploaded by mjordan (License 6283) rb3625.patch uploaded by coreyfarrell (License 5909) rb3602.patch uploaded by coreyfarrell (License 5909) format_compatibility-2.diff uploaded by file (License 5000) core.diff uploaded by file (License 5000) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@419044 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-20voicemail API callbacks: Extract the sayname API call to its own registerd ↵Richard Mudgett
callback. * Extract the sayname API call to its own registerd callback. This allows the app_directory and app_chanspy applications to say a mailbox owner's name using an alternate provider when app_voicemail is not available because you are using res_mwi_external. app_directory still uses the voicemail.conf file. AFS-64 #close Reported by: Mark Michelson git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@416830 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-22res_corosync: Update module to work with Stasis (and compile)Matthew Jordan
This patch fixes res_corosync such that it works with Asterisk 12. This restores the functionality that was present in previous versions of Asterisk, and ensures compatibility with those versions by restoring the binary message format needed to pass information from/to them. The following changes were made in the core to support this: * The event system has been partially restored. All event definition and event types in this patch were pulled from Asterisk 11. Previously, we had hoped that this information would live in res_corosync; however, the approach in this patch seems to be better for a few reasons: (1) Theoretically, ast_events can be used by any module as a binary representation of a Stasis message. Given the structure of an ast_event object, that information has to live in the core to be used universally. For example, defining the payload of a device state ast_event in res_corosync could result in an incompatible device state representation in another module. (2) Much of this representation already lived in the core, and was not easily extensible. (3) The code already existed. :-) * Stasis message types now have a message formatter that converts their payload to an ast_event object. * Stasis message forwarders now handle forwarding to themselves. Previously this would result in an infinite recursive call. Now, this simply creates a new forwarding object with no forwards set up (as it is the thing it is forwarding to). This is advantageous for res_corosync, as returning NULL would also imply an unrecoverable error. Returning a subscription in this case allows for easier handling of message types that are published directly to an aggregate topic that has forwarders. Review: https://reviewboard.asterisk.org/r/3486/ ASTERISK-22912 #close ASTERISK-22372 #close ........ Merged revisions 414330 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@414331 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-09Allow Asterisk to compile under GCC 4.10Kinsey Moore
This resolves a large number of compiler warnings from GCC 4.10 which cause the build to fail under dev mode. The vast majority are signed/unsigned mismatches in printf-style format strings. ........ Merged revisions 413586 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 413587 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 413588 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@413589 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-04-17Fix a silly shadowed variable mistake that was missed from play tones patchJonathan Rose
........ Merged revisions 412549 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@412550 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-04-17ARI: Add tones playback resourceJonathan Rose
Adds a tones URI type to the playback resource. The tone can be specified by name (from indications.conf) or by a tone pattern. In addition, tonezone can be specified in the URI (by appending ;tonezone=<zone>). Tones must be stopped manually in order for a stasis control to move on from playback of the tone. Tones may be paused, resumed, restarted, and stopped. They may not be rewound or fast forwarded (tones can't be controlled in a way that lets you skip around from note to note and pausing and resuming will also restart the tone from the beginning). Tests are currently in development for this feature (https://reviewboard.asterisk.org/r/3428/). (closes issue ASTERISK-23433) Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/3427/ ........ Merged revisions 412535 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@412536 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-14res_mwi_external: Clear the stasis cache entry when the external MWI is deleted.Richard Mudgett
One of the things missing when external MWI support was added was the ability to clear the stasis cache entry of deleted external MWI mailboxes. Review: https://reviewboard.asterisk.org/r/3325/ ........ Merged revisions 410555 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410557 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-07stasis cache: Enhance to keep track of an item from different entities.Richard Mudgett
A stasis cache entry now contains more than a single message/snapshot. It contains messages/snapshots for the local entity as well as any remote entities that post to the cached item. In addition callbacks can be supplied when the cache is created to compute and post the aggregate message/snapshot representing all entities stored in the cache entry. * All stasis messages now have an eid to indicate what entity posted it. * The stasis cache enhancements allow device state to cache and aggregate the device states from local and remote entities in a single operation. The cached aggregate device state is available immediately after it is posted to the stasis bus. This improves performance by eliminating a cache dump and associated ao2 container traversals to calculate the aggregate state. (closes issue ASTERISK-23204) Reported by: Mark Michelson Review: https://reviewboard.asterisk.org/r/3281/ ........ Merged revisions 410184 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410185 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-19Voicemail: Remove mailbox identifier format (box@context) assumptions in the ↵Richard Mudgett
system. This change is in preparation for external MWI support. Removed code from the system for normal mailbox handling that appends @default to the mailbox identifier if it does not have a context. The only exception is the legacy hasvoicemail users.conf option. The legacy option will only work for app_voicemail mailboxes. The system cannot make any assumptions about the format of the mailbox identifer used by app_voicemail. chan_sip and chan_dahdi/sig_pri had the most changes because they both tried to interpret the mailbox identifier. chan_sip just stored and compared the two components. chan_dahdi actually used the box information. The ISDN MWI support configuration options had to be reworked because chan_dahdi was parsing the box@context format to get the box number. As a result the mwi_vm_boxes chan_dahdi.conf option was added and is documented in the chan_dahdi.conf.sample file. Review: https://reviewboard.asterisk.org/r/3072/ ........ Merged revisions 404348 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404350 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-13test_voicemail_api: Add check for a registered voicemail provider before tests.Richard Mudgett
It is much nicer diagnosing a test failure if app_voicemail is actually loaded. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@403726 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-11app_voicemail: Voicemail callback registration/unregistration function ↵Richard Mudgett
improvements. * The voicemail registration/unregistration functions now take a struct of callbacks instead of a lengthy parameter list of callbacks. * The voicemail registration/unregistration functions now prevent a competing module from interfering with an already registered callback supplying module. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@403643 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-11-01voicemail: Simplify callback pointer declarations and add doxygen.Richard Mudgett
* Typedefed and added doxegen for the voicemail callback functions. * Simplified the prototypes for ast_install_vm_functions() and ast_install_vm_test_functions() to use the new function typedefs. * Simplified the voicemail callback function pointer variable declarations to use the new function typedefs. ........ Merged revisions 402398 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@402406 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-10-24memory leaks: Memory leak cleanup patch by Corey Farrell (second set)Jonathan Rose
Also covers ast_app_parse_timelen-fail-zero-length.patch, but the patch was replaced with one of my own. (issue ASTERISK-22467) Reported by: Corey Farrell Patches: chan_dahdi-cleanup_push.patch uploaded by coreyfarrell (license 5909) clicompat-r2.patch uploaded by coreyfarrell (license 5909) codecs-ilbc-doCPLC.patch uploaded by coreyfarrell (license 5909) data-cleanup-test-registration.patch uploaded by coreyfarrell (license 5909) main-asterisk-kill-listener.patch uploaded by coreyfarrell (license 5909) ........ Merged revisions 401704 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 401705 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 401706 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@401707 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-29Memory leaks fixKevin Harwell
(closes ASTERISK-22376) Reported by: John Hardin Patches: memleak.patch uploaded by jhardin (license 6512) memleak2.patch uploaded by jhardin (license 6512) ........ Merged revisions 397946 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397947 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-22Massively clean up app_queue.Mark Michelson
This essentially makes app_queue usable again. From reviewboard: * Reporting of transfers and call completion is done by creating stasis subscriptions and listening for specific events in order to determine when the call is finished (either via a transfer or hangup). * Dial end messages have been added where they were previously missing. * Queue stats are properly being updated again once calls have finished. * AgentComplete stasis messages and AMI events are now occurring again. * Mixmonitor starting has been factored into its own function and uses the Mixmonitor API now instead of using ast_pbx_run() In addition to the changes in app_queue, there are several supplementary changes as well: * Queue logging now differentiates between attended and blind transfers. A note about this is in the CHANGES file. * Local channel optimization events now report more information. This includes which of the two local channels involved is the destination of the optimization, the channel that is replacing the destination local channel, and an identifier so that begin and end events can be matched to each other. The end events are now sent whether the optimization was successful or not and includes an indicator of whether the optimization was successful. * Changes were made to features and bridging_basic so that additional flags may be set on a bridge. This is necessary because the queue requires that its bridge only allows move-swap local channel optimizations into the bridge. (closes issue ASTERISK-21517) Reported by Matt Jordan (closes issue ASTERISK-21943) Reported by Matt Jordan Review: https://reviewboard.asterisk.org/r/2694 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397451 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-06ARI: Add recording controlsDavid M. Lee
This patch implements the controls from ARI recordings. The controls are: * DELETE /recordings/live/{recordingName} - stop recording and discard it * POST /recordings/live/{recordingName}/stop - stop recording * POST /recordings/live/{recordingName}/pause - pause recording * POST /recordings/live/{recordingName}/unpause - resume recording * POST /recordings/live/{recordingName}/mute - mute recording (record silence to the file) * POST /recordings/live/{recordingName}/unmute - unmute recording. Since this underlying functionality did not already exist, is was added to app.c by a set of control frames, similar to how playback control works. The pause/mute control frames are toggles, even though the ARI controls are idempotent, to be consistent with the playback control frames. (closes issue ASTERISK-22181) Review: https://reviewboard.asterisk.org/r/2697/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396331 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-03ARI - channel recording supportDavid M. Lee
This patch is the first step in adding recording support to the Asterisk REST Interface. Recordings are stored in /var/spool/recording. Since recordings may be destructive (overwriting existing files), the API rejects attempts to escape the recording directory (avoiding issues if someone attempts to record to ../../lib/sounds/greeting, for example). (closes issue ASTERISK-21594) (closes issue ASTERISK-21581) Review: https://reviewboard.asterisk.org/r/2612/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393550 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-06-14Fix regression in MWI stasis handling.Mark Michelson
In revision 389733, mwi state allocation was placed into its own function instead of performing the allocation in-line when required. The issue was that in ast_publish_mwi_state_full(), the local variable "uniqueid" was no longer being set, but it was still being used as the topic for MWI. This meant that all MWI publications ended up being published to the "" (empty string) mailbox topic. Thus MWI subscriptions for specific mailboxes were never notified of mailbox state changes. This change fixes the issue by removing the local uniqueid variable from ast_publish_mwi_state_full() and instead referencing the mwi_state->uniqueid field since it has been properly set. (closes issue ASTERISK-21913) Reported by Malcolm Davenport git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391921 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-06-09Clean up MWI topic pool before message type destructionMatthew Jordan
Topics need to be disposed of prior to the message types that are published on them. This includes topic pools. This prevents an assertion from being raised on shutdown. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391040 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-30Missed a line from a bad merge in r390122David M. Lee
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@390154 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-30Avoid unnecessary cleanups during immediate shutdownDavid M. Lee
This patch addresses issues during immediate shutdowns, where modules are not unloaded, but Asterisk atexit handlers are run. In the typical case, this usually isn't a big deal. But the introduction of the Stasis message bus makes it much more likely for asynchronous activity to be happening off in some thread during shutdown. During an immediate shutdown, Asterisk skips unloading modules. But while it is processing the atexit handlers, there is a window of time where some of the core message types have been cleaned up, but the message bus is still running. Specifically, it's still running module subscriptions that might be using the core message types. If a message is received by that subscription in that window, it will attempt to use a message type that has been cleaned up. To solve this problem, this patch introduces ast_register_cleanup(). This function operates identically to ast_register_atexit(), except that cleanup calls are not invoked on an immediate shutdown. All of the core message type and topic cleanup was moved from atexit handlers to cleanup handlers. This ensures that core type and topic cleanup only happens if the modules that used them are first unloaded. This patch also changes the ast_assert() when accessing a cleaned up or uninitialized message type to an error log message. Message type functions are actually NULL safe across the board, so the assert was a bit heavy handed. Especially for anyone with DO_CRASH enabled. Review: https://reviewboard.asterisk.org/r/2562/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@390122 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-23This patch adds support for controlling a playback operation from theDavid M. Lee
Asterisk REST interface. This adds the /playback/{playbackId}/control resource, which may be POSTed to to pause, unpause, reverse, forward or restart the media playback. Attempts to control a playback that is not currently playing will either return a 404 Not Found (because the playback object no longer exists) or a 409 Conflict (because the playback object is still in the queue to be played). This patch also adds skipms and offsetms parameters to the /channels/{channelId}/play resource. (closes issue ASTERISK-21587) Review: https://reviewboard.asterisk.org/r/2559 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@389603 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-22Fixed startup race condition which caused occasional stasis_mwi_state_type ↵David M. Lee
assertions. The caching topic (which refers to the message type) was created before the message type. If the initial subscription message gets processed before the type can be initialized, the assertion about using an uninitialized type fires. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@389519 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-15Refactored the rest of the message types to use the STASIS_MESSAGE_TYPE_*David M. Lee
macros. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@388751 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-03-28Break the world. Stasis message type accessors should now all be named ↵Kinsey Moore
correctly. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@384261 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-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-22core: Fix a memory leak in app.c from an early returnJonathan Rose
ast_app_group_match_get_count allocates memory with the regcomp function and we previously forgot to free it when bailing out due to a regex compilation failure against category. (closes issue AST-1018) Reported by: Guenther Kelleter Patches: regcomp_memleak.diff uploaded by Guenther Kelleter (license 6372) ........ Merged revisions 375299 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 375300 from http://svn.asterisk.org/svn/asterisk/branches/10 ........ Merged revisions 375301 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@375311 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-18Doxygen Updates - Title updateAndrew Latham
Update and extend the configuration_file group and enable linking. Commit other cleanups from multi-version Doxygen testing. Update title that was left behind many years ago. (issue ASTERISK-20259) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@375182 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-13Doxygen Clean upsAndrew Latham
Add app_skel.c as an example in app.c and fix some formating for the "Dial Privacy scripts" so it actually shows up in the Doxygen output. (issue ASTERISK-20259) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374956 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-09-28Add pause one second W dial modifier.Richard Mudgett
* The following dialplan applications now recognize 'W' to pause sending DTMF for one second in addition to the previously existing 'w' that paused sending DTMF for half a second. Dial, ExternalIVR, and SendDTMF. * The chan_dahdi analog port dialing and deferred DTMF dialing for PRI now distinguishes between 'w' and 'W'. The 'w' pauses dialing for half a second. The 'W' pauses dialing for one second. * Created dahdi_dial_str() in chan_dahdi that eliminated a lot of duplicated dialing code and diagnostic messages for the channel driver. (closes issue ASTERISK-20039) Reported by: Jeremiah Gowdy Patches: jgowdy-wait-6-22-2012.diff (license #5621) patch uploaded by Jeremiah Gowdy Expanded patch to add support in chan_dahdi. Tested by: rmudgett git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374030 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-09-27Cleanup ast_dtmf_stream()Richard Mudgett
* Made ast_dtmf_stream() wait after starting the silence generator rather than before. * Made ast_dtmf_stream() put the peer in autoservice for the whole time things are being done to the chan. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@373966 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-06-15Multiple revisions 369001-369002Kevin P. Fleming
........ r369001 | kpfleming | 2012-06-15 10:56:08 -0500 (Fri, 15 Jun 2012) | 11 lines Add support-level indications to many more source files. Since we now have tools that scan through the source tree looking for files with specific support levels, we need to ensure that every file that is a component of a 'core' or 'extended' module (or the main Asterisk binary) is explicitly marked with its support level. This patch adds support-level indications to many more source files in tree, but avoids adding them to third-party libraries that are included in the tree and to source files that don't end up involved in Asterisk itself. ........ r369002 | kpfleming | 2012-06-15 10:57:14 -0500 (Fri, 15 Jun 2012) | 3 lines Add a script to enable finding source files without support-levels defined. ........ Merged revisions 369001-369002 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 369005 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369013 65c4cc65-6c06-0410-ace0-fbb531ad65f3