Add some asserts that were handy when looking for a stasis cache problem.

* Assert if a channel is destroyed but has the snapshot staging flag set.
In this case the final channel destruction snapshot would never get taken.

* Assert if what we just got out of the stasis cache is not what we were
looking for.  This assert would have saved several days searching for a
bug and a lot of my hair.

* Assert if the music on hold message posts could not find the associated
channel.  A crash will happen later when manager tries to send the MOH AMI
message.  This assert catches the problem when the stasis message is
posted instead of by the thread processing the defective message.

* Always generate a backtrace when an ast_assert() fails.

Review: https://reviewboard.asterisk.org/r/3411/
........

Merged revisions 411701 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@411702 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Richard Mudgett
2014-04-04 17:57:46 +00:00
parent 73f337d97b
commit 9be438299d
4 changed files with 30 additions and 7 deletions

View File

@@ -280,6 +280,9 @@ static void moh_post_start(struct ast_channel *chan, const char *moh_class_name)
message = ast_channel_blob_create_from_cache(ast_channel_uniqueid(chan),
ast_channel_moh_start_type(), json_object);
if (message) {
/* A channel snapshot must have been in the cache. */
ast_assert(((struct ast_channel_blob *) stasis_message_data(message))->snapshot != NULL);
stasis_publish(ast_channel_topic(chan), message);
}
ao2_cleanup(message);
@@ -295,6 +298,9 @@ static void moh_post_stop(struct ast_channel *chan)
message = ast_channel_blob_create_from_cache(ast_channel_uniqueid(chan),
ast_channel_moh_stop_type(), NULL);
if (message) {
/* A channel snapshot must have been in the cache. */
ast_assert(((struct ast_channel_blob *) stasis_message_data(message))->snapshot != NULL);
stasis_publish(ast_channel_topic(chan), message);
}
ao2_cleanup(message);