[Freeswitch-users] Help with multiple gateway dialplan failover and limits

Tim St. Pierre fs-list at communicatefreely.net
Mon Dec 9 22:31:24 MSK 2013


It's built on the fly with php, but I can show you what it looks like
when it comes out -

This is called by an execute_extension earlier on, where we set things
like caller ID, rating variables, etc.  Depending on what the call is
doing, there may be additional dialplan afterwards (ie, if this is part
of a find-me, follow-me system).

isp-primary and isp-secondary are the primary and secondary gateway
definitions of a local SIP PRI.  isp-ld-primary and isp-ld-secondary are
the primary and secondary gateways for an alternate PRI circuit.
Depending on what comes out of the route table lookup, these values
could be something else, but the dial plan structure would be identical.

I probably could put all the gateways in the same dial string, except
that would mess up my limit_execute functionality.  The channel counts
need to be aggregated for primary/secondary gateway pairs, but distinct
for different gateways.

<?xml version="1.0"?>
<document type="freeswitch/xml">
 <section name="dialplan">
  <context name="trunk_dial">
   <extension name="primary_trunk" description="Dial out the primary
trunk" continue="true">
    <condition field="destination_number" expression="4164790769">
     <action application="set" data="hangup_after_bridge=true"/>
     <action application="set" data="inherit_codec=true"/>
     <action application="set"
data="continue_on_fail=NO_ANSWER,UNALLOCATED_NUMBER,NO_ROUTE_TRANSIT_NET,CALL_REJECTED,NETWORK_OUT_OF_ORDER,DESTINATION_OUT_OF_ORDER,NORMAL_CIRCUIT_CONGESTION,NORMAL_TEMPORARY_FAILURE,SWITCH_CONGESTION,NO_USER_RESPONSE"/>
     <action application="set" data="call_timeout=10"/>
     <action application="set" data="progress_timeout=30"/>
     <action application="set" data="continue_on_timeout=true"/>
     <action application="set" data="trunk=isp"/>
     <action application="limit_execute" data="db trunk isp 28 bridge
sofia/gateway/isp-primary/14164790769|sofia/gateway/isp-secondary/14164790769"/>
     <action application="set" data="trunk=isp-ld"/>
     <action application="limit_execute" data="db trunk isp-ld 23 bridge
sofia/gateway/isp-ld-primary/14164790769|sofia/gateway/isp-ld-secondary/14164790769"/>
     <action application="set" data="inherit_codec=true"/>
     <action application="set"
data="continue_on_fail=NO_ANSWER,UNALLOCATED_NUMBER,NO_ROUTE_TRANSIT_NET,CALL_REJECTED,NETWORK_OUT_OF_ORDER,DESTINATION_OUT_OF_ORDER,NORMAL_CIRCUIT_CONGESTION,NORMAL_TEMPORARY_FAILURE,SWITCH_CONGESTION,NO_USER_RESPONSE"/>
     <action application="set" data="call_timeout=10"/>
     <action application="set" data="progress_timeout=30"/>
     <action application="set" data="continue_on_timeout=true"/>
     <action application="set" data="trunk=isp-ld"/>
     <action application="limit_execute" data="db trunk isp-ld 23 bridge
sofia/gateway/isp-ld-primary/14164790769|sofia/gateway/isp-ld-secondary/14164790769"/>
    </condition>
   </extension>
  </context>
 </section>
</document>


On 13-12-09 01:59 PM, Brian West wrote:
> How are you building your dial string?  can you show us a sample of you dial plan?
> --
> Brian West
> brian at freeswitch.org
> FreeSWITCH Solutions, LLC
> PO BOX 2531
> Brookfield, WI 53008-2531
> Twitter: @FreeSWITCH_Wire , @briankwest
> http://www.freeswitchbook.com
> http://www.freeswitchcookbook.com
> 
> T: +1.918.420.9001  |  F: +1.918.420.9002  |  M: +1.918.424.WEST
> iNUM: +883 5100 1420 9001
> ISN: 410*543
> Skype:briankwest
> PGP Key: http://www.bkw.org/key.txt (AB93356707C76CED)
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> On Dec 9, 2013, at 12:54 PM, Tim St. Pierre <fs-list at communicatefreely.net> wrote:
> 
>> Hello,
>>
>> I'm having some trouble with what should be a simple dialplan operation.
>>
>> For each outgoing call, I consult a database for two possible routes to
>> a destination number.  I then want to bridge to the first gateway, and
>> then fallback to the second gateway if it can't complete the call.
>>
>> If the call rings on the first gateway goes unanswered, I DON'T want try
>> the second gateway, I want the dialplan to continue so I can do
>> something else (either play an error, or in some cases, continue on to
>> the user's voice mail).
>>
>> I also want to use limit_db to keep track of how many calls are on each
>> trunk, so that I can divert when they get full (so that new incoming
>> calls aren't blocked on that gateway).
>>
>> I have tried using limit_execute with bridge, separating the primary and
>> secondary addresses of a gateway with |
>> I then continue on in the dialplan and run limit_execute/bridge again,
>> but this time with the secondary set of gateway addresses.  I have to do
>> these separately so that limit_execute uses the correct key in the
>> database (otherwise, a failed call could get credited to the wrong trunk!)
>>
>> The problem with the above is that unanswered calls ring twice before
>> continuing on.  What I really need is some way to skip the second bridge
>> statement if the previous one returned a "NO_ANSWER"
>>
>> Any ideas??
>>
>> Thanks!
>>
>> -Tim
>>
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services:
>> consulting at freeswitch.org
>> http://www.freeswitchsolutions.com
>>
>> 
>> 
>>
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://wiki.freeswitch.org
>> http://www.cluecon.com
>>
>> FreeSWITCH-users mailing list
>> FreeSWITCH-users at lists.freeswitch.org
>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>> http://www.freeswitch.org
> 
> 
> 
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
> 
> 
> 
> 
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
> 
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
> 



Join us at ClueCon 2013 Aug 6-8, 2013
More information about the FreeSWITCH-users mailing list