[OpenSIPS-Users] Dispatcher module disable gateway after X failures, auto re-enable after some time

Bogdan-Andrei Iancu bogdan at opensips.org
Thu Nov 2 13:16:10 EDT 2017


Hi Adam,

You can try something like this, it makes sense, considering your custom 
requirements. The local cache is decent as performance, no worries. In 
terms of changing the the destination status from script, you can do it 
only in the context of a call failed to that destination. If this is not 
good for you, let me know and I can show you some tricks ;)

Regards,

Bogdan-Andrei Iancu
   OpenSIPS Founder and Developer
   http://www.opensips-solutions.com

On 10/31/2017 02:10 PM, Adam Raszynski wrote:
> My first idea was to create failure counter for each gateway (variable 
> in local cache)
>
> Than in onreply route to increment counter every time call is not 
> established, and reset counter if any call was successful. So we get 
> consecutive failures counter in cache and can make further decisions 
> basing on that information
>
> Does it make sense? Is local cache fast enough (and causes no locking 
> problems) to be incremented in such intensive way?
>
> Is it possible to change dispatcher gateway status from inside script? 
> Or it's possible only by using external interface?
>
> 2017-10-31 12:31 GMT+01:00 Bogdan-Andrei Iancu <bogdan at opensips.org 
> <mailto:bogdan at opensips.org>>:
>
>     Hi Adam,
>
>     Maybe such a custom logic is outside OpenSIPS scope - still have
>     you considered using the ds_set_state MI function to control from
>     outside the status of the destinations ? Of course you will have
>     to use the Event Interface too, to receive the notifications on
>     the destination status (when OpenSIPS is doing the state
>     transition) - see the E_DISPATCHER_STATUS event
>     (http://www.opensips.org/html/docs/modules/2.3.x/dispatcher.html#idp5746368
>     <http://www.opensips.org/html/docs/modules/2.3.x/dispatcher.html#idp5746368>)
>
>     So, when OpenSIPS switches a destination into probing (based on a
>     failure detection), you can get the event and force the
>     destination into Inactive ; after some custom amount of time, you
>     can put it back into Probing mode, to allow OpenSIPS to re-enable it.
>
>     Regards,
>
>     Bogdan-Andrei Iancu
>        OpenSIPS Founder and Developer
>        http://www.opensips-solutions.com <http://www.opensips-solutions.com>
>
>     On 10/28/2017 04:13 PM, Adam Raszynski wrote:
>>     Hi
>>
>>     Could you suggest some working configuration of the dispatcher
>>     module for the following setup:
>>
>>     - Flag gateway as failed (even if it's still responding to
>>     OPTIONS) after some number of consecutive call failures. That's
>>     the easy part
>>
>>     - Automatically un-flag gateway after some time, to allow
>>     re-checking (reset failure counter?)
>>
>>     - Ideal solution would also include increasing re-check interval,
>>     ie first re-check after 1 minute, if next failure detected next
>>     re-check after 2 minutes, next after 4 and so on
>>
>>
>>     Best Regards
>>
>>
>>
>>     _______________________________________________
>>     Users mailing list
>>     Users at lists.opensips.org <mailto:Users at lists.opensips.org>
>>     http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>     <http://lists.opensips.org/cgi-bin/mailman/listinfo/users>
>
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20171102/a1fd9214/attachment.html>


More information about the Users mailing list