Hello,

I am trying to play early media purely relaying on kamailio and i have accomplished that using the below:

rtpengine_manage();
append_to_reply("Content-Type: application/sdp\r\n");
 $var(body)= $(rb{re.subst,/(IP4.).*/\127.0.0.1/g});
set_reply_body($var(body), "application/sdp");
send_reply("100","Trying");
send_reply("183","Session In Progress");
play_media("totag=$ft file=/home/rawad/test.wav");

My problem is that once the RTP stream starts the call is kept open so my question is is there a way for kamailio to detect the end of rtp stream so that i can send BYE or can kamailio do that automatically.