summaryrefslogtreecommitdiff
path: root/apps/app_dial.c
AgeCommit message (Collapse)Author
2018-03-19Merge "loader: Convert reload_classes to built-in modules."Jenkins2
2018-03-16app_dial: Enable early-media videoFlorian Floimair
Certain applications (e.g. door-phone) require that also video is transmitted before a call is accepted. Change-Id: I9842e1dc2f6e1c2c49dc33fe615255007d2f821e
2018-03-14loader: Convert reload_classes to built-in modules.Corey Farrell
* acl (named_acl.c) * cdr * cel * ccss * dnsmgr * dsp * enum * extconfig (config.c) * features * http * indications * logger * manager * plc * sounds * udptl These modules are now loaded at appropriate time by the module loader. Unlike loadable modules these use AST_MODULE_LOAD_FAILURE on error so the module loader will abort startup on failure of these modules. Some of these modules are still initialized or shutdown from outside the module loader. logger.c is initialized very early and shutdown very late, manager.c is initialized by the module loader but is shutdown by the Asterisk core (too much uses it without holding references). Change-Id: I371a9a45064f20026c492623ea8062d02a1ab97f
2017-12-22Remove as much trailing whitespace as possible.Sean Bright
Change-Id: I873c1c6d00f447269bd841494459efccdd2c19c0
2017-10-18app_macro deprecation.Corey Farrell
* Mark the module deprecated. * Disable the module by default. * Produce a warning the first time a macro is used. * Note deprecation related options in app_dial and app_queue. ASTERISK-27350 Change-Id: I560ea043bacdbc5534a17d97854273d52c2f1bdc
2017-05-16asterisk: Audit locking of channel when manipulating flags.Joshua Colp
When manipulating flags on a channel the channel has to be locked to guarantee that nothing else is also manipulating the flags. This change introduces locking where necessary to guarantee this. It also adds helper functions that manipulate channel flags and lock to reduce repeated code. ASTERISK-26789 Change-Id: I489280662dba0f4c50981bfc5b5a7073fef2db10
2017-04-27channel: Add ability to request an outgoing channel with stream topology.Joshua Colp
This change extends the ast_request functionality by adding another function and callback to create an outgoing channel with a requested stream topology. Fallback is provided by either converting the requested stream topology into a format capabilities structure if the channel driver does not support streams or by converting the requested format capabilities into a stream topology if the channel driver does support streams. The Dial application has also been updated to request an outgoing channel with the stream topology of the calling channel. ASTERISK-26959 Change-Id: Ifa9037a672ac21d42dd7125aa09816dc879a70e6
2017-03-27channel: Remove old epoll support and fixed max number of file descriptors.Joshua Colp
This change removes the old epoll support which has not been used or maintained in quite some time. The fixed number of file descriptors on a channel has also been removed. File descriptors are now contained in a growable vector. This can be used like before by specifying a specific position to store a file descriptor at or using a new API call, ast_channel_fd_add, which adds a file descriptor to the channel and returns its position. Tests have been added which cover the growing behavior of the vector and the new API call. ASTERISK-26885 Change-Id: I1a754b506c009b83dfdeeb08c2d2815db30ef928
2017-02-10core: Cleanup some channel snapshot staging anomalies.Richard Mudgett
We shouldn't unlock the channel after starting a snapshot staging because another thread may interfere and do its own snapshot staging. * app_dial.c:dial_exec_full() made hold the channel lock while setting up the outgoing channel staging. Made hold the channel lock after the called party answers while updating the caller channel staging. * chan_sip.c:sip_new() completed the channel staging on off-nominal exit. Also we need to use ast_hangup() instead of ast_channel_unref() at that location. * channel.c:__ast_channel_alloc_ap() added a comment about not needing to complete the channel snapshot staging on off-nominal exit paths. * rtp_engine.c:ast_rtp_instance_set_stats_vars() made hold the channel locks while staging the channels for the stats channel variables. Change-Id: Iefb6336893163f6447bad65568722ad5d5d8212a
2016-11-02app_dial: Fix incorrect device state when channel is picked up.Joshua Colp
Given the scenario where multiple channels are dialed using Dial() but the caller is picked up using PickupChan() all outgoing channels except the channel specified to PickupChan() would be marked as ringing until the call had been hung up. When using the PickupChan application the channel executing the application is swapped into place of another channel. As part of this process the channel is answered. The Dial application has explicit logic which checks if the channel is answered, cancels all other outgoing channels, and bridges. This logic is different than the normal logic that is executed when an outgoing channel is answered. This different logic failed to publish dial events stating that the other outgoing channels had been canceled. As a result references to the outgoing channels were held onto by the dial masquerade process until the call had been ended and the channels had gone away. This would result in the channels appearing in the "core show channels" list despite not being present anymore and would also result in incorrect device state. This change makes it so that this logic also publishes dial events stating that the other outgoing channels have been canceled. ASTERISK-26549 Change-Id: Iea7168e6e82f7d4609ec0366153804e4f55ea64f
2016-10-27Remove ASTERISK_REGISTER_FILE.Corey Farrell
ASTERISK_REGISTER_FILE no longer has any purpose so this commit removes all traces of it. Previously exported symbols removed: * __ast_register_file * __ast_unregister_file * ast_complete_source_filename This also removes the mtx_prof static variable that was declared when MTX_PROFILE was enabled. This variable was only used in lock.c so it is now initialized in that file only. ASTERISK-26480 #close Change-Id: I1074af07d71f9e159c48ef36631aa432c86f9966
2016-10-11app_dial: Add the "Q" option to set the cause on unanswered channelsGeorge Joseph
The "Q" option will set the cause on the unanswered channels when another channel answers. It overrides the default of ANSWERED_ELSEWHERE. NOTE: chan_sip does not support setting the cause on a CANCEL to anything other than ANSWERED_ELSEWHERE. ASTERISK-26446 #close Change-Id: I71742e0919aaa16784c30a2b2e73fbeed7672e47
2016-09-07Merge "apps/app_dial: Fix crash on non-connect call paths for ↵zuul
Privacy/Screening option"
2016-09-03apps/app_dial: Fix crash on non-connect call paths for Privacy/Screening optionMatt Jordan
In any scenario in which the callee is not connected to the caller, the current code in app_dial will crash due to raising a Dial End Stasis Message after the callee channel has been hung up. This patch corrects the error by simply moving the explicit hangup of the callee (peer) channel until after the dial end message. ASTERISK-25691 #close Change-Id: I816a414014424d0d8c80e2a3cbef13ef8c63798d
2016-09-03apps/app_dial: Set the DIALSTATUS to NOANSWER on privacy option 5Matt Jordan
If the callee selects option '5' using the Dial application's privacy (P) option, the DIALSTATUS is erroneously set to ANSWER. This option reflects the callee sending the caller to VoiceMail one time; the call is definitely *not* ANSWERed in such a scenario. With this patch, the DIALSTATUS is instead set to NOANSWER, which is the same DIALSTATUS that is set when the 'send to VoiceMail every time' option is set. ASTERISK-25691 Change-Id: Iaf0c9f0fa00545e7366443875e2bb7d9a89a1358
2016-08-15app_dial: Improve documentationMatt Jordan
* Add some helpful <literal> and other embedded paragraph tags * Document some of the lesser known channel variables set by Dial * Add examples for some common Dial uses, along with some more challenging but useful options Change-Id: Ib2fb9301e8e044d14fbb2815ec64161f19bbfbc1
2016-06-09Merge "Fixes to include signal.h"Joshua Colp
2016-06-08Fixes to include signal.hTimo Teräs
POSIX defines signal.h. sys/signal.h should not be used as it is c-library internal header which may or may not exist. Notably with musl it generates warning of being incorrect. Change-Id: Ia56b0aa1d84b5c590114867b1b384a624f39a6fc
2016-06-04core/dial: New channel variable FORWARDERNAMEAlexei Gradinari
Added a new channel variable FORWARDERNAME which indicates which channel was responsible for a forwarding requests received on dial attempt. Fixed a bug in the app_queue: FORWARD_CONTEXT is not used. ASTERISK-26059 #close Change-Id: I34e93e8c1b5e17776a77b319703c48c8ca48e7b2
2016-05-31Expand the scope of Dial EventsMark Michelson
Dial events up to this point have come in two flavors * A Dial event with no status to indicate that dialing has begun * A Dial event with a status to indicate that dialing has ended With this change, Dial events have been expanded to also give intermediate events, such as "RINGING", "PROCEEDING", and "PROGRESS". This is especially useful for ARI dialing, as it gives the application writer the opportunity to place a channel into an early bridge when early media is detected. AMI handles these in-progress dial events by sending a new event called "DialState" that simply indicates that dial state has changed but has not ended. ARI never distinguished between DialBegin and DialEnd, so no change was made to the event itself. Another change here relates to dial forwards. A forward-related event was previously only sent when a channel was successfully able to forward a call to a new channel. With this set of changes, if forwarding is blocked, we send a Dial event with a forwarding destination but no forwarding channel, since we were prevented from creating one. This is again useful for ARI since application writers can now handle call forward attempts from within their own application. ASTERISK-25925 #close Reported by Mark Michelson Change-Id: I42cbec7730d84640a434d143a0d172a740995543
2016-01-04app_dial: Immediately exit dial if the caller is already hung up.Richard Mudgett
If a caller hangs up before dial is executed within an AGI then the AGI has likely eaten all queued frames before executing the dial in DeadAGI mode. With the caller hung up and no pending frames from the caller's read queue, dial would not know that the call has hung up until a called channel answers. It is rather annoying to whoever just answered the non-existent call. Dial should not continue execution in DeadAGI mode, hangup handlers, or the h exten. * Added a check early in dial to abort dialing if the caller has hungup. ASTERISK-25307 #close Reported by: David Cunningham Change-Id: Icd1bc0764726ef8c809f76743ca008d0f102f418
2015-11-06docs: Fix a few typo's in app docs (more then, resourse).Walter Doekes
Change-Id: Iba57efadf6c0b822e762c7a001bc89611d98afd7
2015-09-29Merge "app_dial.c: Make 'A' option pass COLP updates."Matt Jordan
2015-09-29Merge "app_dial.c: Force COLP update if outgoing channel name changed."Matt Jordan
2015-09-28Merge "app_dial.c: Factor out a connected line update routine."Joshua Colp
2015-09-25app_dial.c: Make 'A' option pass COLP updates.Richard Mudgett
While the 'A' option is playing the announcement file allow the caller and peer to exchange COLP update frames. ASTERISK-25423 Reported by: John Hardin Change-Id: Iac6cf89b56d26452c6bb88e9363622bbf23895f9
2015-09-25app_dial.c: Force COLP update if outgoing channel name changed.Richard Mudgett
* When a call is answered and the outgoing channel name has changed then force a connected line update because the channel is no longer the same. The channel was masqueraded into by another channel. This is usually because of a call pickup. Note: Forwarded calls are handled in a controlled manner so the original channel name is replaced with the forwarded channel. ASTERISK-25423 Reported by: John Hardin Change-Id: I2e01f7a698fbbc8c26344a59c2be40c6cd98b00c
2015-09-25app_dial.c: Factor out a connected line update routine.Richard Mudgett
Replace inlined code with update_connected_line_from_peer(). ASTERISK-25423 Reported by: John Hardin Change-Id: Ia14f18def417645cd7fb453e1bdac682630a5091
2015-09-25app_dial.c: Remove some no-op code.Richard Mudgett
Change-Id: Ice1884a94315d3cb7e3bbd47a9fba76a27276c54
2015-06-24app_dial: Hold reference to calling channel formats when dialing outbound.Joshua Colp
Currently when requesting a channel the native formats of the calling channel are provided to the core for usage when dialing the outbound channel. This occurs without holding the channel lock or keeping a reference to the formats. This is problematic as the channel driver may end up changing the formats during this time. In the case of chan_sip this happens when an SDP negotiation completes. This change makes it so app_dial keeps a reference to the native formats of the calling channel which guarantees that they will remain valid for the period of time needed. ASTERISK-25172 #close Change-Id: I2f0a67bd0d5d14c3bdbaae552b4b1613a283f0db
2015-04-17Detect potential forwarding loops based on count.Mark Michelson
A potential problem that can arise is the following: * Bob's phone is programmed to automatically forward to Carol. * Carol's phone is programmed to automatically forward to Bob. * Alice calls Bob. If left unchecked, this results in an endless loops of call forwards that would eventually result in some sort of fiery crash. Asterisk's method of solving this issue was to track which interfaces had been dialed. If a destination were dialed a second time, then the attempt to call that destination would fail since a loop was detected. The problem with this method is that call forwarding has evolved. Some SIP phones allow for a user to manually forward an incoming call to an ad-hoc destination. This can mean that: * There are legitimate use cases where a device may be dialed multiple times, or * There can be human error when forwarding calls. This change removes the old method of detecting forwarding loops in favor of keeping a count of the number of destinations a channel has dialed on a particular branch of a call. If the number exceeds the set number of max forwards, then the call fails. This approach has the following advantages over the old: * It is much simpler. * It can detect loops involving local channels. * It is user configurable. The only disadvantage it has is that in the case where there is a legitimate forwarding loop present, it takes longer to detect it. However, the forwarding loop is still properly detected and the call is cleaned up as it should be. Address review feedback on gerrit. * Correct "mfgium" to "Digium" * Decrement max forwards by one in the case where allocation of the max forwards datastore is required. * Remove irrelevant code change from pjsip_global_headers.c ASTERISK-24958 #close Change-Id: Ia7e4b7cd3bccfbd34d9a859838356931bba56c23
2015-04-13git migration: Refactor the ASTERISK_FILE_VERSION macroMatt Jordan
Git does not support the ability to replace a token with a version string during check-in. While it does have support for replacing a token on clone, this is somewhat sub-optimal: the token is replaced with the object hash, which is not particularly easy for human consumption. What's more, in practice, the source file version was often not terribly useful. Generally, when triaging bugs, the overall version of Asterisk is far more useful than an individual SVN version of a file. As a result, this patch removes Asterisk's support for showing source file versions. Specifically, it does the following: * Rename ASTERISK_FILE_VERSION macro to ASTERISK_REGISTER_FILE, and remove passing the version in with the macro. Other facilities than 'core show file version' make use of the file names, such as setting a debug level only on a specific file. As such, the act of registering source files with the Asterisk core still has use. The macro rename now reflects the new macro purpose. * main/asterisk: - Refactor the file_version structure to reflect that it no longer tracks a version field. - Remove the "core show file version" CLI command. Without the file version, it is no longer useful. - Remove the ast_file_version_find function. The file version is no longer tracked. - Rename ast_register_file_version/ast_unregister_file_version to ast_register_file/ast_unregister_file, respectively. * main/manager: Remove value from the Version key of the ModuleCheck Action. The actual key itself has not been removed, as doing so would absolutely constitute a backwards incompatible change. However, since the file version is no longer tracked, there is no need to attempt to include it in the Version key. * UPGRADE: Add notes for: - Modification to the ModuleCheck AMI Action - Removal of the "core show file version" CLI command Change-Id: I6cf0ff280e1668bf4957dc21f32a5ff43444a40e
2015-01-21apps/app_dial: Don't publish DialEnd twice on unexpected GoSub/Macro valuesMatthew Jordan
The Dial application has some interesting options with the mid-call Macro (M) and GoSub (U) options. If the MACRO_RESULT/GOSUB_RESULT returns specific values, the Dial application will take some action upon the channels involved in the dial operation (such as hanging up a particular party, etc.) The Dial application ensures that a Stasis message is published in the event that MACRO_RESULT/GOSUB_RESULT returns a value that kills the dial operation, so that there is a corresponding DialEnd event published in AMI/ARI for the DialBegin event that preceeded it. A bug exists where that same DialEnd event will be published on Stasis even if the value returned in MACRO_RESULT/GOSUB_RESULT is not one that the Dial application cares about. This causes two DialEnd events to be published - one with the MACRO_RESULT/GOSUB_RESULT and another with "ANSWERED" - which is all sorts of wrong. This patch fixes the bug by ensuring that we only publish a DialEnd message to Stasis if the Dial application's mid-call Macro/GoSub returns something that Dial cares about. Review: https://reviewboard.asterisk.org/r/4336 ASTERISK-24682 #close Reported by: Matt Jordan ........ Merged revisions 430842 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@430844 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-18Improve call forwarding reporting, especially with regards to ARI.Matthew Jordan
This patch addresses a few issues: 1) The order of Dial events have been changed when performing a call forward. The order has now been altered to 1) Dial begins dialing channel A. 2) When A forwards the call to B, we issue the dial end event to channel A, indicating the dial is being canceled due to a forward to B. 3) When the call to channel B occurs, we then issue a new dial begin to channel B. 2) Call forwards are now reported on the calling channel, not the peer channel. 3) AMI DialEnd events have been altered to display the extension the call is being forwarded to when relevant. 4) You can now get the values of channel variables for channels that are not currently in the Stasis application. This brings the retrieval of channel variables more in line with the rest of channel read operations since they may be performed on channels not in Stasis. ASTERISK-24134 #close Reported by Matt Jordan ASTERISK-24138 #close Reported by Matt Jordan Patches: forward-shenanigans.diff uploaded by Matt Jordan (License #6283) Review: https://reviewboard.asterisk.org/r/3899 ........ Merged revisions 420794 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@421310 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-17apps/app_dial: Fix Dial 'z' optionMatthew Jordan
The 'z' option is supposed to disable the dial timeout in the case of a call forward. Unfortunately, the wrong timeout timer was passed to the do_forward function, resulting in the option not working. ASTERISK-24225 #close Reported by: dimitripietro Tested by: dimitripietro patches: jira_asterisk_24225_v1.8.patch uploaded by rmudgett (License 5621) jira_asterisk_24225_v11.patch uploaded by rmudgett (License 5621) ........ Merged revisions 421232 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 421233 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 421234 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 421235 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@421236 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-24accountcode: Slightly change accountcode propagation.Richard Mudgett
The previous behavior was to simply set the accountcode of an outgoing channel to the accountcode of the channel initiating the call. It was done this way a long time ago to allow the accountcode set on the SIP/100 channel to be propagated to a local channel so the dialplan execution on the Local;2 channel would have the SIP/100 accountcode available. SIP/100 -> Local;1/Local;2 -> SIP/200 Propagating the SIP/100 accountcode to the local channels is very useful. Without any dialplan manipulation, all channels in this call would have the same accountcode. Using dialplan, you can set a different accountcode on the SIP/200 channel either by setting the accountcode on the Local;2 channel or by the Dial application's b(pre-dial), M(macro) or U(gosub) options, or by the FollowMe application's b(pre-dial) option, or by the Queue application's macro or gosub options. Before Asterisk v12, the altered accountcode on SIP/200 will remain until the local channels optimize out and the accountcode would change to the SIP/100 accountcode. Asterisk v1.8 attempted to add peeraccount support but ultimately had to punt on the support. The peeraccount support was rendered useless because of how the CDR code needed to unconditionally force the caller's accountcode onto the peer channel's accountcode. The CEL events were thus intentionally made to always use the channel's accountcode as the peeraccount value. With the arrival of Asterisk v12, the situation has improved somewhat so peeraccount support can be made to work. Using the indicated example, the the accountcode values become as follows when the peeraccount is set on SIP/100 before calling SIP/200: SIP/100 ---> Local;1 ---- Local;2 ---> SIP/200 acct: 100 \/ acct: 200 \/ acct: 100 \/ acct: 200 peer: 200 /\ peer: 100 /\ peer: 200 /\ peer: 100 If a channel already has an accountcode it can only change by the following explicit user actions: 1) A channel originate method that can specify an accountcode to use. 2) The calling channel propagating its non-empty peeraccount or its non-empty accountcode if the peeraccount was empty to the outgoing channel's accountcode before initiating the dial. e.g., Dial and FollowMe. The exception to this propagation method is Queue. Queue will only propagate peeraccounts this way only if the outgoing channel does not have an accountcode. 3) Dialplan using CHANNEL(accountcode). 4) Dialplan using CHANNEL(peeraccount) on the other end of a local channel pair. If a channel does not have an accountcode it can get one from the following places: 1) The channel driver's configuration at channel creation. 2) Explicit user action as already indicated. 3) Entering a basic or stasis-mixing bridge from a peer channel's peeraccount value. You can specify the accountcode for an outgoing channel by setting the CHANNEL(peeraccount) before using the Dial, FollowMe, and Queue applications. Queue adds the wrinkle that it will not overwrite an existing accountcode on the outgoing channel with the calling channels values. Accountcode and peeraccount values propagate to an outgoing channel before dialing. Accountcodes also propagate when channels enter or leave a basic or stasis-mixing bridge. The peeraccount value only makes sense for mixing bridges with two channels; it is meaningless otherwise. * Made peeraccount functional by changing accountcode propagation as described above. * Fixed CEL extracting the wrong ie value for the peeraccount. This was done intentionally in Asterisk v1.8 when that version had to punt on peeraccount. * Fixed a few places dealing with accountcodes that were reading from channels without the lock held. AFS-65 #close Review: https://reviewboard.asterisk.org/r/3601/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@419520 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-18app_dial and app_queue: Make lock the forwarding channel while taking the ↵Richard Mudgett
channel snapshot. * Fixed ast_channel_publish_dial_forward() not locking the forwarded channel when taking the channel snapshot. * Fixed app_dial.c:do_forward() using the wrong channel to get the original call forwarding string. * Removed unnecessary locking when calling ast_channel_publish_dial() and ast_channel_publish_dial_forward() in app_dial and app_queue. Holding channel locks when calling ast_channel_publish_dial_forward() with a forwarded channel could result in pausing the system while the stasis bus completes processsing a forwarded channel subscription. Review: https://reviewboard.asterisk.org/r/3451/ ........ Merged revisions 412579 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@412580 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-07uniqueid: channel linkedid, ami, ari object creation with id'sScott Griepentrog
Much needed was a way to assign id to objects on creation, and much change was necessary to accomplish it. Channel uniqueids and linkedids are split into separate string and creation time components without breaking linkedid propgation. This allowed the uniqueid to be specified by the user interface - and those values are now carried through to channel creation, adding the assignedids value to every function in the chain including the channel drivers. For local channels, the second channel can be specified or left to default to a ;2 suffix of first. In ARI, bridge, playback, and snoop objects can also be created with a specified uniqueid. Along the way, the args order to allocating channels was fixed in chan_mgcp and chan_gtalk, and linkedid is no longer lost as masquerade occurs. (closes issue ASTERISK-23120) Review: https://reviewboard.asterisk.org/r/3191/ ........ Merged revisions 410157 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410158 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-31CDRs: fix a variety of dial status problems, h/hangup handler creating CDRsMatthew Jordan
This patch fixes a number of small-ish problems that were noticed when witnessing the records that the FreePBX dialplan produces: (1) Mid-call events (as well as privacy options) have the ability to change the overall state of the Dial operation after the called party answers. This means that publishing the DialEnd event when the called party is premature; we have to wait for the execution of these subroutines to complete before we can signal the overall status of the DialEnd. This patch moves that publication and adds handlers for the mid-call events. (2) The AST_FLAG_OUTGOING channel flag is cleared if an after bridge goto datastore is detected. This flag was preventing CDRs from being recorded for all outbound channels that had a 'continue' option enabled on them by the Dial application. (3) The CDR engine now locks the 'Dial' application as being the CDR application if it detects that the current CDR has entered that app. This is similar to the logic that is done for Parking. In general, if we entered into Dial, then we want that CDR to record the application as such - this prevents pre-dial handlers, mid-call handlers, and other shenaniganry from changing the application value. (4) The CDR engine now checks for the AST_SOFTHANGUP_HANGUP_EXEC in more places to determine if the channel is in hangup logic or dead. In either case, we don't want to record changes in the channel. (5) The default option for "endbeforehexten" has been changed to "yes". In general, you don't want to see CDRs in the 'h' exten or in hangup logic. Since the semantics of that option changed in 12, it made sense to update the default value as well. (6) Finally, because we now have the ability to synchronize on the messages published to the CDR topic, on shutdown the CDR engine will now synchronize to the messages currently in flight. This helps to ensure that all in-flight CDRs are written before shutting down. (closes issue ASTERISK-23164) Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/3154 ........ Merged revisions 407084 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@407085 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-31app_dial: Allow macro/gosub pre-bridge execution to occur on prioritiesMatthew Jordan
The parsing for the destination of the macro/gosub uses the '^' character to separate out context, extension, and priority. However, the logic for the macro/gosub execution was written such that it would only do the actual macro/gosub jump if a '^' character existed. This doesn't apply when the macro/gosub jump occurs in a priority/priority label. This patch changes the logic so that the parsing still occurs, but the jump will occur even for priorities/priority labels. (issue ASTERISK-23164) Review: https://reviewboard.asterisk.org/r/3154 ........ Merged revisions 407041 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 407074 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 407082 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@407083 65c4cc65-6c06-0410-ace0-fbb531ad65f3
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-14res_stasis: Expose event for call forwarding and follow forwarded channel.Joshua Colp
This change adds an event for when an originated call is redirected to another target. This event contains the original channel and the newly created channel. If a stasis subscription exists on the original originated channel for a stasis application then a new subscription will also be created on the stasis application to the redirected channel. This allows the application to follow the call path completely. (closes issue ASTERISK-22719) Reported by: Joshua Colp Review: https://reviewboard.asterisk.org/r/3054/ ........ Merged revisions 403808 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@403810 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-22Add an 'R' option to Dial which sends ringing until early media has been ↵Joshua Colp
received. (closes issue ASTERISK-10487) Reported by: Gaspar Zoltan Patches: 10487.patch uploaded by n8ideas (license 6075) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@401411 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-10-18Add channel lock protection around translation path setup.Richard Mudgett
Most callers of ast_channel_make_compatible() happen before the channels enter a two party bridge. With the new bridging framework, two party bridging technologies may also call ast_channel_make_compatible() when there is more than one thread involved with the two channels. * Added channel lock protection in set_format() and ast_channel_make_compatible_helper() when dealing with the channel's native formats while setting up a translation path. * Fixed best_src_fmt and best_dst_fmt usage consistency in ast_channel_make_compatible_helper(). The call to ast_translator_best_choice() got them backwards. * Updated some callers of ast_channel_make_compatible() and the function documentation. There is actually a difference between the two channels passed in. * Fixed the deadlock potential in res_fax.c dealing with ast_channel_make_compatible(). The deadlock potential was already there anyway because res_fax called ast_channel_make_compatible() with chan locked. (closes issue ASTERISK-22542) Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/2915/ ........ Merged revisions 401239 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@401240 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-26Adding a few words to the Dial option 'r' help text to clarify its tone ↵Rusty Newton
argument description ........ Merged revisions 399874 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@399875 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-22Bridge API: Set a cause code on a channel when it is ejected from a bridge.Richard Mudgett
The cause code needs to be passed from the disconnecting channel to the bridge peers if the disconnecting channel dissolves the bridge. * Made the call to an app_agent_pool agent disconnect with the busy cause code if the agent does not ack the call in time or hangs up before acking the call. (closes issue ASTERISK-22042) Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/2772/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397472 65c4cc65-6c06-0410-ace0-fbb531ad65f3