Commit Graph

8 Commits

Author SHA1 Message Date
Alexey Melnichuk f939c82862 Add. Allow use `call_flow_subscribe.lua` with feature codes without `flow+` prefix. (#2609)
This commit allows create call flow extension with some feature code (e.g. `*401`)
Then on the phone you can configure BLF like `flow+*401` and use `call_flow_subscribe` to
track current status of this call flow. BLF like `*401` will also works but only if
use `call_flow_monitor` script.
Also it is possible dial `flow+*401` as well as `*401` to toggle call flow state.
2017-06-08 09:44:45 -06:00
Alexey Melnichuk a7d58e14c7 Add. Support DND feature via BLF key (#2606) 2017-05-29 09:50:20 -06:00
Alexey Melnichuk 868c7dd153 Change. Use `service::control` event to control services (#1790)
* 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`
2016-08-02 14:00:49 -06:00
Alexey Melnichuk d47151ba8d Add `service` script and make timout optional for EventConsumer ctor (#1775)
* 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`
2016-07-26 11:58:37 -06:00
Alexey Melnichuk cae644c8a1 Add. EventConsumer class. (#1741)
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()
```
2016-07-08 13:10:43 -06:00
Alexey Melnichuk 3d1f5b6866 Add. Support multiple events. (#1736)
Now subscriber stops and remove pid files when FS shutdown.
So if you use Status->Services you will see correct status.
2016-07-06 12:37:16 -06:00
Alexey Melnichuk 8a72e2afd8 Add. Event handler to support MWI. (#1720)
* Add. Event handler to support MWI.

* Fix. store cache only when get data from memcache

* Change. Use UUID as PID.
2016-06-30 09:55:37 -06:00
Alexey Melnichuk 61d6f0be6c Add. Handler for SUBSCRIBE method for call flow application. (#1701)
* 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.
2016-06-24 10:32:19 -06:00