* Change. Use `service::control` event to control services
This is more FS way. E.g. sofia sends `sofia::register` event
and add all information to headers. So now `service` script
emit `fusion::service::control` event and each service responsible
for test its own name. This also allows add in future evnets to
e.g. monitor service status like `fusion::service::satus` so it
will be possible write service which will be restart services.
* Change. rename service name from `flow` to `call_flow`
* Change. Pass pid file first. Because there really no need pass timeout.
Add. `fsc` script to be able shutdown MWI and Call Flow subscribe services.
* Change. rename `fsc` to `service`.
* Change. Use `stop` command instead of `shutdown`
Rewrite MWI and CallFlow subscribe handlers based on EventConsumer class.
Also on my test VirtualBox/Debian system Lua function `os.clock` produce
very strange result(delta ~0.015 for 1 second) so I switch to `os.time`.
Now to to stop this background Lua scripts it possible send CUSTOM event
with subclass `fusion::XXX::shutdown`. Where XXX is `mwi` or `flow`.
Usage of EventConsumer class
```Lua
-- create new object with timeout one minute
local events = EventConsumer.new(60000)
-- bind to some FS event
events:bind("SHUTDOW", function(self, name, event) ... end)
-- bind to another FS event with subclass
events:bind("CUSTOM::fusion::mwi::shutdown", function(self, name, event) ... end)
-- handle timeout event
events:on("TIMEOUT", function(self, name) ... end)
--run event loop
events:run()
```
* Add. Handler for SUBSCRIBE method for call flow application.
Usage:
1. Run form fs_cli `luarun call_flow_subscribe`
2. Create new call flow extension and set feature code to `flow+<EXTENSION>`(e.g. `flow+401`).
3. Set on the phone BLF key to `flow+401`
This code based on `mod_valet_parking`.
* Add. prevent running 2 copy of script.
Remove some unused vars and simplify implementation.
* Fix. Use correct protocol for send event.
* Fix. Do escape SQL arguments
* Fix. escape `+` sign in call flow extension.