I believe you're looking for `api_on_pre_answer` or `api_on_media`

https://freeswitch.org/confluence/display/FREESWITCH/api_on_media