Play custom audio file in early media (ringback) without bridge

Hi everyone,

I have troubles playing a file (.wav) in early media while executing other things in freeswitch dialplan (let’s say sleep for example). It’s not really a ringback because I don’t want to bridge my a-leg to something else.
Basically, I want to receive a call, play an audio file in early media and execute something at the same time (sleep, a lua or python script) and still play the audio file while the script is executing.
I can’t use playback because it’s a blocking application (I want to execute an other application at the same time).

I succeeded to hear the default ringback tone, but it seems ${ringback} value is not taken into account.

I tested ring_ready, it seems that’s not what I want because it only answers a 180 without SDP.
I tested with ignore_early_media=true, but it failed. I think this variable is only useful when a bridge is executed.
I tested with pre_answer, it plays nothing (no sound at all)
I tested instant_ringback=true which works, but it only plays tone, it did not played what I put in ${ringback}
I tested ringback=/absolute/path/to/my_file.wav, it never plays the given file.
I mixed every setting in every order :zipper_mouth_face:

I searched in the documentation and mailing-list, but nothing worked. I’m pretty sure the solution is easy, but I can’t find any way to find it !
I tested on freeswitch 1.6.20 (CentOS) and 1.10.9 (Debian 10).

Here is the dialplan I use :

<extension name='debug ringback'>
		<action application='log' data='CRIT ringback debug 008'/>
		<action application="set" data="instant_ringback=true"/>
		<action application="set" data="ignore_early_media=true"/>
		<action application="pre_answer"/>
		<action application='set' data='ringback=/usr/share/freeswitch/sounds/music/8000/suite-espanola-op-47-leyenda.wav'/>
		<action application='info' data='crit'/>
		<action application='sleep' data='20000'/>

If you know any way to play my custom audio file in early media in freeswitch, tell me, I’m desperate to find a solution !

Thank you

An example of this exact thing exists in the vanilla config. You need to set ringback before you do any pre_answer, its too late once you pre_answer.