Index: /branches/1.8/apps/app_chanspy.c =================================================================== --- /branches/1.8/apps/app_chanspy.c (revision 358857) +++ /branches/1.8/apps/app_chanspy.c (working copy) @@ -483,6 +483,11 @@ ast_log(LOG_NOTICE, "Attaching %s to %s\n", spychan_name, autochan->chan->name); + /* Make sure the channel isn't a zombie before we attach the audio hook. */ + if (ast_test_flag(autochan->chan, AST_FLAG_ZOMBIE)) { + return -1; + } + ast_set_flag(audiohook, AST_AUDIOHOOK_TRIGGER_SYNC | AST_AUDIOHOOK_SMALL_QUEUE); res = ast_audiohook_attach(autochan->chan, audiohook); @@ -550,6 +555,7 @@ if (start_spying(spyee_autochan, spyer_name, &csth.spy_audiohook)) { ast_audiohook_destroy(&csth.spy_audiohook); + ast_log(LOG_ERROR, "Aborting chanspy %s - couldn't attach audiohook.\n", name); return 0; }