In Yate the IVR functionality is not related to routing, therefore regexroute - or any other routing module - will not help writing an IVR. In Yate an IVR is rather an application started when an incoming call is routed to that application. This application gets the opportunity of inspecting events generated by the caller and giving commands to Yate - all these by handling or generating Messages.
Where to place the script
You must make sure extmodule.yate exist (is compiled and/or installed) and is not disabled from the yate.conf file. Also in extmodule.conf make sure you specify a proper scripts_dir setting in the [general] section. The scripts_dir parameter must point to the directory where the external scripts and their libraries are installed, like in this example:
In this directory you should place the IVR applications or scripts you are going to use.
How to route calls to script
You will also need to route the incoming calls to the external application so it creates an instance of the IVR when the user dials that number. Let's suppose you want to use Regular expressions to route the short number 555 to the voicemail.
Most IVR scripts would use type "nodata" for their type as the actual voice data is not provided by the IVR itself but by Yate provided sources attached later.
You can find some IVR examples Yate's sources ~/share/scripts/.
How it works
When the 555 number is dialed an instance of the voicemail.php script is launched and the "call.execute" message is passed to it (even if it didn't install a handler) so it can pick up usefull info about the call:
- caller channel "id"
- caller number "caller"
- caller user account "user" - if authenticated by the incoming call driver
- called number "called" - in case the IVR handles more than one number
The application then keeps running, installing message handlers, generating messages and keeping the event loop running.
In the end the caller is either disconnected or is transferred to another channel which can be another IVR.
The application terminates when the caller disconnects or is transferred.
You can find more about the internal working of an IVR application in the page related to Writing an IVR.