114
« on: April 04, 2018, 01:10:50 AM »
Multiple instances are built for 'routing' script only (if configured). Global scripts exist in a single instance only.
A routing script instance is attached to a call leg when a call.preroute/call.route is handled for a channel.
Functions handled: onStartup, onPreroute (if applicable), onExecute, onRinging, onAnswered, onDisconnected. These functions will be called, if implemented, on corresponding channel events. No need to install a message handler for them.
Route event is handled in script main flow.
At all time current call leg id is accessible with Channel.id
For extra events (like DTMFs) you may install a message handler for them.
If you are making outbound calls internally generated you should install a filter matching the peer id.
You may always use a global script.
Keep a list of active calls (track chan.disconnected to remove a call leg from list).
For channel events (ringing, answer ...) you must define your functions and install a handler for them.