Index: mod_amd.c =================================================================== --- mod_amd.c (revision 48) +++ mod_amd.c (working copy) @@ -49,6 +49,7 @@ typedef struct amd_settings amd_settings struct amd_helper { amd_settings_t *settings; switch_core_session_t *session; + switch_channel_t *channel; switch_frame_t frame; int state; @@ -78,6 +79,7 @@ struct amd_helper { uint32_t hangover_hits; uint32_t hangunder_hits; + int wait_for_answer; }; typedef struct amd_helper amd_helper_t; @@ -338,8 +340,12 @@ static switch_bool_t amd_callback(switch case SWITCH_ABC_TYPE_READ: if (ah) { - switch_assert(ah != NULL); + switch_assert(ah != NULL); switch_assert(ah->session != NULL); + + if (ah->wait_for_answer && !switch_channel_test_flag(ah->channel, CF_ANSWERED)) { + return SWITCH_TRUE; + } if (switch_core_media_bug_read(bug, &frame) == SWITCH_STATUS_SUCCESS) { switch_status_t status; @@ -456,6 +462,11 @@ SWITCH_STANDARD_APP(voice_start_function ah->hangover_hits = 0; ah->hangunder_hits = 0; ah->session = session; + ah->channel = switch_core_session_get_channel(ah->session); + + if (switch_true(switch_channel_get_variable(channel, "amd_wait_for_answer"))) { + ah->wait_for_answer = 1; + } as = (amd_settings_t *) switch_core_session_alloc(session, sizeof(*as)); ah->settings = as;