[asterisk-users] Setting up an outgoing trunk group

Geoff Lane geoff at gjctech.co.uk
Wed Jan 21 03:37:27 CST 2009


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




More information about the asterisk-users mailing list