[OpenSIPS-Users] Dispatcher algorithm 9

Răzvan Crainea razvan at opensips.org
Thu Oct 15 09:07:17 EST 2020


According to the logs, due to the fact that the uri has a colon in its 
name, it is considered a s a group (load_sip group). You can try to 
define a group explicitly, such as 
update_stat("dispatcher:load_sip:$rd"); and define the dispatcher stat 
as $stat(dispatcher:load_%u).
I haven't tried this, but it might work.

Best regards,

Răzvan Crainea
OpenSIPS Core Developer
http://www.opensips-solutions.com

On 9/16/20 8:48 PM, Social Boh wrote:
> I think the problem is with the statistics module:
> 
> DBG:statistics:pv_parse_name: name 0x7f2a934d5fc0 with name 
> <load_sip:1.2.3.4:5060>
> DBG:statistics:pv_parse_name: name 0x7f2a934d5fc0, name cloned 
> (in=0x7fff6f8b1876, out=0x7f2a934d8fa0)
> DBG:statistics:get_stat_name: stat with name 0x7f2a934d5fc0 still not found
> DBG:statistics:parse_groupname: group: 'load_sip', name: '1.2.3.4:5060'
> DBG:statistics:get_stat_name: stat name 0x7f2a934d5fc0 
> (load_sip:1.2.3.4:5060) after lookup is (nil)
> DBG:statistics:pv_parse_name: name 0x7f2a934dbe98 with name 
> <load_sip:5.6.7.8:5060>
> DBG:statistics:pv_parse_name: name 0x7f2a934dbe98, name cloned 
> (in=0x7fff6f8b1876, out=0x7f2a934d8ec0)
> DBG:statistics:get_stat_name: stat with name 0x7f2a934dbe98 still not found
> 
> Regards
> 
> ---
> I'm SoCIaL, MayBe
> 
> On 6/09/20 5:10, Social Boh wrote:
>> hello, I'm usisng 3.1
>>
>> So i can't use the function or is there other option?
>>
>> Thank you
>>
>> Regards
>>
>> ---
>> I'm SoCIaL, MayBe
>>
>> On 6/09/20 1:32, Răzvan Crainea wrote:
>>> I think the problem is that the update_stat() does not accept 
>>> variables as parameters - are you using OpenSIPS 2.4?
>>>
>>> Best regards,
>>>
>>> Răzvan Crainea
>>> OpenSIPS Core Developer
>>> http://www.opensips-solutions.com
>>>
>>> On 9/4/20 7:42 PM, Social Boh wrote:
>>>> No luck:
>>>>
>>>> if (is_method("BYE")) {
>>>> do_accounting("db","cdr|failed");
>>>>                                          if (isflagset("NAT")) {
>>>> rtpengine_delete();
>>>>                                             }
>>>>                                             if (ds_is_in_list($si, 
>>>> $sp)) {
>>>> xlog("L_NOTICE", "BYE comes from Gateway");
>>>> update_stat("load_sip:$si", -1);
>>>>                                             } else {
>>>> xlog("L_NOTICE", "BYE comes from user");
>>>> update_stat("load_sip:$dd", -1);
>>>>                                             }
>>>>                  }
>>>>
>>>> During a Call the user hang up but the statistics no change. For 
>>>> each call grows one unit and always using the same Gateway
>>>>
>>>> Thank you
>>>>
>>>> Regards
>>>>
>>>> ---
>>>> I'm SoCIaL, MayBe
>>>>
>>>> On 4/09/20 2:44, Răzvan Crainea wrote:
>>>>> Depending on the BYE's direction, the `$dd` variable may point to 
>>>>> the gateway or to the caller. If the BYE comes from the gateway, 
>>>>> you should decrease the statistic based on $si, not $dd.
>>>>>
>>>>> Best regards,
>>>>>
>>>>> Răzvan Crainea
>>>>> OpenSIPS Core Developer
>>>>> http://www.opensips-solutions.com
>>>>>
>>>>> On 9/3/20 7:10 PM, Social Boh wrote:
>>>>>> Hello,
>>>>>>
>>>>>> I'm trying to using DISPATCHER module with algorithm 9 together 
>>>>>> with STATISTICS module:
>>>>>>
>>>>>> My configuration:
>>>>>>
>>>>>> #### STATISTIC module
>>>>>> loadmodule "statistics.so"
>>>>>> modparam("statistics", "stat_groups", "load_sip")
>>>>>>
>>>>>> #### DISPATCHER module
>>>>>> loadmodule "dispatcher.so"
>>>>>> modparam("dispatcher", 
>>>>>> "db_url","mysql://opensips:password@localhost/opensips")
>>>>>> modparam("dispatcher", "algo_route", "disproute")
>>>>>> modparam("dispatcher", "ds_ping_method", "OPTIONS")
>>>>>> modparam("dispatcher", "ds_ping_from", "sip:proxy at 1.2.3.4")
>>>>>> modparam("dispatcher", "ds_ping_interval", 30)
>>>>>> modparam("dispatcher", "ds_probing_threshhold", 2)
>>>>>> modparam("dispatcher", "ds_probing_mode", 1)
>>>>>> modparam("dispatcher", "dst_avp", "$avp(271)")
>>>>>> modparam("dispatcher", "pvar_algo_pattern", "$stat(load_%u)")
>>>>>>
>>>>>> script:
>>>>>>
>>>>>> on the BYE block:
>>>>>>
>>>>>> update_stat("load_sip:$dd", -1)
>>>>>>
>>>>>> On the DISPATCHER route:
>>>>>>
>>>>>> route[DISP] {
>>>>>>                     if(!ds_select_dst(1,9)) {
>>>>>>                             send_reply(404, "No destination");
>>>>>>                             exit;
>>>>>>                     }
>>>>>>          xlog("L_NOTICE", "script: Call to $ru via $du\n");
>>>>>>          update_stat("load_sip:$dd", +1);
>>>>>>          t_on_failure("DISPATCHER_FAILURE");
>>>>>>          t_relay();
>>>>>>          exit;
>>>>>> }
>>>>>>
>>>>>> The problem is the when the call terminate, the load stay on 1. If 
>>>>>> I make 6 calls and hangup:
>>>>>>
>>>>>> {
>>>>>>                              "URI": "sip:5.6.7.8:5060",
>>>>>>                              "state": "Active",
>>>>>>                              "first_hit_counter": 6
>>>>>>                          },
>>>>>>
>>>>>> The calls never go to second Gateway and never change the load.
>>>>>>
>>>>>> Any help is really appreciate.
>>>>>>
>>>>>> Regards
>>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Users mailing list
>>>>> Users at lists.opensips.org
>>>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>>
>>>> _______________________________________________
>>>> Users mailing list
>>>> Users at lists.opensips.org
>>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>
>>> _______________________________________________
>>> Users mailing list
>>> Users at lists.opensips.org
>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
> 
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users



More information about the Users mailing list