On Wed, Mar 15, 2023 at 2:56 AM <[email protected]> wrote: > I am looking to configure Kamailio and RTPEngine to play a wav file for > any new calls during a scheduled asterisk server maintenance. I have set up > the following within route{} to send the call to a early_media route based > on a variable that I can set on the server using kamcmd. > > route { > ... > if ($sht(config=>maint)=="1") { > if (is_method("INVITE") && !has_totag()) { > xlog ("L_INFO","Ongoing maintenance. Call-ID:$ci | Method: > $rm"); > route(early_media); > } > } > ... > } > > route[early_media] { > xlog("Maintenance: handling early_media\n"); > rtpengine_manage("direction=external direction=external"); > $var(body) = $(rb{re.subst,/(IP4.).*/\1##server IP redacted##/g}); > set_reply_body($var(body), "application/sdp"); > t_send_reply("183", "Session Progress"); > sleep(2); > unblock_dtmf("all"); > play_media("file=/etc/kamailio/media/maintenance.wav"); > sleep(21); > rtpengine_delete(); > t_reply("480","Temporarily Unavailable"); > } > > This mostly works as I hear the recorded message in place of the ringing > tone when a call is processed by kamailio and then a busy signal is heard > as part of the 480 reply at the end. The sleep's are in place to match the > duration of the recorded message as otherwise the 480 is sent immediately > following the start of the play_media. Feel free to let me know if there is > a better solution to wait the duration of the media file and then proceed > with processing instead of using sleep(). >
I don't have a solution, but just keep in mind that sleep will block the process for the duration of the timeout. So the process will not do anything else during the sleep. Also, I think the sleep is not interruptible. So even if the caller CANCELs, the INVITE, the process will keep waiting for the timeout.
__________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe send an email to [email protected] Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe:
