In an originated outbound session that is in progressing phase, I do, via esl socket outbound, a "tone_detect".

When I receive the event "DETECTED_TONE" I do the "stop_tone_detect" but sometimes the stop has no effect and I see in the log the warning:

"switch_core_session.c:1955 Cannot execute app 'stop_tone_detect' media required on an outbound channel that does not have media established"

But the media is present (the tone is correctly detected!).

The event I receive on this channel are (in sequence)

CHANNEL_UUID
CHANNEL_OUTGOING
CHANNEL_ORIGINATE
CHANNEL_STATE - CS_INIT
CHANNEL_STATE - CS_ROUTING
CHANNEL_STATE - CS_CONSUME_MEDIA
CHANNEL_PROGRESS
CHANNEL_PROGRESS_MEDIA
CHANNEL_STATE - CS_EXECUTE
CHANNEL_EXECUTE
CHANNEL_PARK

then I do the "tone_detect" and I receive:

CHANNEL_EXECUTE
MEDIA_BUG_START
CHANNEL_EXECUTE_COMPLETE
DETECTED_TONE

so I do the "stop_tone_detect" that fails in the log

Please, can anyone address me to solve this issue?