But how does get_avail_gw find out it's avail?
It would have to try making the call so you would call over it to find out it's ok to call then pass that back up to bridge?

You can try to hide the complexity but you still have to stash it somewhere.

So if you don't like looking at it consider making a script or a C mod to hide it.

Here's one cool way you can do with just regular dialplan.


    <extension name="gateways">
      <condition field="destination_number" expression="gateway_macro">
        <action application="set" data="continue_on_fail=true"/>
        <action application="set" data="hangup_after_bridge=true"/>
        <action application="bridge" data="sofia/gateway/gw1/${dialed_number}"/>
        <action application="bridge" data="sofia/gateway/gw2/${dialed_number}"/>
        <action application="bridge" data="sofia/gateway/gw3/${dialed_number}"/>
        <action application="bridge" data="sofia/gateway/gw4/${dialed_number}"/>
        <action application="bridge" data="sofia/gateway/gw5/${dialed_number}"/>
      </condition>
    </extension>

    <extension name="myext">
      <condition field="destination_number" expression="^(whatever)$">
        <action application="set" data="dialed_number=$1"/>
        <action application="transfer" data="gateway_macro"/>
      </condition>
    </extension>

change whatever to your favorite regex
so now all you have to do is set dialed_number and transfer to gateway_macro (you could have many of these with different names)


One way or another all your real goal seems to be is hiding the complexity so *shrug* here's and easy way with existing tools.



On Wed, Aug 26, 2009 at 12:44 AM, Max Ivanov <ivanov.maxim@gmail.com> wrote:
>
> Continue_on_fail and hangup_after_bridge like tony pointed out are what you
> want if you don’t want to use the | delimiting ... I use these all the time
> with gateway counts > 10 just stacking additional actions for each bridge
> line

Let's imagine that I need to call 1000,1001,1002 via  gw1,gw2,gw3 by
choosing first available. How dialplan would look like?

continue_on_fail=True
hangup_after_bridge=True
bridge gw1/1000
bridge gw1/1001
bridge gw1/1002
bridge gw2/1000
bridge gw2/1001
bridge gw2/1002
bridge gw3/1000
bridge gw3/1001
bridge gw3/1002

Is it easy to understand? From my point of view it's not. Compare to this:
continue_on_fail=True
hangup_after_bridge=True
bridge ${get_avail_gw(gw1,gw2,gw3)}/1000
bridge ${get_avail_gw(gw1,gw2,gw3)}/1001
bridge ${get_avail_gw(gw1,gw2,gw3)}/1002



--
Anthony Minessale II

FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/
Twitter: http://twitter.com/FreeSWITCH_wire

AIM: anthm
MSN:anthony_minessale@hotmail.com
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org
iax:guest@conference.freeswitch.org/888
googletalk:conf+888@conference.freeswitch.org
pstn:213-799-1400