Hi Peter,
thanks for this enhancement, I find it very useful.
I have few remarks for potentially a better integration with available code:
a) lib/kcore/faked_msg.{c,h} offers already a way to get a fake SIP msg.
It should be used instead of building a new one inside dispatcher
module. The Makefile of the module has to be updated to link against
internal libkcore
b) instead of using route blocks with names, I think it is better to
define two new event_route blocks to be executed when a destination is
un/available. There are several modules that are still running route
blocks for non-sip message events, because they were developed long time
ago, but for new implementations, whenever one needs to execute a block
of actions from config file on an event which is not related to SIP
message routing, should be done via event_route.
In this case, for example, can be used event_route[dispatcher:dst-down]
and event_route[dispatcher:dst-up]. If they are defined, they will be
executed. Checking for existence of these event routes can be done at
startup, so no new module parameters are needed -- the names of the
event routes will be "known" and reserved in the future. You can see
inside htable module how event_route[htable:mod-init] is looked up and
executed.
Using an event route instead of a route block will also clearly indicate
that is not about SIP routing, therefore not all of the functions
exported by modules work properly there.
Cheers,
Daniel
On 8/16/11 12:27 PM, Peter Dunkley wrote:
> Module: sip-router
> Branch: master
> Commit: 085638299508ef6bf0c96673a663453da76d0a4f
> URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=085638299508ef6bf0c96673a663453da76d0a4f
>
> Author: pd<peter.dunkley@crocodile-rcs.com>
> Committer: pd<peter.dunkley@crocodile-rcs.com>
> Date: Tue Aug 16 11:24:44 2011 +0100
>
> modules_k/dispatcher: Added new feature that enables routes to be run when destinations fail/recover
>
> - Two new exported parameters ds_dst_unavailable_route and
> ds_dst_available_route allow you to specify routes to run when
> a destination is marked PROBING and unmarked PROBING respectively.
>
> This is useful for integration with NMC and alarms equipment as
> these routes can be used to trigger/log these status changes.
>
> ---
>
> modules_k/dispatcher/README | 114 ++++++++++++++++++-------
> modules_k/dispatcher/dispatch.c | 64 ++++++++++++--
> modules_k/dispatcher/dispatch.h | 5 +-
> modules_k/dispatcher/dispatcher.c | 94 ++++++++++++++++++++
> modules_k/dispatcher/doc/dispatcher_admin.xml | 64 ++++++++++++++-
> 5 files changed, 299 insertions(+), 42 deletions(-)
>
> Diff: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commitdiff;h=085638299508ef6bf0c96673a663453da76d0a4f
>
> _______________________________________________
> sr-dev mailing list
> sr-dev@lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev