[Freeswitch-users] limit_execute and distributor concurrent module usage
Rupa Schomaker
rupa at rupa.com
Tue Oct 5 10:28:35 PDT 2010
That won't work '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).
As you can see, without changing how distributor works this will be full of
race conditions.
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'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.
Kind of a pain.
A bit more heavy weight, but maybe look at using mod_lcr with limit support?
On Tue, Oct 5, 2010 at 9:26 AM, Frank Ochere <ochere at gmail.com> wrote:
> Hello,
>
> I have the following in distributor.conf.xml
>
> <list name="aa_rr" total-weight="2">
> <node name="GW_001" weight="1"/>
> <node name="GW_002" weight="1"/>
> </list>
>
>
>
> in dialplan
>
> <extension name="TESTGW">
> <condition field="destination_number" expression="^7777(\d+)$">
> <action application="limit_execute" data="hash TESTGW TESTGW 1
> bridge sofia/gateway/${distributor(aa_rr)}/$1"/>
> </condition>
> </extension>
>
> my question is, is it possible to use limit_execute and distributor
> concurrently as in TESTGW above? ie limit calls to 1 per gateway but
> being alternated as specified in list aa_rr
>
>
> sofia debug below
>
> Dialplan: sofia/external/00000000 at 1.1.1.1:5060 Action limit_execute(hash
> TESTGW TESTGW 1 bridge
> sofia/gateway/${distributor(sat_rr)}/00777717171)
> 2010-10-05 17:13:15.616463 [DEBUG] switch_core_state_machine.c:119
> (sofia/external/00000000 at 1.1.1.1:5060) State Change CS_ROUTING ->
> CS_EXECUTE
> 2010-10-05 17:13:15.616463 [DEBUG] switch_core_session.c:1047 Send
> signal sofia/external/00000000 at 1.1.1.1:5060 [BREAK]
> 2010-10-05 17:13:15.616463 [DEBUG] switch_core_state_machine.c:341
> (sofia/external/00000000 at 1.1.1.1:5060) State ROUTING going to sleep
> 2010-10-05 17:13:15.616463 [DEBUG] switch_core_state_machine.c:314
> (sofia/external/00000000 at 1.1.1.1:5060) Running State Change CS_EXECUTE
> 2010-10-05 17:13:15.616463 [DEBUG] switch_core_state_machine.c:348
> (sofia/external/00000000 at 1.1.1.1:5060) State EXECUTE
> 2010-10-05 17:13:15.616463 [DEBUG] mod_sofia.c:239
> sofia/external/00000000 at 1.1.1.1:5060 SOFIA EXECUTE
> 2010-10-05 17:13:15.616463 [DEBUG] switch_core_state_machine.c:157
> sofia/external/00000000 at 1.1.1.1:5060 Standard EXECUTE
> EXECUTE sofia/external/00000000 at 1.1.1.1:5060 limit_execute(hash TESTGW
> TESTGW 1 bridge sofia/gateway/-err/00777717171)
> 2010-10-05 17:13:15.616463 [INFO] switch_limit.c:126 incr called:
> TESTGW_TESTGW max:1, interval:0
> 2010-10-05 17:13:15.616463 [INFO] mod_hash.c:202 Usage for TESTGW_TESTGW
> is now 1/1
> EXECUTE sofia/external/00000000 at 1.1.1.1:5060
> bridge(sofia/gateway/-err/00777717171)
> 2010-10-05 17:13:15.616463 [ERR] mod_sofia.c:3725 Invalid Gateway
> 2010-10-05 17:13:15.616463 [NOTICE] mod_sofia.c:4047 Close Channel N/A
> [CS_NEW]
> 2010-10-05 17:13:15.616463 [DEBUG] switch_core_state_machine.c:430 ()
> Running State Change CS_DESTROY
> 2010-10-05 17:13:15.616463 [DEBUG] switch_core_state_machine.c:440 (N/A)
> State DESTROY
> 2010-10-05 17:13:15.616463 [DEBUG] mod_sofia.c:362 N/A SOFIA DESTROY
> 2010-10-05 17:13:15.616463 [DEBUG] switch_core_state_machine.c:440 (N/A)
> State DESTROY going to sleep
> 2010-10-05 17:13:15.616463 [ERR] switch_ivr_originate.c:2648 Cannot
> create outgoing channel of type [sofia] cause: [INVALID_NUMBER_FORMAT]
> 2010-10-05 17:13:15.616463 [DEBUG] switch_ivr_originate.c:3456 Originate
> Resulted in Error Cause: 28 [INVALID_NUMBER_FORMAT]
> 2010-10-05 17:13:15.616463 [INFO] mod_dptools.c:2411 Originate Failed.
> Cause: INVALID_NUMBER_FORMAT
> 2010-10-05 17:13:15.616463 [DEBUG] switch_channel.c:2359
> (sofia/external/00000000 at 1.1.1.1:5060) Callstate Change RINGING ->
> HANGUP
> 2010-10-05 17:13:15.616463 [NOTICE] mod_dptools.c:2474 Hangup
> sofia/external/00000000 at 1.1.1.1:5060 [CS_EXECUTE]
> [INVALID_NUMBER_FORMAT]
> 2010-10-05 17:13:15.616463 [DEBUG] switch_channel.c:2375 Send signal
> sofia/external/00000000 at 1.1.1.1:5060 [KILL]
> 2010-10-05 17:13:15.616463 [INFO] mod_hash.c:300 Usage for TESTGW_TESTGW
> is now 0
>
>
> _______________________________________________
> 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
>
--
-Rupa
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20101005/8be6c0fd/attachment.html
More information about the FreeSWITCH-users
mailing list