avmd_session=(avmd_session_t*)switch_core_session_alloc(fs_session,sizeof(avmd_session_t));/* Allocate memory attached to this FreeSWITCH session for use in the callback routine and to store state information */
status=switch_core_media_bug_add(fs_session,"avmd",NULL,avmd_callback,avmd_session,0,flags,&bug);/* Add a media bug that allows me to intercept the reading leg of the audio stream */
if(status!=SWITCH_STATUS_SUCCESS){/* If adding a media bug fails exit */