The duration of the media playback is returned from the play_media() command (see `media_duration` modparam). You could use some sort of timer to invoke media unblocking after media playback ends. Sadly my Kamailio-Fu isn't strong enough to be able to tell you how to run this sort of timer. :)
Cheers
Thank you for the hint.
I was thinking about timers, but rtimer cannot be triggered in an event route. I used a "timer" module, it could trigger another route from the event route but when a new route is triggered unblock_media() is not aware of the call-id and if i assign call-id to a variable in the event route, that variable is unavailable at new route. Hope that make sense.
here is my peace of code:
loadmodule "timer.so"
modparam("timer", "declare_timer", "PB_TIMER=START,5000");
route[START]{
xlog("current call id at event route is $ci, but call-id avp is $avp(call_id)");
unblock_media("all");
timer_enable("PB_TIMER",0); #we need to disable timer or it will be triggered over and over again
}
event_route[dialog:start]{
xlog("L_INFO", "dialog started, received 200OK");
#block_media();
play_media("all file=/usr/local/src/myfile.wav");
$avp(call_id)=$ci;
timer_enable("PB_TIMER",1);
}