summaryrefslogtreecommitdiff
path: root/main/bridge.c
AgeCommit message (Collapse)Author
2017-09-20res_pjsip_session: Check for removed stream state.Ben Ford
When a sip session is refreshed, the stream topology is looped through, checking each stream for compatible formats. This would cause a crash if the stream state was AST_STREAM_STATE_REMOVED, since the formats would never be set for this stream, causing a NULL value to be returned from ast_stream_get_formats. This commit adds a check for streams with removed states. Also removed a stray semicolon. Change-Id: Ic86f8b65a4a26a60885b28b8b1a0b22e1b471d42
2017-09-06stasis/control: Fix possible deadlock with swap channelGeorge Joseph
If an error occurs during a bridge impart it's possible that the "bridge_after" callback might try to run before control_swap_channel_in_bridge has been signalled to continue. Since control_swap_channel_in_bridge is holding the control lock and the callback needs it, a deadlock will occur. * control_swap_channel_in_bridge now only holds the control lock while it's actually modifying the control structure and releases it while the bridge impart is running. * bridge_after_cb is now tolerant of impart failures. Change-Id: Ifd239aa93955b3eb475521f61e284fcb0da2c3b3
2017-08-06bridge: Fix stream topology/participant locking and video misrouting.Joshua Colp
This change fixes a few locking issues and some video misrouting. 1. When accessing the stream topology of a channel the channel lock must be held to guarantee the topology remains valid. 2. When a channel was joined to a bridge the bridge specific implementation for stream mapping was not invoked, causing video to be misrouted for a brief period of time. ASTERISK-27182 Change-Id: I5d2f779248b84d41c5bb3896bf22ba324b336b03
2017-07-26bridge_softmix / res_rtp_asterisk: Fix packet loss and renegotiation issues.Joshua Colp
This change does a few things to improve packet loss and renegotiation: 1. On outgoing RTP streams we will now properly reflect out of order packets and packet loss in the sequence number. This allows the remote jitterbuffer to better reorder things. 2. Video updates can now be discarded for a period of time after one has been sent to prevent flooding of clients. 3. For declined and removed streams we will now release any media session resources associated with them. This was not previously done and caused an issue where old state was being used for a new stream. 4. RTP bundling was not actually removing bundled RTP instances from the parent. This has been resolved by removing based on the RTP instance itself and not the SSRC. 5. The code did not properly handle explicitly unbundling an RTP instance from its parent. This now works as expected. ASTERISK-27143 Change-Id: Ibd91362f0e4990b6129638e712bc8adf0899fd45
2017-06-21Merge "bridge: stuck channel(s) after failed attended transfer"Jenkins2
2017-06-21core_local: local channel data not being properly unref'ed and unlockedKevin Harwell
In an earlier version of Asterisk a local channel [un]lock all functions were added in order to keep a crash from occurring when a channel hung up too early during an attended transfer. Unfortunately, when a transfer failure occurs and depending on the timing, the local channels sometime do not get properly unlocked and deref'ed after being locked and ref'ed. This happens because the underlying local channel structure gets NULLed out before unlocking. This patch reworks those [un]lock functions and makes sure the values that get locked and ref'ed later get unlocked and deref'ed. ASTERISK-27074 #close Change-Id: Ice96653e29bd9d6674ed5f95feb6b448ab148b09
2017-06-21bridge: stuck channel(s) after failed attended transferKevin Harwell
If an attended transfer failed it was possible for some of the channels involved to get "stuck" because Asterisk was not hanging up the transfer target. This patch ensures Asterisk hangs up the transfer target when an attended transfer failure occurs. ASTERISK-27075 #close Change-Id: I98a6ecd92d3461ab98c36f0d9451d23adaf3e5f9
2017-06-13bridge: Add a deferred queue.Joshua Colp
This change adds a deferred queue to bridging. If a bridge technology determines that a frame can not be written and should be deferred it can indicate back to bridging to do so. Bridging will then requeue any deferred frames upon a new channel joining the bridge. This change has been leveraged for T.38 request negotiate control frames. Without the deferred queue there is a race condition between the bridge receiving the T.38 request negotiate and the second channel joining and being in the bridge. If the channel is not yet in the bridge then the T.38 negotiation fails. A unit test has also been added that confirms that a T.38 request negotiate control frame is deferred when no other channel is in the bridge and that it is requeued when a new channel joins the bridge. ASTERISK-26923 Change-Id: Ie05b08523f399eae579130f4a5f562a344d2e415
2017-05-30Confbridge: Add "sfu" video mode to bridge profile options.Mark Michelson
A previous commit added plumbing to bridge_softmix to allow for an SFU experience with Asterisk. This commit adds an option to app_confbridge that allows for a confbridge to actually make use of the SFU video mode. SFU mode is implemented in a "set it and forget it" kind of way. That is, when the bridge is created, if SFU mode is enabled, then the video mode gets set to SFU and cannot be changed. Future improvements may allow for a hybrid experience (e.g. forward multiple video streams, specifically those of the most recent talkers), but for this addition, no such capability is present. Change-Id: I87bbcb63dec6dbbb42488f894871b86f112b2020
2017-05-30Add primitive SFU support to bridge_softmix.Mark Michelson
This sets up the "plumbing" in bridge_softmix to be able to accommodate Asterisk asking as an SFU (selective forwarding unit) for conferences. The way this works is that whenever a channel enters or leaves a conference, all participants in the bridge get sent a stream topology change request. The topologies consist of the channels' original topology, along with video destination streams corresponding to each participants' source video streams. So for instance, if Alice, Bob, and Carol are in the conference, and each supplies one video stream, then the topologies for each would look like so: Alice: Audio, Source video(Alice), Destination Video(Bob), Destination video (Carol) Bob: Audio, Source video(Bob) Destination Video(Alice), Destination video (Carol) Carol: Audio, Source video(Carol) Destination Video(Alice), Destination video (Bob) This way, video that arrives from a source video stream can then be copied out to the destination video streams on the other participants' channels. Once the bridge gets told that a topology on a channel has changed, the bridge constructs a map in order to get the video frames routed to the proper destination streams. This is done using the bridge channel's stream_map. This change is bare-bones with regards to SFU support. Some key features are missing at this point: * Stream limits. This commit makes no effort to limit the number of streams on a specific channel. This means that if there were 50 video callers in a conference, bridge_softmix will happily send out topology change requests to every channel in the bridge, requesting 50+ streams. * Configuration. The plumbing has been added to bridge_softmix, but there has been nothing added as of yet to app_confbridge to enable SFU video mode. * Testing. Some functions included here have unit tests. However, the functionality as a whole has only been verified by hand-tracing the code. * Selectivenss. For a "selective" forwarding unit, this does not currently have any means of being selective. * Features. Presumably, someone might wish to only receive video from specific sources. There are no external-facing functions at the moment that allow for users to select who they receive video from. * Efficiency. The current scheme treats all video streams as being unidirectional. We could be re-using a source video stream as a desetnation, too. But to simplify things on this first round, I did it this way. Change-Id: I7c44a829cc63acf8b596a337b2dc3c13898a6c4d
2017-05-03bridge_simple: Added support for streamsKevin Harwell
This patch is the first cut at adding stream support to the bridging framework. Changes were made to the framework that allows mapping of stream topologies to a bridge's supported media types. The first channel to enter a bridge initially defines the media types for a bridge (i.e. a one to one mapping is created between the bridge and the first channel). Subsequently added channels merge their media types into the bridge's adding to it when necessary. This allows channels with different sized topologies to map correctly to each other according to media type. The bridge drops any frame that does not have a matching index into a given write stream. For now though, bridge_simple will align its two channels according to size or first to join. Once both channels join the bridge the one with the most streams will indicate to the other channel to update its streams to be the same as that of the other. If both channels have the same number of streams then the first channel to join is chosen as the stream base. A topology change source was also added to a channel when a stream toplogy change request is made. This allows subsystems to know whether or not they initiated a change request. Thus avoiding potential recursive situations. ASTERISK-26966 #close Change-Id: I1eb5987921dd80c3cdcf52accc136393ca2d4163
2017-02-23Binaural synthesis (confbridge): Adds binaural synthesis to bridge_softmix.frahaase
Adds binaural synthesis to bridge_softmix (via convolution using libfftw3). Binaural synthesis is conducted at 48kHz. For a conference, only one spatial representation is rendered. The default rendering is applied for mono-capable channels. ASTERISK-26292 Change-Id: Iecdb381b6adc17c961049658678f6219adae1ddf
2017-02-13cli: Fix various CLI documentation and completion issuesSean Bright
* app_minivm: Use built-in completion facilities to complete optional arguments. * app_voicemail: Use built-in completion facilities to complete optional arguments. * app_confbridge: Add missing colons after 'Usage' text. * chan_alsa: Use built-in completion facilities to complete optional arguments. * chan_sip: Use built-in completion facilities to complete optional arguments. Add completions for 'load' for 'sip show user', 'sip show peer', and 'sip qualify peer.' * chan_skinny: Correct and extend completions for 'skinny reset' and 'skinny show line.' * func_odbc: Correct completions for 'odbc read' and 'odbc write' * main/astmm: Use built-in completion facilities to complete arguments for 'memory' commands. * main/bridge: Correct completions for 'bridge kick.' * main/ccss: Use built-in completion facilities to complete arguments for 'cc cancel' command. * main/cli: Add 'all' completion for 'channel request hangup.' Correct completions for 'core set debug channel.' Correct completions for 'core show calls.' * main/pbx_app: Remove redundant completions for 'core show applications.' * main/pbx_hangup_handler: Remove unused completions for 'core show hanguphandlers all.' * res_sorcery_memory_cache: Add completion for 'reload' argument of 'sorcery memory cache stale' and properly implement. Change-Id: Iee58c7392f6fec34ad9d596109117af87697bbca
2016-11-14res/ari/resource_bridges: Add the ability to manipulate the video sourceMatt Jordan
In multi-party bridges, Asterisk currently supports two video modes: * Follow the talker, in which the speaker with the most energy is shown to all participants but the speaker, and the speaker sees the previous video source * Explicitly set video sources, in which all participants see a locked video source Prior to this patch, ARI had no ability to manipulate the video source. This isn't important for two-party bridges, in which Asterisk merely relays the video between the participants. However, in a multi-party bridge, it can be advantageous to allow an external application to manipulate the video source. This patch provides two new routes to accomplish this: (1) setVideoSource: POST /bridges/{bridgeId}/videoSource/{channelId} Sets a video source to an explicit channel (2) clearVideoSource: DELETE /bridges/{bridgeId}/videoSource Removes any explicit video source, and sets the video mode to talk detection ASTERISK-26595 #close Change-Id: I98e455d5bffc08ea5e8d6b84ccaf063c714e6621
2016-11-04main/bridge: Add some verbose logging for video source changesMatt Jordan
It's actually quite useful to see the source of a video stream change. This doesn't happen terribly often, even with talk detection - but when it does, it's nice to know which channel is now providing your video stream. As a verbose 5 level message, it shouldn't be terribly spammy or costly to have, and is 'lower level' then most other verbose messages that the bridge system emits. ASTERISK-26555 Change-Id: Ia1c20ecafa9670171fd38bddcf3beccae47fb15c
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-08-15manager: Add <see-also> tags to relate Bridge related events,actions, and appsMatt Jordan
Change-Id: I67e6b79fa3102e494b5fe6cc7510472249080e85
2016-05-23Bridging: introduce "invisible" bridges.Mark Michelson
Invisible bridges function the same as normal bridges, but they have the following restrictions: * They never show up in CLI, AMI, or ARI queries. * They do not have Stasis messages published about them. Invisible bridges' main use is for when use of the bridging system is desired, but the bridge should not be known to users of the Asterisk system. ASTERISK-25925 Change-Id: I804a209d3181d7c54e3d61a60eb462e7ce0e3670
2016-04-25Merge "Bridge system: Fix memory leaks and double frees on impart failure."zuul
2016-04-25Merge "bridge_softmix.c: Fix crash if channel fails to join mixing tech."zuul
2016-04-22Bridge system: Fix memory leaks and double frees on impart failure.Richard Mudgett
You cannot reference the passed in features struct after calling ast_bridge_impart(). Even if the call fails. Change-Id: I902b88ba0d5d39520e670fb635078a367268ea21
2016-04-22bridge_softmix.c: Fix crash if channel fails to join mixing tech.Richard Mudgett
softmix_bridge_join() failed because of an allocation failure. To address this, the softmix bridge technology now checks if the channel failed to join softmix successfully. In addition, the bridge now begins the process of kicking the channel out of the bridge so we don't have channels partially in the bridge for very long. * Fix the test_channel_feature_hooks.c unit tests. The test channel must have a valid codec to join the simple_bridge technology. This patch makes joining a bridge more strict by not allowing partially joined channels to remain in the bridge. Change-Id: I97e2ade6a2bcd1214f24fb839fda948825b61a2b
2016-04-20bridge: Hold off more than one imparting channel at a time.Richard Mudgett
An earlier patch blocked the ast_bridge_impart() call until the channel either entered the target bridge or it failed. Unfortuantely, if the target bridge is stasis and the imprted channel is not a stasis channel, stasis bounces the channel out of the bridge to come back into the bridge as a proper stasis channel. When the channel is bounced out, that released the block on ast_bridge_impart() to continue. If the impart was a result of a transfer, then it became a race to see if the swap channel would get hung up before the imparted channel could come back into the stasis bridge. If the imparted channel won then everything is fine. If the swap channel gets hung up first then the transfer will fail because the swap channel is leaving the bridge. * Allow a chain of ast_bridge_impart()'s to happen before any are unblocked to prevent the race condition described above. When the channel finally joins the bridge or completely fails to join the bridge then the ast_bridge_impart() instances are unblocked. ASTERISK-25947 Reported by: Richard Mudgett ASTERISK-24649 Reported by: John Bigelow ASTERISK-24782 Reported by: John Bigelow Change-Id: I8fef369171f295f580024ab4971e95c799d0dde1
2016-03-03bridge.c: Crash during attended transfer when missing a local channel halfKevin Harwell
It's possible for the transferer channel to get hung up early during the attended transfer process. For instance, a phone may send a "bye" immediately upon receiving a sip notify that contains a sip frag 100 (I'm looking at you Jitsi). When this occurs a race begins between the transferer being hung up and completion of the transfer code. If the channel hangs up too early during a transfer involving stasis bridging for instance, then when the created local channel goes to look up its swap channel (and associated datastore) it can't find it (since it is no longer in the bridge) thus it fails to enter the stasis application. Consequently, the created local channel(s) hang up as well. If the timing is just right then the bridging code attempts to add the message link with missing local channel(s). Hence the crash. Unfortunately, there is no great way to solve the problem of the unexpected "bye". While we can't guarantee we won't receive an early hangup, and in this case still fail to enter the stasis application, we can make it so asterisk does not crash. This patch does just that by locking the local channel structure, checking that the local channel's peer has not been lost, and then continuing. This keeps the local channel's peer from being ripped out from underneath it by the local/unreal hangup code while attempting to set the stasis message link. ASTERISK-25771 Change-Id: Ie6d6061e34c7c95f07116fffac9a09e5d225c880
2016-02-29bridge_channel: Don't settle owed events on an optimization.Richard Mudgett
Local channel optimization could cause DTMF digits to be duplicated. Pending DTMF end events would be posted to a bridge when the local channel optimizes out and is replaced by the channel further down the chain. When the real digit ends, the channel would get another DTMF end posted to the bridge. A -- LocalA;1/n -- LocalA;2/n -- LocalB;1 -- LocalB;2 -- B 1) LocalA has the /n flag to prevent optimization. 2) B is sending DTMF to A through the local channel chain. 3) When LocalB optimizes out it can move B to the position of LocalB;1 4) Without this patch, when B swaps with LocalB;1 then LocalB;1 would settle an owed DTMF end to the bridge toward LocalA;2. 5) When B finally ends its DTMF it sends the DTMF end down the chain. 6) Without this patch, A would hear the DTMF digit end when LocalB optimizes out and when B ends the original digit. ASTERISK-25582 Change-Id: I1bbd28b8b399c0fb54985a5747f330a4cd2aa251
2015-12-01Unset BRIDGEPEER when leaving a bridgeJonathan Rose
Currently if a channel is transferred out of a bridge, the BRIDGEPEER variable (also BRIDGEPVTCALLID) remain set even once the channel is out of the bridge. This patch removes these variables when leaving the bridge. ASTERISK-25600 #close Reported by: Mark Michelson Change-Id: I753ead2fffbfc65427ed4e9244c7066610e546da
2015-07-13bridge.c: Fixed race condition during attended transferKevin Harwell
During an attended transfer a thread is started that handles imparting the bridge channel. From the start of the thread to when the bridge channel is ready exists a gap that can potentially cause problems (for instance, the channel being swapped is hung up before the replacement channel enters the bridge thus stopping the transfer). This patch adds a condition that waits for the impart thread to get to a point of acceptable readiness before allowing the initiating thread to continue. ASTERISK-24782 Reported by: John Bigelow Change-Id: I08fe33a2560da924e676df55b181e46fca604577
2015-06-23bridge.c: Hangup attended transfer target if bridgedKevin Harwell
After completing an attended transfer the transfer target channel was not being hung up after leaving the bridge. Added an explicit softhangup to hangup said channel, but only if it was previously bridged. ASTERISK-24782 #close Reported by: John Bigelow Change-Id: Idde9543d56842369384a5e8c00d72a22bbc39ada
2015-04-16bridge.c: NULL app causes crash during attended transferKevin Harwell
Due to a race condition there was a chance that during an attended transfer the channel's application would return NULL. This, of course, would cause a crash when attempting to access the memory. This patch retrieves the channel's app at an earlier time in processing in hopes that the app name is available. However, if it is not then "unknown" is used instead. Since some string value is now always present the crash can no longer occur. ASTERISK-24869 #close Reported by: viniciusfontes Review: https://gerrit.asterisk.org/#/c/133/ Change-Id: I5134b84c4524906d8148817719d76ffb306488ac
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-04-08Bridging: Eliminate the unnecessary make channel compatible with bridge ↵Richard Mudgett
operation. When a channel enters the bridging system it is first made compatible with the bridge and then the bridge technology makes the channel compatible with the technology. For all but the DAHDI native and softmix bridge technologies the make channel compatible with the bridge step is an effective noop because the other technologies allow all audio formats. For the DAHDI native bridge technology it doesn't matter because it is not an initial bridge technology and chan_dahdi allows only one native format per channel. For the softmix bridge technology, it is a noop at best and harmful at worst because the wrong translation path could be setup if the channel's native formats allow more than one audio format. This is an intermediate patch for a series of patches aimed at improving translation path choices. * Removed code dealing with the unnecessary step of making the channel compatible with the bridge. ASTERISK-24841 Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/4600/ ........ Merged revisions 434424 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@434430 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-04-07bridge.c: Hangup attended transfer target after it has been swapped outKevin Harwell
After completing an attended transfer the transfer target channel (the one that gets swapped out) was not being hung up after leaving the bridge. This resulted in a channel possibly being left around. Added an explicit softhangup for the channel in question after the transfer is successfully completed in order to make sure the channel is hung up. ASTERISK-24782 #close Reported by: John Bigelow Review: https://reviewboard.asterisk.org/r/4575/ ........ Merged revisions 434240 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@434241 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-26Replace most uses of ast_register_atexit with ast_register_cleanup.Corey Farrell
Since 'core stop now' and 'core restart now' do not stop modules, it is unsafe for most of the core to run cleanups. Originally all cleanups used ast_register_atexit, and were only changed when it was shown to be unsafe. ast_register_atexit is now used only when absolutely required to prevent corruption and close child processes. Exceptions that need to use ast_register_atexit: * CDR: Flush records. * res_musiconhold: Kill external applications. * AstDB: Close the DB. * canary_exit: Kill canary process. ASTERISK-24142 #close Reported by: David Brillert ASTERISK-24683 #close Reported by: Peter Katzmann ASTERISK-24805 #close Reported by: Badalian Vyacheslav ASTERISK-24881 #close Reported by: Corey Farrell Review: https://reviewboard.asterisk.org/r/4500/ Review: https://reviewboard.asterisk.org/r/4501/ ........ Merged revisions 433495 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 433497 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433498 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-13Logger: Convert 'struct ast_callid' to unsigned int.Corey Farrell
Switch logger callid's from AO2 objects to simple integers. This helps in two ways. Copying integers is faster than referencing AO2 objects, so this will result in a small reduction in logger overhead. This also erases the possibility of an infinate loop caused by an invalid callid in threadstorage. ASTERISK-24833 #comment Committed callid conversion to trunk. Reported by: Corey Farrell Review: https://reviewboard.asterisk.org/r/4466/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432834 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-11HTTP: Stop accepting requests on final system shutdown.Richard Mudgett
There are three CLI commands to stop and restart Asterisk each. 1) core stop/restart now - Hangup all calls and stop or restart Asterisk. New channels are prevented while the shutdown request is pending. 2) core stop/restart gracefully - Stop or restart Asterisk when there are no calls remaining in the system. New channels are prevented while the shutdown request is pending. 3) core stop/restart when convenient - Stop or restart Asterisk when there are no calls in the system. New calls are not prevented while the shutdown request is pending. ARI has made stopping/restarting Asterisk more problematic. While a shutdown request is pending it is desirable to continue to process ARI HTTP requests for current calls. To handle the current calls while a shutdown request is pending, a new committed to shutdown phase is needed so ARI applications can deal with the calls until the system is fully committed to shutdown. * Added a new shutdown committed phase so ARI applications can deal with calls until the final committed to shutdown phase is reached. * Made refuse new HTTP requests when the system has reached the final system shutdown phase. Starting anything while the system is actively releasing resources and unloading modules is not a good thing. * Split the bridging framework shutdown to not cleanup the global bridging containers when shutting down in a hurry. This is similar to how other modules prevent crashes on rapid system shutdown. * Moved ast_begin_shutdown(), ast_cancel_shutdown(), and ast_shutting_down(). You should not have to include channel.h just to access these system functions. ASTERISK-24752 #close Reported by: Matthew Jordan Review: https://reviewboard.asterisk.org/r/4399/ ........ Merged revisions 431692 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431694 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-29stasis transfer: fix stasis bridge push race part twoScott Griepentrog
When swapping a Local channel in place of one already in a bridge (to complete a bridge attended transfer), the channel that was swapped out can actually be hung up before the stasis bridge push callback executes on the independant transfer thread. This results in the stasis app loop dropping out and removing the control that has the the app name which the local replacement channel needs so it can re-enter stasis. To avoid this race condition a new push_peek callback has been added, and called from the ast_bridge_impart thread before it launches the independant thread that will complete the transfer. Now the stasis push_peek callback can copy the stasis app name before the swap channel can hang up. ASTERISK-24649 Review: https://reviewboard.asterisk.org/r/4382/ ........ Merged revisions 431450 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431451 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-22Bridge core: Pass a ref with the swap channel when joining a bridge.Richard Mudgett
When code imparts a channel into a bridge to swap with another channel, a ref needs to be held on the swap channel to ensure that it cannot dissapear before finding it in the bridge. * The ast_bridge_join() swap channel parameter now always steals a ref for the swap channel. This is the only change to the bridge framework's public API semantics. * bridge_channel_internal_join() now requires the bridge_channel->swap channel to pass in a ref. ASTERISK-24649 Reported by: John Bigelow Review: https://reviewboard.asterisk.org/r/4354/ ........ Merged revisions 430975 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@430976 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-12Revert -r430452 It needs to be redone for the next major AMI version change ↵Richard Mudgett
instead. ASTERISK-24049 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@430509 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-09AMI: Remove no longer used parameter from astman_send_listack().Richard Mudgett
Follow-up issue to -r430435 from reviewboard review. ASTERISK-24049 Review: https://reviewboard.asterisk.org/r/4315/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@430452 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-09AMI: Make AMI actions that generate event lists consistent.Richard Mudgett
* Made the following AMI actions use list API calls for consistency: Agents BridgeInfo BridgeList BridgeTechnologyList ConfbridgeLIst ConfbridgeLIstRooms CoreShowChannels DAHDIShowChannels DBGet DeviceStateList ExtensionStateList FAXSessions Hangup IAXpeerlist IAXpeers IAXregistry MeetmeList MeetmeListRooms MWIGet ParkedCalls Parkinglots PJSIPShowEndpoint PJSIPShowEndpoints PJSIPShowRegistrationsInbound PJSIPShowRegistrationsOutbound PJSIPShowResourceLists PJSIPShowSubscriptionsInbound PJSIPShowSubscriptionsOutbound PresenceStateList PRIShowSpans QueueStatus QueueSummary ShowDialPlan SIPpeers SIPpeerstatus SIPshowregistry SKINNYdevices SKINNYlines Status VoicemailUsersList * Incremented the AMI version to 2.7.0. * Changed astman_send_listack() to not use the listflag parameter and always set the value to "Start" so the start capitalization is consistent. i.e., The FAXSessions used "Start" while the rest of the system used "start". The corresponding complete event always used "Complete". * Fixed ami_show_resource_lists() "PJSIPShowResourceLists" to output the AMI ActionID for all of its list events. * Fixed off-nominal AMI protocol error in manager_bridge_info(), manager_parking_status_single_lot(), and manager_parking_status_all_lots(). Use of astman_send_error() after responding to the original AMI action request violates the action response pattern by sending two responses. * Fixed minor protocol error in action_getconfig() when no requested categories are found. Each line needs to be formatted as "Header: text". * Fixed off-nominal memory leak in manager_build_parked_call_string(). * Eliminated unnecessary use of RAII_VAR() in ami_subscription_detail(). ASTERISK-24049 #close Reported by: Jonathan Rose Review: https://reviewboard.asterisk.org/r/4315/ ........ Merged revisions 430434 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@430435 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-11-24DTMF hooks: Leaving channels need to push any collected digits into the bridge.Richard Mudgett
Any partially collected DTMF digits for a DTMF hook need to be pushed into the bridge when a channel leaves the bridging system as if there were a timeout. Review: https://reviewboard.asterisk.org/r/4199/ ........ Merged revisions 428601 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 428602 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@428603 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-11-14Fix race condition that could result in ARI transfer messages not being sent.Mark Michelson
From reviewboard: "During blind transfer testing, it was noticed that tests were failing occasionally because the ARI blind transfer event was not being sent. After investigating, I detected a race condition in the blind transfer code. When blind transferring a single channel, the actual transfer operation (i.e. removing the transferee from the bridge and directing them to the proper dialplan location) is queued onto the transferee bridge channel. After queuing the transfer operation, the blind transfer Stasis message is published. At the time of publication, snapshots of the channels and bridge involved are created. The ARI subscriber to the blind transfer Stasis message then attempts to determine if the bridge or any of the involved channels are subscribed to by ARI applications. If so, then the blind transfer message is sent to the applications. The way that the ARI blind transfer message handler works is to first see if the transferer channel is subscribed to. If not, then iterate over all the channel IDs in the bridge snapshot and determine if any of those are subscribed to. In the test we were running, the lone transferee channel was subscribed to, so an ARI event should have been sent to our application. Occasionally, though, the bridge snapshot did not have any channels IDs on it at all. Why? The problem is that since the blind transfer operation is handled by a separate thread, it is possible that the transfer will have completed and the channels removed from the bridge before we publish the blind transfer Stasis message. Since the blind transfer has completed, the bridge on which the transfer occurred no longer has any channels on it, so the resulting bridge snapshot has no channels on it. Through investigation of the code, I found that attended transfers can have this issue too for the case where a transferee is transferred to an application." The fix employed here is to decouple the creation of snapshots for the transfer messages from the publication of the transfer messages. This way, snapshots can be created to reflect what they are at the time of the transfer operation. Review: https://reviewboard.asterisk.org/r/4135 ........ Merged revisions 427848 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 427870 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@427873 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-10-28main/bridge: Destroy features struct on off nominal path during bridge impartMatthew Jordan
When a channel is imparted to a bridge, the invocation of the function may provide an ast_bridge_features struct. Upon passing this to ast_bridge_impart, the caller must assume that ownership has passed to the function, as in all paths the function destroys the struct prior to returning (as its purpose is to configure the behavior of the channel while in the bridge). On one off nominal path - where the channel already has a PBX thread - the struct was not being destroyed. This patch fixes that glitch. ASTERISK-24437 #close Reported by: Scott Griepentrog ........ Merged revisions 426431 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 426432 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@426433 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-10-10bridge: During a smart bridge operation provide a more complete bridge to ↵Joshua Colp
the old technology. When a smart bridge operation occurs and a bridge transitions from one technology to another the old technology is provided the channels formerly in it and told that they are leaving. Unfortunately the bridge provided along with them is incomplete. The bridge, despite there being channels in it, contains none. This forces technology implementations to have additional logic when channels are leaving or to store their own duplicated state. This change makes the bridge more complete so it contains the expected channels. Now that the bridge is complete special logic within bridge_native_rtp is no longer needed and has been removed. Review: https://reviewboard.asterisk.org/r/4057/ ........ Merged revisions 425242 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 425243 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@425244 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-20chan_pjsip: Update media translation paths when new SDP negotiated.Richard Mudgett
On a SIP reinvite that changes media strams, the PJSIP channel driver was flooding the log with "Asked to transmit frame type %s, while native formats is %s" warnings. * Fixes PJSIP not setting up translation paths when the formats change on a reinvite. AFS-63 was effectively reintroduced because of the media formats work. res_pjsip_sdp_rtp.c:set_caps() * Improved the unexpected frame format WARNING message to include more information. * Added protective locking while altering formats on a channel. Reworked set_format() to simplify and protect the formats under manipulation. * Restored some code that got lost in the media_formats work. (channel.c:set_format() and res_pjsip_sdp_rtp.c:set_caps()) AFS-137 #close Reported by: Mark Michelson Review: https://reviewboard.asterisk.org/r/3906/ ........ Merged revisions 421645 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@421646 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-20Stasis: Add information to blind transfer eventKinsey Moore
When a blind transfer occurs that is forced to create a local channel pair to satisfy the transfer request, information about the local channel pair is not published. This adds a field to describe that channel to the blind transfer message struct so that this information is conveyed properly to consumers of the blind transfer message. This also fixes a bug in which Stasis() was unable to properly identify the channel that was replacing an existing Stasis-controlled channel due to a blind transfer. Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/3921/ ........ Merged revisions 421537 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 421538 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@421539 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-07Ensure bridges exist when trying to determine bridged parties when ↵Mark Michelson
publishing transfer information. ........ Merged revisions 420387 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@420388 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-07Stasis: Convey transfer information to applicationsKinsey Moore
This fixes a class of issues where Stasis applications were not made aware that their channels were being manipulated or replaced by external entitiessuch as transfers, AMI commands, or dialplan applications such as Bridge(). Inconsistent information such as StasisEnd events with unknown channels as a result of masquerades has also been corrected. To accomplish these fixes, several new fields were added to blind and attended transfer messages as well as StasisStart and BridgeAttendedTransfer Stasis events. ASTERISK-23941 #close Review: https://reviewboard.asterisk.org/r/3865/ Review: https://reviewboard.asterisk.org/r/3857/ Review: https://reviewboard.asterisk.org/r/3852/ Review: https://reviewboard.asterisk.org/r/3816/ Review: https://reviewboard.asterisk.org/r/3731/ Review: https://reviewboard.asterisk.org/r/3729/ Review: https://reviewboard.asterisk.org/r/3728/ ........ Merged revisions 420325 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@420338 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-25bridge: Make "bridge destroy" only available in developer mode and add "all" ↵Joshua Colp
to "bridge kick". The "bridge destroy" CLI command is invasive to bridges and can leave them in an unexpected state for the users of them. Since this command may be useful for developers it is now only available when developer mode is available. To take its place "all" has been added as a valid option to the "bridge kick" CLI command. It will kick all of the channels in the bridge out. ASTERISK-23987 Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/3840/ ........ Merged revisions 419536 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@419537 65c4cc65-6c06-0410-ace0-fbb531ad65f3