Hi all, I would like to have two asterisk servers in a "cluster". From what I understand using a mysql database I can store all of my peer/user information in the db and share this between servers. I can then take my polycom phone and register it to both of the asterisk servers at the same time - so if one were to go offline traffic would be redirected to the second. This works in theory for the end user - but how do I provide redundancy with my upstream providers? I.e. how do I fail over my registration to an upstream sip provider? Thanks in advance, Max -- Max Clark max [at] clarksys.com http://www.clarksys.com
You can simply put then in order in your dial plan: exten => _1NXXNXXXXXX,1,Dial(SIP/${EXTEN}@carrier1} exten => _1NXXNXXXXXX,2,Dial(SIP/${EXTEN}@carrier2} and so on. if carrier1 returns an error, * will dial out using carrier2. SciptHead On 12/2/05, Max Clark <max@clarksys.com> wrote:> > Hi all, > > I would like to have two asterisk servers in a "cluster". From what I > understand using a mysql database I can store all of my peer/user > information in the db and share this between servers. I can then take my > polycom phone and register it to both of the asterisk servers at the > same time - so if one were to go offline traffic would be redirected to > the second. > > This works in theory for the end user - but how do I provide redundancy > with my upstream providers? I.e. how do I fail over my registration to > an upstream sip provider? > > Thanks in advance, > Max > > -- > Max Clark > max [at] clarksys.com > http://www.clarksys.com > _______________________________________________ > --Bandwidth and Colocation provided by Easynews.com -- > > Asterisk-Users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20051204/c06fd03e/attachment.htm
With this setup Asterisk will also dial out using carrier2 even if the call via carrier1 does NOT fail. It will dial out via carrier2 if the number is busy, disconnected, answered then ended, etc. This is BAD BAD BAD. Try looking at std-exten for an example of how to handle stuff when Dial exits. Script Head wrote:> You can simply put then in order in your dial plan: > > exten => _1NXXNXXXXXX,1,Dial(SIP/${EXTEN}@carrier1} > exten => _1NXXNXXXXXX,2,Dial(SIP/${EXTEN}@carrier2} > > and so on. if carrier1 returns an error, * will dial out using carrier2. > > SciptHead > > > On 12/2/05, *Max Clark* <max@clarksys.com <mailto:max@clarksys.com>> wrote: > > Hi all, > > I would like to have two asterisk servers in a "cluster". From what I > understand using a mysql database I can store all of my peer/user > information in the db and share this between servers. I can then > take my > polycom phone and register it to both of the asterisk servers at the > same time - so if one were to go offline traffic would be redirected to > the second. > > This works in theory for the end user - but how do I provide redundancy > with my upstream providers? I.e. how do I fail over my registration to > an upstream sip provider? > > Thanks in advance, > Max > > -- > Max Clark > max [at] clarksys.com <http://clarksys.com> > http://www.clarksys.com > _______________________________________________ > --Bandwidth and Colocation provided by Easynews.com > <http://Easynews.com> -- > > Asterisk-Users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users > > > > ------------------------------------------------------------------------ > > _______________________________________________ > --Bandwidth and Colocation provided by Easynews.com -- > > Asterisk-Users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users
Script Head wrote:> You can simply put then in order in your dial plan: > > exten => _1NXXNXXXXXX,1,Dial(SIP/${EXTEN}@carrier1} > exten => _1NXXNXXXXXX,2,Dial(SIP/${EXTEN}@carrier2} > > and so on. if carrier1 returns an error, * will dial out using carrier2. > > SciptHead > > > On 12/2/05, *Max Clark* <max@clarksys.com <mailto:max@clarksys.com>> wrote: > > Hi all, > > I would like to have two asterisk servers in a "cluster". From what I > understand using a mysql database I can store all of my peer/user > information in the db and share this between servers. I can then > take my > polycom phone and register it to both of the asterisk servers at the > same time - so if one were to go offline traffic would be redirected to > the second. > > This works in theory for the end user - but how do I provide redundancy > with my upstream providers? I.e. how do I fail over my registration to > an upstream sip provider? > > Thanks in advance, > MaxJust be aware there can be lots of different reasons for calls not be processed that will not be detected and handled with the above.
Try something like this. Note: I did not write these scripts. I would give credit to who did, but unfortunately I do not remember where I got it. Dan [globals] TRUNK1 => IAX2/user:password@provider1.com TRUNK2 => IAX2/user:password@provider2.com ; Sets up the outgoing gateway according to availability [macro-swap-priority] exten => s,1,NoOp(Swapping trunk priority) exten => s,n,SetGlobalVar(TRUNKBUF=${TRUNK1}) exten => s,n,SetGlobalVar(TRUNK1=${TRUNK2}) exten => s,n,SetGlobalVar(TRUNK2=${TRUNKBUF}) exten => s,n,NoOp(Swapped) exten => s,n,NoOp(Priority 1 ${TRUNK1}) exten => s,n,NoOP(Priority 2 ${TRUNK2}) ; calls the swap-priority macro to find out which gateway is set to the default and dials the number. [macro-outbound-dial] exten => s,1,Wait(3) exten => s,n,Set(TIMEOUT(response)=60) exten => s,n,Dial(${TRUNK1}/${ARG1}) exten => s,n,NoOp(TRUNK1 failed) exten => s,n,SetVar(A=2) exten => s,n,NoOp(rolling over to TRUNK2) exten => s,n,Playback(hang-on-a-second) exten => s,n,Macro(swap-priority) exten => s,n,Wait(2) exten => s,n,Dial(${TRUNK1}/${ARG1}) exten => s,n,Playback(all-outgoing-lines-unavailable) exten => s,n,Playback(please-try-again-later) exten => s,n,Hangup() ;Call outbound-dial macro [from-inside] exten => _1XXXXXXXXXX,1,Macro(outbound-dial,${EXTEN})