Thomas Balsfulland
2007-Nov-30 18:16 UTC
[asterisk-users] How to setup redundant SIP peers
Hello list, I try to setup an asterisk-server with different SIP-Peers to PSTN. The Peer are working and configured in sip.conf: [peer1] type=peer host=10.10.10.1 [peer2] type=peer host=10.10.10.2 Now dialout is no problem. Extensions.conf says: exten => _0Z.,1,Dial(SIP/49${EXTEN:1}@peer1,30) But how can I setup a failure-route if the SIP-Proxy "peer1" ist not answering (in 3sec) or send "50x" error? Next idea is to use both peers in round-robin, if they are working. Could someone help? Regards Thomas
On Nov 30, 2007 11:46 PM, Thomas Balsfulland <tbals at ctrl-c.de> wrote:> Hello list, > > I try to setup an asterisk-server with different SIP-Peers to PSTN. > The Peer are working and configured in sip.conf: > > [peer1] > type=peer > host=10.10.10.1 > > [peer2] > type=peer > host=10.10.10.2 > > Now dialout is no problem. Extensions.conf says: > > exten => _0Z.,1,Dial(SIP/49${EXTEN:1}@peer1,30) >add another line exten => _0Z.,2,Dial(SIP/49${EXTEN:1}@peer2,30) ram -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20071203/ace0f3f9/attachment.htm
Thomas Balsfulland
2007-Dec-03 11:29 UTC
[asterisk-users] How to setup redundant SIP peers
> > Hello list, > > I try to setup an asterisk-server with different SIP-Peers to PSTN. > > The Peer are working and configured in sip.conf: > > > > [peer1] > > type=peer > > host=10.10.10.1 > > > > [peer2] > > type=peer > > host=10.10.10.2 > > > > Now dialout is no problem. Extensions.conf says: > > > > exten => _0Z.,1,Dial(SIP/49${EXTEN:1}@peer1,30) > > > > add another line > exten => _0Z.,2,Dial(SIP/49${EXTEN:1}@peer2,30) > ramthis is not the right way, because it takes 30 sec before asterisk try dialout over peer2. the dial-timer (.... at peer1,30) is normaly set for the time to wait of "200 OK", but it is also active when peer1 is down or not answering. thank you thomas
Some email asked for some examples. He's an example system that will use ViaTalk lines (which allow 2 concurrent calls on a channel, so I use GroupCount to check for a value of 2). It isn't round-robin and actually I'd pay someone good money to make a revised Dial() function that would do round robbin on a defined set of SIP trunks. I solve the Round Robbin issue right now by periodicly changing where SIP/trunk0 ... SIP/trunkN point to and then reloading the configurations. Periodic for me is midnight each night. So every night the order in priority order is reset. *Again, just in case someone from Asterisk-Dev or Asterisk-Bus is reading this: I will donate/pay to have a Round Robbin outbound trunk balancing scheme developed. Should be able to use any Asterisk supported trunk type (SIP, IAX2, etc). No need to care about maximum concurrent connections since if it fails then we're out of lines anyways.* [globals] TRY1=SIP/trunk0 TRY2=SIP/trunk1 TRY3=SIP/trunk2 TRY4=SIP/trunk3 TRY5=SIP/trunk4 TRY6=SIP/trunk5 TRY7=SIP/trunk6 TRY8=SIP/trunk7 TRY9=SIP/trunk8 TRY10=SIP/trunk9 TRY11=SIP/trunk10 [macro-which-line] exten => s,1,set(TRIES=0) exten => s,n(nextone),set(TRIES=$[${TRIES} + 1]) ; increment TRIES by 1 exten => s,n,set(DIALSTRING=${TRY${TRIES}}) ; assign TRYn to DIALSTRING exten => s,n,gotoif($["${DIALSTRING}" = ""]?donehere) ; see if we've run out of things to try exten => s,n,ChanIsAvail(${DIALSTRING}) ; it will be up or down, no need for this to be exclusive exten => s,n,gotoif($[${AVAILSTATUS} = 0]?:nextone) exten => s,n,gotoif($[${GROUP_COUNT(${DIALSTRING})} >= 2]?nextone) ; have we used up the allowed calls on this channel exten => s,n,set(GROUP()=${DIALSTRING}) ; Lock the line! Yay... exten => s,n,Dial(${DIALSTRING}/1${ARG1}) ; dial the phone exten => s,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?donehere) ; Don't keep dialing exten => s,n,NoOp("Moving to the next one..."); exten => s,n,goto(nextone) ; TEMP exten => s,n(donehere),MacroExit() ; we only get here if everything failed ================ Okay, that's one example. Your simple two line thing might be better done another way. Let's say we try this: 1) Place a call two two phone lines at once, but have a single line delayed by 3 seconds. Something to this effect:>> Dial(SIP/trunk0&Local/delayed_trunk1)Where Delayed_Trunk1 is a macro which calls SLEEP(3) and then Dial(Trunk1). I could go into more detail, but I'm going to assume you can figure out how to do this. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20080102/06d936f7/attachment-0001.htm
Maybe Matching Threads
- 0-client_t: null client [Invalid argument] & high CPU usage (Gluster 3.12)
- Best way to know a call is being transfered
- 0-client_t: null client [Invalid argument] & high CPU usage (Gluster 3.12)
- sem package and growth curves
- 0-client_t: null client [Invalid argument] & high CPU usage (Gluster 3.12)