[asterisk-users] SIP failover between Sip Providers

Anselm Martin Hoffmeister anselm at hoffmeister-online.de
Wed Apr 18 05:57:40 MST 2007


Am Mittwoch, den 18.04.2007, 13:18 +0200 schrieb Knud Müller:
> Dinesh Nair wrote:
> >On Wed, 18 Apr 2007 09:04:22 +0200, Knud Müller wrote:
> >
> >>I 
> >>think it can be done by using the dialplan and the database to store the 
> >>statistical information but maybe there is an easier way that integrates 
> >>better with asterisk!?
> >
> >i dont think you'd even need a database with statistics. just have all
> >calls sent to provider A with an automatic failover to provider B if the
> >call can't be completed through A. you'd need to go look at the DIALSTATUS
> >variable for that.
> >
> The disadvantage of that solution is, that I'll always try to make a 
> connection with a provider for that I know by experience it wouldn't 
> work. In the failover case the time between starting to dial and the 
> first ring gets longer. If I know that Provider A fails 60% of Calls 
> then I don't need to start with a but can start with b directly.

Hi Knud,

I think what you want is a combination of both.

If indeed DIALSTATUS reveals that provider A is having his "five
minutes" (again), the first call that notices this could set a database
flag, say, DB(a-is-crappy) to the current time value.

All calls could, before trying provider A, retrieve this value - if the
last "crap" moment was less than 300 seconds ago, just skip A and go for
B immediately. This way, no more than one call per 300 seconds should be
delayed - except of course, when those 300 timed out and two outgoing
calls start before any of those returns the bad DIALSTATUS. Anyway, they
will block the provider A again if he continues having "moments", but
will allow using A as long as that works fine.

You should take extra care to distinguish DIALSTATUS cases; a call that
could not be terminated because the number was invalid should better not
block provider A if this can be distinguished.

Anselm('s 2 cent)



More information about the asterisk-users mailing list