res_stasis: Fix crash on a hanging up channel.

* Give the struct stasis_app_control ao2 object a ref to the channel held
in the object.  Now the channel will still be around if a thread needs to
post a stasis message instead of crash because the topic was destroyed.

* Moved stopping any lingering silence generator out of the struct
stasis_app_control destructor and made it a part of exiting the Stasis
application.  Who knows which thread the destructor will be called under
so it cannot affect the channel's silence generator.  Not only was the
channel unprotected when the silence generator was stopped, stasis may no
longer even control the channel.

ASTERISK-25882

Change-Id: I21728161b5fe638cef7976fa36a605043a7497e4
This commit is contained in:
Richard Mudgett
2016-03-28 18:10:40 -05:00
parent e1fdb0a6da
commit a179aba65e
3 changed files with 33 additions and 19 deletions

View File

@@ -108,5 +108,13 @@ int control_add_channel_to_bridge(
struct stasis_app_control *control,
struct ast_channel *chan, void *obj);
/*!
* \brief Stop playing silence to a channel right now.
* \since 13.9.0
*
* \param control The control for chan
*/
void control_silence_stop_now(struct stasis_app_control *control);
#endif /* _ASTERISK_RES_STASIS_CONTROL_H */