That won&#39;t work &#39;cause you are limiting on the general TESTGW for realm and resource.  You need to find out which resource distributor gave you and then use limit_execute and the actual resource name (GW_001 or GW_002).<div>
<br></div><div>As you can see, without changing how distributor works this will be full of race conditions.</div><div><br></div><div>ie: you can get the resource by expanding ${distributor(aa_rr)} and then using that in limit_execute, but since distributor has no knowledge of limits it may continue serving up a resource that has reached it&#39;s limit.  And even if distributor knew about limits it would have to reserve the resource and then *use* the resource right then not pass it back as a string.  That changes how you use distributor.</div>
<div><br></div><div>Kind of a pain.</div><div><br></div><div>A bit more heavy weight, but maybe look at using mod_lcr with limit support?</div><div><br><div class="gmail_quote">On Tue, Oct 5, 2010 at 9:26 AM, Frank Ochere <span dir="ltr">&lt;<a href="mailto:ochere@gmail.com">ochere@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hello,<br>
<br>
I have the following in distributor.conf.xml<br>
<br>
    &lt;list name=&quot;aa_rr&quot; total-weight=&quot;2&quot;&gt;<br>
      &lt;node name=&quot;GW_001&quot; weight=&quot;1&quot;/&gt;<br>
      &lt;node name=&quot;GW_002&quot; weight=&quot;1&quot;/&gt;<br>
    &lt;/list&gt;<br>
<br>
<br>
<br>
in dialplan<br>
<br>
     &lt;extension name=&quot;TESTGW&quot;&gt;<br>
       &lt;condition field=&quot;destination_number&quot; expression=&quot;^7777(\d+)$&quot;&gt;<br>
         &lt;action application=&quot;limit_execute&quot; data=&quot;hash TESTGW TESTGW 1<br>
bridge sofia/gateway/${distributor(aa_rr)}/$1&quot;/&gt;<br>
       &lt;/condition&gt;<br>
     &lt;/extension&gt;<br>
<br>
my question is, is it possible to use limit_execute and distributor<br>
concurrently as in TESTGW above? ie limit calls to 1 per gateway but<br>
being alternated as specified in list aa_rr<br>
<br>
<br>
sofia debug below<br>
<br>
Dialplan: sofia/external/<a href="http://00000000@1.1.1.1:5060" target="_blank">00000000@1.1.1.1:5060</a> Action limit_execute(hash<br>
TESTGW TESTGW 1 bridge<br>
sofia/gateway/${distributor(sat_rr)}/00777717171)<br>
2010-10-05 17:13:15.616463 [DEBUG] switch_core_state_machine.c:119<br>
(sofia/external/<a href="http://00000000@1.1.1.1:5060" target="_blank">00000000@1.1.1.1:5060</a>) State Change CS_ROUTING -&gt;<br>
CS_EXECUTE<br>
2010-10-05 17:13:15.616463 [DEBUG] switch_core_session.c:1047 Send<br>
signal sofia/external/<a href="http://00000000@1.1.1.1:5060" target="_blank">00000000@1.1.1.1:5060</a> [BREAK]<br>
2010-10-05 17:13:15.616463 [DEBUG] switch_core_state_machine.c:341<br>
(sofia/external/<a href="http://00000000@1.1.1.1:5060" target="_blank">00000000@1.1.1.1:5060</a>) State ROUTING going to sleep<br>
2010-10-05 17:13:15.616463 [DEBUG] switch_core_state_machine.c:314<br>
(sofia/external/<a href="http://00000000@1.1.1.1:5060" target="_blank">00000000@1.1.1.1:5060</a>) Running State Change CS_EXECUTE<br>
2010-10-05 17:13:15.616463 [DEBUG] switch_core_state_machine.c:348<br>
(sofia/external/<a href="http://00000000@1.1.1.1:5060" target="_blank">00000000@1.1.1.1:5060</a>) State EXECUTE<br>
2010-10-05 17:13:15.616463 [DEBUG] mod_sofia.c:239<br>
sofia/external/<a href="http://00000000@1.1.1.1:5060" target="_blank">00000000@1.1.1.1:5060</a> SOFIA EXECUTE<br>
2010-10-05 17:13:15.616463 [DEBUG] switch_core_state_machine.c:157<br>
sofia/external/<a href="http://00000000@1.1.1.1:5060" target="_blank">00000000@1.1.1.1:5060</a> Standard EXECUTE<br>
EXECUTE sofia/external/<a href="http://00000000@1.1.1.1:5060" target="_blank">00000000@1.1.1.1:5060</a> limit_execute(hash TESTGW<br>
TESTGW 1 bridge sofia/gateway/-err/00777717171)<br>
2010-10-05 17:13:15.616463 [INFO] switch_limit.c:126 incr called:<br>
TESTGW_TESTGW max:1, interval:0<br>
2010-10-05 17:13:15.616463 [INFO] mod_hash.c:202 Usage for TESTGW_TESTGW<br>
is now 1/1<br>
EXECUTE sofia/external/<a href="http://00000000@1.1.1.1:5060" target="_blank">00000000@1.1.1.1:5060</a><br>
bridge(sofia/gateway/-err/00777717171)<br>
2010-10-05 17:13:15.616463 [ERR] mod_sofia.c:3725 Invalid Gateway<br>
2010-10-05 17:13:15.616463 [NOTICE] mod_sofia.c:4047 Close Channel N/A<br>
[CS_NEW]<br>
2010-10-05 17:13:15.616463 [DEBUG] switch_core_state_machine.c:430 ()<br>
Running State Change CS_DESTROY<br>
2010-10-05 17:13:15.616463 [DEBUG] switch_core_state_machine.c:440 (N/A)<br>
State DESTROY<br>
2010-10-05 17:13:15.616463 [DEBUG] mod_sofia.c:362 N/A SOFIA DESTROY<br>
2010-10-05 17:13:15.616463 [DEBUG] switch_core_state_machine.c:440 (N/A)<br>
State DESTROY going to sleep<br>
2010-10-05 17:13:15.616463 [ERR] switch_ivr_originate.c:2648 Cannot<br>
create outgoing channel of type [sofia] cause: [INVALID_NUMBER_FORMAT]<br>
2010-10-05 17:13:15.616463 [DEBUG] switch_ivr_originate.c:3456 Originate<br>
Resulted in Error Cause: 28 [INVALID_NUMBER_FORMAT]<br>
2010-10-05 17:13:15.616463 [INFO] mod_dptools.c:2411 Originate Failed.<br>
Cause: INVALID_NUMBER_FORMAT<br>
2010-10-05 17:13:15.616463 [DEBUG] switch_channel.c:2359<br>
(sofia/external/<a href="http://00000000@1.1.1.1:5060" target="_blank">00000000@1.1.1.1:5060</a>) Callstate Change RINGING -&gt;<br>
HANGUP<br>
2010-10-05 17:13:15.616463 [NOTICE] mod_dptools.c:2474 Hangup<br>
sofia/external/<a href="http://00000000@1.1.1.1:5060" target="_blank">00000000@1.1.1.1:5060</a> [CS_EXECUTE]<br>
[INVALID_NUMBER_FORMAT]<br>
2010-10-05 17:13:15.616463 [DEBUG] switch_channel.c:2375 Send signal<br>
sofia/external/<a href="http://00000000@1.1.1.1:5060" target="_blank">00000000@1.1.1.1:5060</a> [KILL]<br>
2010-10-05 17:13:15.616463 [INFO] mod_hash.c:300 Usage for TESTGW_TESTGW<br>
is now 0<br>
<br>
<br>
_______________________________________________<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>-Rupa<br>
</div>