[asterisk-users] Setting up an outgoing trunk group
Hi All, I'm confused! My Asterisk system has a Zap trunk and three SIP trunks. I'd like to configure the dialplan to route via the first trunk in a list and if that's not available or it's busy, fall over to the second, then to the third, etc. AIUI Dial(Zap/1&SIP/out1&SIP/out2/${EXTEN}) rings all the trunks in the list and bridges to the first to answer. Unfortunately, that's not what I want, which is (in pseudocode): if Zap/1 is available then Dial(Zap/1/${EXTEN}) elseif SIP/out1 is available then Dial(SIP/out1/${EXTEN}) else Dial(SIP/out2/${EXTEN}) end if Also, to make it easier to reconfigure quickly, I've got a variable defined in [globals] thus: MainOutbound=Zap/1&SIP/out1&SIP/out2 so the Dial statement above would be written in the dialplan thus: Dial(${MainOutbound}/${EXTEN}) So if I can't find the syntax to get the Dial application to do what I want I guess I'd need to use a dialplan function or AGI. Can anyone help? TIA, -- Geoff ___ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Setting up an outgoing trunk group
I would use the ${DIALSTATUS} variable. In your dialplan dial the first trunk you wish, then afterwards examine the ${DIALSTATUS} variable. If that is not equal to ANSWER then dial your second trunk and so on. For example: exten => s,1,Dial(ZAP/1/${EXTEN}) exten => s,n,ExecIf($["${DIALSTATUS}" != "ANSWER"]|Dial|(SIP/out1/${EXTEN}) exten => s,n,ExecIf($["${DIALSTATUS}" != "ANSWER"]|Dial|(SIP/out2/${EXTEN}) That's kind of rough but it should work. Cheers, Darrin Henshaw | IT Administrator | MCTS: Exchange 2007 | MCSE 2003 | LPIC Ignition Support Center | www.ignition.bm Bermuda (441) 496-4319 | Cayman (345) 947-4357 | Halifax (902) 482-1288 Atlanta | Bermuda | Cayman | Halifax -Original Message- From: asterisk-users-boun...@lists.digium.com [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Geoff Lane Sent: Tuesday, January 20, 2009 13:31 To: Asterisk Users Subject: [asterisk-users] Setting up an outgoing trunk group Hi All, I'm confused! My Asterisk system has a Zap trunk and three SIP trunks. I'd like to configure the dialplan to route via the first trunk in a list and if that's not available or it's busy, fall over to the second, then to the third, etc. AIUI Dial(Zap/1&SIP/out1&SIP/out2/${EXTEN}) rings all the trunks in the list and bridges to the first to answer. Unfortunately, that's not what I want, which is (in pseudocode): if Zap/1 is available then Dial(Zap/1/${EXTEN}) elseif SIP/out1 is available then Dial(SIP/out1/${EXTEN}) else Dial(SIP/out2/${EXTEN}) end if Also, to make it easier to reconfigure quickly, I've got a variable defined in [globals] thus: MainOutbound=Zap/1&SIP/out1&SIP/out2 so the Dial statement above would be written in the dialplan thus: Dial(${MainOutbound}/${EXTEN}) So if I can't find the syntax to get the Dial application to do what I want I guess I'd need to use a dialplan function or AGI. Can anyone help? TIA, -- Geoff ___ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users This email and its attachments may be confidential and are intended solely for the use of the individual or parties' to whom it is addressed. All comments are solely those of the author and do not necessarily represent those of Ignition. If you are not the intended recipient of this email and its attachments, you must take no action based upon them, nor must you copy or show them to anyone. Please contact the sender if you believe you have received this email in error. Thanks for considering the environmental impact before printing this email. ___ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Setting up an outgoing trunk group
On Tuesday, January 20, 2009, Darrin Henshaw wrote: > I would use the ${DIALSTATUS} variable. In your dialplan dial the > first trunk you wish, then afterwards examine the ${DIALSTATUS} > variable. If that is not equal to ANSWER then dial your second trunk > and so on. > For example: > exten => s,1,Dial(ZAP/1/${EXTEN}) > exten => s,n,ExecIf($["${DIALSTATUS}" != "ANSWER"]|Dial|(SIP/out1/${EXTEN}) > exten => s,n,ExecIf($["${DIALSTATUS}" != "ANSWER"]|Dial|(SIP/out2/${EXTEN}) > That's kind of rough but it should work. Thanks for the reply. That might be a fallback if all else fails. However, it would be messy to maintain. I'm also unsure what would happen if the first trunk was available and the user hung up before the call was answered. Does hanging up terminate processing? If not, would not DIALSTATUS be set to CANCEL and thus the next trunk be dialled, etc? For various reasons, I might need to change the channel order every couple of days. With this in mind, I'd like to have a series of variable definitions in the globals context of the dialplan with all but one commented out. This is what I currently have: UKGeo=Zap/1 ;UKGeo=SIP/out1 ;UKGeo=SIP/out2 and then later in the dialplan: [uk_geo] exten => _01.,2,Dial(${UKGeo}/${EXTEN}) exten => _02.,2,Dial(${UKGeo}/${EXTEN}) With your strategy, those few lines in the dialplan would expand massively. I could simplify things a little by defining various versions of three variables to use in the dialplan but even that's messy and not ideal. Added to that my dialplan has sections for outgoing calls to my local area, UK geographical, UK national rate, UK lo-call, UK free, UK mobiles, UK personal, UK premium rate, Emergency, and two international zones. Also, what if I want to add or remove a trunk from the list? So it could get very messy. This is why I hoped I'd missed something and that the Dial() application had a syntax to use the first available trunk from a list. However, I suspect that I need to create that functionality with a dialplan function or macro - but I'll need to figure out how to split a list to do that! Thanks again, -- Geoff ___ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users